all: fix rebasing issues

This commit is contained in:
Marius van der Wijden 2026-03-23 20:00:49 +01:00 committed by Jared Wasinger
parent 98f757bcc2
commit 18848bca26
22 changed files with 46 additions and 61 deletions

View file

@ -340,7 +340,6 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H
} }
return types.NewBlockWithHeader(header).WithBody(body), nil return types.NewBlockWithHeader(header).WithBody(body), nil
} }
// BlockToExecutableData constructs the ExecutableData structure by filling the // BlockToExecutableData constructs the ExecutableData structure by filling the

View file

@ -20,7 +20,6 @@ import (
"bufio" "bufio"
"errors" "errors"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/core/types/bal"
"os" "os"
"reflect" "reflect"
"runtime" "runtime"
@ -36,6 +35,7 @@ import (
"github.com/ethereum/go-ethereum/beacon/blsync" "github.com/ethereum/go-ethereum/beacon/blsync"
"github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common" "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/crypto"
"github.com/ethereum/go-ethereum/eth/catalyst" "github.com/ethereum/go-ethereum/eth/catalyst"
"github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/eth/ethconfig"

View file

@ -20,9 +20,10 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/core/types/bal"
"math/big" "math/big"
"github.com/ethereum/go-ethereum/core/types/bal"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus/misc/eip1559" "github.com/ethereum/go-ethereum/consensus/misc/eip1559"
@ -420,7 +421,6 @@ func (beacon *Beacon) FinalizeAndAssemble(ctx context.Context, chain consensus.C
} }
blockSpanEnd(nil) blockSpanEnd(nil)
return block, nil return block, nil
} }
// Seal generates a new sealing request for the given input block and pushes // Seal generates a new sealing request for the given input block and pushes

View file

@ -19,6 +19,7 @@ package core
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"

View file

