Skip to content

Commit

Permalink
Properly handle gas in pointer precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
codchen committed Aug 28, 2024
1 parent a8ea0f9 commit bab7d80
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 60 deletions.
14 changes: 8 additions & 6 deletions precompiles/common/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@ type EVMKeeper interface {
GetERC721CW721Pointer(ctx sdk.Context, cw721Address string) (addr common.Address, version uint16, exists bool)
SetCode(ctx sdk.Context, addr common.Address, code []byte)
UpsertERCNativePointer(
ctx sdk.Context, evm *vm.EVM, suppliedGas uint64, token string, metadata utils.ERCMetadata,
) (contractAddr common.Address, remainingGas uint64, err error)
ctx sdk.Context, evm *vm.EVM, token string, metadata utils.ERCMetadata,
) (contractAddr common.Address, err error)
UpsertERCCW20Pointer(
ctx sdk.Context, evm *vm.EVM, suppliedGas uint64, cw20Addr string, metadata utils.ERCMetadata,
) (contractAddr common.Address, remainingGas uint64, err error)
ctx sdk.Context, evm *vm.EVM, cw20Addr string, metadata utils.ERCMetadata,
) (contractAddr common.Address, err error)
UpsertERCCW721Pointer(
ctx sdk.Context, evm *vm.EVM, suppliedGas uint64, cw721Addr string, metadata utils.ERCMetadata,
) (contractAddr common.Address, remainingGas uint64, err error)
ctx sdk.Context, evm *vm.EVM, cw721Addr string, metadata utils.ERCMetadata,
) (contractAddr common.Address, err error)
GetEVMGasLimitFromCtx(ctx sdk.Context) uint64
GetCosmosGasLimitFromEVMGas(ctx sdk.Context, evmGas uint64) uint64
}

