diff --git a/core/vm/interface.go b/core/vm/interface.go index 0fe1cbf5b..3dbe6fe5c 100644 --- a/core/vm/interface.go +++ b/core/vm/interface.go @@ -39,6 +39,7 @@ type CallContext interface { Create(env *EVM, me ContractRef, data []byte, gas, value *big.Int) ([]byte, libcommon.Address, error) } +// VMInterface exposes the EVM interface for external callers. type VMInterface interface { Reset(txCtx evmtypes.TxContext, ibs evmtypes.IntraBlockState) Create(caller ContractRef, code []byte, gas uint64, value *uint256.Int) (ret []byte, contractAddr libcommon.Address, leftOverGas uint64, err error) @@ -51,3 +52,18 @@ type VMInterface interface { IntraBlockState() evmtypes.IntraBlockState TxContext() evmtypes.TxContext } + +// VMInterpreter exposes additional EVM methods for use in the interpreter. +type VMInterpreter interface { + VMInterface + Cancelled() bool + IncrementDepth() + DecrementDepth() + Depth() int + SetCallGasTemp(gas uint64) + CallGasTemp() uint64 + StaticCall(caller ContractRef, addr libcommon.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) + DelegateCall(caller ContractRef, addr libcommon.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) + CallCode(caller ContractRef, addr libcommon.Address, input []byte, gas uint64, value *uint256.Int) (ret []byte, leftOverGas uint64, err error) + Create2(caller ContractRef, code []byte, gas uint64, endowment *uint256.Int, salt *uint256.Int) (ret []byte, contractAddr libcommon.Address, leftOverGas uint64, err error) +} diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index cf7597e2d..0df15b947 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -19,7 +19,6 @@ package vm import ( "hash" - "github.com/holiman/uint256" "github.com/ledgerwatch/erigon-lib/chain" libcommon "github.com/ledgerwatch/erigon-lib/common" "github.com/ledgerwatch/log/v3" @@ -85,21 +84,6 @@ type EVMInterpreter struct { jt *JumpTable // EVM instruction table } -type VMInterpreter interface { - VMInterface - Cancelled() bool - IncrementDepth() - DecrementDepth() - Depth() int - SetCallGasTemp(gas uint64) - CallGasTemp() uint64 - StaticCall(caller ContractRef, addr libcommon.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) - DelegateCall(caller ContractRef, addr libcommon.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) - CallCode(caller ContractRef, addr libcommon.Address, input []byte, gas uint64, value *uint256.Int) (ret []byte, leftOverGas uint64, err error) - Create(caller ContractRef, code []byte, gas uint64, endowment *uint256.Int) (ret []byte, contractAddr libcommon.Address, leftOverGas uint64, err error) - Create2(caller ContractRef, code []byte, gas uint64, endowment *uint256.Int, salt *uint256.Int) (ret []byte, contractAddr libcommon.Address, leftOverGas uint64, err error) -} - // structcheck doesn't see embedding // //nolint:structcheck diff --git a/turbo/stages/chain_makers_test.go b/turbo/stages/chain_makers_test.go index 02e207b8a..986588002 100644 --- a/turbo/stages/chain_makers_test.go +++ b/turbo/stages/chain_makers_test.go @@ -99,7 +99,11 @@ func TestGenerateChain(t *testing.T) { return } - tx, _ := m.DB.BeginRo(m.Ctx) + tx, err := m.DB.BeginRo(m.Ctx) + if err != nil { + fmt.Printf("beginro error: %v\n", err) + return + } defer tx.Rollback() st := state.New(state.NewPlainStateReader(tx))