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: latest memiavl is not integrated #993

Merged
merged 2 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v19
- uses: cachix/install-nix-action@v22
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
Expand Down Expand Up @@ -410,7 +410,7 @@ jobs:
files: |
go.mod
go.sum
- uses: cachix/install-nix-action@v19
- uses: cachix/install-nix-action@v22
if: steps.changed-files.outputs.any_changed == 'true'
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v19
- uses: cachix/install-nix-action@v22
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
Expand All @@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v19
- uses: cachix/install-nix-action@v22
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v19
- uses: cachix/install-nix-action@v22
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
Expand All @@ -104,7 +104,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: cachix/install-nix-action@v19
- uses: cachix/install-nix-action@v22
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
environment: release
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v19
- uses: cachix/install-nix-action@v22
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
environment: release
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v19
- uses: cachix/install-nix-action@v22
with:
# pin to nix-2.13 to workaround compability issue of 2.14,
# see: https://github.com/cachix/install-nix-action/issues/161
Expand Down
24 changes: 15 additions & 9 deletions app/memiavl.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

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

"github.com/crypto-org-chain/cronos/memiavl"
"github.com/crypto-org-chain/cronos/store/rootmulti"
Expand All @@ -25,22 +24,29 @@ const (

func SetupMemIAVL(logger log.Logger, homePath string, appOpts servertypes.AppOptions, baseAppOptions []func(*baseapp.BaseApp)) []func(*baseapp.BaseApp) {
if cast.ToBool(appOpts.Get(FlagMemIAVL)) {
// 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(filepath.Join(homePath, "data", "memiavl.db"), logger)
cms.SetMemIAVLOptions(memiavl.Options{
opts := memiavl.Options{
AsyncCommitBuffer: cast.ToInt(appOpts.Get(FlagAsyncCommitBuffer)),
ZeroCopy: cast.ToBool(appOpts.Get(FlagZeroCopy)),
SnapshotKeepRecent: cast.ToUint32(appOpts.Get(FlagSnapshotKeepRecent)),
SnapshotInterval: cast.ToUint32(appOpts.Get(FlagSnapshotInterval)),
CacheSize: cast.ToInt(appOpts.Get(FlagCacheSize)),
})
baseAppOptions = append([]func(*baseapp.BaseApp){setCMS(cms)}, baseAppOptions...)
}
// 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.
baseAppOptions = append([]func(*baseapp.BaseApp){setMemIAVL(homePath, logger, opts)}, baseAppOptions...)
}

return baseAppOptions
}

func setCMS(cms storetypes.CommitMultiStore) func(*baseapp.BaseApp) {
return func(bapp *baseapp.BaseApp) { bapp.SetCMS(cms) }
func setMemIAVL(homePath string, logger log.Logger, opts memiavl.Options) func(*baseapp.BaseApp) {
return func(bapp *baseapp.BaseApp) {
// trigger state-sync snapshot creation by memiavl
opts.TriggerStateSyncExport = func(height int64) {
go bapp.SnapshotManager().SnapshotIfApplicable(height)
}
cms := rootmulti.NewStore(filepath.Join(homePath, "data", "memiavl.db"), logger)
cms.SetMemIAVLOptions(opts)
bapp.SetCMS(cms)
}
}
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ 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/memiavl v0.0.3-0.20230615113127-926000fa6493
github.com/crypto-org-chain/cronos/store v0.0.3-0.20230615113127-926000fa6493
// v1.0.8
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230529083827-565fa417b0f8
github.com/crypto-org-chain/cronos/memiavl v0.0.3-0.20230621152914-f83c74b904cd
github.com/crypto-org-chain/cronos/store v0.0.3-0.20230621152914-f83c74b904cd
// release/v1.0.x
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230623043455-e162787ed0b9
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.3
github.com/google/renameio v1.0.0
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,12 @@ 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-0.20230615113127-926000fa6493 h1:5P0qarea/g/3CwEct5OGTUcS4gx2EOSPVrTl3pVTxLo=
github.com/crypto-org-chain/cronos/memiavl v0.0.3-0.20230615113127-926000fa6493/go.mod h1:CQjV+A6D3OA/8zjgFZgKymKaWJcS9pATjrEaYNl0iZ8=
github.com/crypto-org-chain/cronos/store v0.0.3-0.20230615113127-926000fa6493 h1:cTNQTL1RwXw/Rp++p+C+cHDfvujfe4btchGQBj8Tp/U=
github.com/crypto-org-chain/cronos/store v0.0.3-0.20230615113127-926000fa6493/go.mod h1:NBMo3NxuIslHFDCskFYqOTjk81tW3tR+ecfFDickQF4=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230529083827-565fa417b0f8 h1:HiSwdL2dzYnqwcG+cU3Phrm7FWag5yknViZnnZBgqQ0=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230529083827-565fa417b0f8/go.mod h1:VJuoTEh4AmvQv1+rxCZutb/Z0OXvS1PdL9zUU+U2+zs=
github.com/crypto-org-chain/cronos/memiavl v0.0.3-0.20230621152914-f83c74b904cd h1:ONnKixvnZU/tgQwcFXdMVpDyADUBXnjKaAFTk4yY/Jw=
github.com/crypto-org-chain/cronos/memiavl v0.0.3-0.20230621152914-f83c74b904cd/go.mod h1:cGIAa6KfrvtjPc9ETOcvG/lKa97kU3GWFYVN37UFQ0w=
github.com/crypto-org-chain/cronos/store v0.0.3-0.20230621152914-f83c74b904cd h1:03L84ozFAcO8K6cJk1Oy00yruiFE8AIs7AFK+z7YAsc=
github.com/crypto-org-chain/cronos/store v0.0.3-0.20230621152914-f83c74b904cd/go.mod h1:6O69W4LrmEuBM8oAKqiXIp/mrxYiGyZO+ekQiiKxdR8=
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=
github.com/crypto-org-chain/tm-db v0.6.8-0.20230424032152-87c7e7f4fb61/go.mod h1:BA6bNc7haulu2IjMy/I2SJiKWjQzfIb7LEAMsnIoLWU=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
Expand Down
12 changes: 6 additions & 6 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ schema = 3
version = "v0.3.2"
hash = "sha256-Y261IO/d9xjV0UScqHvo31broxvnKn4IQQC9Mu6jNkE="
[mod."github.com/crypto-org-chain/cronos/memiavl"]
version = "v0.0.3-0.20230615113127-926000fa6493"
hash = "sha256-AMHRImoY5o1zC2G3z422klV+o2K04y3xd2Xkp7Fk1OI="
version = "v0.0.3-0.20230621152914-f83c74b904cd"
hash = "sha256-cKUm7IniQ682rFL1mXI2wr/Q15MSb3nMyUxx+6aAMz8="
[mod."github.com/crypto-org-chain/cronos/store"]
version = "v0.0.3-0.20230615113127-926000fa6493"
hash = "sha256-vPCGp6taCOQCPhcuWZt4k1WUBinkcdGf6YmFj/RDfZA="
version = "v0.0.3-0.20230621152914-f83c74b904cd"
hash = "sha256-wZG6K7CmWzKPD0MQ/3ThXD50Miy+aysa9wCDWc3ONCc="
[mod."github.com/crypto-org-chain/cronos/versiondb"]
version = "v0.0.0-20230529083827-565fa417b0f8"
hash = "sha256-jTWVxOHchsC1e98wldJp6pZe7+lH2wiUUhhUnvJA8O4="
version = "v0.0.0-20230623043455-e162787ed0b9"
hash = "sha256-Z+uXkJk9zUrR5uf7MHsaDX27suu3DJO4CBgcA8TG20I="
[mod."github.com/danieljoos/wincred"]
version = "v1.1.2"
hash = "sha256-Nnklfg12vmWCOhELGyoRqEF4w4srp0WbPwreaChYLKs="
Expand Down
Loading