From d49947aa4f6d9df85fa1635d24e4d04df913a18c Mon Sep 17 00:00:00 2001 From: Javier Su Date: Wed, 30 Nov 2022 03:45:12 +0800 Subject: [PATCH] fix: remove unnecessary cms typecasting (#14054) * fix: remove unnecessary cms typecasting * Update baseapp/baseapp.go Co-authored-by: Julien Robert Co-authored-by: Aleksandr Bezobchuk Co-authored-by: Julien Robert Co-authored-by: Marko (cherry picked from commit 730d6313f4c088073430373171129ca0ef90f247) # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 3 +++ baseapp/baseapp.go | 11 +++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abd22d177378..433bfb7f2e7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -172,7 +172,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#13794](https://github.com/cosmos/cosmos-sdk/pull/13794) `types/module.Manager` now supports the `cosmossdk.io/core/appmodule.AppModule` API via the new `NewManagerFromMap` constructor. * [#14019](https://github.com/cosmos/cosmos-sdk/issues/14019) Remove the interface casting to allow other implementations of a `CommitMultiStore`. +<<<<<<< HEAD * [#14175](https://github.com/cosmos/cosmos-sdk/pull/14175) Add `server.DefaultBaseappOptions(appopts)` function to reduce boiler plate in root.go. +======= +>>>>>>> 730d6313f (fix: remove unnecessary cms typecasting (#14054)) ### State Machine Breaking diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 5a8c2efd3441..1a2472438daf 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -17,7 +17,6 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/snapshots" "github.com/cosmos/cosmos-sdk/store" - "github.com/cosmos/cosmos-sdk/store/rootmulti" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -358,11 +357,11 @@ func (app *BaseApp) Init() error { app.setState(runTxModeCheck, emptyHeader) app.Seal() - rms, ok := app.cms.(*rootmulti.Store) - if !ok { - return fmt.Errorf("invalid commit multi-store; expected %T, got: %T", &rootmulti.Store{}, app.cms) - } - return rms.GetPruning().Validate() +if app.cms == nil { + return errors.New("commit multi-store must not be nil") +} + +return app.cms.GetPruning().Validate() } func (app *BaseApp) setMinGasPrices(gasPrices sdk.DecCoins) {