From 010036457c210d12c3b92ae4e696ef6479c071af Mon Sep 17 00:00:00 2001 From: yihuang Date: Tue, 10 Aug 2021 19:23:22 +0800 Subject: [PATCH] app: call SetModuleVersionMap in InitChainer (#422) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit keep the scaffolding up-to-date: https://github.com/cosmos/cosmos-sdk/blob/release/v0.43.x/simapp/app.go#L433 Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> --- app/app.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index c89448e2..02261d73 100644 --- a/app/app.go +++ b/app/app.go @@ -1,6 +1,7 @@ package app import ( + "encoding/json" "io" "net/http" "os" @@ -534,7 +535,10 @@ func (app *EthermintApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) a // InitChainer updates at chain initialization func (app *EthermintApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { var genesisState simapp.GenesisState - app.cdc.MustUnmarshalJSON(req.AppStateBytes, &genesisState) + if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { + panic(err) + } + app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) return app.mm.InitGenesis(ctx, app.appCodec, genesisState) }