From 19bef000b09b6d800cfca44f44d4b445fb28b331 Mon Sep 17 00:00:00 2001 From: aaronbuchwald Date: Fri, 21 Jul 2023 11:25:19 -0400 Subject: [PATCH] Remove call from precompile (#748) --- core/vm/evm.go | 5 ----- go.mod | 2 +- precompile/contract/interfaces.go | 1 - precompile/contract/mock_interfaces.go | 5 ----- 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/core/vm/evm.go b/core/vm/evm.go index 764bce4e65..fab2283c11 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -313,11 +313,6 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas return ret, gas, err } -// CallFromPrecompile invokes Call to execute the contract with the given input parameters. -func (evm *EVM) CallFromPrecompile(caller common.Address, addr common.Address, input []byte, gas uint64, value *big.Int) (ret []byte, leftOverGas uint64, err error) { - return evm.Call(AccountRef(caller), addr, input, gas, value) -} - // CallCode executes the contract associated with the addr with the given input // as parameters. It also handles any necessary value transfer required and takes // the necessary steps to create accounts and reverses the state in case of an diff --git a/go.mod b/go.mod index b3bbb63dc7..e9862120c6 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/fsnotify/fsnotify v1.6.0 github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 github.com/go-cmd/cmd v1.4.1 + github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 github.com/gorilla/rpc v1.2.0 github.com/gorilla/websocket v1.4.2 @@ -70,7 +71,6 @@ require ( github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/golang-jwt/jwt/v4 v4.3.0 // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect diff --git a/precompile/contract/interfaces.go b/precompile/contract/interfaces.go index 7243265c61..d53ed72619 100644 --- a/precompile/contract/interfaces.go +++ b/precompile/contract/interfaces.go @@ -60,7 +60,6 @@ type AccessibleState interface { GetStateDB() StateDB GetBlockContext() BlockContext GetSnowContext() *snow.Context - CallFromPrecompile(caller common.Address, addr common.Address, input []byte, gas uint64, value *big.Int) (ret []byte, leftOverGas uint64, err error) } // BlockContext defines an interface that provides information to a stateful precompile about the diff --git a/precompile/contract/mock_interfaces.go b/precompile/contract/mock_interfaces.go index aa4a9dcfaa..590d002001 100644 --- a/precompile/contract/mock_interfaces.go +++ b/precompile/contract/mock_interfaces.go @@ -8,7 +8,6 @@ import ( "github.com/ava-labs/avalanchego/snow" "github.com/ava-labs/subnet-evm/commontype" - "github.com/ethereum/go-ethereum/common" ) // TODO: replace with gomock library @@ -53,10 +52,6 @@ func (m *mockAccessibleState) GetBlockContext() BlockContext { return m.blockCon func (m *mockAccessibleState) GetSnowContext() *snow.Context { return m.snowContext } -func (m *mockAccessibleState) CallFromPrecompile(caller common.Address, addr common.Address, input []byte, gas uint64, value *big.Int) (ret []byte, leftOverGas uint64, err error) { - return nil, 0, nil -} - type mockChainState struct { feeConfig commontype.FeeConfig allowedFeeRecipients bool