From 5c9d7ccb1b00c00477a060f0c2cd4e911603ce93 Mon Sep 17 00:00:00 2001 From: Kevin Yang <5478483+k-yang@users.noreply.github.com> Date: Mon, 26 Feb 2024 17:14:10 -0700 Subject: [PATCH 1/3] fix: use proper db backend type when reading chain id --- server/util.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/util.go b/server/util.go index 2348fb4c1634..e22137aad0da 100644 --- a/server/util.go +++ b/server/util.go @@ -462,7 +462,8 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) { chainID := cast.ToString(appOpts.Get(flags.FlagChainID)) if chainID == "" { // read the chainID from home directory (either from comet or genesis). - chainId, err := readChainIdFromHome(homeDir) + dbBackend := cast.ToString(appOpts.Get("db_backend")) + chainId, err := readChainIdFromHome(homeDir, dbBackend) if err != nil { panic(err) } @@ -503,9 +504,10 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) { } // readChainIdFromHome reads chain id from home directory. -func readChainIdFromHome(homeDir string) (string, error) { +func readChainIdFromHome(homeDir string, dbBackend string) (string, error) { cfg := tmcfg.DefaultConfig() cfg.SetRoot(homeDir) + cfg.BaseConfig.DBBackend = dbBackend // if the node's current height is not zero then try to read the chainID from comet db. db, err := node.DefaultDBProvider(&node.DBContext{ID: "blockstore", Config: cfg}) From aeb6ebbef32ceb3b65ddf4c3dfb42548c25aae2e Mon Sep 17 00:00:00 2001 From: Kevin Yang <5478483+k-yang@users.noreply.github.com> Date: Mon, 26 Feb 2024 23:54:13 -0700 Subject: [PATCH 2/3] chore: update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dba91e888f1..9636cecb3464 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Bug Fixes + +* (baseapp) [19573](https://github.com/cosmos/cosmos-sdk/pull/19573) fix: use proper `db_backend` type when reading chain-id + ## [v0.47.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.9) - 2024-02-19 ### Bug Fixes From 88646c9fb9ae1d888096825665e66a4e443a96bc Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 27 Feb 2024 08:48:41 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9636cecb3464..1e078ca0a4e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes -* (baseapp) [19573](https://github.com/cosmos/cosmos-sdk/pull/19573) fix: use proper `db_backend` type when reading chain-id +* (server) [#19573](https://github.com/cosmos/cosmos-sdk/pull/19573) Use proper `db_backend` type when reading chain-id ## [v0.47.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.9) - 2024-02-19