Skip to content

Commit

Permalink
Wait until EVM processes block
Browse files Browse the repository at this point in the history
  • Loading branch information
rakanalh committed Jul 13, 2024
1 parent 9b04f79 commit 3ae1061
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions bin/citrea/tests/e2e/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1336,13 +1336,21 @@ async fn test_prover_sync_with_commitments() -> Result<(), anyhow::Error> {
)
.await;
wait_for_l2_block(&seq_test_client, 8, None).await;
// Allow for the L2 block to be commited and stored
// Otherwise, the L2 block height might be registered but it hasn't
// been processed inside the EVM yet.
sleep(Duration::from_secs(1)).await;
assert_eq!(seq_test_client.eth_block_number().await, 8);
// Should now have 8 blocks = 2 commitments of blocks 1-4 and 5-9
// there is an extra soft confirmation due to the prover publishing a proof. This causes
// a new MockDa block, which in turn causes the sequencer to publish an extra soft confirmation
// becase it must not skip blocks.
wait_for_l2_block(&prover_node_test_client, 8, None).await;
assert_eq!(prover_node_test_client.eth_block_number().await, 8);
wait_for_l2_block(&prover_node_test_client, 9, None).await;
// Allow for the L2 block to be commited and stored
// Otherwise, the L2 block height might be registered but it hasn't
// been processed inside the EVM yet.
sleep(Duration::from_secs(1)).await;
assert_eq!(prover_node_test_client.eth_block_number().await, 9);
// on the 8th DA block, we should have a proof
let mut blobs = da_service.get_block_at(4).await.unwrap().blobs;

Expand Down Expand Up @@ -1510,6 +1518,10 @@ async fn test_reopen_prover() -> Result<(), anyhow::Error> {
wait_for_l2_block(&seq_test_client, 6, None).await;
// Still should have 4 blocks there are no commitments yet
wait_for_l2_block(&prover_node_test_client, 6, None).await;
// Allow for the L2 block to be commited and stored
// Otherwise, the L2 block height might be registered but it hasn't
// been processed inside the EVM yet.
sleep(Duration::from_secs(1)).await;
assert_eq!(prover_node_test_client.eth_block_number().await, 6);

thread_kill_sender.send("kill").unwrap();
Expand Down

0 comments on commit 3ae1061

Please sign in to comment.