Skip to content

Commit

Permalink
test: debug trace
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Feb 7, 2024
1 parent 7c4fb92 commit fcaf830
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions tests/integration_tests/test_debug_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def test_trace_blk(ethermint):
sender = acc.address
# fund new sender
fund = 3000000000000000000
blk = wait_for_new_blocks(cli, 1, sleep=0.1)
tx = {"to": sender, "value": fund, "gasPrice": w3.eth.gas_price}
send_transaction(w3, tx)
assert w3.eth.get_balance(sender, "latest") == fund
Expand All @@ -39,13 +40,20 @@ def test_trace_blk(ethermint):
res = w3.eth.wait_for_transaction_receipt(txhash)
assert res.status == 1

url = f"http://127.0.0.1:{ports.evmrpc_port(ethermint.base_port(0))}"
params = {
"method": "debug_traceBlockByNumber",
"params": [hex(blk + 1)],
"id": 1,
"jsonrpc": "2.0",
}
rsp = requests.post(url, json=params)
assert rsp.status_code == 200
assert len(rsp.json()["result"]) == 2
def trace_blk(blk):
url = f"http://127.0.0.1:{ports.evmrpc_port(ethermint.base_port(0))}"
params = {
"method": "debug_traceBlockByNumber",
"params": [hex(blk + 1)],
"id": 1,
"jsonrpc": "2.0",
}
rsp = requests.post(url, json=params)
assert rsp.status_code == 200
return rsp.json()["result"]

total = len(trace_blk(blk))
expected = 2
if total < expected:
total += len(trace_blk(blk + 1))
assert total == expected

0 comments on commit fcaf830

Please sign in to comment.