miner, core: reuse the chain's jumpdest cache when building payloads (#35378)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

Follow-up to #34850. The miner's payload EVM previously used a private
per-EVM JUMPDEST map, so every ~2s payload rebuild re-analyzed the code
bitmap of every contract the block touches.
This commit is contained in:
Jonny Rhea 2026-07-18 17:38:24 -05:00 committed by GitHub
parent dddbaa4bf3
commit bb6401ee5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -524,6 +524,12 @@ func (bc *BlockChain) CodeDB() *state.CodeDB {
return bc.codedb
}
// JumpDestCache retrieves the shared JUMPDEST analysis cache, so callers such
// as the miner can reuse bitmaps already computed during block import.
func (bc *BlockChain) JumpDestCache() vm.JumpDestCache {
return bc.jumpDestCache
}
// HeaderChain returns the underlying header chain.
func (bc *BlockChain) HeaderChain() *HeaderChain {
return bc.hc

View file

@ -345,6 +345,8 @@ func (miner *Miner) makeEnv(parent *types.Header, header *types.Header, coinbase
}
}
state.StartPrefetcher("miner", bundle)
evm := vm.NewEVM(core.NewEVMBlockContext(header, miner.chain, &coinbase), state, miner.chainConfig, vm.Config{})
evm.SetJumpDestCache(miner.chain.JumpDestCache())
// Note the passed coinbase may be different with header.Coinbase.
return &environment{
@ -356,7 +358,7 @@ func (miner *Miner) makeEnv(parent *types.Header, header *types.Header, coinbase
header: header,
bal: bal.NewConstructionBlockAccessList(),
witness: state.Witness(),
evm: vm.NewEVM(core.NewEVMBlockContext(header, miner.chain, &coinbase), state, miner.chainConfig, vm.Config{}),
evm: evm,
}, nil
}