Skip to content

Conversation

@d4mr
Copy link
Member

@d4mr d4mr commented Jul 8, 2025

  • Added call_gas_limit to UserOpBuilderConfig for better gas management.
  • Introduced AuthorizationSchema and SignedAuthorizationSchema for EIP-7702 authorization handling.
  • Updated transaction structures to accommodate new gas limit and authorization features.
  • Refactored execution options to streamline transaction type data handling.
  • Improved error handling and logging in transaction processing.

These changes aim to enhance the flexibility and efficiency of transaction execution, particularly for EIP-7702 compliant operations.

Summary by CodeRabbit

  • New Features

    • Added support for multiple Ethereum transaction types (EIP-7702, EIP-1559, Legacy), including gas and authorization data, in transaction handling.
    • Introduced OpenAPI schema representations for EIP-7702 authorizations.
  • Bug Fixes

    • Improved handling of gas limit configuration by propagating optional gas limits throughout transaction building and execution.
  • Refactor

    • Simplified execution options by removing transaction type-specific data from certain configuration structures.
    • Unified transaction type data handling across modules for consistency.
  • Style

    • Updated schema annotations and serialization attributes for improved API documentation and compatibility.

- Added `call_gas_limit` to `UserOpBuilderConfig` for better gas management.
- Introduced `AuthorizationSchema` and `SignedAuthorizationSchema` for EIP-7702 authorization handling.
- Updated transaction structures to accommodate new gas limit and authorization features.
- Refactored execution options to streamline transaction type data handling.
- Improved error handling and logging in transaction processing.

These changes aim to enhance the flexibility and efficiency of transaction execution, particularly for EIP-7702 compliant operations.
@coderabbitai
Copy link

coderabbitai bot commented Jul 8, 2025

Walkthrough

The changes introduce new transaction type data structures and gas limit handling for Ethereum transactions, including EIP-7702 support. Transaction configuration and authorization schemas are refactored and relocated, with gas limit and transaction type data now part of the InnerTransaction struct. Related builder, execution, and serialization logic is updated to utilize these new fields and structures, and redundant or obsolete configuration is removed.

Changes

File(s) Change Summary
aa-core/src/userop/builder.rs Added optional call_gas_limit to UserOpBuilderConfig and updated builder initialization logic to propagate this value.
core/src/defs.rs Added AuthorizationSchema and SignedAuthorizationSchema structs for OpenAPI schema representation of EIP-7702 authorizations.
core/src/execution_options/eoa.rs Removed transaction type-specific configuration, authorization schemas, and gas limit from EoaExecutionOptions and related types.
core/src/execution_options/mod.rs Reordered module declarations and marked the Auto variant as the default in SpecificExecutionOptions.
core/src/transaction.rs Added gas_limit and transaction_type_data fields to InnerTransaction. Introduced TransactionTypeData enum and related structs for EIP-7702, EIP-1559, and legacy transaction support.
executors/src/eoa/store.rs Replaced EoaTransactionTypeData with TransactionTypeData in EoaTransactionRequest, updated Redis key format for transaction data storage.
executors/src/eoa/worker.rs Replaced usage of EoaTransactionTypeData with TransactionTypeData throughout transaction building logic.
executors/src/external_bundler/send.rs Added computation of custom call gas limit based on transaction gas limits and propagated it to the user operation builder config.
server/src/execution_router/mod.rs Updated EoaTransactionRequest construction to use gas_limit and transaction_type_data from the transaction object.
server/src/http/dyn_contract.rs Updated to_inner_transaction to explicitly set gas_limit and transaction_type_data to None in returned InnerTransaction.
server/src/http/routes/contract_read.rs Adjusted serde_with imports and attribute placement for ReadOptions struct; no logic changes.

Sequence Diagram(s)

Transaction Submission Flow with Gas Limit and Type Data

sequenceDiagram
    participant Client
    participant Server (Router)
    participant Executor
    participant Bundler
    participant Builder

    Client->>Server (Router): Submit transaction (with gas_limit, transaction_type_data)
    Server (Router)->>Executor: Create EoaTransactionRequest (using transaction.gas_limit, transaction_type_data)
    Executor->>Bundler: Prepare job data (includes transactions with gas_limit)
    Bundler->>Builder: Compute call_gas_limit from transactions
    Builder->>Builder: Initialize UserOpBuilderConfig (with call_gas_limit)
    Builder-->>Bundler: Built user operation
    Bundler-->>Executor: Submit user operation
    Executor-->>Server (Router): Respond with result
    Server (Router)-->>Client: Return execution result
