Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: submit-legacy-proposal doesn't work for rc5 #1699

Merged
merged 3 commits into from
Nov 19, 2024
Merged
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
7 changes: 7 additions & 0 deletions integration_tests/configs/upgrade-test-package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ let
# release/v1.3.x
released1_3 =
(fetchFlake "crypto-org-chain/cronos" "e1d819c862b30f0ce978baf2addb12516568639e").default;
# release/v1.4.x
released1_4 =
(fetchFlake "crypto-org-chain/cronos" "ce797fa995000530ee53cd1fbeb3c67180648002").default;
current = pkgs.callPackage ../../. { };
in
pkgs.linkFarm "upgrade-test-package" [
Expand All @@ -42,6 +45,10 @@ pkgs.linkFarm "upgrade-test-package" [
}
{
name = "v1.4";
path = released1_4;
}
{
name = "v1.4.0-rc5-testnet";
path = current;
}
]
29 changes: 29 additions & 0 deletions integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,35 @@ def edit_validator(
)
)

def software_upgrade(self, proposer, proposal, **kwargs):
kwargs.setdefault("gas_prices", DEFAULT_GAS_PRICE)
kwargs.setdefault("gas", DEFAULT_GAS)
rsp = json.loads(
self.raw(
"tx",
"upgrade",
"software-upgrade",
proposal["name"],
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
"-y",
"--no-validate",
from_=proposer,
# content
title=proposal.get("title"),
note=proposal.get("note"),
upgrade_height=proposal.get("upgrade-height"),
upgrade_time=proposal.get("upgrade-time"),
upgrade_info=proposal.get("upgrade-info"),
summary=proposal.get("summary"),
deposit=proposal.get("deposit"),
# basic
home=self.data_dir,
**kwargs,
)
)
if rsp["code"] == 0:
rsp = self.event_query_tx_for(rsp["txhash"])
return rsp

def gov_propose_legacy(self, proposer, kind, proposal, mode="block", **kwargs):
kwargs.setdefault("gas_prices", DEFAULT_GAS_PRICE)
kwargs.setdefault("gas", DEFAULT_GAS)
Expand Down
6 changes: 1 addition & 5 deletions integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,18 +865,14 @@ def fn(cmd):
cronos.base_dir / "tasks.ini",
lambda cmd: fn(cmd),
)
cli = cronos.cosmos_cli()
# update right after a new block start
wait_for_new_blocks(cli, 1, sleep=0.1)
cronos.supervisorctl("update")
# ensure nodes stop and start at the same time
time.sleep(2)
wait_for_port(ports.evmrpc_port(cronos.base_port(0)))

# reset to origin_cmd only
if max_gas_wanted is None:
return

cli = cronos.cosmos_cli()
w3 = cronos.w3
block_gas_limit = 81500000
tx_gas_limit = 80000000
Expand Down
60 changes: 35 additions & 25 deletions integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,36 @@ def exec(c, tmp_path_factory):
wait_for_new_blocks(cli, 1)

def do_upgrade(plan_name, target, mode=None):
rsp = cli.gov_propose_legacy(
"community",
"software-upgrade",
{
"name": plan_name,
"title": "upgrade test",
"description": "ditto",
"upgrade-height": target,
"deposit": "10000basetcro",
},
mode=mode,
)
assert rsp["code"] == 0, rsp["raw_log"]
approve_proposal(c, rsp["logs"][0]["events"])
print(f"upgrade {plan_name} height: {target}")
if plan_name == "v1.4.0-rc5-testnet":
rsp = cli.software_upgrade(
"community",
{
"name": plan_name,
"title": "upgrade test",
"note": "ditto",
"upgrade-height": target,
"summary": "summary",
"deposit": "10000basetcro",
},
)
assert rsp["code"] == 0, rsp["raw_log"]
approve_proposal(c, rsp["events"])
else:
rsp = cli.gov_propose_legacy(
"community",
"software-upgrade",
{
"name": plan_name,
"title": "upgrade test",
"description": "ditto",
"upgrade-height": target,
"deposit": "10000basetcro",
},
mode=mode,
)
assert rsp["code"] == 0, rsp["raw_log"]
approve_proposal(c, rsp["logs"][0]["events"])

# update cli chain binary
c.chain_binary = (
Expand All @@ -190,14 +206,11 @@ def do_upgrade(plan_name, target, mode=None):
cli.migrate_keystore()
height = cli.block_height()
target_height0 = height + 15
print("upgrade v1.1 height", target_height0)

cli = do_upgrade("v1.1.0", target_height0, "block")
check_basic_tx(c)

height = cli.block_height()
target_height1 = height + 15
print("upgrade v1.2 height", target_height1)

w3 = c.w3
random_contract = deploy_contract(
Expand Down Expand Up @@ -269,18 +282,12 @@ def do_upgrade(plan_name, target, mode=None):
wait_for_new_blocks(c.cosmos_cli(), 1)

height = cli.block_height()
target_height2 = height + 15
print("upgrade v1.3 height", target_height2)
txs = get_txs(base_port, height)
do_upgrade("v1.3", target_height2)
cli = do_upgrade("v1.3", height + 15)
assert txs == get_txs(base_port, height)

height = cli.block_height()
target_height3 = height + 15
print("upgrade v1.4 height", target_height2)
gov_param = cli.query_params("gov")

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

assert_evm_params(cli, e0, target_height0 - 1)
assert_evm_params(cli, e1, target_height1 - 1)
Expand All @@ -291,6 +298,9 @@ def do_upgrade(plan_name, target, mode=None):
cli.query_params("icaauth")
assert_gov_params(cli, gov_param)

cli = do_upgrade("v1.4.0-rc5-testnet", cli.block_height() + 15)
check_basic_tx(c)


def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory):
exec(custom_cronos, tmp_path_factory)
Loading
Loading