Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove state_prefetcher.go #447

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading