Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Github API Request
id: request
uses: octokit/request-action@v2.0.0
uses: octokit/request-action@main
if: github.event_name == 'issue_comment'
with:
route: ${{ github.event.issue.pull_request.url }}
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
### Bug Fixes

* [#1748](https://github.com/crypto-org-chain/cronos/pull/1748) Query with GetCFWithTS to compare both timestamp and key to avoid run fixdata multiple times.
* (versiondb) [#1751](https://github.com/crypto-org-chain/cronos/pull/1751) Add missing Destroy for read options to properly hold and release options reference.
* [#1753](https://github.com/crypto-org-chain/cronos/pull/1753) Support legacy global AccountNumber.

### Improvements

Expand Down
72 changes: 45 additions & 27 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
flake = false;
};
gomod2nix = {
url = "github:obreitwi/gomod2nix/fix/go_mod_vendor";
url = "github:nix-community/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/crypto-org-chain/cronos/v2

go 1.23.1
go 1.23.3

require (
cosmossdk.io/api v0.7.6
Expand Down Expand Up @@ -253,7 +253,7 @@ require (
replace (
cosmossdk.io/store => github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241217090828-cfbca9fe8254
cosmossdk.io/x/tx => github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241217090828-cfbca9fe8254
github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.43.0-beta1.0.20241217090828-cfbca9fe8254
github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.43.0-beta1.0.20250224030921-39d7b26bbb97
)

replace (
Expand All @@ -272,7 +272,7 @@ replace (
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a
// release/v1.4.x
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20241217093037-21bd7ce300e8
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.6.1-0.20250109075157-62042e2252f6
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,14 @@ github.com/crypto-org-chain/btree v0.0.0-20240406140148-2687063b042c h1:MOgfS4+F
github.com/crypto-org-chain/btree v0.0.0-20240406140148-2687063b042c/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY=
github.com/crypto-org-chain/cometbft v0.0.0-20250203071505-1964da4a0cac h1:o09a/x43av8lYlJ0c8ChRU11iGYyqMvbeOz7skV6f6Y=
github.com/crypto-org-chain/cometbft v0.0.0-20250203071505-1964da4a0cac/go.mod h1:khbgmtxbgwJfMqDmnGY4rl2sQpTdzpPb1f9nqnfpy1o=
github.com/crypto-org-chain/cosmos-sdk v0.43.0-beta1.0.20241217090828-cfbca9fe8254 h1:qmTKLerKyvXGxIt4lThZ9QPpZYw9w8e4Bm36CNPI5S8=
github.com/crypto-org-chain/cosmos-sdk v0.43.0-beta1.0.20241217090828-cfbca9fe8254/go.mod h1:JwwsMeZldLN20b72mmbWPY0EV9rs+v/12hRu1JFttvY=
github.com/crypto-org-chain/cosmos-sdk v0.43.0-beta1.0.20250224030921-39d7b26bbb97 h1:Aj5lZUTybx2x4fcHNYqWT4Ih8sql6qZkUFRytqwgcmo=
github.com/crypto-org-chain/cosmos-sdk v0.43.0-beta1.0.20250224030921-39d7b26bbb97/go.mod h1:JwwsMeZldLN20b72mmbWPY0EV9rs+v/12hRu1JFttvY=
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241217090828-cfbca9fe8254 h1:NEgy0r3otU/O+0OAjMdEhbn4VotQlg+98hHbD7M23wU=
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20241217090828-cfbca9fe8254/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM=
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241217090828-cfbca9fe8254 h1:JzLOFRiKsDtLJt5h0M0jkEIPDKvFFyja7VEp7gG6O9U=
github.com/crypto-org-chain/cosmos-sdk/x/tx v0.0.0-20241217090828-cfbca9fe8254/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
github.com/crypto-org-chain/ethermint v0.6.1-0.20241217093037-21bd7ce300e8 h1:R07pGqWiqQNJonAA6htHUlniWRYP4ZnZEAVLLWX6E8Y=
github.com/crypto-org-chain/ethermint v0.6.1-0.20241217093037-21bd7ce300e8/go.mod h1:9FNO9k70szJ7CEge4tnJraWu3baTbwNxjpZhZBqlMok=
github.com/crypto-org-chain/ethermint v0.6.1-0.20250109075157-62042e2252f6 h1:TFO18Bi2Rp/N/9T+6xSXXHM5CBY8MKSDdo/o39aeBZU=
github.com/crypto-org-chain/ethermint v0.6.1-0.20250109075157-62042e2252f6/go.mod h1:b/zGbkkYhrshNpuHTk1sCA5Teyo5d3Ex3CpPdq8f+ZA=
github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716 h1:OvD5Rm0B6LHUJk6z858UgwdP72jU2DuUdXeclRyKpDI=
github.com/crypto-org-chain/go-block-stm v0.0.0-20240919080136-6c49aef68716/go.mod h1:iwQTX9xMX8NV9k3o2BiWXA0SswpsZrDk5q3gA7nWYiE=
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20240926023215-d2275b4afb9a h1:IUPD+dg1YQl8cLocxQ/Mbx/ObTgAgcrZlcBhFjsLO40=
Expand Down
11 changes: 5 additions & 6 deletions gomod2nix.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration_tests/configs/upgrade-test-package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let
(fetchFlake "crypto-org-chain/cronos" "1aea999eef67a0a01b22422bad94b36e45b9759a").default;
# release/v1.3.x
released1_3 =
(fetchFlake "crypto-org-chain/cronos" "e1d819c862b30f0ce978baf2addb12516568639e").default;
(fetchFlake "crypto-org-chain/cronos" "dd3cea2df41732ef030a1f830244e340f3cf6bf0").default;
# release/v1.4.x
released1_4 =
(fetchFlake "crypto-org-chain/cronos" "ce797fa995000530ee53cd1fbeb3c67180648002").default;
Expand Down
5 changes: 5 additions & 0 deletions integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,11 @@ def restore_versiondb(self, height, format=3):
"changeset", "restore-versiondb", height, format, home=self.data_dir
)

def changeset_fixdata(self, versiondb_dir, dry_run=False):
return self.raw(
"changeset", "fixdata", versiondb_dir, "--dry-run" if dry_run else None
)

def dump_snapshot(self, height, tarball, format=3):
return self.raw(
"snapshots", "dump", height, format, home=self.data_dir, output=tarball
Expand Down
22 changes: 22 additions & 0 deletions integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import shutil
import stat
import subprocess
import time
from contextlib import contextmanager
from datetime import datetime, timedelta
from pathlib import Path
Expand All @@ -19,6 +20,7 @@
assert_gov_params,
deploy_contract,
edit_ini_sections,
eth_to_bech32,
get_consensus_params,
get_send_enable,
send_transaction,
Expand Down Expand Up @@ -291,6 +293,23 @@ def do_upgrade(plan_name, target, mode=None):
assert txs == get_txs(base_port, height)

gov_param = cli.query_params("gov")

c.supervisorctl("stop", "cronos_777-1-node0")
time.sleep(3)
cli.changeset_fixdata(f"{c.base_dir}/node0/data/versiondb")
print(cli.changeset_fixdata(f"{c.base_dir}/node0/data/versiondb", dry_run=True))
c.supervisorctl("start", "cronos_777-1-node0")
wait_for_port(ports.evmrpc_port(c.base_port(0)))

to = "0x2D5B6C193C39D2AECb4a99052074E6F325258a0f"
with pytest.raises(AssertionError) as err:
cli.query_account(eth_to_bech32(to))
assert "crc194dkcxfu88f2aj62nyzjqa8x7vjjtzs0jwcj06 not found" in str(err.value)
receipt = send_transaction(w3, {"to": to, "value": 10, "gas": 21000})
method = "debug_traceTransaction"
params = [receipt["transactionHash"].hex(), {"tracer": "callTracer"}]
tx_bf = w3.provider.make_request(method, params)

cli = do_upgrade("v1.4", cli.block_height() + 15)

assert_evm_params(cli, e0, target_height0 - 1)
Expand All @@ -305,6 +324,9 @@ def do_upgrade(plan_name, target, mode=None):
cli = do_upgrade("v1.4.0-rc5-testnet", cli.block_height() + 15)
check_basic_tx(c)

tx_af = w3.provider.make_request(method, params)
assert tx_af.get("result") == tx_bf.get("result"), tx_af


def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory):
exec(custom_cronos, tmp_path_factory)
20 changes: 19 additions & 1 deletion nix/build_overlay.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# some basic overlays necessary for the build
final: super: {
final: super:
let
replaceLast =
newVal: l:
let
len = builtins.length l;
in
if len == 0 then [ ] else final.lib.lists.take (len - 1) l ++ [ newVal ];
in
{
go_1_23 = super.go_1_23.overrideAttrs (old: rec {
version = "1.23.4";
src = final.fetchurl {
url = "https://go.dev/dl/go${version}.src.tar.gz";
hash = "sha256-rTRaxCHpCBQpOpaZzKGd1SOCUcP2h5gLvK4oSVsmNTE=";
};
# https://github.com/NixOS/nixpkgs/pull/372367
patches = replaceLast ./go_no_vendor_checks-1.23.patch old.patches;
});
rocksdb = final.callPackage ./rocksdb.nix { };
golangci-lint = final.callPackage ./golangci-lint.nix { };
}
26 changes: 26 additions & 0 deletions nix/go_no_vendor_checks-1.23.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/src/cmd/go/internal/modload/import.go b/src/cmd/go/internal/modload/import.go
index a3105b6b6d..0e10154a70 100644
--- a/src/cmd/go/internal/modload/import.go
+++ b/src/cmd/go/internal/modload/import.go
@@ -345,7 +345,7 @@ func importFromModules(ctx context.Context, path string, rs *Requirements, mg *M
// vendor/modules.txt does not exist or the user manually added directories to the vendor directory.
// Go 1.23 and later require vendored packages to be present in modules.txt to be imported.
_, ok := vendorPkgModule[path]
- if ok || (gover.Compare(MainModules.GoVersion(), gover.ExplicitModulesTxtImportVersion) < 0) {
+ if ok || (gover.Compare(MainModules.GoVersion(), gover.ExplicitModulesTxtImportVersion) < 0) || os.Getenv("GO_NO_VENDOR_CHECKS") == "1" {
mods = append(mods, vendorPkgModule[path])
dirs = append(dirs, dir)
roots = append(roots, vendorDir)
diff --git a/src/cmd/go/internal/modload/vendor.go b/src/cmd/go/internal/modload/vendor.go
index b2cb44100e..05bf3829d5 100644
--- a/src/cmd/go/internal/modload/vendor.go
+++ b/src/cmd/go/internal/modload/vendor.go
@@ -159,7 +159,7 @@ func checkVendorConsistency(indexes []*modFileIndex, modFiles []*modfile.File, m
panic(fmt.Errorf("not in workspace mode but number of indexes is %v, not 1", len(indexes)))
}
index := indexes[0]
- if gover.Compare(index.goVersion, "1.14") < 0 {
+ if gover.Compare(index.goVersion, "1.14") < 0 || (os.Getenv("GO_NO_VENDOR_CHECKS") == "1" && len(vendorMeta) == 0) {
// Go versions before 1.14 did not include enough information in
// vendor/modules.txt to check for consistency.
// If we know that we're on an earlier version, relax the consistency check.
10 changes: 5 additions & 5 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"gomod2nix": {
"branch": "fix/go_mod_vendor",
"branch": "master",
"description": "Convert applications using Go modules to Nix expressions",
"homepage": null,
"owner": "obreitwi",
"owner": "nix-community",
"repo": "gomod2nix",
"rev": "983228366edc1bed1be6e6f7a45e285b4707b9ba",
"sha256": "1pz4qymn6755p96ai00birvj2y5wrkv6wkyi40y8vpqzs2s60pnj",
"rev": "514283ec89c39ad0079ff2f3b1437404e4cba608",
"sha256": "tPsqU00FhgdFr0JiQUiBMgPVbl1jbPCY5gbFiJycL3I=",
"type": "tarball",
"url": "https://github.com/obreitwi/gomod2nix/archive/983228366edc1bed1be6e6f7a45e285b4707b9ba.tar.gz",
"url": "https://github.com/nix-community/gomod2nix/archive/514283ec89c39ad0079ff2f3b1437404e4cba608.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"gravity-bridge": {
Expand Down
8 changes: 6 additions & 2 deletions versiondb/tsrocksdb/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ func (s Store) PutAtVersion(version int64, changeSet []*types.StoreKVPair) error
}

func (s Store) GetAtVersionSlice(storeKey string, key []byte, version *int64) (*grocksdb.Slice, error) {
readOpts := newTSReadOptions(version)
defer readOpts.Destroy()
value, ts, err := s.db.GetCFWithTS(
newTSReadOptions(version),
readOpts,
s.cfHandle,
prependStoreKey(storeKey, key),
)
Expand Down Expand Up @@ -164,7 +166,9 @@ func (s Store) iteratorAtVersion(storeKey string, start, end []byte, version *in
prefix := storePrefix(storeKey)
start, end = iterateWithPrefix(prefix, start, end)

itr := s.db.NewIteratorCF(newTSReadOptions(version), s.cfHandle)
readOpts := newTSReadOptions(version)
defer readOpts.Destroy()
itr := s.db.NewIteratorCF(readOpts, s.cfHandle)
return newRocksDBIterator(itr, prefix, start, end, reverse, s.skipVersionZero), nil
}

Expand Down
Loading