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: ensure L1 messages are stored in db consistently #679

Merged
merged 2 commits into from
Mar 26, 2024

Conversation

Thegaram
Copy link

1. Purpose or design rationale of this PR

In fetchMessagesInRange we did not check it.Error(). If there is a transient error in the L1 node, we could miss some L1 messages and end up with an inconsistent database. The correct behavior is to detect error and retry.

Since L1 message consistency (that means that we have all L1 messages with no gap in queue index) was taken for granted, the only consistency check was in ReadL1MessagesFrom. This PR adds a consistency check in SyncService.fetchMessages to allow us to detect inconsistencies early and avoid corrupting the node's local database.

Fixes #592.

2. PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • fix: A bug fix

3. Deployment tag versioning

Has the version in params/version.go been updated?

  • This PR doesn't involve a new deployment, git tag, docker image tag, and it doesn't affect traces
  • Yes

4. Breaking change label

Does this PR have the breaking-change label?

  • This PR is not a breaking change
  • Yes

@Thegaram Thegaram added the bug Something isn't working label Mar 26, 2024
@colinlyguo
Copy link
Member

To see if I understand correctly: the check of db error would not likely happen after adding failure check and retry in sync service. And it's added to the completeness of db corrupt detection.

example code: https://github.com/scroll-tech/go-ethereum/pull/679/files#diff-cbeb8282854297a2c8ef02293455cb0258ae75b1d2a1a398b2eb60e59a591ba5R198-R200

@Thegaram
Copy link
Author

To see if I understand correctly: the check of db error would not likely happen after adding failure check and retry in sync service. And it's added to the completeness of db corrupt detection.

Yes, the DB error should never happen, but I added this check for completeness' sake.

@Thegaram Thegaram merged commit 411889e into develop Mar 26, 2024
6 checks passed
@Thegaram Thegaram deleted the fix-ensure-l1-message-consistency branch March 26, 2024 14:02
0xmountaintop pushed a commit that referenced this pull request Jun 10, 2024
* fix: ensure L1 messages are stored in db consistently

* check db iterator errors
0xmountaintop pushed a commit that referenced this pull request Jun 13, 2024
* fix: ensure L1 messages are stored in db consistently

* check db iterator errors
0xmountaintop added a commit that referenced this pull request Jun 13, 2024
* fix: ensure L1 messages are stored in db consistently (#679)

* fix: ensure L1 messages are stored in db consistently

* check db iterator errors

* fix(sync-service): only add queue index when message index is not zero (#682)

* fix(sync-service): increase queue index only when L1 message index is not zero

---------

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

fix

---------

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scroll chain geth stops unexpectedly at 1444216
3 participants