-
Notifications
You must be signed in to change notification settings - Fork 8
Implement fleet ID support in EIP-7702 execution options #73
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
Conversation
- 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.
WalkthroughAdds optional Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
There was a problem hiding this 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 thechain_auth_headersvariable 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_headersis cloned when passed towith_new_default_headersif 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.
📒 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>withskip_serializing_ifto 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.
There was a problem hiding this 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.
📒 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-idheader 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_headersis defined on theChaintrait (core/src/chain.rs:40) with the correct signaturefn bundler_client_with_headers(&self, headers: HeaderMap) -> BundlerClient;and has a concrete implementation atcore/src/chain.rs:102. The code in the review comment correctly passes aHeaderMapto this method.Likely an incorrect or invalid review comment.
fleet_idfield toEip7702OwnerExecutionandEip7702SessionKeyExecutionstructs to allow routing transactions to specific bundler fleets.fleet_idmethod inEip7702ExecutionOptionsfor retrieving the fleet ID.fleet_idheader when present, enhancing transaction routing capabilities.Summary by CodeRabbit
New Features
Bug Fixes / Reliability