fix(op-node): pre-fetching handle L1 reOrg #115
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: