diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index 030b76135673..06c0c7b554c9 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -24,6 +24,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/snapshots" snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types" "github.com/cosmos/cosmos-sdk/store/rootmulti" @@ -41,6 +42,7 @@ var ( capKey2 = sdk.NewKVStoreKey("key2") interfaceRegistry = testdata.NewTestInterfaceRegistry() + encCfg = simapp.MakeTestEncodingConfig() ) type paramStore struct { @@ -163,6 +165,7 @@ func setupBaseAppWithSnapshots(t *testing.T, blocks uint, blockTxs int, options middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(interfaceRegistry), + TxDecoder: encCfg.TxConfig.TxDecoder(), }, func(ctx sdk.Context, tx sdk.Tx, simulate bool) (sdk.Context, error) { return ctx, nil }, ) @@ -958,6 +961,7 @@ func TestCheckTx(t *testing.T) { middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(interfaceRegistry), + TxDecoder: encCfg.TxConfig.TxDecoder(), }, customHandlerTxTest(t, capKey1, counterKey), ) @@ -1018,6 +1022,7 @@ func TestDeliverTx(t *testing.T) { middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(interfaceRegistry), + TxDecoder: encCfg.TxConfig.TxDecoder(), }, customHandlerTxTest(t, capKey1, anteKey), ) @@ -1080,6 +1085,7 @@ func TestMultiMsgDeliverTx(t *testing.T) { middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(interfaceRegistry), + TxDecoder: encCfg.TxConfig.TxDecoder(), }, customHandlerTxTest(t, capKey1, anteKey), ) @@ -1168,6 +1174,7 @@ func TestSimulateTx(t *testing.T) { middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(interfaceRegistry), + TxDecoder: encCfg.TxConfig.TxDecoder(), }, func(ctx sdk.Context, tx sdk.Tx, simulate bool) (sdk.Context, error) { return ctx, nil }, ) @@ -1243,6 +1250,7 @@ func TestRunInvalidTransaction(t *testing.T) { middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(interfaceRegistry), + TxDecoder: encCfg.TxConfig.TxDecoder(), }, func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, err error) { return @@ -1367,6 +1375,7 @@ func TestTxGasLimits(t *testing.T) { middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(interfaceRegistry), + TxDecoder: encCfg.TxConfig.TxDecoder(), }, ante, ) @@ -1454,6 +1463,7 @@ func TestMaxBlockGasLimits(t *testing.T) { middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(interfaceRegistry), + TxDecoder: encCfg.TxConfig.TxDecoder(), }, ante, ) @@ -1540,6 +1550,7 @@ func TestBaseAppMiddleware(t *testing.T) { middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(interfaceRegistry), + TxDecoder: encCfg.TxConfig.TxDecoder(), }, customHandlerTxTest(t, capKey1, anteKey), ) @@ -1634,6 +1645,7 @@ func TestGasConsumptionBadTx(t *testing.T) { middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(interfaceRegistry), + TxDecoder: encCfg.TxConfig.TxDecoder(), }, ante, ) @@ -1695,6 +1707,7 @@ func TestQuery(t *testing.T) { middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(interfaceRegistry), + TxDecoder: encCfg.TxConfig.TxDecoder(), }, func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, err error) { store := ctx.KVStore(capKey1) @@ -2014,7 +2027,10 @@ func TestWithRouter(t *testing.T) { customRouter := &testCustomRouter{routes: sync.Map{}} r := sdk.NewRoute(routeMsgCounter, handlerMsgCounter(t, capKey1, deliverKey)) customRouter.AddRoute(r) - txHandler := middleware.NewRunMsgsTxHandler(middleware.NewMsgServiceRouter(interfaceRegistry), customRouter) + txHandler := middleware.ComposeMiddlewares( + middleware.NewRunMsgsTxHandler(middleware.NewMsgServiceRouter(interfaceRegistry), customRouter), + middleware.NewTxDecoderMiddleware(encCfg.TxConfig.TxDecoder()), + ) bapp.SetTxHandler(txHandler) } app := setupBaseApp(t, txHandlerOpt)