Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions core/src/execution_options/eip7702.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,27 @@ pub enum Eip7702ExecutionOptions {
SessionKey(Eip7702SessionKeyExecution),
}

impl Eip7702ExecutionOptions {
/// Get the fleet ID if present
pub fn fleet_id(&self) -> Option<&str> {
match self {
Eip7702ExecutionOptions::Owner(o) => o.fleet_id.as_deref(),
Eip7702ExecutionOptions::SessionKey(s) => s.fleet_id.as_deref(),
}
}
}

#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
#[schema(title = "EIP-7702 Owner Execution")]
#[serde(rename_all = "camelCase")]
pub struct Eip7702OwnerExecution {
#[schema(value_type = AddressDef)]
/// The delegated EOA address
pub from: Address,

/// Optional fleet ID to route the transaction to a specific bundler fleet
#[serde(skip_serializing_if = "Option::is_none")]
pub fleet_id: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
Expand All @@ -30,7 +44,12 @@ pub struct Eip7702SessionKeyExecution {
#[schema(value_type = AddressDef)]
/// The session key address is your server wallet, which has been granted a session key to the `account_address`
pub session_key_address: Address,

#[schema(value_type = AddressDef)]
/// The account address is the address of a delegated account you want to execute the transaction on. This account has granted a session key to the `session_key_address`
pub account_address: Address,

/// Optional fleet ID to route the transaction to a specific bundler fleet
#[serde(skip_serializing_if = "Option::is_none")]
pub fleet_id: Option<String>,
}
17 changes: 15 additions & 2 deletions executors/src/eip7702_executor/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,27 @@ where
})
.map_err_fail()?;

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

// Add optional fleet_id header for bundler routing
if let Some(fleet_id) = job_data.execution_options.fleet_id() {
chain_auth_headers.insert(
"x-executor-fleet-id",
fleet_id
.parse()
.map_err(|e| Eip7702SendError::InvalidRpcCredentials {
message: format!("Invalid fleet_id value: {e}"),
})
.map_err_fail()?,
);
}

let chain = chain.with_new_default_headers(chain_auth_headers);

let owner_address = match &job_data.execution_options {
Expand Down Expand Up @@ -230,7 +243,7 @@ where
let mapped_error = Eip7702SendError::DelegationCheckFailed {
inner_error: e.clone(),
};

// Retry only if the error is retryable (network issues, 5xx, etc.)
// Client errors (4xx) like "Invalid chain" or auth errors fail immediately
if is_build_error_retryable(&e) {
Expand Down