Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: logging packing duration #52

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions miner/bidder.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ func (b *Bidder) bid(work *environment) {
_, err := cli.SendBid(context.Background(), bidArgs)
if err != nil {
b.deleteBestWork(work)
log.Error("Bidder: bidding failed", "err", err, "number", work.header.Number, "txcount", len(work.txs), "unrevertible", len(work.UnRevertible))
log.Error("Bidder: bidding failed", "err", err, "number", work.header.Number, "txcount", len(work.txs),
"unrevertible", len(work.UnRevertible), "packing_duration", work.duration.Milliseconds())

var bidErr rpc.Error
ok := errors.As(err, &bidErr)
Expand All @@ -290,7 +291,8 @@ func (b *Bidder) bid(work *environment) {
}

b.deleteBestWork(work)
log.Info("Bidder: bidding success", "number", work.header.Number, "txs", len(work.txs))
log.Info("Bidder: bidding success", "number", work.header.Number, "txs", len(work.txs),
"packing_duration", work.duration.Milliseconds())
}

// isBestWork returns the work is better than the current best work
Expand Down
2 changes: 2 additions & 0 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ type environment struct {

profit *big.Int // block gas fee + BNBSentToSystem
UnRevertible []common.Hash
duration time.Duration
}

// copy creates a deep copy of environment.
Expand Down Expand Up @@ -1311,6 +1312,7 @@ LOOP:
fillStart := time.Now()
err = w.fillTransactionsAndBundles(interruptCh, work, stopTimer)
fillDuration := time.Since(fillStart)
work.duration = fillDuration
switch {
case errors.Is(err, errBlockInterruptedByNewHead):
// work.discard()
Expand Down
Loading