Skip to content

Commit

Permalink
update precompiles
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Nov 5, 2024
1 parent 528552c commit c000b6a
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 91 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ replace (
replace (
github.com/cometbft/cometbft => github.com/initia-labs/cometbft v0.0.0-20240925132752-ff8ff0126261
github.com/cosmos/ibc-go/v8 => github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d
github.com/ethereum/go-ethereum => github.com/initia-labs/evm v0.0.0-20241104061036-f8482395518d
github.com/ethereum/go-ethereum => github.com/initia-labs/evm v0.0.0-20241105070652-c43b570a4e98

// use custom version until this PR is merged
// - https://github.com/strangelove-ventures/cometbft-client/pull/10
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1440,8 +1440,8 @@ github.com/initia-labs/cometbft v0.0.0-20240925132752-ff8ff0126261 h1:V62KOhe6Em
github.com/initia-labs/cometbft v0.0.0-20240925132752-ff8ff0126261/go.mod h1:KsQ7Wm/dw9N0l7Ypn3QKGwgUX5XinTlcHGIF0DSjsw4=
github.com/initia-labs/cometbft-client v0.0.0-20240924071428-ef115cefa07e h1:k+pg63SFozCAK4LZFSiZtof6z69Tlu0O/Zftj1aAwes=
github.com/initia-labs/cometbft-client v0.0.0-20240924071428-ef115cefa07e/go.mod h1:aVposiPW9FOUeAeJ7JjJRdE3g+L6i8YDxFn6Cv6+Az4=
github.com/initia-labs/evm v0.0.0-20241104061036-f8482395518d h1:9fqIEcfMe10BjfNWmuQDqYGmvtTIMRcMXJi26VCs5DM=
github.com/initia-labs/evm v0.0.0-20241104061036-f8482395518d/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E=
github.com/initia-labs/evm v0.0.0-20241105070652-c43b570a4e98 h1:JmJpxtYnF++Lj9MhD2LxOtgNAJM0aYqgO9nBkuhiGlI=
github.com/initia-labs/evm v0.0.0-20241105070652-c43b570a4e98/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E=
github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d h1:TLq8lB1PtQ0pjGf+bN8YgGVeLMuytZ26SBGMOs1seKY=
github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d/go.mod h1:zh6x1osR0hNvEcFrC/lhGD08sMfQmr9wHVvZ/mRWMCs=
github.com/initia-labs/initia v0.6.0 h1:/39ZN26zeixxZZdcfY1sOitiBhfnG3lcbPtpFqd9z7A=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ replace (
replace (
github.com/cometbft/cometbft => github.com/initia-labs/cometbft v0.0.0-20240925132752-ff8ff0126261
github.com/cosmos/ibc-go/v8 => github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d
github.com/ethereum/go-ethereum => github.com/initia-labs/evm v0.0.0-20241104061036-f8482395518d
github.com/ethereum/go-ethereum => github.com/initia-labs/evm v0.0.0-20241105070652-c43b570a4e98

// use custom version until this PR is merged
// - https://github.com/strangelove-ventures/cometbft-client/pull/10
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1398,8 +1398,8 @@ github.com/initia-labs/OPinit/api v0.5.1 h1:zwyJf7HtKJCKvLJ1R9PjVfJO1L+d/jKoeFyT
github.com/initia-labs/OPinit/api v0.5.1/go.mod h1:gHK6DEWb3/DqQD5LjKirUx9jilAh2UioXanoQdgqVfU=
github.com/initia-labs/cometbft v0.0.0-20240925132752-ff8ff0126261 h1:V62KOhe6Em3wAvJsDVP+3is98I3mk/29OKNVs4IxeFQ=
github.com/initia-labs/cometbft v0.0.0-20240925132752-ff8ff0126261/go.mod h1:KsQ7Wm/dw9N0l7Ypn3QKGwgUX5XinTlcHGIF0DSjsw4=
github.com/initia-labs/evm v0.0.0-20241104061036-f8482395518d h1:9fqIEcfMe10BjfNWmuQDqYGmvtTIMRcMXJi26VCs5DM=
github.com/initia-labs/evm v0.0.0-20241104061036-f8482395518d/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E=
github.com/initia-labs/evm v0.0.0-20241105070652-c43b570a4e98 h1:JmJpxtYnF++Lj9MhD2LxOtgNAJM0aYqgO9nBkuhiGlI=
github.com/initia-labs/evm v0.0.0-20241105070652-c43b570a4e98/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E=
github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d h1:TLq8lB1PtQ0pjGf+bN8YgGVeLMuytZ26SBGMOs1seKY=
github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d/go.mod h1:zh6x1osR0hNvEcFrC/lhGD08sMfQmr9wHVvZ/mRWMCs=
github.com/initia-labs/initia v0.6.0 h1:/39ZN26zeixxZZdcfY1sOitiBhfnG3lcbPtpFqd9z7A=
Expand Down
9 changes: 5 additions & 4 deletions x/evm/keeper/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ func (k Keeper) CreateEVM(ctx context.Context, caller common.Address, tracer *tr
stateDB,
types.DefaultChainConfig(ctx),
vmConfig,
k.precompiles.toMap(stateDB),
// use custom precompiles
k.Precompiles(stateDB),
)

if tracer != nil {
Expand Down Expand Up @@ -238,7 +239,7 @@ func (k Keeper) EVMStaticCallWithTracer(ctx context.Context, caller common.Addre
sdkCtx := sdk.UnwrapSDKContext(ctx)
gasBalance := k.computeGasLimit(sdkCtx)
rules := evm.ChainConfig().Rules(evm.Context.BlockNumber, evm.Context.Random != nil, evm.Context.Time)
evm.StateDB.Prepare(rules, caller, types.NullAddress, &contractAddr, append(vm.ActivePrecompiles(rules), k.precompiles.toAddrs()...), accessList)
evm.StateDB.Prepare(rules, caller, types.NullAddress, &contractAddr, k.precompileAddrs, accessList)

retBz, gasRemaining, err := evm.StaticCall(
vm.AccountRef(caller),
Expand Down Expand Up @@ -276,7 +277,7 @@ func (k Keeper) EVMCallWithTracer(ctx context.Context, caller common.Address, co
}

rules := evm.ChainConfig().Rules(evm.Context.BlockNumber, evm.Context.Random != nil, evm.Context.Time)
evm.StateDB.Prepare(rules, caller, types.NullAddress, &contractAddr, append(vm.ActivePrecompiles(rules), k.precompiles.toAddrs()...), accessList)
evm.StateDB.Prepare(rules, caller, types.NullAddress, &contractAddr, k.precompileAddrs, accessList)

retBz, gasRemaining, err := evm.Call(
vm.AccountRef(caller),
Expand Down Expand Up @@ -370,7 +371,7 @@ func (k Keeper) EVMCreateWithTracer(ctx context.Context, caller common.Address,
}

rules := evm.ChainConfig().Rules(evm.Context.BlockNumber, evm.Context.Random != nil, evm.Context.Time)
evm.StateDB.Prepare(rules, caller, types.NullAddress, nil, append(vm.ActivePrecompiles(rules), k.precompiles.toAddrs()...), accessList)
evm.StateDB.Prepare(rules, caller, types.NullAddress, nil, k.precompileAddrs, accessList)

var gasRemaining uint64
if salt == nil {
Expand Down
9 changes: 7 additions & 2 deletions x/evm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"

evmconfig "github.com/initia-labs/minievm/x/evm/config"
"github.com/initia-labs/minievm/x/evm/contracts/i_cosmos_callback"
Expand Down Expand Up @@ -77,7 +78,9 @@ type Keeper struct {
// evm stores
EVMBlockHashes collections.Map[uint64, []byte]

precompiles precompiles
precompiles vm.PrecompiledContracts
precompileAddrs []common.Address

queryCosmosWhitelist types.QueryCosmosWhitelist
cosmosCallbackABI *abi.ABI
}
Expand Down Expand Up @@ -154,7 +157,9 @@ func NewKeeper(

EVMBlockHashes: collections.NewMap(sb, types.EVMBlockHashPrefix, "evm_block_hashes", collections.Uint64Key, collections.BytesValue),

precompiles: []precompile{},
precompiles: vm.PrecompiledContracts{},
precompileAddrs: []common.Address{},

queryCosmosWhitelist: queryCosmosWhitelist,
cosmosCallbackABI: cosmosCallbackABI,
}
Expand Down
57 changes: 21 additions & 36 deletions x/evm/keeper/precompiles.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
package keeper

import (
"github.com/ethereum/go-ethereum/common"
"math/big"
"slices"

"github.com/ethereum/go-ethereum/core/vm"

sdk "github.com/cosmos/cosmos-sdk/types"

cosmosprecompile "github.com/initia-labs/minievm/x/evm/precompiles/cosmos"
erc20registryprecompile "github.com/initia-labs/minievm/x/evm/precompiles/erc20_registry"
"github.com/initia-labs/minievm/x/evm/types"
)

// precompile is a precompiled contract.
type precompile struct {
addr common.Address
contract vm.PrecompiledContract
}

// loadPrecompiles loads the precompiled contracts.
func (k *Keeper) loadPrecompiles() error {
erc20RegistryPrecompile, err := erc20registryprecompile.NewERC20RegistryPrecompile(k.erc20StoresKeeper)
Expand All @@ -35,38 +33,25 @@ func (k *Keeper) loadPrecompiles() error {
return err
}

k.precompiles = precompiles{
{
addr: common.BytesToAddress([]byte{0xf1}),
contract: cosmosPrecompile,
},
{
addr: common.BytesToAddress([]byte{0xf2}),
contract: erc20RegistryPrecompile,
},
}

return nil
}
// prepare precompiles; always use latest chain config
// to load all precompiles.
chainConfig := types.DefaultChainConfig(sdk.Context{})
rules := chainConfig.Rules(big.NewInt(1), true, 1)

// precompiles is a list of precompiled contracts.
type precompiles []precompile
precompiles := vm.ActivePrecompiledContracts(rules)
precompiles[types.CosmosPrecompileAddress] = cosmosPrecompile
precompiles[types.ERC20RegistryPrecompileAddress] = erc20RegistryPrecompile
k.precompiles = precompiles

// toMap converts the precompiles to a map.
func (ps precompiles) toMap(stateDB types.StateDB) map[common.Address]vm.PrecompiledContract {
m := make(map[common.Address]vm.PrecompiledContract)
for _, p := range ps {
m[p.addr] = p.contract.(types.WithStateDB).WithStateDB(stateDB)
}
precompileAddrs := slices.Clone(vm.ActivePrecompiles(rules))
precompileAddrs = append(precompileAddrs, types.CosmosPrecompileAddress, types.ERC20RegistryPrecompileAddress)
k.precompileAddrs = precompileAddrs

return m
return nil
}

func (ps precompiles) toAddrs() []common.Address {
addrs := make([]common.Address, len(ps))
for i, p := range ps {
addrs[i] = p.addr
}

return addrs
func (k *Keeper) Precompiles(stateDB types.StateDB) vm.PrecompiledContracts {
k.precompiles[types.CosmosPrecompileAddress].(types.SetStateDB).SetStateDB(stateDB)
k.precompiles[types.ERC20RegistryPrecompileAddress].(types.SetStateDB).SetStateDB(stateDB)
return k.precompiles
}
23 changes: 11 additions & 12 deletions x/evm/precompiles/cosmos/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"github.com/initia-labs/minievm/x/evm/types"
)

var _ vm.ExtendedPrecompiledContract = CosmosPrecompile{}
var _ vm.PrecompiledContract = CosmosPrecompile{}
var _ types.WithStateDB = CosmosPrecompile{}
var _ vm.ExtendedPrecompiledContract = &CosmosPrecompile{}
var _ vm.PrecompiledContract = &CosmosPrecompile{}
var _ types.SetStateDB = &CosmosPrecompile{}

type CosmosPrecompile struct {
*abi.ABI
Expand All @@ -49,13 +49,13 @@ func NewCosmosPrecompile(
edk types.ERC20DenomKeeper,
grpcRouter types.GRPCRouter,
queryWhitelist types.QueryCosmosWhitelist,
) (CosmosPrecompile, error) {
) (*CosmosPrecompile, error) {
abi, err := i_cosmos.ICosmosMetaData.GetAbi()
if err != nil {
return CosmosPrecompile{}, err
return nil, err

Check warning on line 55 in x/evm/precompiles/cosmos/contract.go

View check run for this annotation

Codecov / codecov/patch

x/evm/precompiles/cosmos/contract.go#L55

Added line #L55 was not covered by tests
}

return CosmosPrecompile{
return &CosmosPrecompile{
ABI: abi,
cdc: cdc,
ac: ac,
Expand All @@ -67,12 +67,11 @@ func NewCosmosPrecompile(
}, nil
}

func (e CosmosPrecompile) WithStateDB(stateDB types.StateDB) vm.PrecompiledContract {
func (e *CosmosPrecompile) SetStateDB(stateDB types.StateDB) {
e.stateDB = stateDB
return e
}

func (e CosmosPrecompile) originAddress(ctx context.Context, addrBz []byte) (sdk.AccAddress, error) {
func (e *CosmosPrecompile) originAddress(ctx context.Context, addrBz []byte) (sdk.AccAddress, error) {
account := e.ak.GetAccount(ctx, addrBz)
if shorthandCallerAccount, ok := account.(types.ShorthandAccountI); ok {
addr, err := shorthandCallerAccount.GetOriginalAddress(e.ac)
Expand All @@ -87,7 +86,7 @@ func (e CosmosPrecompile) originAddress(ctx context.Context, addrBz []byte) (sdk
}

// ExtendedRun implements vm.ExtendedPrecompiledContract.
func (e CosmosPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, suppliedGas uint64, readOnly bool) (resBz []byte, usedGas uint64, err error) {
func (e *CosmosPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, suppliedGas uint64, readOnly bool) (resBz []byte, usedGas uint64, err error) {
snapshot := e.stateDB.Snapshot()
ctx := e.stateDB.ContextOfSnapshot(snapshot).WithGasMeter(storetypes.NewGasMeter(suppliedGas))

Expand Down Expand Up @@ -345,11 +344,11 @@ func (e CosmosPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, suppl
}

// RequiredGas implements vm.PrecompiledContract.
func (e CosmosPrecompile) RequiredGas(input []byte) uint64 {
func (e *CosmosPrecompile) RequiredGas(input []byte) uint64 {

Check warning on line 347 in x/evm/precompiles/cosmos/contract.go

View check run for this annotation

Codecov / codecov/patch

x/evm/precompiles/cosmos/contract.go#L347

Added line #L347 was not covered by tests
return 0
}

// Run implements vm.PrecompiledContract.
func (e CosmosPrecompile) Run(input []byte) ([]byte, error) {
func (e *CosmosPrecompile) Run(input []byte) ([]byte, error) {

Check warning on line 352 in x/evm/precompiles/cosmos/contract.go

View check run for this annotation

Codecov / codecov/patch

x/evm/precompiles/cosmos/contract.go#L352

Added line #L352 was not covered by tests
return nil, errors.New("the CosmosPrecompile works exclusively with ExtendedRun")
}
18 changes: 9 additions & 9 deletions x/evm/precompiles/cosmos/contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func Test_CosmosPrecompile_IsBlockedAddress(t *testing.T) {
require.NoError(t, err)

stateDB := NewMockStateDB(ctx)
cosmosPrecompile = cosmosPrecompile.WithStateDB(stateDB).(precompiles.CosmosPrecompile)
cosmosPrecompile.SetStateDB(stateDB)

evmAddr := common.HexToAddress("0x1")
cosmosAddr, err := ac.BytesToString(evmAddr.Bytes())
Expand Down Expand Up @@ -113,7 +113,7 @@ func Test_CosmosPrecompile_IsModuleAddress(t *testing.T) {
require.NoError(t, err)

stateDB := NewMockStateDB(ctx)
cosmosPrecompile = cosmosPrecompile.WithStateDB(stateDB).(precompiles.CosmosPrecompile)
cosmosPrecompile.SetStateDB(stateDB)

evmAddr := common.HexToAddress("0x1")
cosmosAddr, err := ac.BytesToString(evmAddr.Bytes())
Expand Down Expand Up @@ -159,7 +159,7 @@ func Test_CosmosPrecompile_ToCosmosAddress(t *testing.T) {
require.NoError(t, err)

stateDB := NewMockStateDB(ctx)
cosmosPrecompile = cosmosPrecompile.WithStateDB(stateDB).(precompiles.CosmosPrecompile)
cosmosPrecompile.SetStateDB(stateDB)

evmAddr := common.HexToAddress("0x1")
cosmosAddr, err := ac.BytesToString(evmAddr.Bytes())
Expand Down Expand Up @@ -190,7 +190,7 @@ func Test_CosmosPrecompile_ToEVMAddress(t *testing.T) {
require.NoError(t, err)

stateDB := NewMockStateDB(ctx)
cosmosPrecompile = cosmosPrecompile.WithStateDB(stateDB).(precompiles.CosmosPrecompile)
cosmosPrecompile.SetStateDB(stateDB)

evmAddr := common.HexToAddress("0x1")
cosmosAddr, err := ac.BytesToString(evmAddr.Bytes())
Expand Down Expand Up @@ -221,7 +221,7 @@ func Test_ExecuteCosmos(t *testing.T) {
require.NoError(t, err)

stateDB := NewMockStateDB(ctx)
cosmosPrecompile = cosmosPrecompile.WithStateDB(stateDB).(precompiles.CosmosPrecompile)
cosmosPrecompile.SetStateDB(stateDB)

evmAddr := common.HexToAddress("0x1")
cosmosAddr, err := ac.BytesToString(evmAddr.Bytes())
Expand Down Expand Up @@ -294,7 +294,7 @@ func Test_ExecuteCosmosWithOptions(t *testing.T) {
require.NoError(t, err)

stateDB := NewMockStateDB(ctx)
cosmosPrecompile = cosmosPrecompile.WithStateDB(stateDB).(precompiles.CosmosPrecompile)
cosmosPrecompile.SetStateDB(stateDB)

evmAddr := common.HexToAddress("0x1")
cosmosAddr, err := ac.BytesToString(evmAddr.Bytes())
Expand Down Expand Up @@ -400,7 +400,7 @@ func Test_QueryCosmos(t *testing.T) {
require.NoError(t, err)

stateDB := NewMockStateDB(ctx)
cosmosPrecompile = cosmosPrecompile.WithStateDB(stateDB).(precompiles.CosmosPrecompile)
cosmosPrecompile.SetStateDB(stateDB)

evmAddr := common.HexToAddress("0x1")

Expand Down Expand Up @@ -447,7 +447,7 @@ func Test_ToDenom(t *testing.T) {
require.NoError(t, err)

stateDB := NewMockStateDB(ctx)
cosmosPrecompile = cosmosPrecompile.WithStateDB(stateDB).(precompiles.CosmosPrecompile)
cosmosPrecompile.SetStateDB(stateDB)

evmAddr := common.HexToAddress("0x1")

Expand Down Expand Up @@ -489,7 +489,7 @@ func Test_ToErc20(t *testing.T) {
require.NoError(t, err)

stateDB := NewMockStateDB(ctx)
cosmosPrecompile = cosmosPrecompile.WithStateDB(stateDB).(precompiles.CosmosPrecompile)
cosmosPrecompile.SetStateDB(stateDB)

evmAddr := common.HexToAddress("0x1")

Expand Down
21 changes: 10 additions & 11 deletions x/evm/precompiles/erc20_registry/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,27 @@ import (
"github.com/initia-labs/minievm/x/evm/types"
)

var _ vm.ExtendedPrecompiledContract = ERC20RegistryPrecompile{}
var _ vm.PrecompiledContract = ERC20RegistryPrecompile{}
var _ types.WithStateDB = ERC20RegistryPrecompile{}
var _ vm.ExtendedPrecompiledContract = &ERC20RegistryPrecompile{}
var _ vm.PrecompiledContract = &ERC20RegistryPrecompile{}
var _ types.SetStateDB = &ERC20RegistryPrecompile{}

type ERC20RegistryPrecompile struct {
*abi.ABI
stateDB types.StateDB
k types.IERC20StoresKeeper
}

func NewERC20RegistryPrecompile(k types.IERC20StoresKeeper) (ERC20RegistryPrecompile, error) {
func NewERC20RegistryPrecompile(k types.IERC20StoresKeeper) (*ERC20RegistryPrecompile, error) {
abi, err := i_erc20_registry.IErc20RegistryMetaData.GetAbi()
if err != nil {
return ERC20RegistryPrecompile{}, err
return nil, err

Check warning on line 28 in x/evm/precompiles/erc20_registry/contract.go

View check run for this annotation

Codecov / codecov/patch

x/evm/precompiles/erc20_registry/contract.go#L28

Added line #L28 was not covered by tests
}

return ERC20RegistryPrecompile{ABI: abi, k: k}, nil
return &ERC20RegistryPrecompile{ABI: abi, k: k}, nil
}

func (e ERC20RegistryPrecompile) WithStateDB(stateDB types.StateDB) vm.PrecompiledContract {
func (e *ERC20RegistryPrecompile) SetStateDB(stateDB types.StateDB) {
e.stateDB = stateDB
return e
}

const (
Expand All @@ -44,7 +43,7 @@ const (
)

// ExtendedRun implements vm.ExtendedPrecompiledContract.
func (e ERC20RegistryPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, suppliedGas uint64, readOnly bool) (resBz []byte, usedGas uint64, err error) {
func (e *ERC20RegistryPrecompile) ExtendedRun(caller vm.ContractRef, input []byte, suppliedGas uint64, readOnly bool) (resBz []byte, usedGas uint64, err error) {
snapshot := e.stateDB.Snapshot()
ctx := e.stateDB.ContextOfSnapshot(snapshot).WithGasMeter(storetypes.NewGasMeter(suppliedGas))

Expand Down Expand Up @@ -159,11 +158,11 @@ func (e ERC20RegistryPrecompile) ExtendedRun(caller vm.ContractRef, input []byte
}

// RequiredGas implements vm.PrecompiledContract.
func (e ERC20RegistryPrecompile) RequiredGas(input []byte) uint64 {
func (e *ERC20RegistryPrecompile) RequiredGas(input []byte) uint64 {

Check warning on line 161 in x/evm/precompiles/erc20_registry/contract.go

View check run for this annotation

Codecov / codecov/patch

x/evm/precompiles/erc20_registry/contract.go#L161

Added line #L161 was not covered by tests
return 0
}

// Run implements vm.PrecompiledContract.
func (e ERC20RegistryPrecompile) Run(input []byte) ([]byte, error) {
func (e *ERC20RegistryPrecompile) Run(input []byte) ([]byte, error) {

Check warning on line 166 in x/evm/precompiles/erc20_registry/contract.go

View check run for this annotation

Codecov / codecov/patch

x/evm/precompiles/erc20_registry/contract.go#L166

Added line #L166 was not covered by tests
return nil, errors.New("the ERC20RegistryPrecompile works exclusively with ExtendedRun")
}
Loading

0 comments on commit c000b6a

Please sign in to comment.