Loading

Transaction Type Data Handling in InnerTransaction

sequenceDiagram
    participant User
    participant API
    participant InnerTransaction

    User->>API: Submit transaction (specifies type: EIP-7702, EIP-1559, or Legacy)
    API->>InnerTransaction: Construct with gas_limit and transaction_type_data
    InnerTransaction-->>API: Transaction with correct fields set
    API-->>User: Confirmation/response
Loading

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Clippy (1.86.0)
Updating crates.io index
Updating git repository `ssh://git@github.com/thirdweb-dev/vault.git`

error: failed to get vault-sdk as a dependency of package engine-aa-core v0.1.0 (/aa-core)

Caused by:
failed to load source for dependency vault-sdk

Caused by:
Unable to update ssh://git@github.com/thirdweb-dev/vault.git?branch=pb%2Fupdate-alloy#b0a72f93

Caused by:
failed to create directory /usr/local/git/db/vault-02bb070e2aa0045e

Caused by:
Permission denied (os error 13)

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • EIP-7702: Entity not found: Issue - Could not find referenced Issue.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
executors/src/external_bundler/send.rs (1)

418-432: LGTM: Custom gas limit calculation implemented correctly

The logic correctly calculates the total gas limit by summing individual transaction gas limits when all transactions have gas limits specified. The fallback to None when any transaction lacks a gas limit is appropriate.

Consider using iterator methods for more concise code:

-        let custom_call_gas_limit = {
-            let gas_limits: Vec<u64> = job_data.transactions.iter()
-                .filter_map(|tx| tx.gas_limit)
-                .collect();
-            
-            if gas_limits.len() == job_data.transactions.len() {
-                // All transactions have gas limits specified, sum them up
-                let total_gas: u64 = gas_limits.iter().sum();
-                Some(U256::from(total_gas))
-            } else {
-                // Not all transactions have gas limits specified
-                None
-            }
-        };
+        let custom_call_gas_limit = if job_data.transactions.iter().all(|tx| tx.gas_limit.is_some()) {
+            let total_gas: u64 = job_data.transactions.iter()
+                .filter_map(|tx| tx.gas_limit)
+                .sum();
+            Some(U256::from(total_gas))
+        } else {
+            None
+        };
core/src/transaction.rs (1)

52-96: Consider adding field validation for gas pricing fields.

The transaction type structs are well-designed, but consider adding validation to ensure gas pricing fields are within reasonable bounds (e.g., not zero, not exceeding u128::MAX / 10^9 for wei conversion safety).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c480bd and e546c59.

