Skip to content

Commit d78ab09

Browse files
committed
Merge branch 'main' into song/go_1.25.0
2 parents bd7dba4 + 63b6a38 commit d78ab09

File tree

123 files changed

+10508
-17683
lines changed

Some content is hidden

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

123 files changed

+10508
-17683
lines changed

.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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Changelog
22

33
## UNRELEASED
4-
4+
* [#1895](https://github.com/crypto-org-chain/cronos/pull/1895) feat: use cronos store.
5+
* [#1908](https://github.com/crypto-org-chain/cronos/pull/1908) Add db migration/patch CLI tool
56
* [#1875](https://github.com/crypto-org-chain/cronos/pull/1875) Support for preinstalls
67
* [#1882](https://github.com/crypto-org-chain/cronos/pull/1882) Support for eip2935
78
* [#1880](https://github.com/crypto-org-chain/cronos/pull/1880) Move module from v2 to v1 to follow semver convention

Makefile

Lines changed: 21 additions & 13 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
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,8 +335,10 @@ 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

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/database.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package cmd
2+
3+
import (
4+
"github.com/spf13/cobra"
5+
)
6+
7+
// DatabaseCmd returns the database command with subcommands
8+
func DatabaseCmd() *cobra.Command {
9+
cmd := &cobra.Command{
10+
Use: "database",
11+
Short: "Database management commands",
12+
Long: `Commands for managing Cronos databases.
13+
14+
Available subcommands:
15+
migrate - Migrate databases between different backend types
16+
patch - Patch specific block heights into existing databases
17+
18+
Use "cronosd database [command] --help" for more information about a command.`,
19+
Aliases: []string{"db"},
20+
}
21+
22+
// Add subcommands
23+
cmd.AddCommand(
24+
MigrateCmd(),
25+
PatchCmd(),
26+
)
27+
28+
return cmd
29+
}

0 commit comments

Comments
 (0)