mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-22 15:59:26 +00:00
cmd/evm/internal/t8ntool: Amsterdam t8n updates; adds BAL and slotNum (#35025)
The changes here enable us to fill tests with Amsterdam using geth EVM bin. This will be useful for block builder tests using `testing_buildBlockV1` endpoint and for filling benchmarking compute and stateful tests as Python is too slow for benchmark tests. Tested in [ethereum/execution-specs](https://github.com/ethereum/execution-specs) with: ``` uv run fill --clean --fork=Amsterdam tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py --evm-bin=$GETH_EVM_PATH ```
This commit is contained in:
parent
92cd26cae0
commit
12eabbd76d
2 changed files with 15 additions and 9 deletions
|
|
@ -77,8 +77,8 @@ type ExecutionResult struct {
|
||||||
RequestsHash *common.Hash `json:"requestsHash,omitempty"`
|
RequestsHash *common.Hash `json:"requestsHash,omitempty"`
|
||||||
Requests [][]byte `json:"requests"`
|
Requests [][]byte `json:"requests"`
|
||||||
|
|
||||||
BlockAccessList *bal.BlockAccessList `json:"blockAccessList,omitempty"`
|
BlockAccessList hexutil.Bytes `json:"blockAccessList,omitempty"`
|
||||||
BlockAccessListHash *common.Hash `json:"blockAccessListHash,omitempty"`
|
BlockAccessListHash *common.Hash `json:"blockAccessListHash,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type executionResultMarshaling struct {
|
type executionResultMarshaling struct {
|
||||||
|
|
@ -192,6 +192,9 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
||||||
GasLimit: pre.Env.GasLimit,
|
GasLimit: pre.Env.GasLimit,
|
||||||
GetHash: getHash,
|
GetHash: getHash,
|
||||||
}
|
}
|
||||||
|
if pre.Env.SlotNumber != nil {
|
||||||
|
vmContext.SlotNum = *pre.Env.SlotNumber
|
||||||
|
}
|
||||||
// If currentBaseFee is defined, add it to the vmContext.
|
// If currentBaseFee is defined, add it to the vmContext.
|
||||||
if pre.Env.BaseFee != nil {
|
if pre.Env.BaseFee != nil {
|
||||||
vmContext.BaseFee = new(big.Int).Set(pre.Env.BaseFee)
|
vmContext.BaseFee = new(big.Int).Set(pre.Env.BaseFee)
|
||||||
|
|
@ -396,10 +399,14 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
||||||
execRs.Requests = requests
|
execRs.Requests = requests
|
||||||
}
|
}
|
||||||
if isAmsterdam {
|
if isAmsterdam {
|
||||||
bal := blockAccessList.ToEncodingObj()
|
encoded := blockAccessList.ToEncodingObj()
|
||||||
balHash := bal.Hash()
|
balRLP, err := rlp.EncodeToBytes(encoded)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not encode BAL: %v", err))
|
||||||
|
}
|
||||||
|
balHash := encoded.Hash()
|
||||||
execRs.BlockAccessListHash = &balHash
|
execRs.BlockAccessListHash = &balHash
|
||||||
execRs.BlockAccessList = bal
|
execRs.BlockAccessList = balRLP
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-create statedb instance with new root for MPT mode
|
// Re-create statedb instance with new root for MPT mode
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"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"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/core/types/bal"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = (*executionResultMarshaling)(nil)
|
var _ = (*executionResultMarshaling)(nil)
|
||||||
|
|
@ -33,7 +32,7 @@ func (e ExecutionResult) MarshalJSON() ([]byte, error) {
|
||||||
CurrentBlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed,omitempty"`
|
CurrentBlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed,omitempty"`
|
||||||
RequestsHash *common.Hash `json:"requestsHash,omitempty"`
|
RequestsHash *common.Hash `json:"requestsHash,omitempty"`
|
||||||
Requests []hexutil.Bytes `json:"requests"`
|
Requests []hexutil.Bytes `json:"requests"`
|
||||||
BlockAccessList *bal.BlockAccessList `json:"blockAccessList,omitempty"`
|
BlockAccessList hexutil.Bytes `json:"blockAccessList,omitempty"`
|
||||||
BlockAccessListHash *common.Hash `json:"blockAccessListHash,omitempty"`
|
BlockAccessListHash *common.Hash `json:"blockAccessListHash,omitempty"`
|
||||||
}
|
}
|
||||||
var enc ExecutionResult
|
var enc ExecutionResult
|
||||||
|
|
@ -80,7 +79,7 @@ func (e *ExecutionResult) UnmarshalJSON(input []byte) error {
|
||||||
CurrentBlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed,omitempty"`
|
CurrentBlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed,omitempty"`
|
||||||
RequestsHash *common.Hash `json:"requestsHash,omitempty"`
|
RequestsHash *common.Hash `json:"requestsHash,omitempty"`
|
||||||
Requests []hexutil.Bytes `json:"requests"`
|
Requests []hexutil.Bytes `json:"requests"`
|
||||||
BlockAccessList *bal.BlockAccessList `json:"blockAccessList,omitempty"`
|
BlockAccessList *hexutil.Bytes `json:"blockAccessList,omitempty"`
|
||||||
BlockAccessListHash *common.Hash `json:"blockAccessListHash,omitempty"`
|
BlockAccessListHash *common.Hash `json:"blockAccessListHash,omitempty"`
|
||||||
}
|
}
|
||||||
var dec ExecutionResult
|
var dec ExecutionResult
|
||||||
|
|
@ -138,7 +137,7 @@ func (e *ExecutionResult) UnmarshalJSON(input []byte) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if dec.BlockAccessList != nil {
|
if dec.BlockAccessList != nil {
|
||||||
e.BlockAccessList = dec.BlockAccessList
|
e.BlockAccessList = *dec.BlockAccessList
|
||||||
}
|
}
|
||||||
if dec.BlockAccessListHash != nil {
|
if dec.BlockAccessListHash != nil {
|
||||||
e.BlockAccessListHash = dec.BlockAccessListHash
|
e.BlockAccessListHash = dec.BlockAccessListHash
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue