From a3121e22cddf8169ac688d1a3e4b44bdd5b058fa Mon Sep 17 00:00:00 2001 From: Yiming Zang <50607998+yzang2019@users.noreply.github.com> Date: Tue, 24 Sep 2024 20:38:47 -0700 Subject: [PATCH] Add QMS for online migration (#1870) * Add QMS for online migration * Fix lint --------- Co-authored-by: kbhat1 --- app/seidb.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/seidb.go b/app/seidb.go index 5c25b5a34..5c7e2a38c 100644 --- a/app/seidb.go +++ b/app/seidb.go @@ -34,6 +34,8 @@ const ( // Other configs FlagSnapshotInterval = "state-sync.snapshot-interval" + FlagMigrateIAVL = "migrate-iavl" + FlagMigrateHeight = "migrate-height" ) func SetupSeiDB( @@ -58,8 +60,15 @@ func SetupSeiDB( // cms must be overridden before the other options, because they may use the cms, // make sure the cms aren't be overridden by the other options later on. cms := rootmulti.NewStore(homePath, logger, scConfig, ssConfig) + migrationEnabled := cast.ToBool(appOpts.Get(FlagMigrateIAVL)) + migrationHeight := cast.ToInt64(appOpts.Get(FlagMigrateHeight)) baseAppOptions = append([]func(*baseapp.BaseApp){ func(baseApp *baseapp.BaseApp) { + if migrationEnabled { + originalCMS := baseApp.CommitMultiStore() + baseApp.SetQueryMultiStore(originalCMS) + baseApp.SetMigrationHeight(migrationHeight) + } baseApp.SetCMS(cms) }, }, baseAppOptions...)