diff --git a/x/evm/handler.go b/x/evm/handler.go deleted file mode 100644 index 2464c741cb..0000000000 --- a/x/evm/handler.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2021 Evmos Foundation -// This file is part of Evmos' Ethermint library. -// -// The Ethermint library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The Ethermint library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE -package evm - -import ( - errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - errortypes "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/evmos/ethermint/x/evm/types" -) - -// NewHandler returns a handler for Ethermint type messages. -func NewHandler(server types.MsgServer) baseapp.MsgServiceHandler { - return func(ctx sdk.Context, msg sdk.Msg) (result *sdk.Result, err error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - case *types.MsgEthereumTx: - res, err := server.EthereumTx(ctx, msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgUpdateParams: - res, err := server.UpdateParams(ctx, msg) - return sdk.WrapServiceResult(ctx, res, err) - default: - err := errorsmod.Wrapf(errortypes.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) - return nil, err - } - } -} diff --git a/x/evm/handler_test.go b/x/evm/handler_test.go index de1a19a1cf..52b3ffc7a6 100644 --- a/x/evm/handler_test.go +++ b/x/evm/handler_test.go @@ -38,7 +38,6 @@ import ( "github.com/evmos/ethermint/crypto/ethsecp256k1" "github.com/evmos/ethermint/tests" ethermint "github.com/evmos/ethermint/types" - "github.com/evmos/ethermint/x/evm" "github.com/evmos/ethermint/x/evm/statedb" "github.com/evmos/ethermint/x/evm/types" @@ -170,7 +169,11 @@ func (suite *EvmTestSuite) DoSetupTest(t require.TestingT) { suite.app.StakingKeeper.SetValidator(suite.ctx, validator) suite.ethSigner = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID()) - suite.handler = evm.NewHandler(suite.app.EvmKeeper) + + // get `ethermintd tx evm raw` msg handler + msg := types.NewTx(nil, 0, nil, nil, 0, nil, nil, nil, nil, nil) + suite.handler = suite.app.MsgServiceRouter().Handler(msg) + require.NotNil(t, suite.handler) } func (suite *EvmTestSuite) SetupTest() { diff --git a/x/feemarket/handler.go b/x/feemarket/handler.go deleted file mode 100644 index 33b7a8968e..0000000000 --- a/x/feemarket/handler.go +++ /dev/null @@ -1,27 +0,0 @@ -package feemarket - -import ( - errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - errortypes "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/evmos/ethermint/x/feemarket/types" -) - -// NewHandler returns a handler for Ethermint type messages. -func NewHandler(server types.MsgServer) baseapp.MsgServiceHandler { - return func(ctx sdk.Context, msg sdk.Msg) (result *sdk.Result, err error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - case *types.MsgUpdateParams: - // execute state transition - res, err := server.UpdateParams(ctx, msg) - return sdk.WrapServiceResult(ctx, res, err) - - default: - err := errorsmod.Wrapf(errortypes.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) - return nil, err - } - } -}