Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: versiondb config item not exists in sdk 0.50 #1387

Merged
merged 4 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Problem: store.streamers not exists in sdk 0.50
Solution:
- use dedicated versiondb config section to prepare to sdk 0.50
  integration

Update CHANGELOG.md

Signed-off-by: yihuang <huang@crypto.com>

cleanup
  • Loading branch information
yihuang committed Apr 11, 2024
commit d471a6b8145d9a9a2934281233ec0a414363a5a9
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* (test) [#1380](https://github.com/crypto-org-chain/cronos/pull/1380) Upgrade cosmovisor to 1.5.0 in integration test.
* (versiondb) [#1379](https://github.com/crypto-org-chain/cronos/pull/1379) Flush versiondb when graceful shutdown, make rocksdb upgrade smooth.
* (store) [#1378](https://github.com/crypto-org-chain/cronos/pull/1378) Upgrade rocksdb to `v8.11.3`.
* (versiondb) [#1387](https://github.com/crypto-org-chain/cronos/pull/1387) Add dedicated config section for versiondb, prepare for sdk 0.50 integration.

*April 8, 2024*

Expand Down
4 changes: 1 addition & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
"golang.org/x/exp/slices"

dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
Expand Down Expand Up @@ -860,8 +859,7 @@ func New(
}

// wire up the versiondb's `StreamingService` and `MultiStore`.
streamers := cast.ToStringSlice(appOpts.Get("store.streamers"))
if slices.Contains(streamers, "versiondb") {
if cast.ToBool(appOpts.Get("versiondb.enable")) {
yihuang marked this conversation as resolved.
Show resolved Hide resolved
var err error
app.qms, err = app.setupVersionDB(homePath, keys, tkeys, memKeys)
if err != nil {
Expand Down
18 changes: 18 additions & 0 deletions cmd/cronosd/cmd/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

type VersionDBConfig struct {
// Enable defines if the versiondb should be enabled.
Enable bool `mapstructure:"enable"`
}

func DefaultVersionDBConfig() VersionDBConfig {
return VersionDBConfig{
Enable: false,
}
}

var DefaultVersionDBTemplate = `
[versiondb]
# Enable defines if the versiondb should be enabled.
enable = {{ .VersionDB.Enable }}
`
12 changes: 7 additions & 5 deletions cmd/cronosd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,19 @@ func initAppConfig() (string, interface{}) {
type CustomAppConfig struct {
servercfg.Config

MemIAVL memiavlcfg.MemIAVLConfig `mapstructure:"memiavl"`
MemIAVL memiavlcfg.MemIAVLConfig `mapstructure:"memiavl"`
VersionDB VersionDBConfig `mapstructure:"versiondb"`
}

tpl, cfg := servercfg.AppConfig(ethermint.AttoPhoton)
tpl, cfg := servercfg.AppConfig("")

customAppConfig := CustomAppConfig{
Config: cfg.(servercfg.Config),
MemIAVL: memiavlcfg.DefaultMemIAVLConfig(),
Config: cfg.(servercfg.Config),
MemIAVL: memiavlcfg.DefaultMemIAVLConfig(),
VersionDB: DefaultVersionDBConfig(),
}

return tpl + memiavlcfg.DefaultConfigTemplate, customAppConfig
return tpl + memiavlcfg.DefaultConfigTemplate + DefaultVersionDBTemplate, customAppConfig
}

type appCreator struct {
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/configs/default.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
'zero-copy': true,
'snapshot-interval': 5,
},
store: {
streamers: ['versiondb'],
versiondb: {
enable: true,
},
},
}, {
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ def test_local_statesync(cronos, tmp_path_factory):
Path(home) / "config/app.toml",
base_port,
{
"store": {
"streamers": ["versiondb"],
"versiondb": {
"enable": True,
},
},
)
Expand Down
Loading