miner: add more metrics for mev#3160
Merged
buddh0 merged 3 commits intobnb-chain:developfrom Jun 16, 2025
buddh0:add_more_metrics_for_mev
Merged
miner: add more metrics for mev#3160buddh0 merged 3 commits intobnb-chain:developfrom buddh0:add_more_metrics_for_mev
buddh0 merged 3 commits intobnb-chain:developfrom
buddh0:add_more_metrics_for_mev
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds detailed MEV-related metrics and a spelling fix in the miner and bid simulator, and propagates a receiveTime context value for timing.
- Registers new timers, a gauge, and a counter to track bid pre-checks, simulation phases, interrupts, timeouts, and processing speed.
- Propagates
receiveTimevia context from the API layer into the simulator to seed timing metrics. - Fixes a typo in the miner’s “too late” error message.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| miner/miner_mev.go | Registers bidPreCheckTimer and corrects “befor”→“before” typo |
| miner/bid_simulator.go | Adds metrics (timers/gauge/counter), receiveTime handling, and logging updates |
| internal/ethapi/api_mev.go | Injects receiveTime into context before calling SendBid |
Comments suppressed due to low confidence (1)
miner/bid_simulator.go:36
- [nitpick] The variable and metric name
sim1stBidmixes digits and letters; consider renaming tosimFirstBidTimerand"bid/sim/simFirstBid"for clarity and consistency.
bidSim1stBidTimer = metrics.NewRegisteredTimer("bid/sim/sim1stBid", nil)
Comment on lines
583
to
+588
| timer := time.NewTimer(1 * time.Second) | ||
| defer timer.Stop() | ||
|
|
||
| replyCh := make(chan error, 1) | ||
|
|
||
| receiveTime, ok := ctx.Value("receiveTime").(int64) |
There was a problem hiding this comment.
Using a plain string as a context key can lead to collisions. Define a private type key and a const receiveTimeKey to safely store and retrieve this value.
Suggested change
| timer := time.NewTimer(1 * time.Second) | |
| defer timer.Stop() | |
| replyCh := make(chan error, 1) | |
| receiveTime, ok := ctx.Value("receiveTime").(int64) | |
| type key struct{} | |
| const receiveTimeKey key = key{} | |
| timer := time.NewTimer(1 * time.Second) | |
| defer timer.Stop() | |
| replyCh := make(chan error, 1) | |
| receiveTime, ok := ctx.Value(receiveTimeKey).(int64) |
There was a problem hiding this comment.
0x3E3e258a9A8bF9E016c09dB376F493C1f13BBAFc
zzzckck
reviewed
Jun 11, 2025
zzzckck
approved these changes
Jun 11, 2025
galaio
approved these changes
Jun 16, 2025
This was referenced Jun 16, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
miner: add more metrics for mev
Rationale
tell us why we need these changes...
Example
add an example CLI or API response...
Changes
Notable changes: