From 680056d971460a304afe03504444553b16bb91bc Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 12 Apr 2024 16:49:27 +0800 Subject: [PATCH] upgrade --- default.nix | 2 +- integration_tests/configs/upgrade-test-package.nix | 12 +++++++++++- integration_tests/test_gov_update_params.py | 4 ++-- integration_tests/test_ibc_update_client.py | 2 +- integration_tests/test_upgrade.py | 2 +- integration_tests/utils.py | 6 +++--- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/default.nix b/default.nix index 53aa32eb0a..4501d75db8 100644 --- a/default.nix +++ b/default.nix @@ -11,7 +11,7 @@ , nativeByteOrder ? true # nativeByteOrder mode will panic on big endian machines }: let - version = "v1.2.0"; + version = "v1.3.0"; pname = "cronosd"; tags = [ "ledger" "netgo" network "rocksdb" "grocksdb_no_link" ] ++ lib.optionals nativeByteOrder [ "nativebyteorder" ]; ldflags = lib.concatStringsSep "\n" ([ diff --git a/integration_tests/configs/upgrade-test-package.nix b/integration_tests/configs/upgrade-test-package.nix index e0fc52cf30..bf3e638ca2 100644 --- a/integration_tests/configs/upgrade-test-package.nix +++ b/integration_tests/configs/upgrade-test-package.nix @@ -18,10 +18,20 @@ let }).defaultNix; # release/v1.1.x released = (fetchFlake "crypto-org-chain/cronos" "69a80154b6b24fca15f3562e2c4b312ee1092220").default; + fetchFlake1 = repo: rev: (pkgs.flake-compat { + src = { + outPath = builtins.fetchTarball "https://github.com/${repo}/archive/${rev}.tar.gz"; + inherit rev; + shortRev = builtins.substring 0 7 rev; + }; + }).defaultNix; + # release/v1.2.x + released1 = (fetchFlake1 "crypto-org-chain/cronos" "1aea999eef67a0a01b22422bad94b36e45b9759a").default; current = pkgs.callPackage ../../. { }; in pkgs.linkFarm "upgrade-test-package" [ { name = "genesis"; path = released0; } { name = "v1.1.0"; path = released; } - { name = "v1.2"; path = current; } + { name = "v1.2"; path = released1; } + { name = "v1.3"; path = current; } ] diff --git a/integration_tests/test_gov_update_params.py b/integration_tests/test_gov_update_params.py index cc9d6651cc..c78fc83747 100644 --- a/integration_tests/test_gov_update_params.py +++ b/integration_tests/test_gov_update_params.py @@ -38,7 +38,7 @@ def test_evm_update_param(cronos, tmp_path): proposal.write_text(json.dumps(proposal_src)) rsp = cli.submit_gov_proposal(proposal, from_="community") assert rsp["code"] == 0, rsp["raw_log"] - approve_proposal(cronos, rsp) + approve_proposal(cronos, rsp["events"]) print("check params have been updated now") p = cli.query_params("evm")["params"] assert not p["chain_config"]["merge_netsplit_block"] @@ -81,7 +81,7 @@ def test_gov_update_params(cronos, tmp_path): proposal.write_text(json.dumps(proposal_src)) rsp = cli.submit_gov_proposal(proposal, from_="community") assert rsp["code"] == 0, rsp["raw_log"] - approve_proposal(cronos, rsp) + approve_proposal(cronos, rsp["events"]) print("check params have been updated now") rsp = cli.query_params() print("params", rsp) diff --git a/integration_tests/test_ibc_update_client.py b/integration_tests/test_ibc_update_client.py index b13ddfa3c3..fd00cf6d07 100644 --- a/integration_tests/test_ibc_update_client.py +++ b/integration_tests/test_ibc_update_client.py @@ -128,6 +128,6 @@ def check_status(): }, ) assert rsp["code"] == 0, rsp["raw_log"] - approve_proposal(ibc.cronos, rsp) + approve_proposal(ibc.cronos, rsp["events"]) default_trust_period = "1209600s" assert_trust_period(default_trust_period) diff --git a/integration_tests/test_upgrade.py b/integration_tests/test_upgrade.py index e77b80fa0b..dbc5f332d3 100644 --- a/integration_tests/test_upgrade.py +++ b/integration_tests/test_upgrade.py @@ -146,7 +146,7 @@ def do_upgrade(plan_name, target, mode=None): mode=mode, ) assert rsp["code"] == 0, rsp["raw_log"] - approve_proposal(c, rsp) + approve_proposal(c, rsp["logs"][0]["events"]) # update cli chain binary c.chain_binary = ( diff --git a/integration_tests/utils.py b/integration_tests/utils.py index 869af6d9b0..b3cbc219ad 100644 --- a/integration_tests/utils.py +++ b/integration_tests/utils.py @@ -139,16 +139,16 @@ def wait_for_block_time(cli, t): time.sleep(0.5) -def approve_proposal(n, rsp): +def approve_proposal(n, events, event_query_tx=False): cli = n.cosmos_cli() # get proposal_id ev = find_log_event_attrs( - rsp["events"], "submit_proposal", lambda attrs: "proposal_id" in attrs + events, "submit_proposal", lambda attrs: "proposal_id" in attrs ) proposal_id = ev["proposal_id"] for i in range(len(n.config["validators"])): - rsp = n.cosmos_cli(i).gov_vote("validator", proposal_id, "yes", gas=100000) + rsp = n.cosmos_cli(i).gov_vote("validator", proposal_id, "yes", event_query_tx) assert rsp["code"] == 0, rsp["raw_log"] wait_for_new_blocks(cli, 1) res = cli.query_tally(proposal_id)