Versions in this module Expand all Collapse all v0 v0.5.0 Apr 2, 2025 v0.4.0 Apr 2, 2025 v0.1.0 Mar 27, 2025 Changes in this version + const GasExtStep + const GasFastStep + const GasFastestStep + const GasFastishStep + const GasMidStep + const GasQuickStep + const GasSlowStep + const VMErrorCodeCodeStoreOutOfGas + const VMErrorCodeContractAddressCollision + const VMErrorCodeDepth + const VMErrorCodeExecutionReverted + const VMErrorCodeGasUintOverflow + const VMErrorCodeInsufficientBalance + const VMErrorCodeInvalidCode + const VMErrorCodeInvalidJump + const VMErrorCodeInvalidOpCode + const VMErrorCodeMaxCodeSizeExceeded + const VMErrorCodeNonceUintOverflow + const VMErrorCodeOutOfGas + const VMErrorCodeReturnDataOutOfBounds + const VMErrorCodeStackOverflow + const VMErrorCodeStackUnderflow + const VMErrorCodeUnknown + const VMErrorCodeWriteProtection + var ErrCodeStoreOutOfGas = errors.New("contract creation code storage out of gas") + var ErrContractAddressCollision = errors.New("contract address collision") + var ErrDepth = errors.New("max call depth exceeded") + var ErrExecutionReverted = errors.New("execution reverted") + var ErrGasUintOverflow = errors.New("gas uint64 overflow") + var ErrInsufficientBalance = errors.New("insufficient balance for transfer") + var ErrInvalidCode = errors.New("invalid code: must not begin with 0xef") + var ErrInvalidJump = errors.New("invalid jump destination") + var ErrMaxCodeSizeExceeded = errors.New("max code size exceeded") + var ErrMaxInitCodeSizeExceeded = errors.New("max initcode size exceeded") + var ErrNonceUintOverflow = errors.New("nonce uint64 overflow") + var ErrOutOfGas = errors.New("out of gas") + var ErrReturnDataOutOfBounds = errors.New("return data out of bounds") + var ErrWriteProtection = errors.New("write protection") + var PrecompiledAddressesBerlin []common.Address + var PrecompiledAddressesByzantium []common.Address + var PrecompiledAddressesCancun []common.Address + var PrecompiledAddressesFjord []common.Address + var PrecompiledAddressesGranite []common.Address + var PrecompiledAddressesHomestead []common.Address + var PrecompiledAddressesIstanbul []common.Address + var PrecompiledAddressesIsthmus []common.Address + var PrecompiledAddressesPrague []common.Address + var PrecompiledContractsBLS = PrecompiledContractsPrague + var PrecompiledContractsBerlin = PrecompiledContracts + var PrecompiledContractsByzantium = PrecompiledContracts + var PrecompiledContractsCancun = PrecompiledContracts + var PrecompiledContractsFjord = map[common.Address]PrecompiledContract + var PrecompiledContractsGranite = map[common.Address]PrecompiledContract + var PrecompiledContractsHomestead = PrecompiledContracts + var PrecompiledContractsIstanbul = PrecompiledContracts + var PrecompiledContractsIsthmus = map[common.Address]PrecompiledContract + var PrecompiledContractsPrague = PrecompiledContracts + var PrecompiledContractsVerkle = PrecompiledContractsPrague + func ActivateableEips() []string + func ActivePrecompiles(rules params.Rules) []common.Address + func EnableEIP(eipNum int, jt *JumpTable) error + func HasEOFByte(code []byte) bool + func Immediates(op OpCode) int + func RunPrecompiledContract(p PrecompiledContract, input []byte, suppliedGas uint64, logger *tracing.Hooks) (ret []byte, remainingGas uint64, err error) + func VMErrorFromErr(err error) error + func ValidEip(eipNum int) bool + type BlockContext struct + BaseFee *big.Int + BlobBaseFee *big.Int + BlockNumber *big.Int + CanTransfer CanTransferFunc + Coinbase common.Address + Difficulty *big.Int + GasLimit uint64 + GetHash GetHashFunc + L1CostFunc types.L1CostFunc + OperatorCostFunc types.OperatorCostFunc + Random *common.Hash + Time uint64 + Transfer TransferFunc + type CanTransferFunc func(StateDB, common.Address, *uint256.Int) bool + type Config struct + CallerOverride func(v common.Address) common.Address + EnablePreimageRecording bool + ExtraEips []int + NoBaseFee bool + NoMaxCodeSize bool + PrecompileOverrides PrecompileOverrides + StatelessSelfValidation bool + Tracer *tracing.Hooks + type Container struct + func (c *Container) MarshalBinary() []byte + func (c *Container) String() string + func (c *Container) UnmarshalBinary(b []byte, isInitcode bool) error + func (c *Container) UnmarshalSubContainer(b []byte, isInitcode bool) error + func (c *Container) ValidateCode(jt *JumpTable, isInitCode bool) error + type Contract struct + Code []byte + CodeHash common.Hash + Gas uint64 + Input []byte + IsDeployment bool + IsSystemCall bool + func NewContract(caller common.Address, address common.Address, value *uint256.Int, gas uint64, ...) *Contract + func (c *Contract) Address() common.Address + func (c *Contract) Caller() common.Address + func (c *Contract) GetOp(n uint64) OpCode + func (c *Contract) RefundGas(gas uint64, logger *tracing.Hooks, reason tracing.GasChangeReason) + func (c *Contract) SetCallCode(hash common.Hash, code []byte) + func (c *Contract) UseGas(gas uint64, logger *tracing.Hooks, reason tracing.GasChangeReason) (ok bool) + func (c *Contract) Value() *uint256.Int + type EVM struct + Config Config + Context BlockContext + StateDB StateDB + func NewEVM(blockCtx BlockContext, statedb StateDB, chainConfig *params.ChainConfig, ...) *EVM + func (evm *EVM) Call(caller common.Address, addr common.Address, input []byte, gas uint64, ...) (ret []byte, leftOverGas uint64, err error) + func (evm *EVM) CallCode(caller common.Address, addr common.Address, input []byte, gas uint64, ...) (ret []byte, leftOverGas uint64, err error) + func (evm *EVM) Cancel() + func (evm *EVM) Cancelled() bool + func (evm *EVM) ChainConfig() *params.ChainConfig + func (evm *EVM) Create(caller common.Address, code []byte, gas uint64, value *uint256.Int) (ret []byte, contractAddr common.Address, leftOverGas uint64, err error) + func (evm *EVM) Create2(caller common.Address, code []byte, gas uint64, endowment *uint256.Int, ...) (ret []byte, contractAddr common.Address, leftOverGas uint64, err error) + func (evm *EVM) DelegateCall(originCaller common.Address, caller common.Address, addr common.Address, ...) (ret []byte, leftOverGas uint64, err error) + func (evm *EVM) GetVMContext() *tracing.VMContext + func (evm *EVM) Interpreter() *EVMInterpreter + func (evm *EVM) SetPrecompiles(precompiles PrecompiledContracts) + func (evm *EVM) SetTxContext(txCtx TxContext) + func (evm *EVM) StaticCall(caller common.Address, addr common.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) + type EVMInterpreter struct + func NewEVMInterpreter(evm *EVM) *EVMInterpreter + func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (ret []byte, err error) + type ErrInvalidOpCode struct + func (e *ErrInvalidOpCode) Error() string + type ErrStackOverflow struct + func (e ErrStackOverflow) Error() string + func (e ErrStackOverflow) Unwrap() error + type ErrStackUnderflow struct + func (e ErrStackUnderflow) Error() string + func (e ErrStackUnderflow) Unwrap() error + type GetHashFunc func(uint64) common.Hash + type JumpTable [256]*operation + func LookupInstructionSet(rules params.Rules) (JumpTable, error) + func NewEOFInstructionSetForTesting() JumpTable + type Memory struct + func NewMemory() *Memory + func (m *Memory) Copy(dst, src, len uint64) + func (m *Memory) Data() []byte + func (m *Memory) Free() + func (m *Memory) GetCopy(offset, size uint64) (cpy []byte) + func (m *Memory) GetPtr(offset, size uint64) []byte + func (m *Memory) Len() int + func (m *Memory) Resize(size uint64) + func (m *Memory) Set(offset, size uint64, value []byte) + func (m *Memory) Set32(offset uint64, val *uint256.Int) + type OpCode byte + const ADD + const ADDMOD + const ADDRESS + const AND + const BALANCE + const BASEFEE + const BLOBBASEFEE + const BLOBHASH + const BLOCKHASH + const BYTE + const CALL + const CALLCODE + const CALLDATACOPY + const CALLDATALOAD + const CALLDATASIZE + const CALLER + const CALLF + const CALLVALUE + const CHAINID + const CODECOPY + const CODESIZE + const COINBASE + const CREATE + const CREATE2 + const DATACOPY + const DATALOAD + const DATALOADN + const DATASIZE + const DELEGATECALL + const DIFFICULTY + const DIV + const DUP1 + const DUP10 + const DUP11 + const DUP12 + const DUP13 + const DUP14 + const DUP15 + const DUP16 + const DUP2 + const DUP3 + const DUP4 + const DUP5 + const DUP6 + const DUP7 + const DUP8 + const DUP9 + const DUPN + const EOFCREATE + const EQ + const EXCHANGE + const EXP + const EXTCALL + const EXTCODECOPY + const EXTCODEHASH + const EXTCODESIZE + const EXTDELEGATECALL + const EXTSTATICCALL + const GAS + const GASLIMIT + const GASPRICE + const GT + const INVALID + const ISZERO + const JUMP + const JUMPDEST + const JUMPF + const JUMPI + const KECCAK256 + const LOG0 + const LOG1 + const LOG2 + const LOG3 + const LOG4 + const LT + const MCOPY + const MLOAD + const MOD + const MSIZE + const MSTORE + const MSTORE8 + const MUL + const MULMOD + const NOT + const NUMBER + const OR + const ORIGIN + const PC + const POP + const PREVRANDAO + const PUSH0 + const PUSH1 + const PUSH10 + const PUSH11 + const PUSH12 + const PUSH13 + const PUSH14 + const PUSH15 + const PUSH16 + const PUSH17 + const PUSH18 + const PUSH19 + const PUSH2 + const PUSH20 + const PUSH21 + const PUSH22 + const PUSH23 + const PUSH24 + const PUSH25 + const PUSH26 + const PUSH27 + const PUSH28 + const PUSH29 + const PUSH3 + const PUSH30 + const PUSH31 + const PUSH32 + const PUSH4 + const PUSH5 + const PUSH6 + const PUSH7 + const PUSH8 + const PUSH9 + const RANDOM + const RETF + const RETURN + const RETURNCONTRACT + const RETURNDATACOPY + const RETURNDATALOAD + const RETURNDATASIZE + const REVERT + const RJUMP + const RJUMPI + const RJUMPV + const SAR + const SDIV + const SELFBALANCE + const SELFDESTRUCT + const SGT + const SHL + const SHR + const SIGNEXTEND + const SLOAD + const SLT + const SMOD + const SSTORE + const STATICCALL + const STOP + const SUB + const SWAP1 + const SWAP10 + const SWAP11 + const SWAP12 + const SWAP13 + const SWAP14 + const SWAP15 + const SWAP16 + const SWAP2 + const SWAP3 + const SWAP4 + const SWAP5 + const SWAP6 + const SWAP7 + const SWAP8 + const SWAP9 + const SWAPN + const TIMESTAMP + const TLOAD + const TSTORE + const XOR + func StringToOp(str string) OpCode + func (op OpCode) IsPush() bool + func (op OpCode) String() string + type PrecompileOverrides func(rules params.Rules, original PrecompiledContract, addr common.Address) PrecompiledContract + type PrecompiledContract interface + RequiredGas func(input []byte) uint64 + Run func(input []byte) ([]byte, error) + type PrecompiledContracts map[common.Address]PrecompiledContract + func ActivePrecompiledContracts(rules params.Rules) PrecompiledContracts + type ScopeContext struct + Contract *Contract + Memory *Memory + Stack *Stack + func (ctx *ScopeContext) Address() common.Address + func (ctx *ScopeContext) CallInput() []byte + func (ctx *ScopeContext) CallValue() *uint256.Int + func (ctx *ScopeContext) Caller() common.Address + func (ctx *ScopeContext) ContractCode() []byte + func (ctx *ScopeContext) MemoryData() []byte + func (ctx *ScopeContext) StackData() []uint256.Int + type Stack struct + func (st *Stack) Back(n int) *uint256.Int + func (st *Stack) Data() []uint256.Int + type StateDB interface + AccessEvents func() *state.AccessEvents + AddAddressToAccessList func(addr common.Address) + AddBalance func(common.Address, *uint256.Int, tracing.BalanceChangeReason) uint256.Int + AddLog func(*types.Log) + AddPreimage func(common.Hash, []byte) + AddRefund func(uint64) + AddSlotToAccessList func(addr common.Address, slot common.Hash) + AddressInAccessList func(addr common.Address) bool + CreateAccount func(common.Address) + CreateContract func(common.Address) + Empty func(common.Address) bool + Exist func(common.Address) bool + Finalise func(bool) + GetBalance func(common.Address) *uint256.Int + GetCode func(common.Address) []byte + GetCodeHash func(common.Address) common.Hash + GetCodeSize func(common.Address) int + GetCommittedState func(common.Address, common.Hash) common.Hash + GetNonce func(common.Address) uint64 + GetRefund func() uint64 + GetState func(common.Address, common.Hash) common.Hash + GetStorageRoot func(addr common.Address) common.Hash + GetTransientState func(addr common.Address, key common.Hash) common.Hash + HasSelfDestructed func(common.Address) bool + PointCache func() *utils.PointCache + Prepare func(rules params.Rules, sender, coinbase common.Address, dest *common.Address, ...) + RevertToSnapshot func(int) + SelfDestruct func(common.Address) uint256.Int + SelfDestruct6780 func(common.Address) (uint256.Int, bool) + SetCode func(common.Address, []byte) []byte + SetNonce func(common.Address, uint64, tracing.NonceChangeReason) + SetState func(common.Address, common.Hash, common.Hash) common.Hash + SetTransientState func(addr common.Address, key, value common.Hash) + SlotInAccessList func(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool) + Snapshot func() int + SubBalance func(common.Address, *uint256.Int, tracing.BalanceChangeReason) uint256.Int + SubRefund func(uint64) + Witness func() *stateless.Witness + type TransferFunc func(StateDB, common.Address, common.Address, *uint256.Int) + type TxContext struct + AccessEvents *state.AccessEvents + BlobFeeCap *big.Int + BlobHashes []common.Hash + GasPrice *big.Int + Origin common.Address + type VMError struct + func (e *VMError) Error() string + func (e *VMError) ErrorCode() int + func (e *VMError) Unwrap() error