Skip to content

EOA batch inbox#15

Merged
QuentinI merged 9 commits intoespresso-integrationfrom
ag/eoa-batch-inbox
Mar 19, 2026
Merged

EOA batch inbox#15
QuentinI merged 9 commits intoespresso-integrationfrom
ag/eoa-batch-inbox

Conversation

@QuentinI
Copy link
Copy Markdown

@QuentinI QuentinI commented Mar 2, 2026

Closes #<ISSUE_NUMBER>

This PR:

Companion to EspressoSystems/optimism-espresso-integration#357 - replaces derivation pipeline check for reverted transactions with a check for BatchAuthenticated event in 100-block lookback window.

This PR does not:

Change anything else

Key places to review:

crates/protocol/derive/src/sources/batch_auth.rs
crates/protocol/derive/src/sources/calldata.rs
crates/protocol/derive/src/sources/blobs.rs


@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the batch authentication process within the derivation pipeline. It moves away from solely relying on sender address verification to a more robust system that can leverage L1 event scanning for TEE batchers, while still providing a fallback for traditional batchers. This change is crucial for improving the security and flexibility of batch submission, particularly in contexts requiring fault proofs, by ensuring that batch authorization can be verified directly from L1 receipts.

Highlights

  • Event-Based Batch Authentication: Introduced a new event-based batch authentication mechanism for the derivation pipeline, allowing batchers to be authorized via BatchInfoAuthenticated events emitted on L1, enhancing compatibility with fault proof environments.
  • Flexible Batcher Authorization: Implemented support for two authorization paths: TEE batchers, which require a matching BatchInfoAuthenticated event, and fallback batchers, which are authorized via traditional sender address verification without needing an event.
  • LRU Cache Integration: Integrated an LRU cache to efficiently store and retrieve authenticated batch commitment hashes, improving performance by avoiding redundant L1 receipt scans within the lookback window.
  • Configuration Updates: Added new configuration fields (batch_authenticator_address and fallback_batcher_address) to RollupConfig to enable and control the new batch authentication system.
  • Derivation Source Modifications: Updated BlobSource and CalldataSource to incorporate the new batch authentication logic, replacing previous sender-only verification with the more flexible event-based or fallback sender-based checks.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • Cargo.lock
    • Added 'lru 0.16.0' dependency.
  • crates/protocol/derive/Cargo.toml
    • Added 'lru' workspace dependency.
  • crates/protocol/derive/src/lib.rs
    • Exported 'BatchAuthConfig' from the 'sources' module.
  • crates/protocol/derive/src/sources/batch_auth.rs
    • Added new module for event-based batch authentication.
    • Implemented 'BatchAuthConfig' struct for configuration.
    • Defined 'batch_info_authenticated_topic' for event identification.
    • Provided functions to compute calldata and blob batch hashes.
    • Implemented 'collect_auth_events_from_receipts' to extract authenticated hashes from L1 receipts.
    • Added 'collect_authenticated_batches' to scan L1 blocks for events with LRU caching.
    • Included 'new_batch_auth_cache' for LRU cache initialization.
    • Implemented 'is_batch_authorized' to check batch authorization based on events or fallback sender.
  • crates/protocol/derive/src/sources/blobs.rs
    • Imported batch authentication utilities.
    • Modified 'BlobSource' struct to include 'batch_auth_config' and 'auth_cache'.
    • Updated 'BlobSource::new' constructor to accept 'batch_auth_config' and initialize 'auth_cache'.
    • Modified 'extract_blob_data' to use 'is_batch_authorized' for transaction filtering, incorporating event-based authentication.
    • Integrated 'collect_authenticated_batches' to fetch authenticated hashes before processing blob data.
    • Removed direct 'tx.recover_signer()' check for batcher address in favor of 'is_batch_authorized'.
  • crates/protocol/derive/src/sources/calldata.rs
    • Imported batch authentication utilities.
    • Modified 'CalldataSource' struct to include 'batch_auth_config' and 'auth_cache'.
    • Updated 'CalldataSource::new' constructor to accept 'batch_auth_config' and initialize 'auth_cache'.
    • Modified 'load_calldata' to integrate 'collect_authenticated_batches' and 'is_batch_authorized' for transaction filtering.
    • Removed previous receipt status checks and direct sender verification in favor of the new authorization logic.
    • Added new test cases for event-based batch authentication, including TEE path, unauthenticated batches, and fallback batcher scenarios.
  • crates/protocol/derive/src/sources/ethereum.rs
    • Imported 'BatchAuthConfig'.
    • Updated 'EthereumDataSource::new' and 'new_from_parts' constructors to pass 'batch_auth_config' to 'BlobSource' and 'CalldataSource'.
  • crates/protocol/derive/src/sources/mod.rs
    • Exported 'BatchAuthConfig' from the 'batch_auth' module.
  • crates/protocol/genesis/src/chain/config.rs
    • Updated 'ChainConfig::to_rollup_config' to initialize 'batch_authenticator_address' and 'fallback_batcher_address' as None.
  • crates/protocol/genesis/src/rollup.rs
    • Added 'batch_authenticator_address' field to 'RollupConfig' for L1 authenticator contract address.
    • Added 'fallback_batcher_address' field to 'RollupConfig' for non-TEE batcher authorization.
    • Implemented 'is_batch_auth_enabled' method to check if event-based batch authentication is configured.
  • flake.nix
    • Updated Darwin SDK dependencies from specific frameworks to a general 'apple-sdk'.
    • Commented out 'BINDGEN_EXTRA_CLANG_ARGS' for glibc include.
