Skip to content

Commit 2a74fd2

Browse files
authored
Refactor EIP-7702 sender details and improve webhook error handling (#23)
- 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.
1 parent 55f3672 commit 2a74fd2

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

executors/src/eip7702_executor/confirm.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,5 +345,3 @@ where
345345
}
346346
}
347347
}
348-
349-
// --- Helper Functions ---

executors/src/eip7702_executor/send.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub enum Eip7702Sender {
9191
#[serde(rename_all = "camelCase")]
9292
SessionKey {
9393
session_key_address: Address,
94-
account_address: Address,
94+
eoa_address: Address,
9595
},
9696
}
9797

@@ -302,7 +302,7 @@ where
302302
let sender_details = match session_key_target_address {
303303
Some(target_address) => Eip7702Sender::SessionKey {
304304
session_key_address: owner_address,
305-
account_address: target_address,
305+
eoa_address: target_address,
306306
},
307307
None => Eip7702Sender::Owner {
308308
eoa_address: owner_address,

executors/src/webhook/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use engine_core::execution_options::WebhookOptions;
66
use hex;
77
use hmac::{Hmac, Mac};
88
use reqwest::header::{HeaderMap, HeaderName, HeaderValue};
9+
use reqwest::StatusCode;
910
use serde::{Deserialize, Serialize};
1011
use twmq::error::TwmqError;
1112
use twmq::hooks::TransactionContext;
@@ -285,7 +286,7 @@ impl DurableExecution for WebhookJobHandler {
285286
body_preview: error_body_preview,
286287
};
287288

288-
if status.is_server_error() || status.as_u16() == 429 {
289+
if status.is_server_error() || status == StatusCode::TOO_MANY_REQUESTS {
289290
if job.job.attempts < self.retry_config.max_attempts {
290291
let delay_ms = self.retry_config.initial_delay_ms as f64
291292
* self

0 commit comments

Comments
 (0)