Skip to content

Conversation

@d4mr
Copy link
Contributor

@d4mr d4mr commented Oct 18, 2025

  • Added fleet_id field to Eip7702OwnerExecution and Eip7702SessionKeyExecution structs to allow routing transactions to specific bundler fleets.
  • Introduced fleet_id method in Eip7702ExecutionOptions for retrieving the fleet ID.
  • Updated bundler client creation in the executor to include the optional fleet_id header when present, enhancing transaction routing capabilities.

Summary by CodeRabbit

  • New Features

    • Optional fleet identifier can be attached to EIP‑7702 execution options to route transactions to a specific executor fleet; omitted from payloads when not set.
  • Bug Fixes / Reliability

    • Execution requests now include the fleet identifier header when present and validate its format, producing clearer errors if validation or header construction fails.

- Added `fleet_id` field to `Eip7702OwnerExecution` and `Eip7702SessionKeyExecution` structs to allow routing transactions to specific bundler fleets.
- Introduced `fleet_id` method in `Eip7702ExecutionOptions` for retrieving the fleet ID.
- Updated bundler client creation in the executor to include the optional `fleet_id` header when present, enhancing transaction routing capabilities.
@coderabbitai
Copy link

coderabbitai bot commented Oct 18, 2025

Walkthrough

Adds optional fleet_id fields to EIP-7702 execution structs and a fleet_id() accessor; send logic now conditionally builds bundler request headers and inserts x-executor-fleet-id when a fleet ID is present, validating header parsing and mapping errors to InvalidRpcCredentials.

Changes

Cohort / File(s) Summary
EIP7702 execution options core
core/src/execution_options/eip7702.rs
Added pub fleet_id: Option<String> to Eip7702OwnerExecution and Eip7702SessionKeyExecution with #[serde(skip_serializing_if = "Option::is_none")]. Added pub fn fleet_id(&self) -> Option<&str> on Eip7702ExecutionOptions.
EIP7702 executor send logic
executors/src/eip7702_executor/send.rs
Made chain auth headers mutable and, when job_data.execution_options.fleet_id() is Some, parsed/validated the fleet ID and inserted an x-executor-fleet-id header (errors mapped to InvalidRpcCredentials) before using bundler_client_with_headers(headers); otherwise uses existing bundler_client(). Minor whitespace/comments updated.

Sequence Diagram(s)

sequenceDiagram
    participant Exec as EIP7702 Executor
    participant Options as ExecutionOptions
    participant RPC as RPC Credentials Builder
    participant Bundler as Bundler Client

    Exec->>Options: fleet_id()
    alt fleet_id Some
        Options-->>Exec: Some(fleet_id)
        Exec->>RPC: build headers from auth (mutable)
        RPC-->>Exec: Result<headers, InvalidRpcCredentials>
        alt headers built
            Exec->>Exec: validate/parse fleet_id
            Exec-->>Bundler: bundler_client_with_headers(headers + x-executor-fleet-id)
        else invalid RPC creds
            Exec-->>Exec: Err(InvalidRpcCredentials)
        end
    else fleet_id None
        Options-->>Exec: None
        Exec-->>Bundler: bundler_client()
    end
    Exec->>Bundler: tw_execute(...) / request
    Bundler-->>Exec: response / retry / error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Implement fleet ID support in EIP-7702 execution options" directly and accurately summarizes the main change in the changeset. The PR adds optional fleet_id fields to EIP-7702 execution option structures, introduces a fleet_id accessor method, and updates the bundler client to conditionally embed fleet ID headers. The title is specific, concise, and clearly describes the primary purpose of the changes without vague terms or unnecessary noise. A teammate scanning the history would immediately understand that this PR adds fleet ID routing capabilities to EIP-7702 execution handling.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pb/7702-fleet-id

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8d43747 and 5be7055.

📒 Files selected for processing (1)
  • executors/src/eip7702_executor/send.rs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • executors/src/eip7702_executor/send.rs

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.

Comment @coderabbitai help to get the list of available commands and usage tips.

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 (1)
executors/src/eip7702_executor/send.rs (1)

283-309: Consider refactoring to eliminate duplicate header conversion.

The rpc_credentials.to_header_map() conversion is duplicated at lines 197 and 287. Consider reusing the chain_auth_headers variable created earlier to reduce code duplication.

One approach:

