Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip unmerged blocks in reorg handler #111

Merged
merged 1 commit into from
Oct 24, 2024
Merged

Conversation

iuwqyir
Copy link
Collaborator

@iuwqyir iuwqyir commented Oct 24, 2024

TL;DR

Added support for handling duplicate blocks during chain reorganization detection.

What changed?

  • Added a check in findReorgEndIndex to skip blocks with the same block number during reorg detection
  • Added test cases to verify handling of duplicate blocks and correct block sequences
  • Improved reorg detection logic to handle unmerged blocks in the chain

How to test?

  1. Run the new test cases:
    • TestHandleReorgWithDuplicateBlocks
    • TestNothingIsDoneForCorrectBlocks
  2. Verify that duplicate blocks are properly handled and don't trigger false reorg detections
  3. Confirm that correct block sequences continue to work as expected

Why make this change?

When processing block headers, duplicate blocks with the same block number can appear if there are multiple committers running by mistake. Usually clickhouse will merge these duplicates in the background, but these duplicates should not trigger reorg handling, as they represent unmerged blocks rather than actual chain reorganizations. This change ensures more accurate reorg detection by properly handling these edge cases.

@iuwqyir iuwqyir changed the title handle unmerged blocks Skip unmerged blocks in reorg handler Oct 24, 2024
Copy link
Collaborator Author

iuwqyir commented Oct 24, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @iuwqyir and the rest of your teammates on Graphite Graphite

@iuwqyir iuwqyir marked this pull request as ready for review October 24, 2024 06:54
@iuwqyir iuwqyir merged commit 18df7d3 into main Oct 24, 2024
5 checks passed
@iuwqyir iuwqyir deleted the 10-24-handle_unmerged_blocks branch October 24, 2024 08:05
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.

3 participants