Skip to content

Commit 63b6a38

Browse files
authored
feat: use cronos store (#1895)
* feat: use cronos store * add changelog * update repo * revert grocksdb version * fix golangci-lint * update go.mod * fix golangci-lint * update ci * update go.mod * revert build.yml unittest job * revert unittest * revert proto.yml * update proto breakage * fix proto breakage * fix proto breakage * fix proto breakage * update Makefile * update cronos-store repo * fix nix build * update rocksdb.nix * update Makefile
1 parent 08f26ec commit 63b6a38

98 files changed

Lines changed: 80 additions & 17677 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
7575
- name: test & coverage report creation
7676
run: |
77-
nix develop .#rocksdb -c make test test-versiondb
77+
nix develop .#rocksdb -c make test
7878
if: steps.changed-files.outputs.any_changed == 'true'
7979
- name: filter out proto files
8080
run: |
@@ -88,7 +88,7 @@ jobs:
8888
- uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4
8989
with:
9090
token: ${{ secrets.CODECOV_TOKEN }}
91-
files: ./coverage.txt,./memiavl/coverage.txt,./store/coverage.txt,./versiondb/coverage.txt
91+
files: ./coverage.txt
9292
if: steps.changed-files.outputs.any_changed == 'true'
9393

9494
gomod2nix:

.github/workflows/lint.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ jobs:
4747
BUILD_TAGS=rocksdb,grocksdb_clean_link,objstore
4848
go build -tags $BUILD_TAGS ./cmd/cronosd
4949
golangci-lint run --fix --output.text.path stdout --path-prefix=./ --timeout 30m --build-tags $BUILD_TAGS
50-
cd versiondb
51-
golangci-lint run --fix --output.text.path stdout --path-prefix=./versiondb --timeout 30m --build-tags $BUILD_TAGS
52-
cd ../memiavl
53-
golangci-lint run --fix --output.text.path stdout --path-prefix=./memiavl --timeout 30m --build-tags objstore
54-
cd ../store
55-
golangci-lint run --fix --output.text.path stdout --path-prefix=./store --timeout 30m --build-tags objstore
5650
# Check only if there are differences in the source code
5751
if: steps.changed-files.outputs.any_changed == 'true'
5852
- name: check working directory is clean

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
22

33
## UNRELEASED
4-
4+
* [#1895](https://github.com/crypto-org-chain/cronos/pull/1895) feat: use cronos store.
55
* [#1908](https://github.com/crypto-org-chain/cronos/pull/1908) Add db migration/patch CLI tool
66
* [#1875](https://github.com/crypto-org-chain/cronos/pull/1875) Support for preinstalls
77
* [#1882](https://github.com/crypto-org-chain/cronos/pull/1882) Support for eip2935

Makefile

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,10 @@ build: check-network print-ledger go.sum
109109
install: check-network print-ledger go.sum
110110
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/cronosd
111111

112-
test: test-memiavl test-store test-versiondb
112+
test:
113113
@go test -tags=objstore -v -mod=readonly $(PACKAGES) -coverprofile=$(COVERAGE) -covermode=atomic
114114

115-
test-memiavl:
116-
@cd memiavl && go test -tags=objstore -v -mod=readonly ./... -coverprofile=$(COVERAGE) -covermode=atomic;
117-
118-
test-store:
119-
@cd store && go test -tags=objstore -v -mod=readonly ./... -coverprofile=$(COVERAGE) -covermode=atomic;
120-
121-
test-versiondb:
122-
@cd versiondb && go test -tags=objstore,rocksdb -v -mod=readonly ./... -coverprofile=$(COVERAGE) -covermode=atomic;
123-
124-
.PHONY: clean build install test test-memiavl test-store test-versiondb
115+
.PHONY: all clean build install test
125116

126117
clean:
127118
rm -rf $(BUILDDIR)/
@@ -297,6 +288,21 @@ endif
297288
###############################################################################
298289

299290
HTTPS_GIT := https://github.com/crypto-org-chain/cronos.git
291+
CRONOS_STORE_GIT := https://github.com/crypto-org-chain/cronos-store.git
292+
CRONOS_STORE_VERSION := $(shell go list -m -f '{{if .Replace}}{{.Replace.Version}}{{else}}{{.Version}}{{end}}' github.com/crypto-org-chain/cronos-store/memiavl 2>/dev/null)
293+
ifeq ($(CRONOS_STORE_VERSION),)
294+
CRONOS_STORE_VERSION := $(shell awk '/^[[:space:]]*github.com\/crypto-org-chain\/cronos-store\/memiavl[[:space:]]+=>/ {print $$NF; exit}' go.mod)
295+
endif
296+
ifeq ($(CRONOS_STORE_VERSION),)
297+
CRONOS_STORE_VERSION := $(shell sed -nE -e '/=>/d' -e 's/^[[:space:]]*github.com\/crypto-org-chain\/cronos-store\/memiavl[[:space:]]+([^[:space:]]+).*/\1/p' go.mod | head -n 1)
298+
endif
299+
CRONOS_STORE_REF := $(CRONOS_STORE_VERSION)
300+
ifneq (,$(findstring -, $(CRONOS_STORE_VERSION)))
301+
CRONOS_STORE_REF := $(shell echo $(CRONOS_STORE_VERSION) | awk -F- '{print $$NF}')
302+
endif
303+
ifeq ($(CRONOS_STORE_REF),)
304+
CRONOS_STORE_REF := main
305+
endif
300306
protoVer=0.14.0
301307
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
302308
protoImageCi=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace --user root $(protoImageName)
@@ -329,12 +335,14 @@ proto-format:
329335
@$(protoImage) find ./ -not -path "./third_party/*" -name "*.proto" -exec clang-format -i {} \;
330336

331337
proto-check-breaking:
332-
@echo "Checking Protobuf files for breaking changes"
333-
@$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=main
338+
@echo "Checking Cronos protobuf files for breaking changes"
339+
@$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=main --exclude-path proto/memiavl
340+
@echo "Checking memiavl protobuf files against cronos-store ref $(CRONOS_STORE_REF)"
341+
@$(protoImage) buf breaking --path proto/memiavl --against $(CRONOS_STORE_GIT)#ref=$(CRONOS_STORE_REF) || echo "Warning: memiavl proto check skipped (files may not exist in cronos-store yet)"
334342

335343

336344
.PHONY: proto-all proto-gen proto-format proto-lint proto-check-breaking
337345

338346
vulncheck: $(BUILDDIR)/
339347
GOBIN=$(BUILDDIR) go install golang.org/x/vuln/cmd/govulncheck@latest
340-
$(BUILDDIR)/govulncheck ./...
348+
$(BUILDDIR)/govulncheck ./...

app/app.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ import (
4141
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
4242
ibckeeper "github.com/cosmos/ibc-go/v10/modules/core/keeper"
4343
ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
44+
memiavlstore "github.com/crypto-org-chain/cronos-store/store"
4445
"github.com/crypto-org-chain/cronos/client/docs"
45-
memiavlstore "github.com/crypto-org-chain/cronos/store"
4646
"github.com/crypto-org-chain/cronos/x/cronos"
4747
cronosclient "github.com/crypto-org-chain/cronos/x/cronos/client"
4848
cronoskeeper "github.com/crypto-org-chain/cronos/x/cronos/keeper"
@@ -430,7 +430,8 @@ func New(
430430
// only enable memiavl cache if neither block-stm nor optimistic execution is enabled, because it's not concurrency-safe.
431431
cacheSize = cast.ToInt(appOpts.Get(memiavlstore.FlagCacheSize))
432432
}
433-
baseAppOptions = memiavlstore.SetupMemIAVL(logger, homePath, appOpts, false, false, cacheSize, baseAppOptions)
433+
chainId := cast.ToString(appOpts.Get(flags.FlagChainID))
434+
baseAppOptions = memiavlstore.SetupMemIAVL(logger, homePath, appOpts, false, false, cacheSize, chainId, baseAppOptions)
434435

435436
// The default value of optimisticExecution is enabled.
436437
if !optimisticExecutionDisabled {

app/bench_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
1515
tmtypes "github.com/cometbft/cometbft/types"
1616
dbm "github.com/cosmos/cosmos-db"
17-
memiavlstore "github.com/crypto-org-chain/cronos/store"
17+
memiavlstore "github.com/crypto-org-chain/cronos-store/store"
1818
"github.com/crypto-org-chain/cronos/x/cronos/types"
1919
"github.com/ethereum/go-ethereum/common"
2020
ethtypes "github.com/ethereum/go-ethereum/core/types"

app/versiondb.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"os"
77
"path/filepath"
88

9-
"github.com/crypto-org-chain/cronos/versiondb"
10-
"github.com/crypto-org-chain/cronos/versiondb/tsrocksdb"
9+
"github.com/crypto-org-chain/cronos-store/versiondb"
10+
"github.com/crypto-org-chain/cronos-store/versiondb/tsrocksdb"
1111

1212
storetypes "cosmossdk.io/store/types"
1313
)

cmd/cronosd/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010
cmtcli "github.com/cometbft/cometbft/libs/cli"
1111
dbm "github.com/cosmos/cosmos-db"
1212
rosettaCmd "github.com/cosmos/rosetta/cmd"
13+
memiavlcfg "github.com/crypto-org-chain/cronos-store/store/config"
1314
"github.com/crypto-org-chain/cronos/app"
1415
config2 "github.com/crypto-org-chain/cronos/cmd/cronosd/config"
1516
"github.com/crypto-org-chain/cronos/cmd/cronosd/opendb"
16-
memiavlcfg "github.com/crypto-org-chain/cronos/store/config"
1717
"github.com/crypto-org-chain/cronos/x/cronos"
1818
e2eecli "github.com/crypto-org-chain/cronos/x/e2ee/client/cli"
1919
ethermintclient "github.com/evmos/ethermint/client"

cmd/cronosd/cmd/versiondb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ package cmd
55
import (
66
"sort"
77

8+
versiondbclient "github.com/crypto-org-chain/cronos-store/versiondb/client"
89
"github.com/crypto-org-chain/cronos/app"
910
"github.com/crypto-org-chain/cronos/cmd/cronosd/opendb"
10-
versiondbclient "github.com/crypto-org-chain/cronos/versiondb/client"
1111
"github.com/linxGnu/grocksdb"
1212
"github.com/spf13/cobra"
1313
)

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ require (
2525
// release/v10.0.x
2626
github.com/cosmos/ibc-go/v10 v10.4.0
2727
github.com/cosmos/rosetta v0.50.12
28-
github.com/crypto-org-chain/cronos/store v0.0.4
29-
github.com/crypto-org-chain/cronos/versiondb v0.0.0-00010101000000-000000000000
28+
github.com/crypto-org-chain/cronos-store/store v0.0.0-20251203075505-0670ff683f07
29+
github.com/crypto-org-chain/cronos-store/versiondb v0.0.0-20251203075505-0670ff683f07
3030
github.com/ethereum/go-ethereum v1.15.11
3131
github.com/evmos/ethermint v0.0.0-00010101000000-000000000000
3232
github.com/golang/protobuf v1.5.4
3333
github.com/gorilla/mux v1.8.1
3434
github.com/grpc-ecosystem/grpc-gateway v1.16.0
3535
github.com/hashicorp/go-metrics v0.5.4
36-
github.com/linxGnu/grocksdb v1.9.10-0.20250331012329-9d5f074653d1
36+
github.com/linxGnu/grocksdb v1.10.3
3737
github.com/spf13/cast v1.10.0
3838
github.com/spf13/cobra v1.10.2
3939
github.com/spf13/pflag v1.0.10
@@ -109,7 +109,7 @@ require (
109109
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
110110
github.com/creachadair/atomicfile v0.3.1 // indirect
111111
github.com/creachadair/tomledit v0.0.24 // indirect
112-
github.com/crypto-org-chain/cronos/memiavl v0.0.4 // indirect
112+
github.com/crypto-org-chain/cronos-store/memiavl v0.0.4 // indirect
113113
github.com/crypto-org-chain/go-block-stm v0.0.0-20241213061541-7afe924fb4a6 // indirect
114114
github.com/danieljoos/wincred v1.2.1 // indirect
115115
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
@@ -285,9 +285,9 @@ replace (
285285
)
286286

287287
replace (
288-
github.com/crypto-org-chain/cronos/memiavl => ./memiavl
289-
github.com/crypto-org-chain/cronos/store => ./store
290-
github.com/crypto-org-chain/cronos/versiondb => ./versiondb
288+
github.com/crypto-org-chain/cronos-store/memiavl => github.com/crypto-org-chain/cronos-store/memiavl v0.0.0-20251203075505-0670ff683f07
289+
github.com/crypto-org-chain/cronos-store/store => github.com/crypto-org-chain/cronos-store/store v0.0.0-20251203075505-0670ff683f07
290+
github.com/crypto-org-chain/cronos-store/versiondb => github.com/crypto-org-chain/cronos-store/versiondb v0.0.0-20251203075505-0670ff683f07
291291
)
292292

293293
replace (

0 commit comments

Comments
 (0)