Skip to content

miner: prefetch states for bids simulating#3145

Merged
buddh0 merged 1 commit intobnb-chain:developfrom
buddh0:prefetch-state-when-simulating-bids
Jun 16, 2025
Merged

miner: prefetch states for bids simulating#3145
buddh0 merged 1 commit intobnb-chain:developfrom
buddh0:prefetch-state-when-simulating-bids

Conversation

@buddh0
Copy link
Contributor

@buddh0 buddh0 commented Jun 4, 2025

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:

  • add each change in a bullet point here
  • ...

@buddh0 buddh0 marked this pull request as ready for review June 9, 2025 03:19
@zzzckck zzzckck requested a review from Copilot June 13, 2025 04:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 getPrefetcher getter on worker to access the core prefetcher.
  • Update Prefetch signature in core.Prefetcher and adjust all callers and implementations.
  • Add conditional prefetch logic in bid_simulator and 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 getPrefetcher is non-idiomatic in Go; consider renaming it to Prefetcher() 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
zzzckck previously approved these changes Jun 16, 2025
galaio
galaio previously approved these changes Jun 16, 2025
zzzckck
zzzckck previously approved these changes Jun 16, 2025
@buddh0 buddh0 dismissed stale reviews from zzzckck and galaio via 210c952 June 16, 2025 08:08
@buddh0 buddh0 merged commit 155614e into bnb-chain:develop Jun 16, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants