Skip to content

Commit

Permalink
Problem: versiondb memstore fix not included (#1341)
Browse files Browse the repository at this point in the history
* Problem: memiavl/versiondb new tagged version not used

* changelog
  • Loading branch information
yihuang authored Mar 11, 2024
1 parent 92bb449 commit 90f083c
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 40 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [#1298](https://github.com/crypto-org-chain/cronos/pull/1298) Update cosmos-sdk to latest `v0.46.x`.
- [#1307](https://github.com/crypto-org-chain/cronos/pull/1307) Include fasten memiavl restore and versiondb version mismatch related fixes from submodules.
- [#1341](https://github.com/crypto-org-chain/cronos/pull/1341) Include versiondb memstore fix.

*Jan 05, 2024*

Expand Down
34 changes: 17 additions & 17 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,23 +372,6 @@ func New(

keys, memKeys, tkeys := StoreKeys(experimental)

// load state streaming if enabled
if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, keys); err != nil {
fmt.Printf("failed to load state streaming: %s", err)
os.Exit(1)
}

// wire up the versiondb's `StreamingService` and `MultiStore`.
streamers := cast.ToStringSlice(appOpts.Get("store.streamers"))
var qms sdk.MultiStore
if slices.Contains(streamers, "versiondb") {
var err error
qms, err = setupVersionDB(homePath, bApp, keys, tkeys, memKeys)
if err != nil {
panic(err)
}
}

app := &App{
BaseApp: bApp,
cdc: cdc,
Expand Down Expand Up @@ -754,6 +737,23 @@ func New(
app.MountTransientStores(tkeys)
app.MountMemoryStores(memKeys)

// load state streaming if enabled
if _, _, err := streaming.LoadStreamingServices(app.BaseApp, appOpts, appCodec, keys); err != nil {
fmt.Printf("failed to load state streaming: %s", err)
os.Exit(1)
}

// wire up the versiondb's `StreamingService` and `MultiStore`.
streamers := cast.ToStringSlice(appOpts.Get("store.streamers"))
var qms sdk.MultiStore
if slices.Contains(streamers, "versiondb") {
var err error
qms, err = app.setupVersionDB(homePath, keys, tkeys, memKeys)
if err != nil {
panic(err)
}
}

// initialize BaseApp
app.SetInitChainer(app.InitChainer)
app.SetBeginBlocker(app.BeginBlocker)
Expand Down
6 changes: 2 additions & 4 deletions app/versiondb.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ import (
"os"
"path/filepath"

"github.com/cosmos/cosmos-sdk/baseapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/crypto-org-chain/cronos/versiondb"
"github.com/crypto-org-chain/cronos/versiondb/tsrocksdb"
)

func setupVersionDB(
func (app *App) setupVersionDB(
homePath string,
app *baseapp.BaseApp,
keys map[string]*storetypes.KVStoreKey,
tkeys map[string]*storetypes.TransientStoreKey,
memKeys map[string]*storetypes.MemoryStoreKey,
Expand All @@ -39,7 +37,7 @@ func setupVersionDB(
service := versiondb.NewStreamingService(versionDB, exposeStoreKeys)
app.SetStreamingService(service)

verDB := versiondb.NewMultiStore(versionDB, exposeStoreKeys)
verDB := versiondb.NewMultiStore(app.CommitMultiStore(), versionDB, exposeStoreKeys)
verDB.MountTransientStores(tkeys)
verDB.MountMemoryStores(memKeys)

Expand Down
4 changes: 1 addition & 3 deletions app/versiondb_placeholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ package app
import (
"errors"

"github.com/cosmos/cosmos-sdk/baseapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

func setupVersionDB(
func (app *App) setupVersionDB(
homePath string,
app *baseapp.BaseApp,
keys map[string]*storetypes.KVStoreKey,
tkeys map[string]*storetypes.TransientStoreKey,
memKeys map[string]*storetypes.MemoryStoreKey,
Expand Down
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/armon/go-metrics v0.4.1
github.com/cosmos/cosmos-sdk v0.46.15-0.20231107150241-7799bba7bc88
github.com/cosmos/ibc-go/v5 v5.2.1
github.com/crypto-org-chain/cronos/store v0.0.0-20240130060137-c12016e4052e
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20240130060137-c12016e4052e
github.com/crypto-org-chain/cronos/store v0.0.6
github.com/crypto-org-chain/cronos/versiondb v0.0.6
github.com/ethereum/go-ethereum v1.10.26
github.com/evmos/ethermint v0.0.0-00010101000000-000000000000
github.com/gogo/protobuf v1.3.3
Expand Down Expand Up @@ -77,7 +77,7 @@ require (
github.com/cosmos/iavl v0.19.6 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/crypto-org-chain/cronos/memiavl v0.0.4 // indirect
github.com/crypto-org-chain/cronos/memiavl v0.0.6 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
Expand Down Expand Up @@ -219,7 +219,6 @@ replace (
// the version used by cockroach v22.2.7 release
github.com/cockroachdb/pebble => github.com/cockroachdb/pebble v0.0.0-20230206180212-744ea7cc8f90
github.com/cometbft/cometbft-db => github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63
github.com/crypto-org-chain/cronos/memiavl => github.com/crypto-org-chain/cronos/memiavl v0.0.0-20240130060137-c12016e4052e
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1262,12 +1262,12 @@ github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ
github.com/cristalhq/acmd v0.8.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ=
github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63 h1:R1QJ9a3XdYMSKo+1RdFifxb/g3lNypC52L/rpYrWoKo=
github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63/go.mod h1:rocwIfnS+kA060x64gkSIRvWB9StSppIkJuo5MWzL24=
github.com/crypto-org-chain/cronos/memiavl v0.0.0-20240130060137-c12016e4052e h1:i/5RUn3u17PoPPm40mA30Pd89E+xCRVOvtogbQFE8Qo=
github.com/crypto-org-chain/cronos/memiavl v0.0.0-20240130060137-c12016e4052e/go.mod h1:sPIAu3w4KkWWTlN92GyLaB/qeMdszSYd6fF3r+p0C+A=
github.com/crypto-org-chain/cronos/store v0.0.0-20240130060137-c12016e4052e h1:xH57WcZkh3wxRbKQwK7WVnKOQSinNKVjWNCFHOxTVaY=
github.com/crypto-org-chain/cronos/store v0.0.0-20240130060137-c12016e4052e/go.mod h1:KC9cV7VK8BNIJySzztw2nWSqPqVGcffsumMl3sORPCM=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20240130060137-c12016e4052e h1:9tr6e1b+XB4dkmyAF2fzGJokbosiOXJPQFUUa/R2odU=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20240130060137-c12016e4052e/go.mod h1:i9e8vrU54C/JvSM+rX/jUidFRBcyXZ8FgNX+EvrasQc=
github.com/crypto-org-chain/cronos/memiavl v0.0.6 h1:rEJ906TnPO/qDit2FX+makXtLKHryGdA9uh573qi8LY=
github.com/crypto-org-chain/cronos/memiavl v0.0.6/go.mod h1:sPIAu3w4KkWWTlN92GyLaB/qeMdszSYd6fF3r+p0C+A=
github.com/crypto-org-chain/cronos/store v0.0.6 h1:kil/XuXmm2N2+VjsxscC9H9PTPUcOqRjnJp4SgciKd0=
github.com/crypto-org-chain/cronos/store v0.0.6/go.mod h1:MTFIcuiiLuU15blCkCoUI94Xa1JH2L1qVJQvanUwawo=
github.com/crypto-org-chain/cronos/versiondb v0.0.6 h1:G6FHrDa9G7aX900bePmBFOJgrEQzMsEw+rtqNaRqJU8=
github.com/crypto-org-chain/cronos/versiondb v0.0.6/go.mod h1:wziy3/1v8iGxiAKmiOoCt1XR/SQJKl9t9yHwpA9IQic=
github.com/crypto-org-chain/ethermint v0.20.11-cronos.0.20231220064956-a85daedc6ffc h1:1sdpqaZTdUJtq8N35yVVOhYT/5SzQnA/jI7UYAWXsjw=
github.com/crypto-org-chain/ethermint v0.20.11-cronos.0.20231220064956-a85daedc6ffc/go.mod h1:EDjmywAw/EMpMufJA2Q+E9pNHAB00Dt5siQanMOZC88=
github.com/crypto-org-chain/go-ethereum v1.10.19-deepcopy-jumptable h1:VQLW0R8t9DcC/HvQZO1i0mIWjJfAezhI8lLUCholP0M=
Expand Down
11 changes: 5 additions & 6 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,14 @@ schema = 3
version = "v0.3.2"
hash = "sha256-Y261IO/d9xjV0UScqHvo31broxvnKn4IQQC9Mu6jNkE="
[mod."github.com/crypto-org-chain/cronos/memiavl"]
version = "v0.0.0-20240130060137-c12016e4052e"
version = "v0.0.6"
hash = "sha256-4chV7TmG5Kw4Nac1s0kAcBk5UtyucP5HU5flijas3eg="
replaced = "github.com/crypto-org-chain/cronos/memiavl"
[mod."github.com/crypto-org-chain/cronos/store"]
version = "v0.0.0-20240130060137-c12016e4052e"
hash = "sha256-Kuv0nCgbnzrNPaQkSCCKmVNr/AcNhM9cCpW5e1DdyhM="
version = "v0.0.6"
hash = "sha256-LTHz5StEJ3OibyUYYabeRAOLUYa2AN3LlOjx+WFruWI="
[mod."github.com/crypto-org-chain/cronos/versiondb"]
version = "v0.0.0-20240130060137-c12016e4052e"
hash = "sha256-qI16polu5o09nG0v2WYRThv7bXoEG3HlBgzhy9FBnXo="
version = "v0.0.6"
hash = "sha256-hucr41fmGGzCta2izU62cv/iJNafAEFnWG7MRAXoi4s="
[mod."github.com/danieljoos/wincred"]
version = "v1.1.2"
hash = "sha256-Nnklfg12vmWCOhELGyoRqEF4w4srp0WbPwreaChYLKs="
Expand Down

0 comments on commit 90f083c

Please sign in to comment.