Activity
  • The pull request is currently a Work In Progress (WIP), indicating that further changes or refinements are expected.
  • The author has linked the PR to an issue, suggesting it addresses a specific task or bug.
  • The PR description outlines what this PR adds and what is explicitly out of scope, providing clear boundaries for reviewers.
  • Key areas for review are highlighted in the description, guiding reviewers to critical sections of the code.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new event-based batch authentication mechanism, which is a significant feature for supporting TEE batchers. The implementation adds a new batch_auth.rs module with the core logic and integrates it into the existing BlobSource and CalldataSource. The changes are well-structured. My review focuses on a potential correctness issue where failed transactions might be processed, and some opportunities for performance and code style improvements. I've also noted the removal of a test case that covered an important edge case.

Comment thread crates/protocol/derive/src/sources/batch_auth.rs Outdated
Comment thread crates/protocol/derive/src/sources/batch_auth.rs Outdated
Comment thread crates/protocol/derive/src/sources/batch_auth.rs Outdated
Comment thread crates/protocol/derive/src/sources/calldata.rs
@QuentinI QuentinI changed the title [WIP] EOA batch inbox EOA batch inbox Mar 2, 2026
QuentinI and others added 2 commits March 2, 2026 19:23
Co-authored-by: OpenCode <noreply@opencode.ai>
Replace runtime keccak256 call with a pre-computed const B256 via b256!(),
matching the established pattern used elsewhere in the repo (deposits.rs,
system/mod.rs, hardforks/, etc.).

Co-authored-by: OpenCode <noreply@opencode.ai>
@QuentinI QuentinI marked this pull request as ready for review March 3, 2026 14:03
Copy link
Copy Markdown
Member

@jjeangal jjeangal left a comment

Choose a reason for hiding this comment

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

Nothing alarming on my end, code looks clean and all tests are passing! As discussed, repeated logic with the OP code will eventually be avoided when OP stack transitions to reth.

QuentinI and others added 2 commits March 4, 2026 12:13
The BatchAuthenticator contract event changed from
BatchInfoAuthenticated(bytes32,address) to
BatchInfoAuthenticated(bytes32), dropping the signer topic.

