From e85e02da75d196b7099a392f6f66f48d401d34d6 Mon Sep 17 00:00:00 2001 From: Prithvish Baidya Date: Fri, 25 Jul 2025 05:08:30 +0530 Subject: [PATCH] Refactor EIP-7702 sender details and improve webhook error handling - Renamed `account_address` to `eoa_address` in the `SessionKey` variant of `Eip7702Sender` for clarity and consistency. - Updated the webhook error handling logic to use `StatusCode::TOO_MANY_REQUESTS` instead of a numeric comparison for better readability. - Removed commented-out code in `confirm.rs` to clean up the file. These changes enhance code clarity and maintainability in the EIP-7702 executor and webhook components. --- executors/src/eip7702_executor/confirm.rs | 2 -- executors/src/eip7702_executor/send.rs | 4 ++-- executors/src/webhook/mod.rs | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/executors/src/eip7702_executor/confirm.rs b/executors/src/eip7702_executor/confirm.rs index 9ca6f37..aaeebf7 100644 --- a/executors/src/eip7702_executor/confirm.rs +++ b/executors/src/eip7702_executor/confirm.rs @@ -345,5 +345,3 @@ where } } } - -// --- Helper Functions --- diff --git a/executors/src/eip7702_executor/send.rs b/executors/src/eip7702_executor/send.rs index a70f5d2..c7f5283 100644 --- a/executors/src/eip7702_executor/send.rs +++ b/executors/src/eip7702_executor/send.rs @@ -91,7 +91,7 @@ pub enum Eip7702Sender { #[serde(rename_all = "camelCase")] SessionKey { session_key_address: Address, - account_address: Address, + eoa_address: Address, }, } @@ -302,7 +302,7 @@ where let sender_details = match session_key_target_address { Some(target_address) => Eip7702Sender::SessionKey { session_key_address: owner_address, - account_address: target_address, + eoa_address: target_address, }, None => Eip7702Sender::Owner { eoa_address: owner_address, diff --git a/executors/src/webhook/mod.rs b/executors/src/webhook/mod.rs index 3020868..e2cfc1b 100644 --- a/executors/src/webhook/mod.rs +++ b/executors/src/webhook/mod.rs @@ -6,6 +6,7 @@ use engine_core::execution_options::WebhookOptions; use hex; use hmac::{Hmac, Mac}; use reqwest::header::{HeaderMap, HeaderName, HeaderValue}; +use reqwest::StatusCode; use serde::{Deserialize, Serialize}; use twmq::error::TwmqError; use twmq::hooks::TransactionContext; @@ -285,7 +286,7 @@ impl DurableExecution for WebhookJobHandler { body_preview: error_body_preview, }; - if status.is_server_error() || status.as_u16() == 429 { + if status.is_server_error() || status == StatusCode::TOO_MANY_REQUESTS { if job.job.attempts < self.retry_config.max_attempts { let delay_ms = self.retry_config.initial_delay_ms as f64 * self