Skip to content

Conversation

@goran-ethernal
Copy link
Contributor

@goran-ethernal goran-ethernal commented Dec 16, 2025

🔄 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

🔗 Related PRs

#1379

@goran-ethernal goran-ethernal self-assigned this Dec 16, 2025
@goran-ethernal goran-ethernal changed the title Feat/index-forward-let feat: index and handle forwardLET event Dec 16, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements the indexing and processing of ForwardLET (Forward Local Exit Tree) events in the bridgesync component. ForwardLET events restore previously archived bridges to the exit tree after they were removed by BackwardLET events, enabling the protocol to recover from LocalExitTree state mismatches between the Agglayer and L2.

Key changes:

  • Added ForwardLET event handling infrastructure with database table, event parsing, and processing logic
  • Implemented ABI encoding/decoding utilities for processing Solidity struct arrays from ForwardLET events
  • Enhanced bridge tracking by adding a source column to distinguish regular bridges from BackwardLET and ForwardLET restorations
  • Updated backfill transaction sender logic to exclude BackwardLET and ForwardLET sources from processing

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
bridgesync/processor.go Adds ForwardLET event handling, sanity check for local exit roots, and block position tracking for sequential event processing
bridgesync/processor_forward_let_test.go Comprehensive test coverage for ForwardLET event processing with 8 test scenarios including archived bridge matching
bridgesync/downloader.go Adds ForwardLET event signature and handler registration for event parsing
bridgesync/abi.go Implements LeafData struct and ABI decoding logic for ForwardLET event leaves
bridgesync/abi_test.go Tests for LeafData ABI decoding with various data scenarios
bridgesync/backfill_tx_sender.go Updates queries to exclude BackwardLET and ForwardLET sources from transaction sender backfill
bridgesync/backfill_tx_sender_test.go Tests verifying BackwardLET and ForwardLET exclusion in backfill queries
bridgesync/migrations/bridgesync0012.sql Creates forward_let table schema with necessary fields and constraints
abi/abi_builder.go Generic ABI field builder using reflection and struct tags
abi/abi_builder_test.go Tests for ABI field building with various type scenarios
abi/abi_encode.go Generic ABI struct array encoder
abi/abi_encode_test.go Tests for ABI struct array encoding
abi/abi_decode.go Generic ABI struct array decoder with converter pattern

@Stefan-Ethernal Stefan-Ethernal force-pushed the feat/index-backward-let branch 3 times, most recently from 2e09385 to 72fa419 Compare December 16, 2025 15:06
@goran-ethernal goran-ethernal marked this pull request as ready for review December 17, 2025 14:39
@goran-ethernal goran-ethernal force-pushed the feat/index-forward-let branch 3 times, most recently from 9a11387 to d45406a Compare December 18, 2025 10:40
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants