diff --git a/app/ante/eth.go b/app/ante/eth.go index 9d81b14a..69089444 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -27,7 +27,7 @@ type EVMKeeper interface { WithContext(ctx sdk.Context) ResetRefundTransient(ctx sdk.Context) GetCoinbaseAddress() (common.Address, error) - NewEVM(msg core.Message, config *params.ChainConfig, params evmtypes.Params, coinbase common.Address, tracer string) *vm.EVM + NewEVM(msg core.Message, config *params.ChainConfig, params evmtypes.Params, coinbase common.Address, tracer vm.Tracer) *vm.EVM GetCodeHash(addr common.Address) common.Hash } @@ -389,8 +389,8 @@ func (ctd CanTransferDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate ) } - // NOTE: pass in an empty coinbase address and tracer as we don't need them for the check below - evm := ctd.evmKeeper.NewEVM(coreMsg, ethCfg, params, common.Address{}, "") + // NOTE: pass in an empty coinbase address and nil tracer as we don't need them for the check below + evm := ctd.evmKeeper.NewEVM(coreMsg, ethCfg, params, common.Address{}, nil) // check that caller has enough balance to cover asset transfer for **topmost** call // NOTE: here the gas consumed is from the context with the infinite gas meter diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index db812356..9962c0e7 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -378,7 +378,8 @@ func (k Keeper) EthCall(c context.Context, req *types.EthCallRequest) (*types.Ms return nil, status.Error(codes.Internal, err.Error()) } - evm := k.NewEVM(msg, ethCfg, params, coinbase, k.tracer) + tracer := types.NewTracer(k.tracer, msg, ethCfg, k.Ctx().BlockHeight(), k.debug) + evm := k.NewEVM(msg, ethCfg, params, coinbase, tracer) // pass true means execute in query mode, which don't do actual gas refund. res, err := k.ApplyMessage(evm, msg, ethCfg, true) @@ -449,7 +450,9 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type k.WithContext(ctx) msg := args.ToMessage(req.GasCap) - evm := k.NewEVM(msg, ethCfg, params, coinbase, k.tracer) + + tracer := types.NewTracer(k.tracer, msg, ethCfg, k.Ctx().BlockHeight(), k.debug) + evm := k.NewEVM(msg, ethCfg, params, coinbase, tracer) // pass true means execute in query mode, which don't do actual gas refund. rsp, err := k.ApplyMessage(evm, msg, ethCfg, true) diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index 54285df9..1e623020 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -32,7 +32,7 @@ func (k *Keeper) NewEVM( config *params.ChainConfig, params types.Params, coinbase common.Address, - tracer string, + tracer vm.Tracer, ) *vm.EVM { blockCtx := vm.BlockContext{ CanTransfer: core.CanTransfer, @@ -53,12 +53,10 @@ func (k *Keeper) NewEVM( // VMConfig creates an EVM configuration from the debug setting and the extra EIPs enabled on the // module parameters. The config generated uses the default JumpTable from the EVM. -func (k Keeper) VMConfig(msg core.Message, params types.Params, tracer string) vm.Config { - cfg := params.ChainConfig.EthereumConfig(k.eip155ChainID) - +func (k Keeper) VMConfig(msg core.Message, params types.Params, tracer vm.Tracer) vm.Config { return vm.Config{ Debug: k.debug, - Tracer: types.NewTracer(tracer, msg, cfg, k.Ctx().BlockHeight(), k.debug), + Tracer: tracer, NoRecursion: false, // TODO: consider disabling recursion though params ExtraEips: params.EIPs(), } @@ -161,7 +159,8 @@ func (k *Keeper) ApplyTransaction(tx *ethtypes.Transaction) (*types.MsgEthereumT } // create an ethereum EVM instance and run the message - evm := k.NewEVM(msg, ethCfg, params, coinbase, k.tracer) + tracer := types.NewTracer(k.tracer, msg, ethCfg, k.Ctx().BlockHeight(), k.debug) + evm := k.NewEVM(msg, ethCfg, params, coinbase, tracer) txHash := tx.Hash()