Skip to content

Commit

Permalink
Merge branch 'main' into optional-checktx
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang authored Oct 23, 2024
2 parents 9694508 + 572aae7 commit f9c3e33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,15 +866,19 @@ 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

w3 = cronos.w3
cli = cronos.cosmos_cli()
block_gas_limit = 81500000
tx_gas_limit = 80000000
max_tx_in_block = block_gas_limit // min(max_gas_wanted, tx_gas_limit)
Expand Down
5 changes: 4 additions & 1 deletion integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,14 @@ def wait_for_block(cli, height, timeout=240):
raise TimeoutError(f"wait for block {height} timeout")


def wait_for_new_blocks(cli, n, sleep=0.5):
def wait_for_new_blocks(cli, n, sleep=0.5, timeout=240):
cur_height = begin_height = int(get_sync_info(cli.status())["latest_block_height"])
start_time = time.time()
while cur_height - begin_height < n:
time.sleep(sleep)
cur_height = int(get_sync_info(cli.status())["latest_block_height"])
if time.time() - start_time > timeout:
raise TimeoutError(f"wait for block {begin_height + n} timeout")
return cur_height


Expand Down

0 comments on commit f9c3e33

Please sign in to comment.