Skip to content

Commit a2add5f

Browse files
committed
Fix flaky reconstruction test - no need to wait for reconstruction to complete. Previously it wasn't consistently failing because processing the remaining 64 columns *may* give us enough time to finish reconstruction, but this is still flaky.
1 parent d811058 commit a2add5f

File tree

1 file changed

+8
-13
lines changed
  • beacon_node/network/src/network_beacon_processor

1 file changed

+8
-13
lines changed

beacon_node/network/src/network_beacon_processor/tests.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -916,20 +916,13 @@ async fn data_column_reconstruction_at_deadline() {
916916
.start_of(rig.next_block.slot())
917917
.unwrap();
918918

919-
rig.chain
920-
.slot_clock
921-
.set_current_time(slot_start - rig.chain.spec.maximum_gossip_clock_disparity());
922-
923-
assert_eq!(
924-
rig.chain.slot().unwrap(),
925-
rig.next_block.slot() - 1,
926-
"chain should be at the correct slot"
927-
);
928-
929919
// We push the slot clock to 3 seconds into the slot, this is the deadline to trigger reconstruction.
920+
let slot_duration = rig.chain.slot_clock.slot_duration().as_millis() as u64;
921+
let reconstruction_deadline_millis =
922+
(slot_duration * RECONSTRUCTION_DEADLINE.0) / RECONSTRUCTION_DEADLINE.1;
930923
rig.chain
931924
.slot_clock
932-
.set_current_time(slot_start + Duration::from_secs(3));
925+
.set_current_time(slot_start + Duration::from_millis(reconstruction_deadline_millis));
933926

934927
let min_columns_for_reconstruction = E::number_of_columns() / 2;
935928
for i in 0..min_columns_for_reconstruction {
@@ -939,9 +932,11 @@ async fn data_column_reconstruction_at_deadline() {
939932
}
940933

941934
// Since we're at the reconstruction deadline, reconstruction should be triggered immediately
942-
rig.assert_event_journal_completes_with_timeout(
943-
&[WorkType::ColumnReconstruction],
935+
rig.assert_event_journal_with_timeout(
936+
&[WorkType::ColumnReconstruction.into()],
944937
Duration::from_millis(50),
938+
false,
939+
false,
945940
)
946941
.await;
947942
}

0 commit comments

Comments
 (0)