Skip to content
Closed
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
10 changes: 9 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ jobs:

BUILD_TAGS=rocksdb,grocksdb_clean_link
go build -tags $BUILD_TAGS ./cmd/chain-maind
golangci-lint run --output.text.path stdout --path-prefix=./ --timeout 30m --build-tags $BUILD_TAGS
golangci-lint run --fix --output.text.path stdout --path-prefix=./ --timeout 30m --build-tags $BUILD_TAGS
# Check only if there are differences in the source code
if: steps.changed-files.outputs.any_changed == 'true'
- name: check working directory is clean
id: changes
run: |
set +e
(git diff --no-ext-diff --exit-code)
echo "changed=$?" >> $GITHUB_OUTPUT
- if: steps.changes.outputs.changed == 1
run: echo "Working directory is dirty" && exit 1
35 changes: 35 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,3 +378,38 @@ jobs:
name: debug_files_grpc
path: debug_files_grpc.tar.gz
if-no-files-found: ignore


#test-versiondb:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it still work in progress?

Copy link
Copy Markdown
Contributor Author

@songgaoye songgaoye Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't resolve this, so I used temporary solution in test.yml

# runs-on: ubuntu-latest
# steps:
# - uses: actions/setup-go@v3
# with:
# go-version: '1.22.7'
# - uses: actions/checkout@v3
# - uses: cachix/install-nix-action@6a9a9e84a173d90b3ffb42c5ddaf9ea033fad011 #v23
# with:
# nix_path: nixpkgs=channel:nixos-22.11
# extra_nix_config: |
# access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
# - id: changed-files
# uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
# with:
# files: |
# **/*.go
# *.mod
# *.sum
# - name: test-versiondb
# run: |
# nix profile install nixpkgs#snappy
# nix profile install -f ./nix rocksdb

# export PKG_CONFIG_PATH=~/.nix-profile/lib/pkgconfig
# export CGO_CFLAGS=$(pkg-config --cflags rocksdb)
# export CGO_CPPFLAGS=$CGO_CFLAGS
# export CGO_CXXFLAGS=$CGO_CFLAGS
# export CGO_LDFLAGS=$(pkg-config --libs rocksdb)

# make test-versiondb
# Check only if there are differences in the source code
# if: steps.changed-files.outputs.any_changed == 'true'
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Tests
on:
pull_request:
push:
branches:
- master
- release/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test-versiondb:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.22
check-latest: true
- uses: actions/checkout@v4
- name: Install RocksDB Dependencies
run: |
sudo apt-get update
sudo apt-get -y install -y build-essential libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev liblz4-dev libzstd-dev cmake
- name: Build and Install RocksDB
run: |
git clone https://github.com/facebook/rocksdb.git
Copy link
Copy Markdown
Contributor Author

@songgaoye songgaoye Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a temp solution. It's better to use nix, but I don't know how to use nix.

Copy link
Copy Markdown
Contributor

@thomas-nguy thomas-nguy Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you call look at this
https://github.com/crypto-org-chain/cronos/blob/main/.github/workflows/lint.yml#L42

          nix profile install -f ./nix rocksdb
          export PKG_CONFIG_PATH=$HOME/.nix-profile/lib/pkgconfig
          export CGO_CFLAGS="$(pkg-config --cflags rocksdb)" CGO_LDFLAGS="$(pkg-config --libs rocksdb)"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you call look at this https://github.com/crypto-org-chain/cronos/blob/main/.github/workflows/lint.yml#L42

          nix profile install -f ./nix rocksdb
          export PKG_CONFIG_PATH=$HOME/.nix-profile/lib/pkgconfig
          export CGO_CFLAGS="$(pkg-config --cflags rocksdb)" CGO_LDFLAGS="$(pkg-config --libs rocksdb)"

Yes, I used this in nix.yml#407, it has some problems when linkeing rocksdb. let me look into versiondb prs in the cronos project first

