Sync from fork #74

Merged
0xmuralik merged 232 commits from murali/update-fork into main 2023-01-10 04:50:57 +00:00
2 changed files with 19 additions and 0 deletions
Showing only changes of commit 66e8cdbe02 - Show all commits

View File

@ -12,6 +12,7 @@ from .utils import (
deploy_contract,
send_transaction,
w3_wait_for_new_blocks,
wait_for_block,
)
@ -177,6 +178,7 @@ def send_and_get_hash(w3, tx_value=10):
def test_get_proof(ethermint, geth):
wait_for_block(ethermint.cosmos_cli(), 3)
eth_rpc = ethermint.w3.provider
geth_rpc = geth.w3.provider
make_same_rpc_calls(

View File

@ -1,6 +1,7 @@
import json
import os
import socket
import sys
import time
from pathlib import Path
@ -75,6 +76,22 @@ def wait_for_new_blocks(cli, n):
break
def wait_for_block(cli, height, timeout=240):
for i in range(timeout * 2):
try:
status = cli.status()
except AssertionError as e:
print(f"get sync status failed: {e}", file=sys.stderr)
else:
current_height = int(status["SyncInfo"]["latest_block_height"])
if current_height >= height:
break
print("current block height", current_height)
time.sleep(0.5)
else:
raise TimeoutError(f"wait for block {height} timeout")
def deploy_contract(w3, jsonfile, args=(), key=KEYS["validator"]):
"""
deploy contract and return the deployed contract instance