mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-28 22:02:55 +00:00
all: fix rebasing issues
This commit is contained in:
parent
caedb7ff24
commit
85671f1c4a
27 changed files with 72 additions and 139 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package bal
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue