diff --git a/core/blockchain.go b/core/blockchain.go index 897a05e442..cf2dcf2a1f 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -324,7 +324,7 @@ type BlockChain struct { flushInterval atomic.Int64 // Time interval (processing time) after which to flush a state triedb *triedb.Database // The database handler for maintaining trie nodes. codedb *state.CodeDB // The database handler for maintaining contract codes. - jumpDest vm.JumpDestCache // Shared JUMPDEST analysis cache for block processing + jumpDestCache vm.JumpDestCache // Shared JUMPDEST analysis cache for block processing txIndexer *txIndexer // Transaction indexer, might be nil if not enabled hc *HeaderChain @@ -407,7 +407,7 @@ func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, db: db, triedb: triedb, codedb: state.NewCodeDB(db), - jumpDest: NewJumpDestCache(), + jumpDestCache: NewJumpDestCache(), triegc: prque.New[int64, common.Hash](nil), chainmu: syncx.NewClosableMutex(), bodyCache: lru.NewCache[common.Hash, *types.Body](bodyCacheLimit), @@ -2178,7 +2178,7 @@ func (bc *BlockChain) ProcessBlock(ctx context.Context, parentRoot common.Hash, // Disable tracing for prefetcher executions. vmCfg := bc.cfg.VmConfig vmCfg.Tracer = nil - bc.prefetcher.Prefetch(block, throwaway, bc.jumpDest, vmCfg, &interrupt) + bc.prefetcher.Prefetch(block, throwaway, bc.jumpDestCache, vmCfg, &interrupt) blockPrefetchExecuteTimer.Update(time.Since(start)) if interrupt.Load() { @@ -2224,7 +2224,7 @@ func (bc *BlockChain) ProcessBlock(ctx context.Context, parentRoot common.Hash, // Process block using the parent state as reference point pstart := time.Now() pctx, _, spanEnd := telemetry.StartSpan(ctx, "bc.processor.Process") - res, err := bc.processor.Process(pctx, block, statedb, bc.jumpDest, bc.cfg.VmConfig) + res, err := bc.processor.Process(pctx, block, statedb, bc.jumpDestCache, bc.cfg.VmConfig) spanEnd(&err) if err != nil { bc.reportBadBlock(block, res, err) diff --git a/core/state_prefetcher.go b/core/state_prefetcher.go index a71a7929c3..0f2a2ce33d 100644 --- a/core/state_prefetcher.go +++ b/core/state_prefetcher.go @@ -49,7 +49,7 @@ func newStatePrefetcher(config *params.ChainConfig, chain *HeaderChain) *statePr // Prefetch processes the state changes according to the Ethereum rules by running // the transaction messages using the statedb, but any changes are discarded. The // only goal is to warm the state caches. -func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, jumpDests vm.JumpDestCache, cfg vm.Config, interrupt *atomic.Bool) { +func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, jumpDestCache vm.JumpDestCache, cfg vm.Config, interrupt *atomic.Bool) { var ( fails atomic.Int64 header = block.Header() @@ -94,8 +94,8 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, j // Execute the message to preload the implicit touched states evm := vm.NewEVM(NewEVMBlockContext(header, p.chain, nil), stateCpy, p.config, cfg) defer evm.Release() - if jumpDests != nil { - evm.SetJumpDestCache(jumpDests) + if jumpDestCache != nil { + evm.SetJumpDestCache(jumpDestCache) } // Convert the transaction into an executable message and pre-cache its sender diff --git a/core/state_processor.go b/core/state_processor.go index 024d36858a..00b43aa149 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -61,7 +61,7 @@ func (p *StateProcessor) chainConfig() *params.ChainConfig { // Process returns the receipts and logs accumulated during the process and // returns the amount of gas that was used in the process. If any of the // transactions failed to execute due to insufficient gas it will return an error. -func (p *StateProcessor) Process(ctx context.Context, block *types.Block, statedb *state.StateDB, jumpDests vm.JumpDestCache, cfg vm.Config) (*ProcessResult, error) { +func (p *StateProcessor) Process(ctx context.Context, block *types.Block, statedb *state.StateDB, jumpDestCache vm.JumpDestCache, cfg vm.Config) (*ProcessResult, error) { var ( config = p.chainConfig() receipts = make(types.Receipts, 0, len(block.Transactions())) @@ -89,8 +89,8 @@ func (p *StateProcessor) Process(ctx context.Context, block *types.Block, stated context = NewEVMBlockContext(header, p.chain, nil) evm := vm.NewEVM(context, tracingStateDB, config, cfg) defer evm.Release() - if jumpDests != nil { - evm.SetJumpDestCache(jumpDests) + if jumpDestCache != nil { + evm.SetJumpDestCache(jumpDestCache) } if beaconRoot := block.BeaconRoot(); beaconRoot != nil { diff --git a/core/types.go b/core/types.go index 0b75b269ba..6608fd6660 100644 --- a/core/types.go +++ b/core/types.go @@ -41,7 +41,7 @@ type Prefetcher interface { // Prefetch processes the state changes according to the Ethereum rules by running // the transaction messages using the statedb, but any changes are discarded. The // only goal is to pre-cache transaction signatures and state trie nodes. - Prefetch(block *types.Block, statedb *state.StateDB, jumpDests vm.JumpDestCache, cfg vm.Config, interrupt *atomic.Bool) + Prefetch(block *types.Block, statedb *state.StateDB, jumpDestCache vm.JumpDestCache, cfg vm.Config, interrupt *atomic.Bool) } // Processor is an interface for processing blocks using a given initial state. @@ -49,7 +49,7 @@ type Processor interface { // Process processes the state changes according to the Ethereum rules by running // the transaction messages using the statedb and applying any rewards to both // the processor (coinbase) and any included uncles. - Process(ctx context.Context, block *types.Block, statedb *state.StateDB, jumpDests vm.JumpDestCache, cfg vm.Config) (*ProcessResult, error) + Process(ctx context.Context, block *types.Block, statedb *state.StateDB, jumpDestCache vm.JumpDestCache, cfg vm.Config) (*ProcessResult, error) } // ProcessResult contains the values computed by Process.