📒 Files selected for processing (11)
  • aa-core/src/userop/builder.rs (3 hunks)
  • core/src/defs.rs (1 hunks)
  • core/src/execution_options/eoa.rs (1 hunks)
  • core/src/execution_options/mod.rs (2 hunks)
  • core/src/transaction.rs (2 hunks)
  • executors/src/eoa/store.rs (3 hunks)
  • executors/src/eoa/worker.rs (3 hunks)
  • executors/src/external_bundler/send.rs (1 hunks)
  • server/src/execution_router/mod.rs (1 hunks)
  • server/src/http/dyn_contract.rs (1 hunks)
  • server/src/http/routes/contract_read.rs (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
executors/src/eoa/store.rs (2)
Learnt from: d4mr
PR: thirdweb-dev/engine-core#5
File: executors/src/eoa/worker.rs:173-176
Timestamp: 2025-07-06T15:44:13.701Z
Learning: The EOA executor store uses comprehensive WATCH-based coordination where every Redis state mutation watches the lock key and validates ownership before proceeding. If the lock is lost during any operation, the transaction fails with LockLost error. This makes aggressive lock acquisition safe because only the actual lock holder can successfully perform state mutations, regardless of who claims the lock.
Learnt from: d4mr
PR: thirdweb-dev/engine-core#5
File: executors/src/eoa/worker.rs:173-176
Timestamp: 2025-07-06T15:44:13.701Z
Learning: In the EOA executor system, aggressive lock acquisition is safe because every Redis state mutation uses WATCH operations on the lock key. If the lock is lost during a transaction, the WATCH causes the transaction to fail and the worker exits gracefully. This provides coordination between workers even when using forceful lock takeover.
🔇 Additional comments (21)
server/src/http/routes/contract_read.rs (2)

25-25: LGTM: Import organization improved

The grouping of DisplayFromStr, PickFirst, and serde_as imports from serde_with improves code organization and readability.


148-148: LGTM: Correct attribute placement

The #[serde_as] attribute placement on the ReadOptions struct is correct and aligns with the serialization improvements.

core/src/execution_options/mod.rs (2)

11-11: LGTM: Module reordering

Moving the eoa module below eip7702 aligns with the architectural changes in the PR and improves module organization.


35-35: LGTM: Default schema attribute added

Adding default to the Auto variant's schema attribute correctly identifies it as the default execution option, improving API documentation.

server/src/execution_router/mod.rs (2)

405-405: LGTM: Gas limit sourced from transaction

The change to source gas_limit from transaction.gas_limit correctly reflects the architectural shift where transaction-specific data is now stored in the transaction struct rather than execution options.


409-409: LGTM: Transaction type data sourced from transaction

The change to source transaction_type_data from transaction.transaction_type_data aligns with the PR's objective of moving transaction type data into the transaction struct itself.

executors/src/external_bundler/send.rs (1)

439-439: LGTM: Gas limit passed to builder config

The custom_call_gas_limit is correctly passed to the UserOpBuilderConfig, enabling the user operation builder to use the calculated gas limit.

server/src/http/dyn_contract.rs (1)

317-318: LGTM: Transaction fields properly initialized

The explicit initialization of gas_limit and transaction_type_data to None correctly aligns with the enhanced InnerTransaction structure. For contract calls, these fields are not needed, so None is the appropriate default.

aa-core/src/userop/builder.rs (3)

21-21: LGTM! Good addition of configurable gas limit.

The optional call_gas_limit field enables flexible gas limit configuration while maintaining backward compatibility.


105-105: LGTM! Proper implementation of configurable gas limit.

The implementation correctly uses the configured gas limit or falls back to zero, maintaining backward compatibility.


215-215: LGTM! Consistent implementation across builder versions.

The V0_7 builder correctly mirrors the V0_6 implementation for the configurable gas limit feature.

executors/src/eoa/worker.rs (2)

13-13: LGTM! Import change supports unified transaction type handling.

The change from EoaTransactionTypeData to TransactionTypeData aligns with the PR's goal of consolidating transaction type data structures.


1766-1808: LGTM! Pattern matching correctly updated for new enum.

The match arms are properly updated to use TransactionTypeData variants (Eip1559, Legacy, Eip7702) while preserving the original logic for handling gas fees and authorization lists.

executors/src/eoa/store.rs (3)

8-8: LGTM!

The import change correctly reflects the refactoring that moved transaction type data from execution options to the transaction module.


248-248: LGTM!

The field type change is consistent with the new TransactionTypeData import.


296-296: Ensure backward compatibility when renaming the Redis key

It looks like the eoa_tx_data:{transaction_id} key was renamed to eoa_executor:_tx_data:{transaction_id} without any migration or fallback in place:

  • No remaining references to eoa_tx_data: were found in the Rust code
  • No migration scripts or docs mention migrating old keys
  • Any existing transaction data under the old key format will become inaccessible

Please add one of the following before rolling out this change in production:

  • A migration script to copy or rename existing eoa_tx_data:* keys
  • Fallback logic that attempts the old key if the new one is missing

And confirm that this covers all running environments.

core/src/defs.rs (2)

20-41: LGTM!

The AuthorizationSchema struct is well-designed with proper documentation and schema annotations for EIP-7702 support.


43-83: LGTM!

The SignedAuthorizationSchema struct correctly implements the signed authorization format with proper ECDSA signature components and backward-compatible field naming.

core/src/transaction.rs (2)

23-38: LGTM!

The additions to InnerTransaction are well-designed:

  • Optional gas_limit allows flexibility for gas estimation
  • Flattened transaction_type_data provides a clean API structure
  • Clear documentation about ERC4337 limitations

40-50: LGTM!

The TransactionTypeData enum design with untagged serialization provides a clean API for different transaction types.

core/src/execution_options/eoa.rs (1)

1-46: LGTM!

The simplification of EoaExecutionOptions appropriately removes transaction type-specific data that has been moved to the transaction module, maintaining clean separation of concerns.

@d4mr d4mr merged commit 00832c3 into main Jul 8, 2025
3 checks passed
@d4mr d4mr deleted the pb/extend-inner-transaction branch July 8, 2025 19:53
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.

2 participants