Versions in this module Expand all Collapse all v0 v0.1.3 Jan 16, 2024 v0.1.2 Dec 7, 2023 v0.1.1 Nov 3, 2023 v0.1.0 Oct 17, 2023 Changes in this version + const GasExtStep + const GasFastStep + const GasFastestStep + const GasMidStep + const GasQuickStep + const GasSlowStep + 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") + var ErrInvalidJump = errors.New("invalid jump destination") + var ErrInvalidRetsub = errors.New("invalid retsub") + var ErrInvalidSubroutineEntry = errors.New("invalid subroutine entry") + var ErrMaxCodeSizeExceeded = errors.New("max code 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 ErrReturnStackExceeded = errors.New("return stack limit reached") + var ErrWriteProtection = errors.New("write protection") + var PrecompiledAddressesBerlin []types.Address + var PrecompiledAddressesByzantium []types.Address + var PrecompiledAddressesHomestead []types.Address + var PrecompiledAddressesIstanbul []types.Address + var PrecompiledAddressesIstanbulForBSC []types.Address + var PrecompiledAddressesMoran []types.Address + var PrecompiledAddressesNano []types.Address + var PrecompiledContractsBLS = map[types.Address]PrecompiledContract + var PrecompiledContractsBerlin = map[types.Address]PrecompiledContract + var PrecompiledContractsByzantium = map[types.Address]PrecompiledContract + var PrecompiledContractsHomestead = map[types.Address]PrecompiledContract + var PrecompiledContractsIsMoran = map[types.Address]PrecompiledContract + var PrecompiledContractsIstanbul = map[types.Address]PrecompiledContract + var PrecompiledContractsIstanbulForBSC = map[types.Address]PrecompiledContract + var PrecompiledContractsNano = map[types.Address]PrecompiledContract + func ActivateableEips() []string + func ActivePrecompiles(rules *params.Rules) []types.Address + func CheckCfg(code []byte, proof *CfgProof) bool + func CompressProof(in []byte) []byte + func DecompressProof(in []byte) []byte + func EnableEIP(eipNum int, jt *JumpTable) error + func Eq(st0 *astate, st1 *astate) bool + func ExistsIn(values []AbsValue, value AbsValue) bool + func Leq(st0 *astate, st1 *astate) bool + func Lub(st0 *astate, st1 *astate) *astate + func RunPrecompiledContract(p PrecompiledContract, input []byte, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) + func StringifyAState(st *astate) [][]string + func ToWordSize(size uint64) uint64 + func ValidEip(eipNum int) bool + type AbsValue struct + func AbsValueConcrete(value uint256.Int) AbsValue + func AbsValueDestringify(s string) AbsValue + func AbsValueInvalid() AbsValue + func AbsValueTop(pc int) AbsValue + func (c0 AbsValue) Eq(c1 AbsValue) bool + func (c0 AbsValue) String(abbrev bool) string + func (c0 AbsValue) Stringify() string + type AbsValueKind int + const BotValue + const ConcreteValue + const InvalidValue + const TopValue + func (d AbsValueKind) String() string + type AccountRef types.Address + func (ar AccountRef) Address() types.Address + type Astmt struct + func (stmt *Astmt) String() string + type Block struct + Entrypc int + Exitpc int + Stmts []*Astmt + type CallContext interface + Call func(env *EVM, me ContractRef, addr types.Address, data []byte, gas, value *big.Int) ([]byte, error) + CallCode func(env *EVM, me ContractRef, addr types.Address, data []byte, gas, value *big.Int) ([]byte, error) + Create func(env *EVM, me ContractRef, data []byte, gas, value *big.Int) ([]byte, types.Address, error) + DelegateCall func(env *EVM, me ContractRef, addr types.Address, data []byte, gas *big.Int) ([]byte, error) + type Cfg struct + BadJumps map[int]bool + D map[int]*astate + Metrics *CfgMetrics + PrevEdgeMap map[int]map[int]bool + Program *Program + ProofSerialized []byte + func GenCfg(code []byte, anlyCounterLimit int, maxStackLen int, maxStackCount int, ...) (cfg *Cfg, err error) + func (cfg *Cfg) Clear() + func (cfg *Cfg) GenerateProof() *CfgProof + func (cfg *Cfg) GetCoverageStats() CfgCoverageStats + func (cfg *Cfg) PrintAnlyState() + type CfgAbsSem map[OpCode]*CfgOpSem + func NewCfgAbsSem() *CfgAbsSem + type CfgCoverageStats struct + Coverage int + Covered int + Epilogue int + Instructions int + Uncovered int + type CfgMetrics struct + AnlyCounter int + AnlyCounterLimit bool + BadJumpImprecision bool + BadJumpInvalidJumpDest bool + BadJumpInvalidOp bool + Checker bool + CheckerFailed bool + LowCoverage bool + MemUsedMBs uint64 + NumStacks int + OOM bool + Panic bool + ProofSizeBytes int + ShortStack bool + StackCountLimitReached bool + Time time.Duration + Timeout bool + Unresolved bool + Valid bool + func (metrics *CfgMetrics) GetBadJumpReason() string + type CfgOpSem struct + type CfgProof struct + Blocks []*CfgProofBlock + func DeserializeCfgProof(proofBytes []byte) *CfgProof + func (proof *CfgProof) Serialize() []byte + func (proof *CfgProof) ToString() string + type CfgProofBlock struct + Entry *CfgProofState + Exit *CfgProofState + Preds []int + Succs []int + type CfgProofState struct + Pc int + Stacks [][]string + type Config struct + Debug bool + ExtraEips []int + NoBaseFee bool + NoReceipts bool + NoRecursion bool + ReadOnly bool + RestoreState bool + SkipAnalysis bool + StatelessExec bool + TraceJumpDest bool + Tracer EVMLogger + func (vmConfig *Config) HasEip3860(rules *params.Rules) bool + type Contract struct + CallerAddress types.Address + Code []byte + CodeAddr *types.Address + CodeHash types.Hash + Gas uint64 + Input []byte + func NewContract(caller ContractRef, object ContractRef, value *uint256.Int, gas uint64, ...) *Contract + func (c *Contract) Address() types.Address + func (c *Contract) AsDelegate() *Contract + func (c *Contract) Caller() types.Address + func (c *Contract) GetOp(n uint64) OpCode + func (c *Contract) SetCallCode(addr *types.Address, hash types.Hash, code []byte) + func (c *Contract) SetCodeOptionalHash(addr *types.Address, codeAndHash *codeAndHash) + func (c *Contract) UseGas(gas uint64) (ok bool) + func (c *Contract) Value() *uint256.Int + type ContractRef interface + Address func() types.Address + type EVM struct + func NewEVM(blockCtx evmtypes.BlockContext, txCtx evmtypes.TxContext, ...) *EVM + func (evm *EVM) Call(caller ContractRef, addr types.Address, input []byte, gas uint64, ...) (ret []byte, leftOverGas uint64, err error) + func (evm *EVM) CallCode(caller ContractRef, addr types.Address, input []byte, gas uint64, ...) (ret []byte, leftOverGas uint64, err error) + func (evm *EVM) CallGasTemp() uint64 + func (evm *EVM) Cancel() + func (evm *EVM) Cancelled() bool + func (evm *EVM) ChainConfig() *params.ChainConfig + func (evm *EVM) ChainRules() *params.Rules + func (evm *EVM) Config() Config + func (evm *EVM) Context() evmtypes.BlockContext + func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, endowment *uint256.Int) (ret []byte, contractAddr types.Address, leftOverGas uint64, err error) + func (evm *EVM) Create2(caller ContractRef, code []byte, gas uint64, endowment *uint256.Int, ...) (ret []byte, contractAddr types.Address, leftOverGas uint64, err error) + func (evm *EVM) DelegateCall(caller ContractRef, addr types.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) + func (evm *EVM) Interpreter() Interpreter + func (evm *EVM) IntraBlockState() evmtypes.IntraBlockState + func (evm *EVM) Reset(txCtx evmtypes.TxContext, ibs evmtypes.IntraBlockState) + func (evm *EVM) ResetBetweenBlocks(blockCtx evmtypes.BlockContext, txCtx evmtypes.TxContext, ...) + func (evm *EVM) SetCallGasTemp(gas uint64) + func (evm *EVM) StaticCall(caller ContractRef, addr types.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) + func (evm *EVM) SysCreate(caller ContractRef, code []byte, gas uint64, endowment *uint256.Int, ...) (ret []byte, leftOverGas uint64, err error) + func (evm *EVM) TxContext() evmtypes.TxContext + type EVMInterpreter struct + func NewEVMInterpreter(evm VMInterpreter, cfg Config) *EVMInterpreter + func (in *EVMInterpreter) Depth() int + func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (ret []byte, err error) + type EVMLogger interface + CaptureEnd func(output []byte, usedGas uint64, err error) + CaptureEnter func(typ OpCode, from types.Address, to types.Address, input []byte, gas uint64, ...) + CaptureExit func(output []byte, usedGas uint64, err error) + CaptureFault func(pc uint64, op OpCode, gas, cost uint64, scope *ScopeContext, depth int, ...) + CaptureStart func(env VMInterface, from types.Address, to types.Address, create bool, ...) + CaptureState func(pc uint64, op OpCode, gas, cost uint64, scope *ScopeContext, rData []byte, ...) + CaptureTxEnd func(restGas uint64) + CaptureTxStart func(gasLimit uint64) + type ErrInvalidOpCode struct + func (e *ErrInvalidOpCode) Error() string + type ErrStackOverflow struct + func (e *ErrStackOverflow) Error() string + type ErrStackUnderflow struct + func (e *ErrStackUnderflow) Error() string + type FlushableTracer interface + Flush func(tx transaction.Transaction) + type Interpreter interface + Depth func() int + Run func(contract *Contract, input []byte, static bool) ([]byte, error) + type JumpTable [256]*operation + type Memory struct + func NewMemory() *Memory + func (m *Memory) Data() []byte + func (m *Memory) GetCopy(offset, size int64) (cpy []byte) + func (m *Memory) GetPtr(offset, size int64) []byte + func (m *Memory) Len() int + func (m *Memory) Print() + func (m *Memory) Reset() + 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 BLOCKHASH + const BYTE + const CALL + const CALLCODE + const CALLDATACOPY + const CALLDATALOAD + const CALLDATASIZE + const CALLER + const CALLVALUE + const CHAINID + const CODECOPY + const CODESIZE + const COINBASE + const CREATE + const CREATE2 + 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 EQ + const EXP + const EXTCODECOPY + const EXTCODEHASH + const EXTCODESIZE + const GAS + const GASLIMIT + const GASPRICE + const GT + const INVALID + const ISZERO + const JUMP + const JUMPDEST + const JUMPI + const KECCAK256 + const LOG0 + const LOG1 + const LOG2 + const LOG3 + const LOG4 + const LT + 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 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 RETURN + const RETURNDATACOPY + const RETURNDATASIZE + const REVERT + 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 TIMESTAMP + const XOR + func StringToOp(str string) OpCode + func (op OpCode) IsPush() bool + func (op OpCode) IsStaticJump() bool + func (op OpCode) String() string + type PrecompiledContract interface + RequiredGas func(input []byte) uint64 + Run func(input []byte) ([]byte, error) + type Program struct + Blocks []*Block + Code []byte + Entry2block map[int]*Block + Exit2block map[int]*Block + Stmts []*Astmt + func (program *Program) GetCodeHex() string + type ScopeContext struct + Contract *Contract + Memory *Memory + Stack *stack.Stack + type VM struct + type VMInterface interface + Call func(caller ContractRef, addr types.Address, input []byte, gas uint64, ...) (ret []byte, leftOverGas uint64, err error) + Cancel func() + ChainConfig func() *params.ChainConfig + ChainRules func() *params.Rules + Config func() Config + Context func() evmtypes.BlockContext + Create func(caller ContractRef, code []byte, gas uint64, value *uint256.Int) (ret []byte, contractAddr types.Address, leftOverGas uint64, err error) + IntraBlockState func() evmtypes.IntraBlockState + Reset func(txCtx evmtypes.TxContext, ibs evmtypes.IntraBlockState) + TxContext func() evmtypes.TxContext + type VMInterpreter interface + CallCode func(caller ContractRef, addr types.Address, input []byte, gas uint64, ...) (ret []byte, leftOverGas uint64, err error) + CallGasTemp func() uint64 + Cancelled func() bool + Create2 func(caller ContractRef, code []byte, gas uint64, endowment *uint256.Int, ...) (ret []byte, contractAddr types.Address, leftOverGas uint64, err error) + DelegateCall func(caller ContractRef, addr types.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) + SetCallGasTemp func(gas uint64) + StaticCall func(caller ContractRef, addr types.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error)