Skip to content

Commit

Permalink
Problem: memiavl result is different when replaying write-ahead-log (#…
Browse files Browse the repository at this point in the history
…995)

* Problem: memiavl result is different when replaying write-ahead-log

Solution:
- fix in memiavl and update deps, see crypto-org-chain/cronos#1088

* update setup
  • Loading branch information
yihuang authored Jul 3, 2023
1 parent 8dbdee7 commit 07e1a8f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
7 changes: 3 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ import (
_ "github.com/crypto-org-chain/chain-main/v4/app/docs/statik"

memiavlstore "github.com/crypto-org-chain/cronos/store"
memiavlrootmulti "github.com/crypto-org-chain/cronos/store/rootmulti"
)

// FIXME remove this line, dummy
Expand Down Expand Up @@ -301,7 +300,7 @@ func New(
legacyAmino := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

baseAppOptions = memiavlstore.SetupMemIAVL(logger, homePath, appOpts, baseAppOptions)
baseAppOptions = memiavlstore.SetupMemIAVL(logger, homePath, appOpts, true, baseAppOptions)
bApp := baseapp.NewBaseApp(appName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
bApp.SetVersion(version.Version)
Expand Down Expand Up @@ -940,8 +939,8 @@ func StoreKeys() (
func (app *ChainApp) Close() error {
err := app.BaseApp.Close()

if cms, ok := app.CommitMultiStore().(*memiavlrootmulti.Store); ok {
return errors.Join(err, cms.WaitAsyncCommit())
if cms, ok := app.CommitMultiStore().(io.Closer); ok {
return errors.Join(err, cms.Close())
}

return err
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/cosmos/cosmos-proto v1.0.0-alpha8
github.com/cosmos/cosmos-sdk v0.46.13
github.com/cosmos/ibc-go/v5 v5.2.1
github.com/crypto-org-chain/cronos/store v0.0.3
github.com/crypto-org-chain/cronos/store v0.0.4-0.20230701031330-91fbcb44fffb
// release/v1.0.x
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230623043455-e162787ed0b9
github.com/gogo/protobuf v1.3.3
Expand Down Expand Up @@ -73,7 +73,7 @@ require (
github.com/cosmos/iavl v0.19.6 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/crypto-org-chain/cronos/memiavl v0.0.3 // indirect
github.com/crypto-org-chain/cronos/memiavl v0.0.4-0.20230701031330-91fbcb44fffb // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/crypto-org-chain/cometbft-db v0.0.0-20230412133340-ac70df4b45f6 h1:d4h4Ki1UE/LF6CKwYEm3OZ+HIBCrzSmOokG1vce0O98=
github.com/crypto-org-chain/cometbft-db v0.0.0-20230412133340-ac70df4b45f6/go.mod h1:hF5aclS++7WrW8USOA3zPeKI0CuzwUD2TPYug25ANlQ=
github.com/crypto-org-chain/cronos/memiavl v0.0.3 h1:oNKmV2Vp14eeW4zN/Wvr6H4iYJ5j2YTYZqQwzKNeblM=
github.com/crypto-org-chain/cronos/memiavl v0.0.3/go.mod h1:k3+p+k+HzXx+NoqULMKzai1WHm5z+9CYGO/T9EVbb4w=
github.com/crypto-org-chain/cronos/store v0.0.3 h1:sOn2lCHPIbbC+bVXg/d38M8wrlmSjJcHifeExQVPvdc=
github.com/crypto-org-chain/cronos/store v0.0.3/go.mod h1:jpkj59pegLuibS3LRb1ieD+tZG1qc78f4623fTyBa/4=
github.com/crypto-org-chain/cronos/memiavl v0.0.4-0.20230701031330-91fbcb44fffb h1:R7un4w087nBF3L+NH2NlmZD9G3RiTNIGfsK2iew7DUw=
github.com/crypto-org-chain/cronos/memiavl v0.0.4-0.20230701031330-91fbcb44fffb/go.mod h1:k3+p+k+HzXx+NoqULMKzai1WHm5z+9CYGO/T9EVbb4w=
github.com/crypto-org-chain/cronos/store v0.0.4-0.20230701031330-91fbcb44fffb h1:hmi5zBbZfoHNB5cS5a+ftnm4OuWSPmS+uevRSkTydIM=
github.com/crypto-org-chain/cronos/store v0.0.4-0.20230701031330-91fbcb44fffb/go.mod h1:jpkj59pegLuibS3LRb1ieD+tZG1qc78f4623fTyBa/4=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230623043455-e162787ed0b9 h1:kgdqW/ZIn1DmYh6795XqwNJfTSFVfFIts7XTsw09NlQ=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230623043455-e162787ed0b9/go.mod h1:nJHTLUNSMpAGenR70PTAv7bZu0jCU+iIuQCe4O+r3co=
github.com/crypto-org-chain/tm-db v0.6.8-0.20230424032152-87c7e7f4fb61 h1:Y5OuzOkZtjCfO53Jgzl+H8re6pOU4X205a1VMkDcUdk=
Expand Down
8 changes: 4 additions & 4 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ schema = 3
version = "v0.3.2"
hash = "sha256-Y261IO/d9xjV0UScqHvo31broxvnKn4IQQC9Mu6jNkE="
[mod."github.com/crypto-org-chain/cronos/memiavl"]
version = "v0.0.3"
hash = "sha256-sWn4b1C+UDc94ccT1YZPshyx6DWxqH/jCGrw5AishFU="
version = "v0.0.4-0.20230701031330-91fbcb44fffb"
hash = "sha256-bhf0qfAqoCN9ZU6aaGOBSN8qFfEDQMwIWwCWrFC9ph0="
[mod."github.com/crypto-org-chain/cronos/store"]
version = "v0.0.3"
hash = "sha256-oDbvuSVeK2nPcmWaLfMIHBztuDl3Mm1K2sYNlC9j27U="
version = "v0.0.4-0.20230701031330-91fbcb44fffb"
hash = "sha256-aa6xwd+R//lvcYAg0nwSDJk5fNLKNdyv9qnVkfm5q+4="
[mod."github.com/crypto-org-chain/cronos/versiondb"]
version = "v0.0.0-20230623043455-e162787ed0b9"
hash = "sha256-Z+uXkJk9zUrR5uf7MHsaDX27suu3DJO4CBgcA8TG20I="
Expand Down

0 comments on commit 07e1a8f

Please sign in to comment.