-        let chain_auth_headers = job_data
-            .rpc_credentials
-            .to_header_map()
-            .map_err(|e| Eip7702SendError::InvalidRpcCredentials {
-                message: e.to_string(),
-            })
-            .map_err_fail()?;
+        let mut chain_auth_headers = job_data
+            .rpc_credentials
+            .to_header_map()
+            .map_err(|e| Eip7702SendError::InvalidRpcCredentials {
+                message: e.to_string(),
+            })
+            .map_err_fail()?;

         let chain = chain.with_new_default_headers(chain_auth_headers.clone());
         
         // ... (existing code) ...
         
         // Create bundler client with optional fleet_id header for tw_execute
         let bundler_client = if let Some(fleet_id) = job_data.execution_options.fleet_id() {
-            let mut headers = job_data
-                .rpc_credentials
-                .to_header_map()
-                .map_err(|e| Eip7702SendError::InvalidRpcCredentials {
-                    message: e.to_string(),
-                })
-                .map_err_fail()?;
+            let mut headers = chain_auth_headers.clone();
             
             headers.insert(

Note: Ensure chain_auth_headers is cloned when passed to with_new_default_headers if it needs to be reused.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6c601d8 and daed6b3.

📒 Files selected for processing (2)
  • core/src/execution_options/eip7702.rs (2 hunks)
  • executors/src/eip7702_executor/send.rs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
executors/src/eip7702_executor/send.rs (2)
core/src/chain.rs (2)
  • bundler_client (37-37)
  • bundler_client (94-96)
core/src/execution_options/eip7702.rs (1)
  • fleet_id (19-24)
🔇 Additional comments (3)
core/src/execution_options/eip7702.rs (3)

17-25: LGTM! Clean implementation of the fleet_id accessor.

The method correctly uses pattern matching and as_deref() to provide an optional string reference from both execution variants.


35-37: LGTM! Appropriate field definition for optional fleet routing.

The field is correctly typed as Option<String> with skip_serializing_if to omit it when not provided.


52-54: LGTM! Consistent field definition across execution variants.

The field definition properly mirrors the implementation in Eip7702OwnerExecution, maintaining consistency across both execution types.

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 (1)
executors/src/eip7702_executor/send.rs (1)

285-291: Refactor: Extract header creation to reduce duplication.

The header creation from rpc_credentials (lines 285-291) duplicates the same logic from lines 195-201. Consider extracting this into a helper variable or method to avoid repeating the conversion and error handling.

Apply this diff to reduce duplication:

     let chain_auth_headers = job_data
         .rpc_credentials
         .to_header_map()
         .map_err(|e| Eip7702SendError::InvalidRpcCredentials {
             message: e.to_string(),
         })
         .map_err_fail()?;

     let chain = chain.with_new_default_headers(chain_auth_headers);
+
+    // Reuse headers for bundler client if needed
+    let mut bundler_headers = chain_auth_headers.clone();

Then at lines 285-291:

         // Create bundler client with optional fleet_id header for tw_execute
         let bundler_client = if let Some(fleet_id) = job_data.execution_options.fleet_id() {
-            let mut headers = job_data
-                .rpc_credentials
-                .to_header_map()
-                .map_err(|e| Eip7702SendError::InvalidRpcCredentials {
-                    message: e.to_string(),
-                })
-                .map_err_fail()?;
-
-            headers.insert(
+            bundler_headers.insert(
                 "x-executor-fleet-id",
                 fleet_id
                     .parse()
                     .map_err(|e| Eip7702SendError::InvalidRpcCredentials {
                         message: format!("Invalid fleet_id value: {e}"),
                     })
                     .map_err_fail()?,
             );

             &transactions
                 .account()
                 .chain()
-                .bundler_client_with_headers(headers)
+                .bundler_client_with_headers(bundler_headers.clone())
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between daed6b3 and 8d43747.

📒 Files selected for processing (1)
  • executors/src/eip7702_executor/send.rs (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
executors/src/eip7702_executor/send.rs (3)
eip7702-core/tests/integration_tests.rs (1)
  • bundler_client (135-138)
core/src/chain.rs (2)
  • bundler_client (37-37)
  • bundler_client (94-96)
core/src/execution_options/eip7702.rs (1)
  • fleet_id (19-24)
🔇 Additional comments (3)
executors/src/eip7702_executor/send.rs (3)

283-309: LGTM: Fleet ID routing logic is correctly implemented.

The conditional bundler client creation properly handles the optional fleet_id:

  • Correctly checks for fleet_id presence
  • Appropriately adds the x-executor-fleet-id header when present
  • Falls back to default bundler client when absent
  • Error handling for both header creation and fleet_id parsing is appropriate with immediate failure on invalid credentials

311-311: LGTM: Correctly uses the conditionally-selected bundler client.

The variable usage correctly leverages the conditional bundler client selection from lines 283-309, enabling fleet-based routing when a fleet_id is present.


283-309: The method exists and is correctly called—no issue here.

The search confirms that bundler_client_with_headers is defined on the Chain trait (core/src/chain.rs:40) with the correct signature fn bundler_client_with_headers(&self, headers: HeaderMap) -> BundlerClient; and has a concrete implementation at core/src/chain.rs:102. The code in the review comment correctly passes a HeaderMap to this method.

Likely an incorrect or invalid review comment.

@d4mr d4mr merged commit 3beb5ce into main Oct 18, 2025
3 checks passed
@d4mr d4mr deleted the pb/7702-fleet-id branch October 18, 2025 00:22
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