cd rocksdb
git checkout v9.2.1
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_SNAPPY=ON -DWITH_LZ4=ON -DWITH_ZLIB=ON -DWITH_ZSTD=ON
sudo make -j4
sudo make install
- uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.sol
**/**.go
go.mod
go.sum
- name: Test and Create Coverage Report
run: |
export COSMOS_BUILD_OPTIONS=rocksdb
make test-versiondb
if: env.GIT_DIFF
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Improvements
- [#1169](https://github.com/crypto-org-chain/chain-main/pull/1169) Update linter and tidy up code
- [#1175](https://github.com/crypto-org-chain/chain-main/pull/1175) Add maxsupply module
- [#1179](https://github.com/crypto-org-chain/chain-main/pull/1179) fix(app): RootMultiStore interface and version mismatch

*July 9, 2025*

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ test-sim-after-import:
@echo "Running application simulation-after-import. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppSimulationAfterImport

test-versiondb:
@echo "Running test-versiondb..."
@go test -tags "rocksdb $(test_tags)" -mod=readonly $(SIMAPP) -run TestVersionDB

###############################################################################
### Localnet ###
###############################################################################
Expand Down
4 changes: 3 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ var (
_ servertypes.Application = (*ChainApp)(nil)
)

// RootMultiStore this is source from https://github.com/crypto-org-chain/cosmos-sdk/blob/release/v0.50.x/store/types/store.go
type RootMultiStore interface {
storetypes.MultiStore

LoadLatestVersion() error
// LatestVersion returns the latest version in the store
LatestVersion() int64
}

// ChainApp extends an ABCI application, but with most of its parameters exported.
Expand Down
29 changes: 29 additions & 0 deletions app/versiondb_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//go:build rocksdb
// +build rocksdb

package app_test

import (
"testing"

dbm "github.com/cosmos/cosmos-db"
"github.com/crypto-org-chain/chain-main/v4/app"

"cosmossdk.io/log"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli"
)

func TestVersionDB(t *testing.T) {
db := dbm.NewMemDB()

appOptions := make(simtestutil.AppOptionsMap, 0)
appOptions[flags.FlagHome] = app.DefaultNodeHome
appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue
appOptions["versiondb.enable"] = true
logger := log.NewNopLogger()
_ = app.New(logger, db, nil, false, appOptions, nil...)
}
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ require (
)

replace (
github.com/crypto-org-chain/cronos/memiavl => github.com/crypto-org-chain/cronos/memiavl v0.0.5-0.20241028093154-0f94930c27ce
github.com/crypto-org-chain/cronos/store => github.com/crypto-org-chain/cronos/store v0.0.5-0.20241028093154-0f94930c27ce
github.com/crypto-org-chain/cronos/versiondb => github.com/crypto-org-chain/cronos/versiondb v0.0.0-20241028093154-0f94930c27ce
github.com/crypto-org-chain/cronos/memiavl => github.com/crypto-org-chain/cronos/memiavl v0.0.5-0.20250305073811-995046a21efb
github.com/crypto-org-chain/cronos/store => github.com/crypto-org-chain/cronos/store v0.0.5-0.20250305073811-995046a21efb
github.com/crypto-org-chain/cronos/versiondb => github.com/crypto-org-chain/cronos/versiondb v0.0.0-20250305073811-995046a21efb
)

replace (
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,12 @@ github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6
github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/crypto-org-chain/cronos/memiavl v0.0.5-0.20241028093154-0f94930c27ce h1:yRF9Zsk4fzVBhBQEjkA4oE+Q3Q/Kgaj/UX4gK+xwaAs=
github.com/crypto-org-chain/cronos/memiavl v0.0.5-0.20241028093154-0f94930c27ce/go.mod h1:IyRvgFKOQPC/Qdx543PGl6WgeDOU+hWdv+xLz3stotc=
github.com/crypto-org-chain/cronos/store v0.0.5-0.20241028093154-0f94930c27ce h1:g6ltW2J6W10pp8poYCfjUwVkzHy2izh7/71EvUXRgjM=
github.com/crypto-org-chain/cronos/store v0.0.5-0.20241028093154-0f94930c27ce/go.mod h1:p+VxW2n9j8ojLreWScnqoDHyxGPRjI0ytkMMG5xh9o0=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20241028093154-0f94930c27ce h1:d2TZ+oXM6+qpQhM0800lUKrK5p/BmcDXUi1/Xo2LIho=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20241028093154-0f94930c27ce/go.mod h1:Y1uyFhZn/8jZkZfr3W/alzrO3DfcfWPuA3UwCM0Ah0g=
github.com/crypto-org-chain/cronos/memiavl v0.0.5-0.20250305073811-995046a21efb h1:fvn8JUhIx+9mbdcsv6RV8eEHPgYuIblfTSWWCGlzIm4=
github.com/crypto-org-chain/cronos/memiavl v0.0.5-0.20250305073811-995046a21efb/go.mod h1:/7T/7E/u7KfEZUCiktYdPLke7NjZVEbRf9qukn12TIU=
github.com/crypto-org-chain/cronos/store v0.0.5-0.20250305073811-995046a21efb h1:5YrjdC8proOb9g0cImpQJL6x8765xYV5JCaC1rGEoRY=
github.com/crypto-org-chain/cronos/store v0.0.5-0.20250305073811-995046a21efb/go.mod h1:sBd1Tm9gxgbhM5/P8x0Foior2oXoaJDKPUb009Ico1s=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20250305073811-995046a21efb h1:D9QvDZOQKcYJaCStgg3Slz5S+VdKRzP0ZCwvL+dYsKo=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20250305073811-995046a21efb/go.mod h1:3fjlBj7G0+zNiU2GZjSfGsVHqnZu9/9YIvFAZpEi0Ro=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0=
github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0=
Expand Down
12 changes: 6 additions & 6 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,16 @@ schema = 3
version = "v0.0.24"
hash = "sha256-4vUukHONOjNn0qfQr4esK6TWfPWsIp+rbdz65og84lw="
[mod."github.com/crypto-org-chain/cronos/memiavl"]
version = "v0.0.5-0.20241028093154-0f94930c27ce"
hash = "sha256-F7tPkSvfW8ZbURrK5uvQ9kB1h3uKRfiQyEYql3J1Q6k="
version = "v0.0.5-0.20250305073811-995046a21efb"
hash = "sha256-2iGJ1ibSXcBAor4qu5iv0VXK6aMyRIB24+xF3T28odU="
replaced = "github.com/crypto-org-chain/cronos/memiavl"
[mod."github.com/crypto-org-chain/cronos/store"]
version = "v0.0.5-0.20241028093154-0f94930c27ce"
hash = "sha256-S5INWggeFs1vBrcuVyWyS34C5I2ux+NLJ+czqQqKzUc="
version = "v0.0.5-0.20250305073811-995046a21efb"
hash = "sha256-j+JfESP1cGmtY8kvLJXzSFr2DmhCIF6zj9DWIygIdW4="
replaced = "github.com/crypto-org-chain/cronos/store"
[mod."github.com/crypto-org-chain/cronos/versiondb"]
version = "v0.0.0-20241028093154-0f94930c27ce"
hash = "sha256-dVXYagl8K+JMrIt6dqcoQTjUwwMCqrMmAfpIZimWlyE="
version = "v0.0.0-20250305073811-995046a21efb"
hash = "sha256-sIkqihphEhBq3WUvhQmLL1WcE2Dl6a0eKDYPrxD2nG8="
replaced = "github.com/crypto-org-chain/cronos/versiondb"
[mod."github.com/danieljoos/wincred"]
version = "v1.1.2"
Expand Down
Loading