Co-authored-by: OpenCode <noreply@opencode.ai>
return true;
}
// Fallback batcher: accept via sender verification
if let Some(fallback_addr) = config.fallback_batcher_address {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I dont know if this is needed why cant both fallback and normal batcher just send to authenticator contract. Reason being that will keep the diff smaller

) -> BTreeSet<B256> {
let topic0 = BATCH_INFO_AUTHENTICATED_TOPIC;
let mut result = BTreeSet::new();
for receipt in receipts {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is there no better way to do this? in go ethereum you can give the topic and it gives back the receipts I think

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

They have a facility to filter logs it seems, but it lives in another subcrate of alloy that is not available in the derivation pipeline. Couldn't find anything else.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I see, thanks for looking!

Comment thread crates/protocol/derive/src/sources/batch_auth.rs
}

if current_number == 0 || block_ref.number - current_number >= BATCH_AUTH_LOOKBACK_WINDOW {
break;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can you explain what will happen if the event is not found within this? Maybe add a a comment -> will the chain reorg?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This just isn't a valid batch then, no reorg. Added a comment in 16550fb

Comment thread crates/protocol/derive/src/sources/blobs.rs Outdated
@QuentinI QuentinI force-pushed the ag/eoa-batch-inbox branch from c83ff0b to 17f74d4 Compare March 6, 2026 15:27
Copy link
Copy Markdown

@Sneh1999 Sneh1999 left a comment

Choose a reason for hiding this comment

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

Looks good to me! Will wait to approve so that we can discuss with Celo labs if fallback batcher should be in the derivation pipeline or not
Overall great work!

@QuentinI
Copy link
Copy Markdown
Author

@Sneh1999 merging it for now because Celo's answer was along the lines of "implement it and we'll see if we want it". I want to unblock everything that builds on top of EspressoSystems/optimism-espresso-integration#357. I'll make a separate PR that makes fallback batcher send auth transactions for us and Celo to review.

@QuentinI QuentinI merged commit 5507d77 into espresso-integration Mar 19, 2026
33 checks passed
QuentinI added a commit that referenced this pull request Apr 10, 2026
* EOA batch inbox

* Fix tests

* Simplify BTreeSet insertion with extend

Co-authored-by: OpenCode <noreply@opencode.ai>

* Pre-compute BATCH_INFO_AUTHENTICATED_TOPIC as const

Replace runtime keccak256 call with a pre-computed const B256 via b256!(),
matching the established pattern used elsewhere in the repo (deposits.rs,
system/mod.rs, hardforks/, etc.).

Co-authored-by: OpenCode <noreply@opencode.ai>

* Update BatchInfoAuthenticated event to remove signer parameter

The BatchAuthenticator contract event changed from
BatchInfoAuthenticated(bytes32,address) to
BatchInfoAuthenticated(bytes32), dropping the signer topic.

Co-authored-by: OpenCode <noreply@opencode.ai>

* Cache headers too

* Add comment

* Propagate errors correctly

* Reduce lookback window size

---------

Co-authored-by: OpenCode <noreply@opencode.ai>
QuentinI added a commit that referenced this pull request Apr 10, 2026
* EOA batch inbox

* Fix tests

* Simplify BTreeSet insertion with extend

Co-authored-by: OpenCode <noreply@opencode.ai>

* Pre-compute BATCH_INFO_AUTHENTICATED_TOPIC as const

Replace runtime keccak256 call with a pre-computed const B256 via b256!(),
matching the established pattern used elsewhere in the repo (deposits.rs,
system/mod.rs, hardforks/, etc.).

Co-authored-by: OpenCode <noreply@opencode.ai>

* Update BatchInfoAuthenticated event to remove signer parameter

The BatchAuthenticator contract event changed from
BatchInfoAuthenticated(bytes32,address) to
BatchInfoAuthenticated(bytes32), dropping the signer topic.

Co-authored-by: OpenCode <noreply@opencode.ai>

* Cache headers too

* Add comment

* Propagate errors correctly

* Reduce lookback window size

---------

Co-authored-by: OpenCode <noreply@opencode.ai>
QuentinI added a commit that referenced this pull request Apr 10, 2026
* EOA batch inbox

* Fix tests

* Simplify BTreeSet insertion with extend

Co-authored-by: OpenCode <noreply@opencode.ai>

* Pre-compute BATCH_INFO_AUTHENTICATED_TOPIC as const

Replace runtime keccak256 call with a pre-computed const B256 via b256!(),
matching the established pattern used elsewhere in the repo (deposits.rs,
system/mod.rs, hardforks/, etc.).

Co-authored-by: OpenCode <noreply@opencode.ai>

* Update BatchInfoAuthenticated event to remove signer parameter

The BatchAuthenticator contract event changed from
BatchInfoAuthenticated(bytes32,address) to
BatchInfoAuthenticated(bytes32), dropping the signer topic.

Co-authored-by: OpenCode <noreply@opencode.ai>

* Cache headers too

* Add comment

* Propagate errors correctly

* Reduce lookback window size

---------

Co-authored-by: OpenCode <noreply@opencode.ai>
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.

3 participants