type AccountKeeper interface {
Expand Down
12 changes: 2 additions & 10 deletions precompiles/common/precompiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/sei-protocol/sei-chain/utils"
"github.com/sei-protocol/sei-chain/utils/metrics"
"github.com/sei-protocol/sei-chain/x/evm/state"
"github.com/sei-protocol/sei-chain/x/evm/types"
Expand Down Expand Up @@ -160,12 +159,7 @@ func (d DynamicGasPrecompile) RunAndCalculateGas(evm *vm.EVM, caller common.Addr
if err != nil {
return nil, 0, err
}
gasMultipler := d.executor.EVMKeeper().GetPriorityNormalizer(ctx)
gasLimitBigInt := sdk.NewDecFromInt(sdk.NewIntFromUint64(suppliedGas)).Mul(gasMultipler).TruncateInt().BigInt()
if gasLimitBigInt.Cmp(utils.BigMaxU64) > 0 {
gasLimitBigInt = utils.BigMaxU64
}
ctx = ctx.WithGasMeter(sdk.NewGasMeterWithMultiplier(ctx, gasLimitBigInt.Uint64()))
ctx = ctx.WithGasMeter(sdk.NewGasMeterWithMultiplier(ctx, d.executor.EVMKeeper().GetCosmosGasLimitFromEVMGas(ctx, suppliedGas)))

operation = method.Name
em := ctx.EventManager()
Expand Down Expand Up @@ -231,9 +225,7 @@ sei gas = evm gas * multiplier
sei gas price = fee / sei gas = fee / (evm gas * multiplier) = evm gas / multiplier
*/
func GetRemainingGas(ctx sdk.Context, evmKeeper EVMKeeper) uint64 {
gasMultipler := evmKeeper.GetPriorityNormalizer(ctx)
seiGasRemaining := ctx.GasMeter().Limit() - ctx.GasMeter().GasConsumedToLimit()
return sdk.NewDecFromInt(sdk.NewIntFromUint64(seiGasRemaining)).Quo(gasMultipler).TruncateInt().Uint64()
return evmKeeper.GetEVMGasLimitFromCtx(ctx)

Check warning on line 228 in precompiles/common/precompiles.go

View check run for this annotation

Codecov / codecov/patch

precompiles/common/precompiles.go#L228

Added line #L228 was not covered by tests
}

func ExtractMethodID(input []byte) ([]byte, error) {
Expand Down
8 changes: 4 additions & 4 deletions precompiles/distribution/distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func TestWithdraw(t *testing.T) {
res, err = msgServer.EVMTransaction(sdk.WrapSDKContext(ctx), req)
require.Nil(t, err)
require.Empty(t, res.VmError)
require.Equal(t, uint64(68688), res.GasUsed)
require.Equal(t, uint64(64124), res.GasUsed)

// reinitialized
d, found = testApp.StakingKeeper.GetDelegation(ctx, seiAddr, val)
Expand Down Expand Up @@ -301,7 +301,7 @@ func setWithdrawAddressAndWithdraw(
res, err = msgServer.EVMTransaction(sdk.WrapSDKContext(ctx), r)
require.Nil(t, err)
require.Empty(t, res.VmError)
require.Equal(t, uint64(152854), res.GasUsed)
require.Equal(t, uint64(148290), res.GasUsed)

// reinitialized
for _, val := range vals {
Expand Down Expand Up @@ -1051,7 +1051,7 @@ func TestPrecompile_RunAndCalculateGas_Rewards(t *testing.T) {
suppliedGas: uint64(1000000),
},
wantRet: emptyCasePackedOutput,
wantRemainingGas: 994313,
wantRemainingGas: 998877,
wantErr: false,
},
{
Expand All @@ -1067,7 +1067,7 @@ func TestPrecompile_RunAndCalculateGas_Rewards(t *testing.T) {
suppliedGas: uint64(1000000),
},
wantRet: happyPathPackedOutput,
wantRemainingGas: 994313,
wantRemainingGas: 998877,
wantErr: false,
},
}
Expand Down
6 changes: 3 additions & 3 deletions precompiles/ibc/ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func TestPrecompile_Run(t *testing.T) {
fields: fields{transferKeeper: &MockTransferKeeper{}},
args: commonArgs,
wantBz: packedTrue,
wantRemainingGas: 994313,
wantRemainingGas: 998877,
wantErr: false,
},
{
Expand Down Expand Up @@ -235,7 +235,7 @@ func TestPrecompile_Run(t *testing.T) {
value: nil,
},
wantBz: packedTrue,
wantRemainingGas: 994313,
wantRemainingGas: 998877,
wantErr: false,
},
{
Expand All @@ -255,7 +255,7 @@ func TestPrecompile_Run(t *testing.T) {
value: nil,
},
wantBz: packedTrue,
wantRemainingGas: 994313,
wantRemainingGas: 998877,
wantErr: false,
},
}
Expand Down
21 changes: 12 additions & 9 deletions precompiles/pointer/pointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ func (p PrecompileExecutor) Execute(ctx sdk.Context, method *ethabi.Method, call

switch method.Name {
case AddNativePointer:
return p.AddNative(ctx, method, caller, args, value, evm, suppliedGas)
return p.AddNative(ctx, method, caller, args, value, evm)
case AddCW20Pointer:
return p.AddCW20(ctx, method, caller, args, value, evm, suppliedGas)
return p.AddCW20(ctx, method, caller, args, value, evm)

Check warning on line 78 in precompiles/pointer/pointer.go

View check run for this annotation

Codecov / codecov/patch

precompiles/pointer/pointer.go#L78

Added line #L78 was not covered by tests
case AddCW721Pointer:
return p.AddCW721(ctx, method, caller, args, value, evm, suppliedGas)
return p.AddCW721(ctx, method, caller, args, value, evm)

Check warning on line 80 in precompiles/pointer/pointer.go

View check run for this annotation

Codecov / codecov/patch

precompiles/pointer/pointer.go#L80

Added line #L80 was not covered by tests
default:
err = fmt.Errorf("unknown method %s", method.Name)
}
Expand All @@ -88,7 +88,7 @@ func (p PrecompileExecutor) EVMKeeper() pcommon.EVMKeeper {
return p.evmKeeper
}

func (p PrecompileExecutor) AddNative(ctx sdk.Context, method *ethabi.Method, caller common.Address, args []interface{}, value *big.Int, evm *vm.EVM, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) {
func (p PrecompileExecutor) AddNative(ctx sdk.Context, method *ethabi.Method, caller common.Address, args []interface{}, value *big.Int, evm *vm.EVM) (ret []byte, remainingGas uint64, err error) {
if err := pcommon.ValidateNonPayable(value); err != nil {
return nil, 0, err
}
Expand All @@ -113,15 +113,16 @@ func (p PrecompileExecutor) AddNative(ctx sdk.Context, method *ethabi.Method, ca
}
}
}
contractAddr, remainingGas, err := p.evmKeeper.UpsertERCNativePointer(ctx, evm, suppliedGas, token, utils.ERCMetadata{Name: name, Symbol: symbol, Decimals: decimals})
contractAddr, err := p.evmKeeper.UpsertERCNativePointer(ctx, evm, token, utils.ERCMetadata{Name: name, Symbol: symbol, Decimals: decimals})
if err != nil {
return nil, 0, err
}
ret, err = method.Outputs.Pack(contractAddr)
remainingGas = pcommon.GetRemainingGas(ctx, p.evmKeeper)
return
}

func (p PrecompileExecutor) AddCW20(ctx sdk.Context, method *ethabi.Method, caller common.Address, args []interface{}, value *big.Int, evm *vm.EVM, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) {
func (p PrecompileExecutor) AddCW20(ctx sdk.Context, method *ethabi.Method, caller common.Address, args []interface{}, value *big.Int, evm *vm.EVM) (ret []byte, remainingGas uint64, err error) {

Check warning on line 125 in precompiles/pointer/pointer.go

View check run for this annotation

Codecov / codecov/patch

precompiles/pointer/pointer.go#L125

Added line #L125 was not covered by tests
if err := pcommon.ValidateNonPayable(value); err != nil {
return nil, 0, err
}
Expand All @@ -143,15 +144,16 @@ func (p PrecompileExecutor) AddCW20(ctx sdk.Context, method *ethabi.Method, call
}
name := formattedRes["name"].(string)
symbol := formattedRes["symbol"].(string)
contractAddr, remainingGas, err := p.evmKeeper.UpsertERCCW20Pointer(ctx, evm, suppliedGas, cwAddr, utils.ERCMetadata{Name: name, Symbol: symbol})
contractAddr, err := p.evmKeeper.UpsertERCCW20Pointer(ctx, evm, cwAddr, utils.ERCMetadata{Name: name, Symbol: symbol})

Check warning on line 147 in precompiles/pointer/pointer.go

View check run for this annotation

Codecov / codecov/patch

precompiles/pointer/pointer.go#L147

Added line #L147 was not covered by tests
if err != nil {
return nil, 0, err
}
ret, err = method.Outputs.Pack(contractAddr)
remainingGas = pcommon.GetRemainingGas(ctx, p.evmKeeper)

Check warning on line 152 in precompiles/pointer/pointer.go

View check run for this annotation

Codecov / codecov/patch

precompiles/pointer/pointer.go#L152

Added line #L152 was not covered by tests
return
}

func (p PrecompileExecutor) AddCW721(ctx sdk.Context, method *ethabi.Method, caller common.Address, args []interface{}, value *big.Int, evm *vm.EVM, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) {
func (p PrecompileExecutor) AddCW721(ctx sdk.Context, method *ethabi.Method, caller common.Address, args []interface{}, value *big.Int, evm *vm.EVM) (ret []byte, remainingGas uint64, err error) {

Check warning on line 156 in precompiles/pointer/pointer.go

View check run for this annotation

Codecov / codecov/patch

precompiles/pointer/pointer.go#L156

Added line #L156 was not covered by tests
if err := pcommon.ValidateNonPayable(value); err != nil {
return nil, 0, err
}
Expand All @@ -173,10 +175,11 @@ func (p PrecompileExecutor) AddCW721(ctx sdk.Context, method *ethabi.Method, cal
}
name := formattedRes["name"].(string)
symbol := formattedRes["symbol"].(string)
contractAddr, remainingGas, err := p.evmKeeper.UpsertERCCW721Pointer(ctx, evm, suppliedGas, cwAddr, utils.ERCMetadata{Name: name, Symbol: symbol})
contractAddr, err := p.evmKeeper.UpsertERCCW721Pointer(ctx, evm, cwAddr, utils.ERCMetadata{Name: name, Symbol: symbol})

Check warning on line 178 in precompiles/pointer/pointer.go

View check run for this annotation

Codecov / codecov/patch

precompiles/pointer/pointer.go#L178

Added line #L178 was not covered by tests
if err != nil {
return nil, 0, err
}
ret, err = method.Outputs.Pack(contractAddr)
remainingGas = pcommon.GetRemainingGas(ctx, p.evmKeeper)

Check warning on line 183 in precompiles/pointer/pointer.go

View check run for this annotation

Codecov / codecov/patch

precompiles/pointer/pointer.go#L183

Added line #L183 was not covered by tests
return
}
4 changes: 3 additions & 1 deletion precompiles/pointer/pointer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
Expand All @@ -21,6 +22,7 @@ func TestAddNative(t *testing.T) {
p, err := pointer.NewPrecompile(&testApp.EvmKeeper, testApp.BankKeeper, testApp.WasmKeeper)
require.Nil(t, err)
ctx := testApp.GetContextForDeliverTx([]byte{}).WithBlockTime(time.Now())
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeterWithMultiplier(ctx))
_, caller := testkeeper.MockAddressPair()
suppliedGas := uint64(10000000)
cfg := types.DefaultChainConfig().EthereumConfig(testApp.EvmKeeper.ChainID(ctx))
Expand Down Expand Up @@ -55,7 +57,7 @@ func TestAddNative(t *testing.T) {
evm = vm.NewEVM(*blockCtx, vm.TxContext{}, statedb, cfg, vm.Config{})
ret, g, err := p.RunAndCalculateGas(evm, caller, caller, append(p.GetExecutor().(*pointer.PrecompileExecutor).AddNativePointerID, args...), suppliedGas, nil, nil, false)
require.Nil(t, err)
require.Equal(t, uint64(8907806), g)
require.Equal(t, uint64(8890734), g)
outputs, err := m.Outputs.Unpack(ret)
require.Nil(t, err)
addr := outputs[0].(common.Address)
Expand Down
2 changes: 1 addition & 1 deletion x/evm/gov.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func HandleAddERCNativePointerProposalV2(ctx sdk.Context, k *keeper.Keeper, p *t
}
return k.RunWithOneOffEVMInstance(
ctx, func(e *vm.EVM) error {
_, _, err := k.UpsertERCNativePointer(ctx, e, math.MaxUint64, p.Token, utils.ERCMetadata{Name: p.Name, Symbol: p.Symbol, Decimals: decimals})
_, err := k.UpsertERCNativePointer(ctx, e, p.Token, utils.ERCMetadata{Name: p.Name, Symbol: p.Symbol, Decimals: decimals})
return err
}, func(s1, s2 string) {
logNativeV2Error(ctx, p, s1, s2)
Expand Down
18 changes: 18 additions & 0 deletions x/evm/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,21 @@ func (k *Keeper) ChainID(ctx sdk.Context) *big.Int {
return config.GetEVMChainID(ctx.ChainID())

}

/*
*
sei gas = evm gas * multiplier
sei gas price = fee / sei gas = fee / (evm gas * multiplier) = evm gas / multiplier
*/
func (k *Keeper) GetEVMGasLimitFromCtx(ctx sdk.Context) uint64 {
return k.getEvmGasLimitFromCtx(ctx)

Check warning on line 56 in x/evm/keeper/params.go

View check run for this annotation

Codecov / codecov/patch

x/evm/keeper/params.go#L55-L56

Added lines #L55 - L56 were not covered by tests
}

func (k *Keeper) GetCosmosGasLimitFromEVMGas(ctx sdk.Context, evmGas uint64) uint64 {
gasMultipler := k.GetPriorityNormalizer(ctx)
gasLimitBigInt := sdk.NewDecFromInt(sdk.NewIntFromUint64(evmGas)).Mul(gasMultipler).TruncateInt().BigInt()
if gasLimitBigInt.Cmp(utils.BigMaxU64) > 0 {
gasLimitBigInt = utils.BigMaxU64
}

Check warning on line 64 in x/evm/keeper/params.go

View check run for this annotation

Codecov / codecov/patch

x/evm/keeper/params.go#L63-L64

Added lines #L63 - L64 were not covered by tests
return gasLimitBigInt.Uint64()
}
25 changes: 14 additions & 11 deletions x/evm/keeper/pointer_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,38 @@ func (k *Keeper) RunWithOneOffEVMInstance(
}

func (k *Keeper) UpsertERCNativePointer(
ctx sdk.Context, evm *vm.EVM, suppliedGas uint64, token string, metadata utils.ERCMetadata,
) (contractAddr common.Address, remainingGas uint64, err error) {
ctx sdk.Context, evm *vm.EVM, token string, metadata utils.ERCMetadata,
) (contractAddr common.Address, err error) {
return k.UpsertERCPointer(
ctx, evm, suppliedGas, "native", []interface{}{
ctx, evm, "native", []interface{}{
token, metadata.Name, metadata.Symbol, metadata.Decimals,
}, k.GetERC20NativePointer, k.SetERC20NativePointer,
)
}

func (k *Keeper) UpsertERCCW20Pointer(
ctx sdk.Context, evm *vm.EVM, suppliedGas uint64, cw20Addr string, metadata utils.ERCMetadata,
) (contractAddr common.Address, remainingGas uint64, err error) {
ctx sdk.Context, evm *vm.EVM, cw20Addr string, metadata utils.ERCMetadata,
) (contractAddr common.Address, err error) {
return k.UpsertERCPointer(
ctx, evm, suppliedGas, "cw20", []interface{}{
ctx, evm, "cw20", []interface{}{
cw20Addr, metadata.Name, metadata.Symbol,
}, k.GetERC20CW20Pointer, k.SetERC20CW20Pointer,
)
}

func (k *Keeper) UpsertERCCW721Pointer(
ctx sdk.Context, evm *vm.EVM, suppliedGas uint64, cw721Addr string, metadata utils.ERCMetadata,
) (contractAddr common.Address, remainingGas uint64, err error) {
ctx sdk.Context, evm *vm.EVM, cw721Addr string, metadata utils.ERCMetadata,
) (contractAddr common.Address, err error) {
return k.UpsertERCPointer(
ctx, evm, suppliedGas, "cw721", []interface{}{
ctx, evm, "cw721", []interface{}{
cw721Addr, metadata.Name, metadata.Symbol,
}, k.GetERC721CW721Pointer, k.SetERC721CW721Pointer,
)
}

func (k *Keeper) UpsertERCPointer(
ctx sdk.Context, evm *vm.EVM, suppliedGas uint64, typ string, args []interface{}, getter PointerGetter, setter PointerSetter,
) (contractAddr common.Address, remainingGas uint64, err error) {
ctx sdk.Context, evm *vm.EVM, typ string, args []interface{}, getter PointerGetter, setter PointerSetter,
) (contractAddr common.Address, err error) {
pointee := args[0].(string)
evmModuleAddress := k.GetEVMAddressOrDefault(ctx, k.AccountKeeper().GetModuleAddress(types.ModuleName))

Expand All @@ -86,6 +86,8 @@ func (k *Keeper) UpsertERCPointer(
}
bin = append(artifacts.GetBin(typ), bin...)
existingAddr, _, exists := getter(ctx, pointee)
suppliedGas := k.getEvmGasLimitFromCtx(ctx)
var remainingGas uint64
if exists {
var ret []byte
contractAddr = existingAddr
Expand All @@ -97,6 +99,7 @@ func (k *Keeper) UpsertERCPointer(
if err != nil {
return
}
ctx.GasMeter().ConsumeGas(k.GetCosmosGasLimitFromEVMGas(ctx, suppliedGas-remainingGas), "ERC pointer deployment")
if err = setter(ctx, pointee, contractAddr); err != nil {
return
}
Expand Down
17 changes: 10 additions & 7 deletions x/evm/keeper/pointer_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package keeper_test

import (
"errors"
"math"
"testing"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
testkeeper "github.com/sei-protocol/sei-chain/testutil/keeper"
Expand All @@ -31,9 +31,10 @@ func TestRunWithOneOffEVMInstance(t *testing.T) {
func TestUpsertERCNativePointer(t *testing.T) {
k := &testkeeper.EVMTestApp.EvmKeeper
ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}).WithBlockTime(time.Now())
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeterWithMultiplier(ctx))
var addr common.Address
err := k.RunWithOneOffEVMInstance(ctx, func(e *vm.EVM) error {
a, _, err := k.UpsertERCNativePointer(ctx, e, math.MaxUint64, "test", utils.ERCMetadata{
a, err := k.UpsertERCNativePointer(ctx, e, "test", utils.ERCMetadata{
Name: "test",
Symbol: "test",
Decimals: 6,
Expand All @@ -44,7 +45,7 @@ func TestUpsertERCNativePointer(t *testing.T) {
require.Nil(t, err)
var newAddr common.Address
err = k.RunWithOneOffEVMInstance(ctx, func(e *vm.EVM) error {
a, _, err := k.UpsertERCNativePointer(ctx, e, math.MaxUint64, "test", utils.ERCMetadata{
a, err := k.UpsertERCNativePointer(ctx, e, "test", utils.ERCMetadata{
Name: "test2",
Symbol: "test2",
Decimals: 12,
Expand All @@ -70,9 +71,10 @@ func TestUpsertERCNativePointer(t *testing.T) {
func TestUpsertERC20Pointer(t *testing.T) {
k := &testkeeper.EVMTestApp.EvmKeeper
ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}).WithBlockTime(time.Now())
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeterWithMultiplier(ctx))
var addr common.Address
err := k.RunWithOneOffEVMInstance(ctx, func(e *vm.EVM) error {
a, _, err := k.UpsertERCCW20Pointer(ctx, e, math.MaxUint64, "test", utils.ERCMetadata{
a, err := k.UpsertERCCW20Pointer(ctx, e, "test", utils.ERCMetadata{
Name: "test",
Symbol: "test",
})
Expand All @@ -82,7 +84,7 @@ func TestUpsertERC20Pointer(t *testing.T) {
require.Nil(t, err)
var newAddr common.Address
err = k.RunWithOneOffEVMInstance(ctx, func(e *vm.EVM) error {
a, _, err := k.UpsertERCCW20Pointer(ctx, e, math.MaxUint64, "test", utils.ERCMetadata{
a, err := k.UpsertERCCW20Pointer(ctx, e, "test", utils.ERCMetadata{
Name: "test2",
Symbol: "test2",
})
Expand All @@ -96,9 +98,10 @@ func TestUpsertERC20Pointer(t *testing.T) {
func TestUpsertERC721Pointer(t *testing.T) {
k := &testkeeper.EVMTestApp.EvmKeeper
ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}).WithBlockTime(time.Now())
ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeterWithMultiplier(ctx))
var addr common.Address
err := k.RunWithOneOffEVMInstance(ctx, func(e *vm.EVM) error {
a, _, err := k.UpsertERCCW721Pointer(ctx, e, math.MaxUint64, "test", utils.ERCMetadata{
a, err := k.UpsertERCCW721Pointer(ctx, e, "test", utils.ERCMetadata{
Name: "test",
Symbol: "test",
})
Expand All @@ -108,7 +111,7 @@ func TestUpsertERC721Pointer(t *testing.T) {
require.Nil(t, err)
var newAddr common.Address
err = k.RunWithOneOffEVMInstance(ctx, func(e *vm.EVM) error {
a, _, err := k.UpsertERCCW721Pointer(ctx, e, math.MaxUint64, "test", utils.ERCMetadata{
a, err := k.UpsertERCCW721Pointer(ctx, e, "test", utils.ERCMetadata{
Name: "test2",
Symbol: "test2",
})
Expand Down
Loading

0 comments on commit bab7d80

Please sign in to comment.