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

Add support for L1 to L2 message log syncing #2251

Closed
wants to merge 14 commits into from
Closed

Conversation

t00ts
Copy link
Contributor

@t00ts t00ts commented Sep 19, 2024

Introduces functionality to sync L1 to L2 message logs, improving our ability to track cross-chain interactions.

Key Changes

  1. Added get_logs method to the Ethereum client:
    • Allows fetching logs for a specified block range
    • Implements recursive fetching with automatic range splitting for large queries
  2. Implemented bulk syncing of L1ToL2MessageLog:
    • Fetches logs from the last synced L1 block up to the current state
    • Stores these logs for later matching with L2 transactions
  3. Enhanced L1 sync process:
    • Bulk fetches logs at the beginning of execution
    • Waits for L2 blocks and matches l1_handler transactions with corresponding L1 transaction hashes
  4. Introduced L1BlockNumber and L1TransactionHash types to avoid confusion

Closes #2243

@t00ts t00ts added this to the JSON-RPC 0.8.0 milestone Sep 19, 2024
@t00ts t00ts force-pushed the t00ts/messaging branch 5 times, most recently from 3fcee20 to fc4b2eb Compare September 23, 2024 09:08
@t00ts t00ts marked this pull request as ready for review September 23, 2024 09:09
@t00ts t00ts requested a review from a team as a code owner September 23, 2024 09:09
CHANGELOG.md Outdated Show resolved Hide resolved
crates/common/src/lib.rs Outdated Show resolved Hide resolved
crates/ethereum/src/lib.rs Outdated Show resolved Hide resolved
crates/ethereum/src/lib.rs Outdated Show resolved Hide resolved
@t00ts t00ts force-pushed the t00ts/messaging branch 2 times, most recently from ab30a2c to a935e35 Compare September 23, 2024 15:35
Copy link
Contributor

@kkovaacs kkovaacs left a comment

Choose a reason for hiding this comment

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

I've added a quite a few comments, most of them in these categories:

  • using structured fields in tracing macros: https://docs.rs/tracing/latest/tracing/index.html#recording-fields
  • we should be adding a newtype for L1 block number because we seem to be mixing L1/L2 block numbers at a few places
  • using storage row accessors and type conversions for L1 block number / L1 block hash instead of ad-hoc conversions in storage code

crates/ethereum/src/lib.rs Outdated Show resolved Hide resolved
crates/pathfinder/src/state/sync.rs Outdated Show resolved Hide resolved
crates/pathfinder/src/state/sync.rs Outdated Show resolved Hide resolved
crates/pathfinder/src/state/sync.rs Outdated Show resolved Hide resolved
crates/pathfinder/src/state/sync.rs Outdated Show resolved Hide resolved
crates/storage/src/connection/message.rs Outdated Show resolved Hide resolved
crates/storage/src/connection/message.rs Outdated Show resolved Hide resolved
crates/storage/src/connection/message.rs Outdated Show resolved Hide resolved
crates/pathfinder/src/state/sync.rs Show resolved Hide resolved
l1_tx_hash BLOB NOT NULL,
l2_tx_hash BLOB NOT NULL
);
CREATE INDEX idx_l1_handler_txs_l1_tx_hash ON l1_handler_txs(l1_tx_hash);
Copy link
Contributor

Choose a reason for hiding this comment

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

Another thought: the specification seems to require us returning the L2 transaction statuses for an L1 transaction hash in sending order. We do not currently store any information related to that -- we probably should?

@t00ts
Copy link
Contributor Author

t00ts commented Oct 16, 2024

Closed in favor of #2301

@t00ts t00ts closed this Oct 16, 2024
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.

Introduce L1BlockNumber struct for Ethereum block numbers
4 participants