Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
mskrzypkows committed Dec 4, 2024
1 parent 7c6df3b commit 54b672f
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions e2e_tests/test_avs_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,35 @@ def test_chain_ids(l1_client, l2_client_node1, l2_client_node2):
def test_preconfirm_transaction(l1_client, l2_client_node1):
account = l2_client_node1.eth.account.from_key(l2_prefunded_priv_key)
nonce = l2_client_node1.eth.get_transaction_count(account.address)
l1_block_number = l1_client.eth.block_number
l2_block_number = l2_client_node1.eth.block_number

send_transaction(nonce, account, '0.00005', l2_client_node1, l2_prefunded_priv_key)

wait_for_secs(12)
wait_for_secs(4)

l1_block_number_after = l1_client.eth.block_number
l2_block_number_after = l2_client_node1.eth.block_number

print(f"L1 Block Number: {l1_block_number}")
print(f"L2 Block Number: {l2_block_number}")
print(f"L1 Block Number After: {l1_block_number_after}")
print(f"L2 Block Number After: {l2_block_number_after}")

assert l1_block_number_after > l1_block_number, "L1 block number should increase after sending a transaction"
assert l2_block_number_after > l2_block_number, "L2 block number should increase after sending a transaction"

def test_p2p_preconfirmation(l2_client_node1, l2_client_node2):
account = l2_client_node1.eth.account.from_key(l2_prefunded_priv_key)
nonce = l2_client_node1.eth.get_transaction_count(account.address)
l2_node_1_block_number = l2_client_node1.eth.block_number
l2_node_2_block_number = l2_client_node2.eth.block_number

send_transaction(nonce, account, '0.00006', l2_client_node1, l2_prefunded_priv_key)

wait_for_secs(4)

l2_node_1_block_number_after = l2_client_node1.eth.block_number
l2_node_2_block_number_after = l2_client_node2.eth.block_number
node_1_block_hash = l2_client_node1.eth.get_block(l2_node_2_block_number_after).hash
node_2_block_hash = l2_client_node2.eth.get_block(l2_node_2_block_number_after).hash

print(f"L2 Node 1 Block Number: {l2_node_1_block_number}")
print(f"L2 Node 2 Block Number: {l2_node_2_block_number}")
print(f"L2 Node 1 Block Number After: {l2_node_1_block_number_after}")
print(f"L2 Node 2 Block Number After: {l2_node_2_block_number_after}")

assert l2_node_2_block_number_after > l2_node_2_block_number, "L2 Node 2 block number should increase after sending a transaction"
assert l2_node_2_block_number_after > l2_node_2_block_number, "L2 Node 2 block number should increase after sending a transaction"

assert node_2_block_hash == node_1_block_hash, "L2 Node 1 and L2 Node 2 should have the same block hash after sending a transaction"

0 comments on commit 54b672f

Please sign in to comment.