Skip to content

Commit

Permalink
upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Apr 12, 2024
1 parent 85225c7 commit 680056d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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" ([
Expand Down
12 changes: 11 additions & 1 deletion integration_tests/configs/upgrade-test-package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
]
4 changes: 2 additions & 2 deletions integration_tests/test_gov_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_ibc_update_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
6 changes: 3 additions & 3 deletions integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 680056d

Please sign in to comment.