miner: prefetch states for bids simulating#3145
Merged
buddh0 merged 1 commit intobnb-chain:developfrom Jun 16, 2025
buddh0:prefetch-state-when-simulating-bids
Merged
miner: prefetch states for bids simulating#3145buddh0 merged 1 commit intobnb-chain:developfrom buddh0:prefetch-state-when-simulating-bids
buddh0 merged 1 commit intobnb-chain:developfrom
buddh0:prefetch-state-when-simulating-bids
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces state prefetching for bid simulations by extending the prefetcher interface, updating its implementations, and integrating prefetch calls in the miner and blockchain logic.
- Expose a
getPrefetchergetter onworkerto access the core prefetcher. - Update
Prefetchsignature incore.Prefetcherand adjust all callers and implementations. - Add conditional prefetch logic in
bid_simulatorand adjust blockchain insertion accordingly.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| miner/worker.go | Expose getPrefetcher method to retrieve the worker’s prefetcher. |
| miner/bid_simulator.go | Add prefetch branch for large bids and invoke Prefetch. |
| core/types.go | Update Prefetcher.Prefetch signature to accept transactions, header, gasLimit, etc. |
| core/state_prefetcher.go | Adapt Prefetch implementation to new parameters and update EVM setup. |
| core/state_prefetcher_test.go | Call new Prefetch signature in test. |
| core/blockchain.go | Update prefetch invocation to new signature in insertChain. |
Comments suppressed due to low confidence (3)
miner/worker.go:313
- [nitpick] The method name
getPrefetcheris non-idiomatic in Go; consider renaming it toPrefetcher()to match common getter conventions.
func (w *worker) getPrefetcher() core.Prefetcher {
miner/bid_simulator.go:740
- The new prefetch branch is not covered by existing tests. Add unit tests to verify that prefetch is triggered correctly and that interrupt handling works as expected.
if len(bidRuntime.bid.Txs) > prefetchTxNumber {
core/types.go:49
- [nitpick] Comment should start with a capital letter: change to
Only goal is to warm the state caches.for consistency with Go comment style.
// only goal is to warm the state caches.
zzzckck
previously approved these changes
Jun 16, 2025
galaio
previously approved these changes
Jun 16, 2025
zzzckck
previously approved these changes
Jun 16, 2025
galaio
approved these changes
Jun 16, 2025
zzzckck
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: prefetch states for bids simulating
Rationale
tell us why we need these changes...
Example
add an example CLI or API response...
Changes
Notable changes: