Skip to content

Conversation

@LeoPatOZ
Copy link
Collaborator

@LeoPatOZ LeoPatOZ commented Dec 5, 2025

Resolves #198

Changes:

  • Rewind now only streams reorged ranges instead of restarting
  • Logs from reorg blocks are removed and refetched
  • Added common ancestor block to ReorgDetected (maybe find a better name). I think this helps both our scanner and potentially a better API for library users (easier to find exactly which block was reorged in case they want to do extra processing based of this information)

@LeoPatOZ LeoPatOZ changed the title Reorg log opt Reorg log optimisation Dec 5, 2025
@LeoPatOZ LeoPatOZ changed the title Reorg log optimisation Reorg Rewind optimisation Dec 5, 2025
///
/// The `common_ancestor_block` field contains the block number of the last block
/// that is still valid on the canonical chain.
ReorgDetected { common_ancestor_block: u64 },
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can find a more succinct name

Comment on lines +18 to +21
scanner.start().await?;

// Trigger a reorg that removes the last 2 blocks (events 19 and 20)
provider.primary().anvil_reorg(ReorgOptions { depth: 2, tx_block_pairs: vec![] }).await?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inherently flaky as reorg may complete after scanner finishes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Latest Events: On Reorg Update Only the Reorged Logs in the Resulting Vector

2 participants