Skip to content

Commit 59ce877

Browse files
fix(prover): test_prover_fullnode_commitment_sync_with_racing_transactions
1 parent c87081e commit 59ce877

File tree

1 file changed

+7
-6
lines changed
  • crates/node_types/prover/src/prover/tests

1 file changed

+7
-6
lines changed

crates/node_types/prover/src/prover/tests/mod.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::*;
2-
use prism_common::test_transaction_builder::TestTransactionBuilder;
2+
use prism_common::{digest::Digest, test_transaction_builder::TestTransactionBuilder};
33
use prism_keys::{CryptoAlgorithm, SigningKey, VerifyingKey};
44
use prism_tree::proofs::Proof;
55
use std::{self, sync::Arc, time::Duration};
@@ -366,7 +366,7 @@ async fn test_prover_fullnode_commitment_sync_with_racing_transactions() {
366366
let mut prover_synced = false;
367367
let mut fullnode_synced = false;
368368

369-
for _ in 0..50 {
369+
for _ in 0..10 {
370370
// 5 second timeout
371371
let prover_height = prover.get_db().get_last_synced_height().unwrap_or(0);
372372
let fullnode_height = fullnode.get_db().get_last_synced_height().unwrap_or(0);
@@ -383,7 +383,7 @@ async fn test_prover_fullnode_commitment_sync_with_racing_transactions() {
383383
break;
384384
}
385385

386-
tokio::time::sleep(Duration::from_millis(100)).await;
386+
tokio::time::sleep(Duration::from_millis(500)).await;
387387
}
388388

389389
assert!(
@@ -401,7 +401,7 @@ async fn test_prover_fullnode_commitment_sync_with_racing_transactions() {
401401
}
402402

403403
// Wait a bit for transactions to be processed
404-
tokio::time::sleep(Duration::from_millis(100)).await;
404+
tokio::time::sleep(Duration::from_millis(150)).await;
405405

406406
// Submit racing transactions that arrive while prover is creating proof
407407
for transaction in racing_transactions {
@@ -419,8 +419,9 @@ async fn test_prover_fullnode_commitment_sync_with_racing_transactions() {
419419
assert!(epoch_found, "Prover should have created an epoch");
420420

421421
// Wait for fullnode to sync the epoch
422-
// If this test flakes, it could be because it needs a tiny bit more time here
423-
tokio::time::sleep(Duration::from_millis(5000)).await;
422+
while prover.get_commitment().await.unwrap() != fullnode.get_commitment().await.unwrap() {
423+
tokio::time::sleep(Duration::from_millis(200)).await;
424+
}
424425

425426
// Both nodes should have the same commitment despite racing transactions
426427
let prover_commitment = prover.get_commitment().await.unwrap();

0 commit comments

Comments
 (0)