Skip to content

Commit 3a251fc

Browse files
authored
Add address field to EoaExecutorEvent and related structures (#18)
* Add address field to EoaExecutorEvent and related structures - Introduced an `address` field in `EoaExecutorEvent` to capture the user's request address. - Updated the `EoaSendAttemptSuccessData` structure to include the address. - Modified event creation in various store implementations to populate the new address field from user requests. - Enhanced webhook event handling to include address information for better tracking and reporting of transaction outcomes. * name
1 parent b61e95e commit 3a251fc

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

executors/src/eoa/events.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::fmt::Display;
22

3+
use alloy::primitives::Address;
34
use serde::{Deserialize, Serialize};
45
use twmq::job::RequeuePosition;
56

@@ -16,6 +17,7 @@ use crate::{
1617

1718
pub struct EoaExecutorEvent {
1819
pub transaction_id: String,
20+
pub address: Address,
1921
}
2022

2123
#[derive(Serialize, Deserialize, Debug, Clone, thiserror::Error)]
@@ -34,6 +36,13 @@ pub struct EoaSendAttemptNackData {
3436
pub error: EoaExecutorWorkerError,
3537
}
3638

39+
#[derive(Debug, Clone, Serialize, Deserialize)]
40+
pub struct EoaSendAttemptSuccessData {
41+
#[serde(flatten)]
42+
pub submitted_transaction: SubmittedTransactionDehydrated,
43+
pub eoa_address: Address,
44+
}
45+
3746
#[derive(Debug, Clone, Serialize, Deserialize)]
3847
pub struct EoaExecutorConfirmedTransaction {
3948
pub receipt: alloy::rpc::types::TransactionReceipt,
@@ -60,15 +69,17 @@ impl EoaExecutorEvent {
6069
pub fn send_attempt_success_envelope(
6170
&self,
6271
submitted_transaction: SubmittedTransactionDehydrated,
63-
) -> BareWebhookNotificationEnvelope<SerializableSuccessData<SubmittedTransactionDehydrated>>
64-
{
72+
) -> BareWebhookNotificationEnvelope<SerializableSuccessData<EoaSendAttemptSuccessData>> {
6573
BareWebhookNotificationEnvelope {
6674
transaction_id: self.transaction_id.clone(),
6775
executor_name: EXECUTOR_NAME.to_string(),
6876
stage_name: EoaExecutorStage::Send.to_string(),
6977
event_type: StageEvent::Success,
7078
payload: SerializableSuccessData {
71-
result: submitted_transaction.clone(),
79+
result: EoaSendAttemptSuccessData {
80+
submitted_transaction: submitted_transaction.clone(),
81+
eoa_address: self.address,
82+
},
7283
},
7384
}
7485
}

executors/src/eoa/store/atomic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ impl AtomicEoaExecutorStore {
535535

536536
let event = EoaExecutorEvent {
537537
transaction_id: pending_transaction.transaction_id.clone(),
538+
address: pending_transaction.user_request.from,
538539
};
539540

540541
let fail_envelope = event.transaction_failed_envelope(error.clone(), 1);

executors/src/eoa/store/borrowed.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ impl SafeRedisTransaction for ProcessBorrowedTransactions<'_> {
139139

140140
// Queue webhook event using user_request from SubmissionResult
141141
let event = EoaExecutorEvent {
142+
address: result.transaction.user_request.from,
142143
transaction_id: transaction_id.to_string(),
143144
};
144145

@@ -177,6 +178,7 @@ impl SafeRedisTransaction for ProcessBorrowedTransactions<'_> {
177178
// Queue webhook event using user_request from SubmissionResult
178179
let event = EoaExecutorEvent {
179180
transaction_id: transaction_id.to_string(),
181+
address: result.transaction.user_request.from,
180182
};
181183
let envelope = event.send_attempt_nack_envelope(nonce, err.clone(), 1);
182184

@@ -208,6 +210,7 @@ impl SafeRedisTransaction for ProcessBorrowedTransactions<'_> {
208210
// Queue webhook event using user_request from SubmissionResult
209211
let event = EoaExecutorEvent {
210212
transaction_id: transaction_id.to_string(),
213+
address: result.transaction.user_request.from,
211214
};
212215
let envelope = event.transaction_failed_envelope(err.clone(), 1);
213216
if !result.transaction.user_request.webhook_options.is_empty() {

executors/src/eoa/store/submitted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ impl SafeRedisTransaction for CleanSubmittedTransactions<'_> {
278278
if !tx.user_request.webhook_options.is_empty() {
279279
let event = EoaExecutorEvent {
280280
transaction_id: tx.transaction_id.clone(),
281+
address: tx.user_request.from,
281282
};
282283

283284
let success_envelope =
@@ -309,6 +310,7 @@ impl SafeRedisTransaction for CleanSubmittedTransactions<'_> {
309310
if !tx.user_request.webhook_options.is_empty() {
310311
let event = EoaExecutorEvent {
311312
transaction_id: tx.transaction_id.clone(),
313+
address: tx.user_request.from,
312314
};
313315

314316
let success_envelope =

executors/src/eoa/worker/confirm.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ impl<C: Chain> EoaExecutorWorker<C> {
7070
time_since_movement = time_since_movement,
7171
stall_timeout = NONCE_STALL_TIMEOUT,
7272
current_chain_nonce = current_chain_transaction_count,
73+
cached_transaction_count = cached_transaction_count,
7374
"Nonce has been stalled, attempting gas bump"
7475
);
7576

@@ -85,13 +86,13 @@ impl<C: Chain> EoaExecutorWorker<C> {
8586
}
8687
}
8788

88-
tracing::debug!("No nonce progress, skipping confirm flow");
89-
return Ok(CleanupReport::default());
89+
tracing::debug!("No nonce progress, still going ahead with confirm flow");
90+
// return Ok(CleanupReport::default());
9091
}
9192

9293
tracing::info!(
9394
current_chain_nonce = current_chain_transaction_count,
94-
cached_nonce = cached_transaction_count,
95+
cached_transaction_count = cached_transaction_count,
9596
"Processing confirmations"
9697
);
9798

@@ -140,7 +141,7 @@ impl<C: Chain> EoaExecutorWorker<C> {
140141
ConfirmedTransaction {
141142
transaction_hash: tx.transaction_hash,
142143
transaction_id: tx.transaction_id,
143-
receipt: tx.receipt.into(),
144+
receipt: tx.receipt,
144145
receipt_serialized: receipt_data,
145146
}
146147
})

0 commit comments

Comments
 (0)