Skip to content

feat: Support for L1 reorgs#13428

Merged
spalladino merged 6 commits into
masterfrom
palla/test-l1-reorgs
Apr 29, 2025
Merged

feat: Support for L1 reorgs#13428
spalladino merged 6 commits into
masterfrom
palla/test-l1-reorgs

Conversation

@spalladino

@spalladino spalladino commented Apr 9, 2025

Copy link
Copy Markdown
Contributor

Initial support and e2e tests for L1 reorgs. Adds a suite of tests (a few skipped until we can make them pass) that test how a node deals with proofs being added or removed from L1, or past L2 blocks being removed from L1.

Archiver now supports pruning proven blocks, and decreasing the proven block number. It also checks for new L2 blocks possibly added before the L1 syncpoint (not messages yet!) if it sees a discrepancy between local data and the rollup contract. Last, it sets the finalized tip to the last proven block minus two epochs; this is not exact and is overly cautious, but is the first step towards having a finalized tip different from the proven one.

Fixes #11836

Base automatically changed from palla/reorg-cheat-code to master April 10, 2025 23:40
@spalladino spalladino force-pushed the palla/test-l1-reorgs branch 5 times, most recently from 45bf250 to cb115b9 Compare April 16, 2025 21:42
@spalladino spalladino force-pushed the palla/test-l1-reorgs branch 3 times, most recently from 67e6b4f to 04e7f8d Compare April 25, 2025 22:14
@spalladino spalladino changed the title chore: Tests for L1 reorgs feat: Support for L1 reorgs Apr 25, 2025
@spalladino spalladino marked this pull request as ready for review April 25, 2025 22:34
@spalladino spalladino force-pushed the palla/test-l1-reorgs branch from 5e002bf to fb3b640 Compare April 28, 2025 15:21
@LHerskind LHerskind self-requested a review April 29, 2025 12:24

@LHerskind LHerskind left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like the idea of being a bit too cautious hence the outcome should not be worse than potentially missed blocks due to filling the new chain in.

The diff scared me a little with 12K new lines, but was mostly log files. What is the reasoning about keeping the log files here?

Comment thread yarn-project/archiver/src/archiver/archiver.ts Outdated
Comment thread yarn-project/archiver/src/archiver/archiver.ts
Comment thread yarn-project/archiver/src/archiver/archiver.ts
Comment thread yarn-project/archiver/src/archiver/archiver.ts Outdated
Comment thread yarn-project/archiver/src/archiver/archiver.ts Outdated
Comment thread yarn-project/archiver/src/archiver/archiver.ts
Comment thread yarn-project/end-to-end/src/e2e_epochs/epochs_l1_reorgs.test.ts Outdated
Comment thread yarn-project/end-to-end/src/e2e_epochs/epochs_l1_reorgs.test.ts
@spalladino spalladino force-pushed the palla/test-l1-reorgs branch from 793722d to 7a3c5ab Compare April 29, 2025 16:37
@spalladino spalladino added this pull request to the merge queue Apr 29, 2025
Merged via the queue into master with commit a989602 Apr 29, 2025
@spalladino spalladino deleted the palla/test-l1-reorgs branch April 29, 2025 17:52
spalladino added a commit that referenced this pull request May 7, 2025
Merges 3 commits into alpha-testnet:

- [`Test blob sources on archiver
startup`](6d19a11)
is a cherry-pick from a commit in #13542 in master.
- [`Throw on gaps in blocks in
archiver`](92cf557)
causes the archiver to throw on `getBlocks` calls where there are gaps,
instead of just returning the next available block. This was masking the
world-state syncing errors: a missing block in the archiver would result
on the _next_ block being returned, so world state syncing would skip a
block and fail. This commit also changes the aztec-node to use
`getBlock(number)` from the archiver, instead of `getBlocks(number,
limit:1)`.
- [`Recover from block gaps due to spurious L2
reorgs`](185c029)
makes the archiver check if the previous block exists when adding new
ones. If not, it rolls back the L1 syncpoint to the last known block.
This should help recover from spurious L2 reorgs where the archiver
prunes blocks when it shouldn't have (more info in #13604). Note that
[this piece of
code](https://github.com/AztecProtocol/aztec-packages/pull/13428/files#diff-ea8c8bb366fc42b03ebd6cf063c8e6aa21328b8887942089086fa958f96a3f85R631-R673)
from #13428 should also help, but we have not yet moved L1 reorg code to
alpha-testnet, and this change is less intrusive.

Except for the first one, these commits are not yet in master.

Fixes #13604
@alexghr alexghr mentioned this pull request May 28, 2025
github-merge-queue Bot pushed a commit that referenced this pull request May 29, 2025
This PR attempts to fix the flakey `epochs_empty_blocks` test. There
were a couple of problems with this test resulting from #13428:
- the test assumes it will run for N consecutive epochs
- but the test also waits for certain blocks to become
proven/finalised/historical
- in #13428 the meaning of 'finalised' was changed. This caused the test
to _skip_ entire epochs (e.g. entire epochs would be proven in the
background while it waited for historical blocks)
- this PR replicates the 'finalised' logic from the archiver so that the
epoch counter updates correctly
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.

test scenario: l1 reorg - prunes the proof submission

2 participants