Conversation
Summary of ChangesHello, 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
🧠 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
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
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>
jjeangal
left a comment
There was a problem hiding this comment.
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.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
is there no better way to do this? in go ethereum you can give the topic and it gives back the receipts I think
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| if current_number == 0 || block_ref.number - current_number >= BATCH_AUTH_LOOKBACK_WINDOW { | ||
| break; |
There was a problem hiding this comment.
can you explain what will happen if the event is not found within this? Maybe add a a comment -> will the chain reorg?
There was a problem hiding this comment.
This just isn't a valid batch then, no reorg. Added a comment in 16550fb
c83ff0b to
17f74d4
Compare
Sneh1999
left a comment
There was a problem hiding this comment.
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!
|
@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. |
* 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>
* 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>
* 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>
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.rscrates/protocol/derive/src/sources/calldata.rscrates/protocol/derive/src/sources/blobs.rs