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

fix(op-node): pre-fetching handle L1 reOrg #115

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

welkin22
Copy link
Contributor

Description

If L1 experiences a reorganization within 15 blocks, the pre-fetched receipts data will be useless, which will trigger the optimization in #87, and the sequencer will continue to produce blocks based on the same L1 block height instead of using the next block. In order to minimize this situation, we need to handle the case where L1 experiences a reorganization within 15 blocks.

Rationale

When we detect that the hash value of the oldest block height in this round does not match the hash value of the latest block height in the previous round, it means that a reorganization has occurred in the L1 chain. We will roll back the current block height variable to 15 blocks ago to avoid problems caused by reorganization within 15 blocks. If it is a reorganization of more than 15 blocks, the reset process will handle it.

Example

none

Changes

Notable changes:

  • GoOrUpdatePreFetchReceipts logic modification
  • a new unit test for GoOrUpdatePreFetchReceipts

@github-actions github-actions bot requested review from bnoieh and krish-nr January 25, 2024 14:45
bnoieh
bnoieh previously approved these changes Jan 26, 2024
krish-nr
krish-nr previously approved these changes Jan 26, 2024
@welkin22 welkin22 dismissed stale reviews from krish-nr and bnoieh via e852c3e January 26, 2024 08:15
@welkin22 welkin22 merged commit a4e7213 into bnb-chain:develop Jan 26, 2024
9 checks passed
Copy link

@Nouri11190 Nouri11190 left a comment

Choose a reason for hiding this comment

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

Nice job

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.

4 participants