-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
280 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
local ibc = import 'ibc.jsonnet'; | ||
|
||
ibc { | ||
'cronos_777-1'+: { | ||
'app-config'+: { | ||
'app-db-backend': 'rocksdb', | ||
'iavl-lazy-loading':: super['iavl-lazy-loading'], | ||
}, | ||
validators: [super.validators[0] { | ||
'app-config'+: { | ||
store: { | ||
streamers: ['versiondb'], | ||
}, | ||
}, | ||
}] + super.validators[1:], | ||
genesis+: { | ||
consensus_params: { | ||
block: { | ||
max_bytes: '1048576', | ||
max_gas: '81500000', | ||
}, | ||
}, | ||
app_state+: { | ||
gov+: { | ||
params+: { | ||
expedited_voting_period:: super['expedited_voting_period'], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
let | ||
pkgs = import ../../nix { }; | ||
fetchFlake = | ||
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.3.x | ||
releasedGenesis = | ||
(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" [ | ||
{ | ||
name = "genesis"; | ||
path = releasedGenesis; | ||
} | ||
{ | ||
name = "v1.4"; | ||
path = released1_4; | ||
} | ||
{ | ||
name = "v1.4.0-rc5-testnet"; | ||
path = current; | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import json | ||
import shutil | ||
import stat | ||
import subprocess | ||
from pathlib import Path | ||
|
||
import pytest | ||
import requests | ||
from pystarport import cluster, ports | ||
|
||
from .ibc_utils import ( | ||
assert_channel_open_init, | ||
prepare_network, | ||
wait_for_check_channel_ready, | ||
) | ||
from .utils import do_upgrade, post_init | ||
|
||
pytestmark = pytest.mark.upgrade | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def ibc(tmp_path_factory): | ||
path = tmp_path_factory.mktemp("upgrade") | ||
nix_name = "upgrade-test-package-recent" | ||
configdir = Path(__file__).parent | ||
name = "cosmovisor_with_ibc" | ||
cmd = [ | ||
"nix-build", | ||
configdir / f"configs/{nix_name}.nix", | ||
] | ||
print(*cmd) | ||
subprocess.run(cmd, check=True) | ||
|
||
# copy the content so the new directory is writable. | ||
upgrades = path / "upgrades" | ||
shutil.copytree("./result", upgrades) | ||
mod = stat.S_IRWXU | ||
upgrades.chmod(mod) | ||
for d in upgrades.iterdir(): | ||
d.chmod(mod) | ||
|
||
yield from prepare_network( | ||
path, | ||
name, | ||
incentivized=False, | ||
connection_only=True, | ||
post_init=post_init, | ||
chain_binary=str(upgrades / "genesis/bin/cronosd"), | ||
relayer=cluster.Relayer.RLY.value, | ||
) | ||
|
||
|
||
def get_tx(base_port, hash): | ||
p = ports.api_port(base_port) | ||
url = f"http://127.0.0.1:{p}/cosmos/tx/v1beta1/txs/{hash}" | ||
return requests.get(url).json() | ||
|
||
|
||
def test_cosmovisor_upgrade(ibc): | ||
c = ibc.cronos | ||
cli = c.cosmos_cli() | ||
connid = "connection-0" | ||
v = json.dumps({"fee_version": "ics29-1", "app_version": ""}) | ||
signer = "signer2" | ||
rsp = cli.icaauth_register_account( | ||
connid, | ||
from_=signer, | ||
gas="400000", | ||
version=v, | ||
) | ||
ica_txhash = rsp["txhash"] | ||
_, channel_id = assert_channel_open_init(rsp) | ||
wait_for_check_channel_ready(cli, connid, channel_id) | ||
ica_address = cli.icaauth_query_account( | ||
connid, | ||
cli.address(signer), | ||
)["interchain_account_address"] | ||
print("ica address", ica_address, "channel_id", channel_id) | ||
base_port = c.base_port(0) | ||
ica_bf = get_tx(base_port, ica_txhash) | ||
cli = do_upgrade(c, "v1.4", cli.block_height() + 15) | ||
|
||
with pytest.raises(AssertionError): | ||
cli.query_params("icaauth") | ||
|
||
cli = do_upgrade(c, "v1.4.0-rc5-testnet", cli.block_height() + 15) | ||
ica_af = get_tx(base_port, ica_txhash) | ||
assert ica_bf == ica_af, ica_af |
Oops, something went wrong.