package override

import "github.com/ethereum/go-ethereum/internal/ethapi/override"

Index

Types

type BlockOverrides

type BlockOverrides struct {
	Number        *hexutil.Big
	Difficulty    *hexutil.Big // No-op if we're simulating post-merge calls.
	Time          *hexutil.Uint64
	GasLimit      *hexutil.Uint64
	FeeRecipient  *common.Address
	PrevRandao    *common.Hash
	BaseFeePerGas *hexutil.Big
	BlobBaseFee   *hexutil.Big
	BeaconRoot    *common.Hash
	Withdrawals   *types.Withdrawals
}

BlockOverrides is a set of header fields to override.

func (*BlockOverrides) Apply

func (o *BlockOverrides) Apply(blockCtx *vm.BlockContext) error

Apply overrides the given header fields into the given block context.

func (*BlockOverrides) MakeHeader

func (o *BlockOverrides) MakeHeader(header *types.Header) *types.Header

MakeHeader returns a new header object with the overridden fields. Note: MakeHeader ignores BlobBaseFee if set. That's because header has no such field.

type OverrideAccount

type OverrideAccount struct {
	Nonce            *hexutil.Uint64             `json:"nonce"`
	Code             *hexutil.Bytes              `json:"code"`
	Balance          *hexutil.Big                `json:"balance"`
	State            map[common.Hash]common.Hash `json:"state"`
	StateDiff        map[common.Hash]common.Hash `json:"stateDiff"`
	MovePrecompileTo *common.Address             `json:"movePrecompileToAddress"`
}

OverrideAccount indicates the overriding fields of account during the execution of a message call. Note, state and stateDiff can't be specified at the same time. If state is set, message execution will only use the data in the given state. Otherwise if stateDiff is set, all diff will be applied first and then execute the call message.

type StateOverride

type StateOverride map[common.Address]OverrideAccount

StateOverride is the collection of overridden accounts.

func (*StateOverride) Apply

func (diff *StateOverride) Apply(statedb *state.StateDB, precompiles vm.PrecompiledContracts) error

Apply overrides the fields of specified accounts into the given state.

Source Files

override.go

Version
v1.15.11 (latest)
Published
May 5, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
1 day ago

Tools for package owners.