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 L2 reorg #196

Merged
merged 4 commits into from Mar 14, 2022
Merged

Fix L2 reorg #196

merged 4 commits into from Mar 14, 2022

Conversation

Mirko-von-Leipzig
Copy link
Collaborator

@Mirko-von-Leipzig Mirko-von-Leipzig commented Mar 14, 2022

This PR fixes two bugs in the L2 sync process:

  1. After an L2 reorg, the sync process would continue from the old local block head, instead of taking into account the reorg'd blocks.
  2. The sync process would crash due to inserting a duplicate contract. This can occur when after a reorg as we never delete the old contracts (this prevents us downloading them again), and the "new blocks" will contain the same contract again.

As an aside this really should have been caught by tests -- which I didn't write due to time crunch.

Copy link
Member

@CHr15F0x CHr15F0x left a comment

Choose a reason for hiding this comment

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

lgtm, would be nice to have those missing tests at some point

The L2 sync process was not using the new head after a reorg event.
This resulted in it continuing on from the old, now reorg'd state.
This could occur after an L2 reorg; where the same contract would be
added again.
@Mirko-von-Leipzig Mirko-von-Leipzig merged commit ebd7cf1 into main Mar 14, 2022
@Mirko-von-Leipzig Mirko-von-Leipzig deleted the fix_l2_reorg branch March 14, 2022 13:44
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.

None yet

3 participants