Skip to content

Commit

Permalink
Problem: start with exported genesis is not tested
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Aug 23, 2023
1 parent 6bb4e23 commit 606b60a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ def export(self):
return self.raw("export", home=self.data_dir)

def unsaferesetall(self):
return self.raw("unsafe-reset-all")
return self.raw("tendermint", "unsafe-reset-all")

def create_nft(self, from_addr, denomid, denomname, schema, fees):
return json.loads(
Expand Down
18 changes: 17 additions & 1 deletion integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import subprocess
from datetime import datetime, timedelta
from pathlib import Path

import pytest
Expand All @@ -17,6 +18,7 @@
send_transaction,
wait_for_block,
wait_for_block_time,
wait_for_new_blocks,
wait_for_port,
)

Expand Down Expand Up @@ -90,7 +92,7 @@ def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory):

custom_cronos.supervisorctl("start", "cronos_777-1-node0", "cronos_777-1-node1")
wait_for_port(ports.evmrpc_port(custom_cronos.base_port(0)))

wait_for_new_blocks(cli, 1)
height = cli.block_height()
target_height = height + 15
print("upgrade height", target_height)
Expand Down Expand Up @@ -201,3 +203,17 @@ def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory):
json.dump(cli.migrate_cronos_genesis(cronos_version, str(file_path1)), fp)
fp.flush()
print(cli.validate_genesis(str(file_path2)))

# update the genesis time = current time + 5 secs
newtime = datetime.utcnow() + timedelta(seconds=5)
newtime = newtime.replace(tzinfo=None).isoformat("T") + "Z"
config = custom_cronos.config
config["genesis-time"] = newtime
for i, _ in enumerate(config["validators"]):
genesis = json.load(open(file_path2))
genesis["genesis_time"] = config.get("genesis-time")
file = custom_cronos.cosmos_cli(i).data_dir / "config/genesis.json"
file.write_text(json.dumps(genesis))
custom_cronos.supervisorctl("start", "cronos_777-1-node0", "cronos_777-1-node1")
wait_for_new_blocks(custom_cronos.cosmos_cli(), 1)
custom_cronos.supervisorctl("stop", "all")

0 comments on commit 606b60a

Please sign in to comment.