upgrade to ethermint v0.21.0 #99
@ -44,9 +44,8 @@ func (b *Backend) GetProof(address common.Address, storageKeys []string, blockNr
|
||||
height := blockNum.Int64()
|
||||
_, err = b.GetTendermintBlockByNumber(blockNum)
|
||||
if err != nil {
|
||||
// Get 'latest' proof if query is in the future
|
||||
// this imitates geth behavior
|
||||
height = 0
|
||||
// the error message imitates geth behavior
|
||||
return nil, errors.New("header not found")
|
||||
}
|
||||
ctx := rpctypes.ContextWithHeight(height)
|
||||
|
||||
|
@ -11,8 +11,8 @@ from .utils import (
|
||||
KEYS,
|
||||
deploy_contract,
|
||||
send_transaction,
|
||||
w3_wait_for_block,
|
||||
w3_wait_for_new_blocks,
|
||||
wait_for_block,
|
||||
)
|
||||
|
||||
|
||||
@ -178,7 +178,9 @@ def send_and_get_hash(w3, tx_value=10):
|
||||
|
||||
|
||||
def test_get_proof(ethermint, geth):
|
||||
wait_for_block(ethermint.cosmos_cli(), 3)
|
||||
# on ethermint the proof query will fail for block numbers <= 2
|
||||
# so we must wait for several blocks
|
||||
w3_wait_for_block(ethermint.w3, 3)
|
||||
eth_rpc = ethermint.w3.provider
|
||||
geth_rpc = geth.w3.provider
|
||||
make_same_rpc_calls(
|
||||
@ -192,7 +194,7 @@ def test_get_proof(ethermint, geth):
|
||||
eth_rpc,
|
||||
geth_rpc,
|
||||
"eth_getProof",
|
||||
["0x57f96e6b86cdefdb3d412547816a82e3e0ebf9d2", ["0x0"], "0x32"],
|
||||
["0x57f96e6b86cdefdb3d412547816a82e3e0ebf9d2", ["0x0"], "0x1024"],
|
||||
)
|
||||
|
||||
_ = send_and_get_hash(ethermint.w3)
|
||||
|
@ -92,6 +92,21 @@ def wait_for_block(cli, height, timeout=240):
|
||||
raise TimeoutError(f"wait for block {height} timeout")
|
||||
|
||||
|
||||
def w3_wait_for_block(w3, height, timeout=240):
|
||||
for i in range(timeout * 2):
|
||||
try:
|
||||
current_height = w3.eth.block_number
|
||||
except Exception as e:
|
||||
print(f"get json-rpc block number failed: {e}", file=sys.stderr)
|
||||
else:
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user