Skip to content

Commit eb4317a

Browse files
prestwichclaude
andcommitted
fix: update integration tests for ring buffer reorg design
The ring buffer design now correctly returns removed logs on early-return paths (start > latest) instead of silently discarding them. Update test_multi_block_reorg_log_filter and test_multiple_reorgs_between_polls to expect the removed logs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e65a5e4 commit eb4317a

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

crates/node-tests/tests/reorg.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,13 @@ async fn test_multi_block_reorg_log_filter() {
415415
ctx.revert_block(block3).await.unwrap();
416416
ctx.revert_block(block2).await.unwrap();
417417

418-
// Poll: empty (watermark rewinds start to 2, but latest=1).
418+
// Poll: removed logs for blocks 4, 3, 2 (reorg ring buffer).
419+
// Watermark rewinds start to 2, latest=1 → no forward scan,
420+
// but the removed logs are still returned.
419421
let logs: Vec<Log<LogData>> =
420422
ctx.alloy_provider.get_filter_changes(filter_id).await.unwrap();
421-
assert!(logs.is_empty());
423+
assert_eq!(logs.len(), 3);
424+
assert!(logs.iter().all(|l| l.removed));
422425

423426
// Rebuild blocks 2, 3 (increment each → count 1, 2).
424427
let _new_b2 = process_increment(&ctx, addr).await;
@@ -523,10 +526,13 @@ async fn test_multiple_reorgs_between_polls() {
523526
// DO NOT POLL between reorg 1 and reorg 2 — this is the key.
524527
// The filter now has watermark=3 from the min() of both reorgs.
525528

526-
// Poll: empty (watermark+1=4, but latest=3 → start > latest).
529+
// Poll: removed logs from both reorgs (block 5 from reorg 1,
530+
// block 4 from reorg 3). Reorg 2's block 5 is skipped because
531+
// it was never delivered (number >= snapshot after rewind).
527532
let logs: Vec<Log<LogData>> =
528533
ctx.alloy_provider.get_filter_changes(filter_id).await.unwrap();
529-
assert!(logs.is_empty());
534+
assert_eq!(logs.len(), 2);
535+
assert!(logs.iter().all(|l| l.removed));
530536

531537
// Rebuild blocks 4, 5 (count 3, 4).
532538
let _new_b4 = process_increment(&ctx, addr).await;

0 commit comments

Comments
 (0)