Skip to content

fix: handle LET syncer invalid index on release 0.8#1611

Closed
arnaubennassar wants to merge 4 commits intorelease/0.8from
fix/release-0.8-let-syncer-invalid-index
Closed

fix: handle LET syncer invalid index on release 0.8#1611
arnaubennassar wants to merge 4 commits intorelease/0.8from
fix/release-0.8-let-syncer-invalid-index

Conversation

@arnaubennassar
Copy link
Copy Markdown
Collaborator

🔄 Changes Summary

  • Backports BackwardLET and ForwardLET bridge sync handling to release/0.8 so the L2 bridge syncer can index LET correction events instead of treating subsequent bridge leaves as mismatched indices.
  • Adds optional L2NetworkConfig.InitialLER support and threads it into the L2 bridge syncer for LET sanity checks.
  • Applies the follow-up LET edge-case fixes needed by the production failure: BackwardLET archives/deletes from deposit_count >= N, reorg restores the same range, ForwardLET resumes from PreviousDepositCount, and archived bridge lookups are no longer restricted to origin network 0.

⚠️ Breaking Changes

  • 🛠️ Config: None required. Optional [L2NetworkConfig].InitialLER can be set when the startup LER must be overridden.
  • 🔌 API/CLI: None.
  • 🗑️ Deprecated Features: None.

📋 Config Updates

  • 🧾 Diff/Config snippet:
[L2NetworkConfig]
# InitialLER: optional override for the initial Local Exit Root.
# InitialLER = "0x..."

✅ Testing

  • 🤖 Automatic: go test ./bridgesync -run 'TestProcessor$|TestProcessor_BackwardLET|TestHandleForwardLETEvent|TestBackfillTxnSender_getRecordsNeedingBackfillCount' -count=1
  • 🤖 Automatic: go test ./tree ./config ./cmd
  • 🖱️ Manual: Confirmed the fix targets the Datadog failure on v0.8.3-rc3 where L2 bridge sync halted on mismatched index. Expected: 3, actual: 4 after LET events.

🐞 Issues

  • Closes N/A

🔗 Related PRs

📝 Notes

  • Full go test ./bridgesync ./tree ./config ./cmd still fails locally at TestClaimCalldata because its docker-backed geth RPC resets the connection on 127.0.0.1:8545; the targeted LET and non-docker package tests above pass.

Stefan-Ethernal and others added 4 commits April 30, 2026 13:03
## 🔄 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>
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

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.

4 participants