fix: handle LET syncer invalid index on release 0.8#1611
Closed
arnaubennassar wants to merge 4 commits intorelease/0.8from
Closed
fix: handle LET syncer invalid index on release 0.8#1611arnaubennassar wants to merge 4 commits intorelease/0.8from
arnaubennassar wants to merge 4 commits intorelease/0.8from
Conversation
## 🔄 Changes Summary Implement support for indexing of `BackwardLET` event in the bridge syncer. Also implemented `BackwardToIndex` method on the tree to roll back the Merkle tree to a specific index by deleting higher-indexed roots ### Index of `BackwardLET` event Once we index the `BackwardLET` event, we remove all the bridges whose deposit_count is greater than the new deposit count from the event. We also store the removed bridges into newly introduced `bridge_archive` table, in order to be able to bring them back in case `BackwardLET` event gets reorged. ### Reorg of `BackwardLET` event Once certain `BackwardLET` events get reorged, we figure out which ranges of bridges, by deposit counts, are affected and we restore them back from the `bridge_archive` into the `bridge` table. ##⚠️ Breaking Changes N/A ## 📋 Config Updates N/A ## ✅ Testing - 🤖 **Automatic**: [Optional: Enumerate E2E tests] - 🖱️ **Manual**: [Optional: Steps to verify] ## 🐞 Issues - Closes #1359 ## 🔗 Related PRs - [Optional: Enumerate related pull requests] ## 📝 Notes - [Optional: design decisions, tradeoffs, or TODOs] --------- Co-authored-by: Goran Rojovic <100121253+goran-ethernal@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
## 🔄 Changes Summary This PR implements indexing and processing of `ForwardLET` events in the `bridgesync` component. `ForwardLET` events restore previously archived bridges back into the exit tree after they were removed by `BackwardLET` events. This is part of the broader `BackwardLET`/`ForwardLET` feature that enables the protocol to revert and replay exit tree state changes if a missmatch of `LocalExitTree` state happens between the `Agglayer` and `L2`. **Key changes:** - Added `forward_let` table to store ForwardLET events with encoded leaf data - Implemented `handleForwardLETEvent()` to decode leaves, query archived bridges, and reinsert them into the exit tree - Added bridge source tracking (`bridge.source` column) to distinguish between regular bridges, BackwardLET restorations, and ForwardLET restorations - Created generic ABI encoding/decoding infrastructure for Solidity struct arrays - Enhanced backfill transaction sender query to exclude backward/forward LET sources - Added comprehensive test coverage with 8 test cases including archived bridge matching scenarios ##⚠️ Breaking Changes NA ## 📋 Config Updates NA ## ✅ Testing - 🤖 **Automatic**: `aggkit` CI ## 🐞 Issues - Closes #1360 ## 🔗 Related PRs #1379 --------- Co-authored-by: Stefan Negovanović <stefan@ethernal.tech> Co-authored-by: Stefan Negovanović <93934272+Stefan-Ethernal@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
The call to get the initial **Local Exit Root** from the contract requires an archive node. Using the configurable `InitialLER`, we can skip this call. Introduces a new `[L2NetworkConfig]` section in the top-level config to hold L2-specific settings. The first field, `InitialLER`, allows operators to override the initial Local Exit Root without querying the RollupManager contract on L1, and so, let to use an archive-node. - New `L2NetworkConfig` struct in `etherman/config/network.go` - New `[L2NetworkConfig]` section in the main `Config` and `default.go` - `GetInitialLER` in `cmd/run.go` accepts an optional override; if non-nil, the contract call is skipped - Logs the resolved initial LER on startup None. New optional field under `[L2NetworkConfig]`: ```toml [L2NetworkConfig] ``` Default: not set (field absent → contract is queried as before). None. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


🔄 Changes Summary
release/0.8so the L2 bridge syncer can index LET correction events instead of treating subsequent bridge leaves as mismatched indices.L2NetworkConfig.InitialLERsupport and threads it into the L2 bridge syncer for LET sanity checks.deposit_count >= N, reorg restores the same range, ForwardLET resumes fromPreviousDepositCount, and archived bridge lookups are no longer restricted to origin network 0.[L2NetworkConfig].InitialLERcan be set when the startup LER must be overridden.📋 Config Updates
✅ Testing
go test ./bridgesync -run 'TestProcessor$|TestProcessor_BackwardLET|TestHandleForwardLETEvent|TestBackfillTxnSender_getRecordsNeedingBackfillCount' -count=1go test ./tree ./config ./cmdv0.8.3-rc3where L2 bridge sync halted onmismatched index. Expected: 3, actual: 4after LET events.🐞 Issues
🔗 Related PRs
BackwardLETevent #1379, feat: index and handleforwardLETevent #1404, feat: backward and forward LET testing + runbook + tool #1502, and feat: add L2NetworkConfig with optional InitialLER override #1558.📝 Notes
go test ./bridgesync ./tree ./config ./cmdstill fails locally atTestClaimCalldatabecause its docker-backed geth RPC resets the connection on127.0.0.1:8545; the targeted LET and non-docker package tests above pass.