From 01d9dc6b1dcad8c622e1555f294d4db9a1c8ebee Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 28 Feb 2024 10:10:51 +0800 Subject: [PATCH] Problem: sdk v0.47.x is outdated (#1329) * Problem: different db are not tested when change client id * test revert * test db fix * fix hash * update deps * rm patch * Apply suggestions from code review --- CHANGELOG.md | 6 +++ go.mod | 2 +- go.sum | 4 +- gomod2nix.toml | 4 +- integration_tests/configs/default.jsonnet | 2 + .../{test_client_id.py => test_chain_id.py} | 14 +++++-- nix/playtests-darwin.patch | 40 ------------------- 7 files changed, 24 insertions(+), 48 deletions(-) rename integration_tests/{test_client_id.py => test_chain_id.py} (62%) delete mode 100644 nix/playtests-darwin.patch diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d8ac74044..243a728ca8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## UNRELEASED + +### Bug Fixes + +- [#1329](https://github.com/crypto-org-chain/cronos/pull/1329) Update cosmos-sdk to `v0.47.10`. + *February 19, 2024* ## v1.1.0-rc4 diff --git a/go.mod b/go.mod index f1162620da..e5e797455f 100644 --- a/go.mod +++ b/go.mod @@ -231,7 +231,7 @@ replace ( // Use cosmos keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 github.com/cometbft/cometbft-db => github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63 - github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240220010730-59107173536d + github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240228013111-9bd1e035ed1d github.com/crypto-org-chain/cronos/memiavl => ./memiavl github.com/crypto-org-chain/cronos/store => ./store github.com/crypto-org-chain/cronos/versiondb => ./versiondb diff --git a/go.sum b/go.sum index 11d423c1ea..00ab1d5be1 100644 --- a/go.sum +++ b/go.sum @@ -486,8 +486,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63 h1:R1QJ9a3XdYMSKo+1RdFifxb/g3lNypC52L/rpYrWoKo= github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63/go.mod h1:rocwIfnS+kA060x64gkSIRvWB9StSppIkJuo5MWzL24= -github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240220010730-59107173536d h1:f7HLmQWOUhBeR0ROlODBbNfyc+e6QImZClZCBf0A+1w= -github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240220010730-59107173536d/go.mod h1:cmAawe8FV/52oPKbgeHLt4UpNkrNu8R5KD+kw0kxJFc= +github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240228013111-9bd1e035ed1d h1:ihUBUAEwQYHZEqf7lXrJithNCUJTjB8q3oSQA6Nevco= +github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240228013111-9bd1e035ed1d/go.mod h1:cmAawe8FV/52oPKbgeHLt4UpNkrNu8R5KD+kw0kxJFc= github.com/crypto-org-chain/ethermint v0.6.1-0.20240215080911-ebecd4c35025 h1:lc8T/ho1MtbKydKhUfF2DB74Me8+rQnD2n1FjUKLqMo= github.com/crypto-org-chain/ethermint v0.6.1-0.20240215080911-ebecd4c35025/go.mod h1:T3Tkhw8XMu8rYObcXpeTqGUaKogS+DKsGPD3ulHN/mg= github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e h1:vnyepPQ/m25+19xcTuBUdRxmltZ/EjVWNqEjhg7Ummk= diff --git a/gomod2nix.toml b/gomod2nix.toml index 5bc3cc7ab6..427652e9e0 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -139,8 +139,8 @@ schema = 3 version = "v1.0.0-beta.4" hash = "sha256-5Kn82nsZfiEtuwhhLZqmMxdAY1tX/Fi3HJ0/MEaRohw=" [mod."github.com/cosmos/cosmos-sdk"] - version = "v0.46.0-beta2.0.20240220010730-59107173536d" - hash = "sha256-OXWcFgNN+YwnW63S/Iw1fB9TKCiuMM1z+FthUo2yihc=" + version = "v0.46.0-beta2.0.20240228013111-9bd1e035ed1d" + hash = "sha256-lvsMDhV9WTZ/MRFxPukGoz8hhflqpC3aPXD0tul59fc=" replaced = "github.com/crypto-org-chain/cosmos-sdk" [mod."github.com/cosmos/go-bip39"] version = "v1.0.0" diff --git a/integration_tests/configs/default.jsonnet b/integration_tests/configs/default.jsonnet index ce55711d7f..24cd3d4540 100644 --- a/integration_tests/configs/default.jsonnet +++ b/integration_tests/configs/default.jsonnet @@ -4,11 +4,13 @@ cmd: 'cronosd', 'start-flags': '--trace', config: { + db_backend: 'rocksdb', mempool: { version: 'v1', }, }, 'app-config': { + chain_id: 'cronos_777-1', 'app-db-backend': 'pebbledb', 'minimum-gas-prices': '0basetcro', 'index-events': ['ethereum_tx.ethereumTxHash'], diff --git a/integration_tests/test_client_id.py b/integration_tests/test_chain_id.py similarity index 62% rename from integration_tests/test_client_id.py rename to integration_tests/test_chain_id.py index c6b4e6ffa0..c704a3b65c 100644 --- a/integration_tests/test_client_id.py +++ b/integration_tests/test_chain_id.py @@ -1,8 +1,9 @@ import json +import pytest from pystarport import ports -from .utils import wait_for_port +from .utils import wait_for_block, wait_for_port def test_config_client_id(cronos): @@ -13,7 +14,7 @@ def test_config_client_id(cronos): cli = cronos.cosmos_cli(0) dir = cli.data_dir / "config" - def assert_chain_id(chain_id): + def assert_chain_id(chain_id, timeout=None): genesis_cfg = dir / "genesis.json" genesis = json.loads(genesis_cfg.read_text()) genesis["chain_id"] = f"cronos_{chain_id}-1" @@ -21,7 +22,14 @@ def assert_chain_id(chain_id): cronos.supervisorctl("start", n0) wait_for_port(ports.evmrpc_port(p0)) assert w3.eth.chain_id == chain_id + height = w3.eth.get_block_number() + 2 + # check CONSENSUS FAILURE + if timeout is None: + wait_for_block(cli, height) + else: + with pytest.raises(TimeoutError): + wait_for_block(cli, height, timeout) - assert_chain_id(776) + assert_chain_id(776, 5) cronos.supervisorctl("stop", n0) assert_chain_id(777) diff --git a/nix/playtests-darwin.patch b/nix/playtests-darwin.patch deleted file mode 100644 index 454489a24a..0000000000 --- a/nix/playtests-darwin.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/tests/playTests.sh -+++ b/tests/playTests.sh -@@ -112,29 +112,19 @@ case "$OS" in - esac - - case "$UNAME" in -- Darwin) MD5SUM="md5 -r" ;; -- FreeBSD) MD5SUM="gmd5sum" ;; -- NetBSD) MD5SUM="md5 -n" ;; -- OpenBSD) MD5SUM="md5" ;; - *) MD5SUM="md5sum" ;; - esac - - MTIME="stat -c %Y" --case "$UNAME" in -- Darwin | FreeBSD | OpenBSD | NetBSD) MTIME="stat -f %m" ;; --esac - - assertSameMTime() { - MT1=$($MTIME "$1") - MT2=$($MTIME "$2") - echo MTIME $MT1 $MT2 - [ "$MT1" = "$MT2" ] || die "mtime on $1 doesn't match mtime on $2 ($MT1 != $MT2)" - } - - GET_PERMS="stat -c %a" --case "$UNAME" in -- Darwin | FreeBSD | OpenBSD | NetBSD) GET_PERMS="stat -f %Lp" ;; --esac - - assertFilePermissions() { - STAT1=$($GET_PERMS "$1") -@@ -967,7 +957,6 @@ $MD5SUM dirTestDict/* > tmph1 - zstd -f --rm dirTestDict/* -D tmpDictC - zstd -d --rm dirTestDict/*.zst -D tmpDictC # note : use internal checksum by default - case "$UNAME" in -- Darwin) println "md5sum -c not supported on OS-X : test skipped" ;; # not compatible with OS-X's md5 - *) $MD5SUM -c tmph1 ;; - esac - rm -rf dirTestDict