@ -31,8 +31,6 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/ethereum/go-ethereum/core/types/bal"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/lru" "github.com/ethereum/go-ethereum/common/lru"
"github.com/ethereum/go-ethereum/common/mclock" "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/stateless"
"github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types" "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/core/vm"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
@ -95,6 +94,7 @@ var (
accountReadSingleTimer = metrics.NewRegisteredResettingTimer("chain/account/single/reads", nil) accountReadSingleTimer = metrics.NewRegisteredResettingTimer("chain/account/single/reads", nil)
storageReadSingleTimer = metrics.NewRegisteredResettingTimer("chain/storage/single/reads", nil) storageReadSingleTimer = metrics.NewRegisteredResettingTimer("chain/storage/single/reads", nil)
codeReadSingleTimer = metrics.NewRegisteredResettingTimer("chain/code/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) triedbCommitTimer = metrics.NewRegisteredResettingTimer("chain/triedb/commits", nil)
blockInsertTimer = metrics.NewRegisteredResettingTimer("chain/inserts", nil) blockInsertTimer = metrics.NewRegisteredResettingTimer("chain/inserts", nil)
@ -103,20 +103,12 @@ var (
blockExecutionTimer = metrics.NewRegisteredResettingTimer("chain/execution", nil) blockExecutionTimer = metrics.NewRegisteredResettingTimer("chain/execution", nil)
blockWriteTimer = metrics.NewRegisteredResettingTimer("chain/write", nil) blockWriteTimer = metrics.NewRegisteredResettingTimer("chain/write", nil)
// BALspecific timers // BAL-specific timers
blockPreprocessingTimer = metrics.NewRegisteredResettingTimer("chain/preprocess", nil)
txExecutionTimer = metrics.NewRegisteredResettingTimer("chain/txexecution", nil)
stateTrieHashTimer = metrics.NewRegisteredResettingTimer("chain/statetriehash", nil) stateTrieHashTimer = metrics.NewRegisteredResettingTimer("chain/statetriehash", nil)
accountTriesUpdateTimer = metrics.NewRegisteredResettingTimer("chain/accounttriesupdate", nil) accountTriesUpdateTimer = metrics.NewRegisteredResettingTimer("chain/accounttriesupdate", nil)
stateTriePrefetchTimer = metrics.NewRegisteredResettingTimer("chain/statetrieprefetch", nil) stateTriePrefetchTimer = metrics.NewRegisteredResettingTimer("chain/statetrieprefetch", nil)
stateTrieUpdateTimer = metrics.NewRegisteredResettingTimer("chain/statetrieupdate", nil) stateTrieUpdateTimer = metrics.NewRegisteredResettingTimer("chain/statetrieupdate", nil)
originStorageLoadTimer = metrics.NewRegisteredResettingTimer("chain/originstorageload", nil) stateRootComputeTimer = metrics.NewRegisteredResettingTimer("chain/staterootcompute", nil)
stateRootComputeTimer = metrics.NewRegisteredResettingTimer("chain/staterootcompute", nil)
stateCommitTimer = metrics.NewRegisteredResettingTimer("chain/statetriecommit", nil)
blockPostprocessingTimer = metrics.NewRegisteredResettingTimer("chain/postprocess", nil)
blockReorgMeter = metrics.NewRegisteredMeter("chain/reorg/executes", nil) blockReorgMeter = metrics.NewRegisteredMeter("chain/reorg/executes", nil)
blockReorgAddMeter = metrics.NewRegisteredMeter("chain/reorg/add", nil) blockReorgAddMeter = metrics.NewRegisteredMeter("chain/reorg/add", nil)
@ -615,6 +607,9 @@ func (bc *BlockChain) processBlockWithAccessList(parentRoot common.Hash, block *
return nil, err return nil, err
} }
statedb, err = state.NewWithReader(parentRoot, sdb, prefetchReader) statedb, err = state.NewWithReader(parentRoot, sdb, prefetchReader)
if err != nil {
return nil, err
}
if bc.logger != nil && bc.logger.OnBlockStart != nil { if bc.logger != nil && bc.logger.OnBlockStart != nil {
bc.logger.OnBlockStart(tracing.BlockEvent{ bc.logger.OnBlockStart(tracing.BlockEvent{
@ -2996,10 +2991,6 @@ func (bc *BlockChain) reportBadBlock(block *types.Block, res *ProcessResult, err
log.Error(summarizeBadBlock(block, receipts, bc.Config(), 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 // 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. // active. This is useful so operators know their client is ready for the fork.
func (bc *BlockChain) logForkReadiness(block *types.Block) { func (bc *BlockChain) logForkReadiness(block *types.Block) {

View file

@ -52,6 +52,8 @@ type ExecuteStats struct {
Execution time.Duration // Time spent on the EVM execution Execution time.Duration // Time spent on the EVM execution
Validation time.Duration // Time spent on the block validation Validation time.Duration // Time spent on the block validation
CrossValidation time.Duration // Optional, time spent on the block cross 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 DatabaseCommit time.Duration // Time spent on database commit
BlockWrite time.Duration // Time spent on block write BlockWrite time.Duration // Time spent on block write
TotalTime time.Duration // The total time spent on block execution TotalTime time.Duration // The total time spent on block execution

View file

@ -3,15 +3,15 @@ package core
import ( import (
"cmp" "cmp"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/common" "runtime"
"slices"
"time"
"github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types/bal" "github.com/ethereum/go-ethereum/core/types/bal"
"github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/core/vm"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
"runtime"
"slices"
"time"
) )
// ProcessResultWithMetrics wraps ProcessResult with some metrics that are // ProcessResultWithMetrics wraps ProcessResult with some metrics that are
@ -253,7 +253,6 @@ func (p *ParallelStateProcessor) resultHandler(block *types.Block, preTxReads ba
type stateRootCalculationResult struct { type stateRootCalculationResult struct {
err error err error
metrics *state.BALStateTransitionMetrics metrics *state.BALStateTransitionMetrics
root common.Hash
} }
// calcAndVerifyRoot performs the post-state root hash calculation, verifying // calcAndVerifyRoot performs the post-state root hash calculation, verifying

View file

@ -20,13 +20,13 @@ import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/core/types/bal"
"math/big" "math/big"
"slices" "slices"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus/misc/eip4844" "github.com/ethereum/go-ethereum/consensus/misc/eip4844"
"github.com/ethereum/go-ethereum/core/types" "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/crypto"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"

View file

@ -247,7 +247,6 @@ func (r *ReaderWithBlockLevelAccessList) Account(addr common.Address) (acct *typ
// Storage implements Reader, returning the storage slot with the specific // Storage implements Reader, returning the storage slot with the specific
// address and slot key. // address and slot key.
func (r *ReaderWithBlockLevelAccessList) Storage(addr common.Address, slot common.Hash) (common.Hash, error) { func (r *ReaderWithBlockLevelAccessList) Storage(addr common.Address, slot common.Hash) (common.Hash, error) {
val := r.AccessList.Storage(addr, slot, r.TxIndex) val := r.AccessList.Storage(addr, slot, r.TxIndex)
if val != nil { if val != nil {
return *val, nil return *val, nil
@ -270,6 +269,7 @@ func (r *ReaderWithBlockLevelAccessList) Has(addr common.Address, codeHash commo
func (r *ReaderWithBlockLevelAccessList) Code(addr common.Address, codeHash common.Hash) []byte { func (r *ReaderWithBlockLevelAccessList) Code(addr common.Address, codeHash common.Hash) []byte {
mut := r.AccessList.AccountMutations(addr, r.TxIndex) mut := r.AccessList.AccountMutations(addr, r.TxIndex)
if mut != nil && mut.Code != nil && crypto.Keccak256Hash(mut.Code) == codeHash { if mut != nil && mut.Code != nil && crypto.Keccak256Hash(mut.Code) == codeHash {
// TODO: need to copy here?
return mut.Code return mut.Code
} }
return r.Reader.Code(addr, codeHash) return r.Reader.Code(addr, codeHash)

View file

@ -164,8 +164,8 @@ type noopCodeReader struct{}
func (r *noopCodeReader) Has(addr common.Address, codeHash common.Hash) bool { return false } 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) { func (r *noopCodeReader) Code(addr common.Address, codeHash common.Hash) []byte {
return nil, nil return nil
} }
func (r *noopCodeReader) CodeSize(addr common.Address, codeHash common.Hash) (int, error) { func (r *noopCodeReader) CodeSize(addr common.Address, codeHash common.Hash) (int, error) {

View file

@ -19,13 +19,13 @@ package state
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/core/types/bal"
"maps" "maps"
"slices" "slices"
"time" "time"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "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/crypto"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
@ -672,7 +672,11 @@ func (s *stateObject) CodeSize() int {
s.db.CodeReads += time.Since(start) s.db.CodeReads += time.Since(start)
}(time.Now()) }(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 { if size == 0 {
s.db.setError(fmt.Errorf("code is not found %x", s.CodeHash())) s.db.setError(fmt.Errorf("code is not found %x", s.CodeHash()))
} }

View file

@ -587,16 +587,6 @@ func (s *StateDB) GetTransientState(addr common.Address, key common.Hash) common
// Setting, updating & deleting state object methods. // 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) { func (s *StateDB) updateStateObjects(objs []*stateObject) {
var addrs []common.Address var addrs []common.Address
var accts []*types.StateAccount var accts []*types.StateAccount

View file

@ -18,11 +18,11 @@ package core
import ( import (
"context" "context"
"github.com/ethereum/go-ethereum/core/types/bal"
"sync/atomic" "sync/atomic"
"github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types" "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/core/vm"
) )

View file

@ -19,9 +19,10 @@ package bal
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"maps"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/holiman/uint256" "github.com/holiman/uint256"
"maps"
) )
// ConstructionAccountAccesses contains post-block account state for mutations as well as // ConstructionAccountAccesses contains post-block account state for mutations as well as

View file

@ -23,7 +23,6 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/log"
"io" "io"
"maps" "maps"
"slices" "slices"
@ -31,6 +30,7 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/holiman/uint256" "github.com/holiman/uint256"
@ -176,11 +176,11 @@ type EncodedStorage struct {
var _ rlp.Encoder = &EncodedStorage{} var _ rlp.Encoder = &EncodedStorage{}
var _ rlp.Decoder = &EncodedStorage{} var _ rlp.Decoder = &EncodedStorage{}
func (e *EncodedStorage) ToHash() common.Hash { func (s *EncodedStorage) ToHash() common.Hash {
if e == nil { if s == nil {
return common.Hash{} return common.Hash{}
} }
return e.inner.Bytes32() return s.inner.Bytes32()
} }
func newEncodedStorageFromHash(hash common.Hash) *EncodedStorage { func newEncodedStorageFromHash(hash common.Hash) *EncodedStorage {

View file

@ -3,6 +3,7 @@ package bal
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
) )

View file

@ -3,10 +3,11 @@ package types
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/rlp"
"io" "io"
"os" "os"
"testing" "testing"
"github.com/ethereum/go-ethereum/rlp"
) )
func TestBALDecoding(t *testing.T) { func TestBALDecoding(t *testing.T) {

View file

@ -503,7 +503,6 @@ func (api *ConsensusAPI) GetPayloadV6(payloadID engine.PayloadID) (*engine.Execu
// //
// Note passing nil `forks`, `versions` disables the respective check. // 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) { 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) log.Trace("Engine API request received", "method", "GetPayload", "id", payloadID)
if versions != nil && !payloadID.Is(versions...) { if versions != nil && !payloadID.Is(versions...) {
return nil, engine.UnsupportedFork return nil, engine.UnsupportedFork

View file

@ -19,9 +19,10 @@ package ethconfig
import ( import (
"errors" "errors"
"github.com/ethereum/go-ethereum/core/types/bal"
"time" "time"
"github.com/ethereum/go-ethereum/core/types/bal"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus/beacon" "github.com/ethereum/go-ethereum/consensus/beacon"

View file

@ -388,10 +388,6 @@ func (miner *Miner) makeEnv(parent *types.Header, header *types.Header, coinbase
}, nil }, nil
} }
var (
errAccessListOversized = errors.New("access list oversized")
)
func (miner *Miner) commitTransaction(ctx context.Context, env *environment, tx *types.Transaction) (err error) { func (miner *Miner) commitTransaction(ctx context.Context, env *environment, tx *types.Transaction) (err error) {
_, _, spanEnd := telemetry.StartSpan(ctx, "miner.commitTransaction") _, _, spanEnd := telemetry.StartSpan(ctx, "miner.commitTransaction")
defer spanEnd(&err) defer spanEnd(&err)
@ -447,9 +443,7 @@ func (miner *Miner) applyTransaction(env *environment, tx *types.Transaction) (*
gp = env.gasPool.Snapshot() gp = env.gasPool.Snapshot()
) )
var stateCopy *state.StateDB var stateCopy *state.StateDB
var prevReader state.Reader
if env.accessList != nil { if env.accessList != nil {
prevReader = env.state.Reader()
stateCopy = env.state.WithReader(state.NewReaderWithTracker(env.state.Reader())) stateCopy = env.state.WithReader(state.NewReaderWithTracker(env.state.Reader()))
env.evm.StateDB = stateCopy env.evm.StateDB = stateCopy
} }

View file

@ -22,6 +22,12 @@ import (
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"fmt" "fmt"
stdmath "math"
"math/big"
"os"
"reflect"
"strings"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/common/math"
@ -40,11 +46,6 @@ import (
"github.com/ethereum/go-ethereum/triedb" "github.com/ethereum/go-ethereum/triedb"
"github.com/ethereum/go-ethereum/triedb/hashdb" "github.com/ethereum/go-ethereum/triedb/hashdb"
"github.com/ethereum/go-ethereum/triedb/pathdb" "github.com/ethereum/go-ethereum/triedb/pathdb"
stdmath "math"
"math/big"
"os"
"reflect"
"strings"
) )
// A BlockTest checks handling of entire blocks. // A BlockTest checks handling of entire blocks.

View file

@ -18,6 +18,7 @@ package triedb
import ( import (
"errors" "errors"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"