diff --git a/beacon/engine/types.go b/beacon/engine/types.go index a10bd8c77c..8c1a99c353 100644 --- a/beacon/engine/types.go +++ b/beacon/engine/types.go @@ -340,7 +340,6 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H } return types.NewBlockWithHeader(header).WithBody(body), nil - } // BlockToExecutableData constructs the ExecutableData structure by filling the diff --git a/cmd/geth/config.go b/cmd/geth/config.go index c1a271898d..fc1c5f78a5 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -20,7 +20,6 @@ import ( "bufio" "errors" "fmt" - "github.com/ethereum/go-ethereum/core/types/bal" "os" "reflect" "runtime" @@ -36,6 +35,7 @@ import ( "github.com/ethereum/go-ethereum/beacon/blsync" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types/bal" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth/catalyst" "github.com/ethereum/go-ethereum/eth/ethconfig" diff --git a/consensus/beacon/consensus.go b/consensus/beacon/consensus.go index d22da353ae..a6df91f6f2 100644 --- a/consensus/beacon/consensus.go +++ b/consensus/beacon/consensus.go @@ -20,9 +20,10 @@ import ( "context" "errors" "fmt" - "github.com/ethereum/go-ethereum/core/types/bal" "math/big" + "github.com/ethereum/go-ethereum/core/types/bal" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus/misc/eip1559" @@ -363,8 +364,7 @@ func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types. // FinalizeAndAssemble implements consensus.Engine, setting the final state and // assembling the block. -func (beacon *Beacon) FinalizeAndAssemble(ctx context.Context, chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt, onFinalizeAccessList func(postMut bal.StateMutations) *bal.BlockAccessList) (*types.Block, error) { - if !beacon.IsPoSHeader(header) { +func (beacon *Beacon) FinalizeAndAssemble(ctx context.Context, chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt, onFinalizeAccessList func(postMut bal.StateMutations) *bal.BlockAccessList) (block *types.Block, err error) { ctx, _, spanEnd := telemetry.StartSpan(ctx, "consensus.beacon.FinalizeAndAssemble", telemetry.Int64Attribute("block.number", int64(header.Number.Uint64())), telemetry.Int64Attribute("txs.count", int64(len(body.Transactions))), @@ -373,10 +373,9 @@ func (beacon *Beacon) FinalizeAndAssemble(ctx context.Context, chain consensus.C defer spanEnd(&err) if !beacon.IsPoSHeader(header) { - block, delegateErr := beacon.ethone.FinalizeAndAssemble(ctx, chain, header, state, body, receipts) - return block, delegateErr + return beacon.ethone.FinalizeAndAssemble(ctx, chain, header, state, body, receipts, nil) } - + shanghai := chain.Config().IsShanghai(header.Number, header.Time) if shanghai { // All blocks after Shanghai must include a withdrawals root. @@ -393,7 +392,6 @@ func (beacon *Beacon) FinalizeAndAssemble(ctx context.Context, chain consensus.C _, _, finalizeSpanEnd := telemetry.StartSpan(ctx, "consensus.beacon.Finalize") postMut := beacon.Finalize(chain, header, state, body) finalizeSpanEnd(nil) - // Assign the final state root to header. _, _, rootSpanEnd := telemetry.StartSpan(ctx, "consensus.beacon.IntermediateRoot") @@ -402,19 +400,17 @@ func (beacon *Beacon) FinalizeAndAssemble(ctx context.Context, chain consensus.C // Assemble the final block. _, _, blockSpanEnd := telemetry.StartSpan(ctx, "consensus.beacon.NewBlock") - var block *types.Block if onFinalizeAccessList != nil { al := onFinalizeAccessList(postMut) alHash := al.Hash() header.BlockAccessListHash = &alHash - block := types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)).WithAccessList(al) + block = types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)).WithAccessList(al) } else { - block := types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)) - } + block = types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)) + } blockSpanEnd(nil) return block, nil - } // Seal generates a new sealing request for the given input block and pushes diff --git a/core/block_validator.go b/core/block_validator.go index 3a5379d1a9..c604238ef8 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -19,6 +19,7 @@ package core import ( "errors" "fmt" + "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" diff --git a/core/blockchain.go b/core/blockchain.go index 0c99eaf1c8..a1b7c8502f 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -31,8 +31,6 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/core/types/bal" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/lru" "github.com/ethereum/go-ethereum/common/mclock" @@ -46,6 +44,7 @@ import ( "github.com/ethereum/go-ethereum/core/stateless" "github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/types/bal" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" @@ -95,6 +94,7 @@ var ( accountReadSingleTimer = metrics.NewRegisteredResettingTimer("chain/account/single/reads", nil) storageReadSingleTimer = metrics.NewRegisteredResettingTimer("chain/storage/single/reads", nil) codeReadSingleTimer = metrics.NewRegisteredResettingTimer("chain/code/single/reads", nil) + snapshotCommitTimer = metrics.NewRegisteredResettingTimer("chain/snapshot/commits", nil) triedbCommitTimer = metrics.NewRegisteredResettingTimer("chain/triedb/commits", nil) blockInsertTimer = metrics.NewRegisteredResettingTimer("chain/inserts", nil) @@ -103,20 +103,12 @@ var ( blockExecutionTimer = metrics.NewRegisteredResettingTimer("chain/execution", nil) blockWriteTimer = metrics.NewRegisteredResettingTimer("chain/write", nil) - // BALspecific timers - blockPreprocessingTimer = metrics.NewRegisteredResettingTimer("chain/preprocess", nil) - txExecutionTimer = metrics.NewRegisteredResettingTimer("chain/txexecution", nil) - + // BAL-specific timers stateTrieHashTimer = metrics.NewRegisteredResettingTimer("chain/statetriehash", nil) accountTriesUpdateTimer = metrics.NewRegisteredResettingTimer("chain/accounttriesupdate", nil) stateTriePrefetchTimer = metrics.NewRegisteredResettingTimer("chain/statetrieprefetch", nil) stateTrieUpdateTimer = metrics.NewRegisteredResettingTimer("chain/statetrieupdate", nil) - originStorageLoadTimer = metrics.NewRegisteredResettingTimer("chain/originstorageload", nil) - - stateRootComputeTimer = metrics.NewRegisteredResettingTimer("chain/staterootcompute", nil) - stateCommitTimer = metrics.NewRegisteredResettingTimer("chain/statetriecommit", nil) - - blockPostprocessingTimer = metrics.NewRegisteredResettingTimer("chain/postprocess", nil) + stateRootComputeTimer = metrics.NewRegisteredResettingTimer("chain/staterootcompute", nil) blockReorgMeter = metrics.NewRegisteredMeter("chain/reorg/executes", nil) blockReorgAddMeter = metrics.NewRegisteredMeter("chain/reorg/add", nil) @@ -600,19 +592,24 @@ func (bc *BlockChain) processBlockWithAccessList(parentRoot common.Hash, block * statedb *state.StateDB ) + sdb := state.NewDatabase(bc.triedb, bc.codedb).WithSnapshot(bc.snaps) + useAsyncReads := bc.cfg.BALExecutionMode != bal.BALExecutionNoBatchIO al := block.AccessList() // TODO: make the return of this method not be a pointer accessListReader := bal.NewAccessListReader(*al) - prefetchReader, err := bc.statedb.ReaderEIP7928(parentRoot, accessListReader.StorageKeys(useAsyncReads), runtime.NumCPU()) + prefetchReader, err := sdb.ReaderEIP7928(parentRoot, accessListReader.StorageKeys(useAsyncReads), runtime.NumCPU()) if err != nil { return nil, err } - stateTransition, err := state.NewBALStateTransition(block, prefetchReader, bc.statedb, parentRoot) + stateTransition, err := state.NewBALStateTransition(block, prefetchReader, sdb, parentRoot) + if err != nil { + return nil, err + } + statedb, err = state.NewWithReader(parentRoot, sdb, prefetchReader) if err != nil { return nil, err } - statedb, err = state.NewWithReader(parentRoot, bc.statedb, prefetchReader) if bc.logger != nil && bc.logger.OnBlockStart != nil { bc.logger.OnBlockStart(tracing.BlockEvent{ @@ -2288,7 +2285,7 @@ func (bc *BlockChain) ProcessBlock(ctx context.Context, parentRoot common.Hash, // // Note: the main processor and prefetcher share the same reader with a local // cache for mitigating the overhead of state access. - prefetch, process, err := sdb.ReadersWithCache(parentRoot) + prefetch, process, err := sdb.ReadersWithCacheStats(parentRoot) if err != nil { return nil, err } @@ -3003,10 +3000,6 @@ func (bc *BlockChain) reportBadBlock(block *types.Block, res *ProcessResult, err log.Error(summarizeBadBlock(block, receipts, bc.Config(), err)) } -func (bc *BlockChain) reportBALBlock(block *types.Block, res *ProcessResult, err error) { - -} - // logForkReadiness will write a log when a future fork is scheduled, but not // active. This is useful so operators know their client is ready for the fork. func (bc *BlockChain) logForkReadiness(block *types.Block) { diff --git a/core/blockchain_stats.go b/core/blockchain_stats.go index 93a3e149c8..753e2bc923 100644 --- a/core/blockchain_stats.go +++ b/core/blockchain_stats.go @@ -52,6 +52,8 @@ type ExecuteStats struct { Execution time.Duration // Time spent on the EVM execution Validation time.Duration // Time spent on the block validation CrossValidation time.Duration // Optional, time spent on the block cross validation + SnapshotCommit time.Duration // Time spent on the snapshot commit + TrieDBCommit time.Duration // Time spent on the trie database commit DatabaseCommit time.Duration // Time spent on database commit BlockWrite time.Duration // Time spent on block write TotalTime time.Duration // The total time spent on block execution diff --git a/core/parallel_state_processor.go b/core/parallel_state_processor.go index 1e57584355..dae7f132eb 100644 --- a/core/parallel_state_processor.go +++ b/core/parallel_state_processor.go @@ -3,15 +3,15 @@ package core import ( "cmp" "fmt" - "github.com/ethereum/go-ethereum/common" + "runtime" + "slices" + "time" + "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types/bal" "github.com/ethereum/go-ethereum/core/vm" "golang.org/x/sync/errgroup" - "runtime" - "slices" - "time" ) // ProcessResultWithMetrics wraps ProcessResult with some metrics that are @@ -253,7 +253,6 @@ func (p *ParallelStateProcessor) resultHandler(block *types.Block, preTxReads ba type stateRootCalculationResult struct { err error metrics *state.BALStateTransitionMetrics - root common.Hash } // calcAndVerifyRoot performs the post-state root hash calculation, verifying diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 18e960f892..3956f99e8d 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -20,13 +20,13 @@ import ( "bytes" "encoding/binary" "fmt" - "github.com/ethereum/go-ethereum/core/types/bal" "math/big" "slices" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus/misc/eip4844" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/types/bal" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" diff --git a/core/state/database.go b/core/state/database.go index 12296c15e8..7760cc4b5c 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -252,7 +252,7 @@ func (db *CachingDB) ReaderEIP7928(stateRoot common.Hash, accessList map[common. // Construct the state reader with background prefetching pr := newPrefetchStateReader(r, accessList, threads) - return newReader(newCachingCodeReader(db.disk, db.codeCache, db.codeSizeCache), pr), nil + return newReader(db.codedb.Reader(), pr), nil } // OpenTrie opens the main account trie at a specific root hash. diff --git a/core/state/database_code.go b/core/state/database_code.go index 820c9c1168..a1e16dc46c 100644 --- a/core/state/database_code.go +++ b/core/state/database_code.go @@ -116,12 +116,12 @@ func (r *CodeReader) Code(addr common.Address, codeHash common.Hash) []byte { // CodeSize implements state.ContractCodeReader, retrieving a particular contract // code's size. Zero is returned if the contract code is not present. -func (r *CodeReader) CodeSize(addr common.Address, codeHash common.Hash) int { +func (r *CodeReader) CodeSize(addr common.Address, codeHash common.Hash) (int, error) { if cached, ok := r.cache.GetSize(codeHash); ok { r.hit.Add(1) - return cached + return cached, nil } - return len(r.Code(addr, codeHash)) + return len(r.Code(addr, codeHash)), nil } // CodeWithPrefix retrieves the contract code for the specified account address diff --git a/core/state/reader_eip_7928.go b/core/state/reader_eip_7928.go index 0b3eb67ffb..cff36eba3c 100644 --- a/core/state/reader_eip_7928.go +++ b/core/state/reader_eip_7928.go @@ -247,7 +247,6 @@ func (r *ReaderWithBlockLevelAccessList) Account(addr common.Address) (acct *typ // Storage implements Reader, returning the storage slot with the specific // address and slot key. func (r *ReaderWithBlockLevelAccessList) Storage(addr common.Address, slot common.Hash) (common.Hash, error) { - val := r.AccessList.Storage(addr, slot, r.TxIndex) if val != nil { return *val, nil @@ -267,11 +266,11 @@ func (r *ReaderWithBlockLevelAccessList) Has(addr common.Address, codeHash commo // Code implements Reader, returning the contract code with specified address // and hash. -func (r *ReaderWithBlockLevelAccessList) Code(addr common.Address, codeHash common.Hash) ([]byte, error) { +func (r *ReaderWithBlockLevelAccessList) Code(addr common.Address, codeHash common.Hash) []byte { mut := r.AccessList.AccountMutations(addr, r.TxIndex) if mut != nil && mut.Code != nil && crypto.Keccak256Hash(mut.Code) == codeHash { // TODO: need to copy here? - return mut.Code, nil + return mut.Code } return r.Reader.Code(addr, codeHash) } diff --git a/core/state/reader_eip_7928_test.go b/core/state/reader_eip_7928_test.go index d9d20f6d7b..86641f65b1 100644 --- a/core/state/reader_eip_7928_test.go +++ b/core/state/reader_eip_7928_test.go @@ -164,8 +164,8 @@ type noopCodeReader struct{} func (r *noopCodeReader) Has(addr common.Address, codeHash common.Hash) bool { return false } -func (r *noopCodeReader) Code(addr common.Address, codeHash common.Hash) ([]byte, error) { - return nil, nil +func (r *noopCodeReader) Code(addr common.Address, codeHash common.Hash) []byte { + return nil } func (r *noopCodeReader) CodeSize(addr common.Address, codeHash common.Hash) (int, error) { diff --git a/core/state/state_object.go b/core/state/state_object.go index 77ed8fa7a8..6ec2777684 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -19,13 +19,13 @@ package state import ( "bytes" "fmt" - "github.com/ethereum/go-ethereum/core/types/bal" "maps" "slices" "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/types/bal" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/rlp" @@ -672,7 +672,11 @@ func (s *stateObject) CodeSize() int { s.db.CodeReads += time.Since(start) }(time.Now()) - size := s.db.reader.CodeSize(s.address, common.BytesToHash(s.CodeHash())) + size, err := s.db.reader.CodeSize(s.address, common.BytesToHash(s.CodeHash())) + if err != nil { + s.db.setError(err) + return 0 + } if size == 0 { s.db.setError(fmt.Errorf("code is not found %x", s.CodeHash())) } diff --git a/core/state/statedb.go b/core/state/statedb.go index 112678692d..68ae24db73 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -589,16 +589,6 @@ func (s *StateDB) GetTransientState(addr common.Address, key common.Hash) common // Setting, updating & deleting state object methods. // -// updateStateObject writes the given object to the trie. -func (s *StateDB) updateStateObject(obj *stateObject) { - // Encode the account and update the account trie - if err := s.trie.UpdateAccount(obj.Address(), &obj.data, len(obj.code)); err != nil { - s.setError(fmt.Errorf("updateStateObject (%x) error: %v", obj.Address(), err)) - } - if obj.dirtyCode { - s.trie.UpdateContractCode(obj.Address(), common.BytesToHash(obj.CodeHash()), obj.code) - } -} func (s *StateDB) updateStateObjects(objs []*stateObject) { var addrs []common.Address var accts []*types.StateAccount diff --git a/core/types.go b/core/types.go index f881c9ed8f..da5b8d4b6c 100644 --- a/core/types.go +++ b/core/types.go @@ -18,11 +18,11 @@ package core import ( "context" - "github.com/ethereum/go-ethereum/core/types/bal" "sync/atomic" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/types/bal" "github.com/ethereum/go-ethereum/core/vm" ) diff --git a/core/types/bal/bal.go b/core/types/bal/bal.go index 47efc797a3..2d22ff6b4e 100644 --- a/core/types/bal/bal.go +++ b/core/types/bal/bal.go @@ -19,9 +19,10 @@ package bal import ( "bytes" "encoding/json" + "maps" + "github.com/ethereum/go-ethereum/common" "github.com/holiman/uint256" - "maps" ) // ConstructionAccountAccesses contains post-block account state for mutations as well as diff --git a/core/types/bal/bal_encoding.go b/core/types/bal/bal_encoding.go index 124b7712c9..4c1e04566f 100644 --- a/core/types/bal/bal_encoding.go +++ b/core/types/bal/bal_encoding.go @@ -23,7 +23,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/ethereum/go-ethereum/log" "io" "maps" "slices" @@ -31,6 +30,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" "github.com/holiman/uint256" @@ -176,11 +176,11 @@ type EncodedStorage struct { var _ rlp.Encoder = &EncodedStorage{} var _ rlp.Decoder = &EncodedStorage{} -func (e *EncodedStorage) ToHash() common.Hash { - if e == nil { +func (s *EncodedStorage) ToHash() common.Hash { + if s == nil { return common.Hash{} } - return e.inner.Bytes32() + return s.inner.Bytes32() } func newEncodedStorageFromHash(hash common.Hash) *EncodedStorage { diff --git a/core/types/bal/bal_encoding_json.go b/core/types/bal/bal_encoding_json.go index bf25345b5e..8d495848c6 100644 --- a/core/types/bal/bal_encoding_json.go +++ b/core/types/bal/bal_encoding_json.go @@ -3,6 +3,7 @@ package bal import ( "encoding/json" "fmt" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/rlp" ) diff --git a/core/types/bal_blocks_test.go b/core/types/bal_blocks_test.go index 9500cf8ca7..1bdb95ff30 100644 --- a/core/types/bal_blocks_test.go +++ b/core/types/bal_blocks_test.go @@ -3,10 +3,11 @@ package types import ( "bytes" "fmt" - "github.com/ethereum/go-ethereum/rlp" "io" "os" "testing" + + "github.com/ethereum/go-ethereum/rlp" ) func TestBALDecoding(t *testing.T) { diff --git a/core/vm/gas_table.go b/core/vm/gas_table.go index f483e00e9b..266d774752 100644 --- a/core/vm/gas_table.go +++ b/core/vm/gas_table.go @@ -511,8 +511,8 @@ func gasSelfdestruct(evm *EVM, contract *Contract, stack *Stack, mem *Memory, me gas = params.SelfdestructGasEIP150 var address = common.Address(stack.Back(0).Bytes20()) - if gas > contract.Gas { - return gas, nil + if gas > contract.Gas.RegularGas { + return GasCosts{RegularGas: gas}, nil } if evm.chainRules.IsEIP158 { diff --git a/core/vm/operations_acl.go b/core/vm/operations_acl.go index a44b1f6871..4ef4acd70f 100644 --- a/core/vm/operations_acl.go +++ b/core/vm/operations_acl.go @@ -196,10 +196,10 @@ func makeCallVariantGasCallEIP2929(oldCalculator gasFunc, addressPosition int) g var ( // TODO: we can use the same functions already defined above for the 7702 gas handlers - gasCallEIP2929 = makeCallVariantGasCall(gasCallStateless, gasCallStateful) - gasDelegateCallEIP2929 = makeCallVariantGasCall(gasDelegateCallStateless, gasDelegateCallStateful) - gasStaticCallEIP2929 = makeCallVariantGasCall(gasStaticCallStateless, gasStaticCallStateful) - gasCallCodeEIP2929 = makeCallVariantGasCall(gasCallCodeStateless, gasCallCodeStateful) + gasCallEIP2929 = makeCallVariantGasCallEIP2929(gasCall, 1) + gasDelegateCallEIP2929 = makeCallVariantGasCallEIP2929(gasDelegateCall, 1) + gasStaticCallEIP2929 = makeCallVariantGasCallEIP2929(gasStaticCall, 1) + gasCallCodeEIP2929 = makeCallVariantGasCallEIP2929(gasCallCode, 1) gasSelfdestructEIP2929 = makeSelfdestructGasFn(true) // gasSelfdestructEIP3529 implements the changes in EIP-3529 (no refunds) gasSelfdestructEIP3529 = makeSelfdestructGasFn(false) @@ -244,8 +244,8 @@ func makeSelfdestructGasFn(refundsEnabled bool) gasFunc { return GasCosts{}, ErrOutOfGas } } - if contract.Gas < gas { - return gas, nil + if contract.Gas.RegularGas < gas { + return GasCosts{RegularGas: gas}, nil } // if empty and transfers value diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index a096ffa74c..8146678bcd 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -206,7 +206,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV3(ctx context.Context, update engine. } if api.checkFork(params.Timestamp, forks.Amsterdam) { - return api.forkchoiceUpdated(update, params, engine.PayloadV4, false) + return api.forkchoiceUpdated(ctx, update, params, engine.PayloadV4, false) } } // TODO(matt): the spec requires that fcu is applied when called on a valid @@ -503,7 +503,6 @@ func (api *ConsensusAPI) GetPayloadV6(payloadID engine.PayloadID) (*engine.Execu // // Note passing nil `forks`, `versions` disables the respective check. func (api *ConsensusAPI) getPayload(payloadID engine.PayloadID, full bool, versions []engine.PayloadVersion, forks []forks.Fork) (*engine.ExecutionPayloadEnvelope, error) { - log.Trace("Engine API request received", "method", "GetPayload", "id", payloadID) if versions != nil && !payloadID.Is(versions...) { return nil, engine.UnsupportedFork diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 268bce69d1..e0b6c978e9 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -19,9 +19,10 @@ package ethconfig import ( "errors" - "github.com/ethereum/go-ethereum/core/types/bal" "time" + "github.com/ethereum/go-ethereum/core/types/bal" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus/beacon" diff --git a/miner/worker.go b/miner/worker.go index 344a9fb962..41070a1218 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -388,10 +388,6 @@ func (miner *Miner) makeEnv(parent *types.Header, header *types.Header, coinbase }, nil } -var ( - errAccessListOversized = errors.New("access list oversized") -) - func (miner *Miner) commitTransaction(ctx context.Context, env *environment, tx *types.Transaction) (err error) { _, _, spanEnd := telemetry.StartSpan(ctx, "miner.commitTransaction") defer spanEnd(&err) @@ -447,9 +443,7 @@ func (miner *Miner) applyTransaction(env *environment, tx *types.Transaction) (* gp = env.gasPool.Snapshot() ) var stateCopy *state.StateDB - var prevReader state.Reader if env.accessList != nil { - prevReader = env.state.Reader() stateCopy = env.state.WithReader(state.NewReaderWithTracker(env.state.Reader())) env.evm.StateDB = stateCopy } diff --git a/rlp/raw_test.go b/rlp/raw_test.go index 895e4bf1b6..ed7d3524c2 100644 --- a/rlp/raw_test.go +++ b/rlp/raw_test.go @@ -295,55 +295,6 @@ func TestRawListAppendList(t *testing.T) { } } -func TestRawListAppendList(t *testing.T) { - var rl1 RawList[uint64] - if err := rl1.Append(uint64(1)); err != nil { - t.Fatal("append 1 failed:", err) - } - if err := rl1.Append(uint64(2)); err != nil { - t.Fatal("append 2 failed:", err) - } - - var rl2 RawList[uint64] - if err := rl2.Append(uint64(3)); err != nil { - t.Fatal("append 3 failed:", err) - } - if err := rl2.Append(uint64(4)); err != nil { - t.Fatal("append 4 failed:", err) - } - - rl1.AppendList(&rl2) - - if rl1.Len() != 4 { - t.Fatalf("wrong Len %d, want 4", rl1.Len()) - } - if rl1.Size() != 5 { - t.Fatalf("wrong Size %d, want 5", rl1.Size()) - } - - items, err := rl1.Items() - if err != nil { - t.Fatal("Items failed:", err) - } - if !reflect.DeepEqual(items, []uint64{1, 2, 3, 4}) { - t.Fatalf("wrong items: %v", items) - } - - var empty RawList[uint64] - prevLen := rl1.Len() - rl1.AppendList(&empty) - - if rl1.Len() != prevLen { - t.Fatalf("appending empty list changed Len: got %d, want %d", rl1.Len(), prevLen) - } - - empty.AppendList(&rl1) - - if empty.Len() != 4 { - t.Fatalf("wrong Len %d, want 4", empty.Len()) - } -} - func TestRawListDecodeInvalid(t *testing.T) { tests := []struct { input string diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 3547a3bd6e..657cb55f94 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -22,6 +22,12 @@ import ( "encoding/hex" "encoding/json" "fmt" + stdmath "math" + "math/big" + "os" + "reflect" + "strings" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/math" @@ -40,11 +46,6 @@ import ( "github.com/ethereum/go-ethereum/triedb" "github.com/ethereum/go-ethereum/triedb/hashdb" "github.com/ethereum/go-ethereum/triedb/pathdb" - stdmath "math" - "math/big" - "os" - "reflect" - "strings" ) // A BlockTest checks handling of entire blocks. diff --git a/triedb/database.go b/triedb/database.go index db652b2f2b..e7e47bb91a 100644 --- a/triedb/database.go +++ b/triedb/database.go @@ -18,6 +18,7 @@ package triedb import ( "errors" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/ethdb"