From 4b1c1415e7ffeeeb4f4b2955c4313e3b12f9a5ad Mon Sep 17 00:00:00 2001 From: HuangYi Date: Fri, 6 Dec 2024 11:47:46 +0800 Subject: [PATCH] only patch encoding for tx service --- app/app.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 04188c7703..b129d12cf6 100644 --- a/app/app.go +++ b/app/app.go @@ -1327,7 +1327,23 @@ func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig // RegisterTxService implements the Application.RegisterTxService method. func (app *App) RegisterTxService(clientCtx client.Context) { - authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) + // create new config instance to avoid affect the state machine + encodingConfig := evmenc.MakeConfig() + cdc := encodingConfig.Amino + interfaceRegistry := encodingConfig.InterfaceRegistry + + app.BasicModuleManager.RegisterLegacyAminoCodec(cdc) + app.BasicModuleManager.RegisterInterfaces(interfaceRegistry) + + // for decoding legacy transactions whose modules are removed + RegisterLegacyCodec(cdc) + RegisterLegacyInterfaces(interfaceRegistry) + + clientCtx = clientCtx. + WithInterfaceRegistry(interfaceRegistry). + WithTxConfig(encodingConfig.TxConfig). + WithCodec(encodingConfig.Codec) + authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, interfaceRegistry) } // RegisterTendermintService implements the Application.RegisterTendermintService method.