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

Detect reorgs during event processing #89

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

jbearer
Copy link
Member

@jbearer jbearer commented Oct 13, 2023

Check the hash of the retrieved L1 block against the block hash in the event log we processed. This will detect if the block has changed (due to a reorg) in the time since we processed it. In this case we simply return an error so that the synchronizer will retry fetching the events, now with the new L1 state.

If we don't check this here, we might never detect this reorg, because we will store the hash of the retrieved block (from after the reorg) even though we processed events from the block which got reorged out. The stored hash will then match the hash when we query it again from the L1 in checkReorg, and we will never process events from the new block.

Potential fix for EspressoSystems/espresso-polygon-zkevm-demo#252.

Check the hash of the retrieved L1 block against the block hash in
the event log we processed. This will detect if the block has changed
(due to a reorg) in the time since we processed it. In this case we
simply return an error so that the synchronizer will retry fetching
the events, now with the new L1 state.

If we don't check this here, we might never detect this reorg, because
we will store the hash of the retrieved block (from after the reorg)
even though we processed events from the block which got reorged out.
The stored hash will then match the hash when we query it again from
the L1 in checkReorg, and we will never process events from the new
block.
@jbearer
Copy link
Member Author

jbearer commented Oct 14, 2023

After restarting the node, it successfully synced past the problematic block. This is consistent with the problem being caused by a reorg the first time around.

@jbearer jbearer marked this pull request as ready for review October 14, 2023 14:06
@jbearer jbearer merged commit e84d96d into hotshot-integration Oct 30, 2023
2 checks passed
@jbearer jbearer deleted the fix/multiple-events-one-block branch October 30, 2023 20:31
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.

2 participants