diff --git a/app.go b/app.go index 6b21ef8cfa7..48c25ecbb33 100644 --- a/app.go +++ b/app.go @@ -331,7 +331,7 @@ func NewSimApp( ) app.mm.RegisterInvariants(&app.CrisisKeeper) - app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), codec.NewAminoCodec(encodingConfig.Amino)) + app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) app.mm.RegisterQueryServices(app.GRPCQueryRouter()) // add test gRPC service for testing gRPC queries in isolation @@ -507,8 +507,6 @@ func (app *SimApp) SimulationManager() *module.SimulationManager { // API server. func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server) { clientCtx := apiSvr.ClientCtx - // amino is needed here for backwards compatibility of REST routes - clientCtx = clientCtx.WithJSONMarshaler(clientCtx.LegacyAmino) rpc.RegisterRoutes(clientCtx, apiSvr.Router) authrest.RegisterTxRoutes(clientCtx, apiSvr.Router) ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router) diff --git a/simd/cmd/genaccounts.go b/simd/cmd/genaccounts.go index 67ffb88e20b..bda0fcba533 100644 --- a/simd/cmd/genaccounts.go +++ b/simd/cmd/genaccounts.go @@ -114,7 +114,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa } genFile := config.GenesisFile() - appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(depCdc, genFile) + appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) if err != nil { return fmt.Errorf("failed to unmarshal genesis state: %w", err) } diff --git a/state.go b/state.go index 54629441c3d..921aac5906c 100644 --- a/state.go +++ b/state.go @@ -9,6 +9,7 @@ import ( "time" "github.com/tendermint/tendermint/crypto/secp256k1" + tmjson "github.com/tendermint/tendermint/libs/json" tmtypes "github.com/tendermint/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" @@ -56,7 +57,10 @@ func AppStateFn(cdc codec.JSONMarshaler, simManager *module.SimulationManager) s panic(err) } - cdc.MustUnmarshalJSON(bz, &appParams) + err = json.Unmarshal(bz, &appParams) + if err != nil { + panic(err) + } appState, simAccs = AppStateRandomizedFn(simManager, r, cdc, accs, genesisTimestamp, appParams) default: @@ -132,10 +136,17 @@ func AppStateFromGenesisFileFn(r io.Reader, cdc codec.JSONMarshaler, genesisFile } var genesis tmtypes.GenesisDoc - cdc.MustUnmarshalJSON(bytes, &genesis) + // NOTE: Tendermint uses a custom JSON decoder for GenesisDoc + err = tmjson.Unmarshal(bytes, &genesis) + if err != nil { + panic(err) + } var appState GenesisState - cdc.MustUnmarshalJSON(genesis.AppState, &appState) + err = json.Unmarshal(genesis.AppState, &appState) + if err != nil { + panic(err) + } var authGenesis authtypes.GenesisState if appState[authtypes.ModuleName] != nil {