Skip to content

Commit

Permalink
Remove state_prefetcher.go (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
darioush authored Jan 4, 2024
1 parent e771e2a commit 95eb65e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 122 deletions.
12 changes: 4 additions & 8 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,10 @@ type BlockChain struct {

stopping atomic.Bool // false if chain is running, true when stopped

engine consensus.Engine
validator Validator // Block and state validator interface
prefetcher Prefetcher // Block state prefetcher interface
processor Processor // Block transaction processor interface
vmConfig vm.Config
engine consensus.Engine
validator Validator // Block and state validator interface
processor Processor // Block transaction processor interface
vmConfig vm.Config

lastAccepted *types.Block // Prevents reorgs past this height

Expand Down Expand Up @@ -335,7 +334,6 @@ func NewBlockChain(
}
bc.stateCache = state.NewDatabaseWithNodeDB(bc.db, bc.triedb)
bc.validator = NewBlockValidator(chainConfig, bc, engine)
bc.prefetcher = newStatePrefetcher(chainConfig, bc, engine)
bc.processor = NewStateProcessor(chainConfig, bc, engine)

bc.hc, err = NewHeaderChain(db, chainConfig, cacheConfig, engine)
Expand Down Expand Up @@ -1321,8 +1319,6 @@ func (bc *BlockChain) insertBlock(block *types.Block, writes bool) error {
statedb.StartPrefetcher("chain", bc.cacheConfig.TriePrefetcherParallelism)
activeState = statedb

// If we have a followup block, run that against the current state to pre-cache
// transactions and probabilistically some of the account/storage trie nodes.
// Process block using the parent state as reference point
pstart := time.Now()
receipts, logs, usedGas, err := bc.processor.Process(block, parent, statedb, bc.vmConfig)
Expand Down
104 changes: 0 additions & 104 deletions core/state_prefetcher.go

This file was deleted.

10 changes: 0 additions & 10 deletions core/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
package core

import (
"sync/atomic"

"github.com/ava-labs/coreth/core/state"
"github.com/ava-labs/coreth/core/types"
"github.com/ava-labs/coreth/core/vm"
Expand All @@ -46,14 +44,6 @@ type Validator interface {
ValidateState(block *types.Block, state *state.StateDB, receipts types.Receipts, usedGas uint64) error
}

// Prefetcher is an interface for pre-caching transaction signatures and state.
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, cfg vm.Config, interrupt *atomic.Bool)
}

// Processor is an interface for processing blocks using a given initial state.
type Processor interface {
// Process processes the state changes according to the Ethereum rules by running
Expand Down

0 comments on commit 95eb65e

Please sign in to comment.