Skip to content

Commit 1d4e650

Browse files
authored
Enhance error handling in EoaExecutorWorker for unsupported EIP-1559 errors (#39)
* Enhance error handling in EoaExecutorWorker for unsupported EIP-1559 errors - Updated the error handling logic to include a new function `is_unsupported_eip1559_error`, which checks for unsupported feature errors and specific error messages related to method availability. - Modified the transaction processing logic to utilize this new error handling function, improving the robustness of the EoaExecutorWorker's response to unsupported EIP-1559 features. * Update tracing instrumentation in AtomicEoaExecutorStore to log transaction length instead of transactions directly.
1 parent 9cab16d commit 1d4e650

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

executors/src/eoa/store/atomic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl AtomicEoaExecutorStore {
141141
///
142142
/// The transactions must have sequential nonces starting from the current optimistic count.
143143
/// This operation validates nonce ordering and atomically moves all transactions.
144-
#[tracing::instrument(skip_all, fields(transactions = ?transactions))]
144+
#[tracing::instrument(skip_all, fields(transactions_length = transactions.len()))]
145145
pub async fn atomic_move_pending_to_borrowed_with_incremented_nonces(
146146
&self,
147147
transactions: &[BorrowedTransactionData],

executors/src/eoa/worker/error.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ pub fn is_retryable_rpc_error(kind: &RpcErrorKind) -> bool {
238238
RpcErrorKind::ErrorResp(resp) => {
239239
let message = resp.message.to_lowercase();
240240
// if the error message contains "invalid chain", it's not retryable
241-
!message.contains("invalid chain")
241+
!(message.contains("invalid chain") || message.contains("invalid opcode"))
242242
}
243243
_ => true,
244244
}
@@ -323,3 +323,16 @@ impl SubmissionResult {
323323
}
324324
}
325325
}
326+
327+
pub fn is_unsupported_eip1559_error(error: &RpcError<TransportErrorKind>) -> bool {
328+
if let RpcError::UnsupportedFeature(_) = error {
329+
return true;
330+
}
331+
332+
if let RpcError::ErrorResp(resp) = error {
333+
let message = resp.message.to_lowercase();
334+
return message.contains("method not found");
335+
}
336+
337+
false
338+
}

executors/src/eoa/worker/transaction.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ use engine_core::{
2020
};
2121

2222
use crate::eoa::{
23-
EoaTransactionRequest,
2423
store::{
2524
BorrowedTransaction, BorrowedTransactionData, PendingTransaction, SubmittedNoopTransaction,
26-
},
27-
worker::{
28-
EoaExecutorWorker,
29-
error::{EoaExecutorWorkerError, is_retryable_preparation_error},
30-
},
25+
}, worker::{
26+
error::{is_retryable_preparation_error, is_unsupported_eip1559_error, EoaExecutorWorkerError}, EoaExecutorWorker
27+
}, EoaTransactionRequest
3128
};
3229

3330
// Retry constants for preparation phase
@@ -199,7 +196,7 @@ impl<C: Chain> EoaExecutorWorker<C> {
199196
}
200197
Err(eip1559_error) => {
201198
// Check if this is an "unsupported feature" error
202-
if let RpcError::UnsupportedFeature(_) = &eip1559_error {
199+
if is_unsupported_eip1559_error(&eip1559_error) {
203200
tracing::debug!("EIP-1559 not supported, falling back to legacy gas price");
204201

205202
// Fall back to legacy gas price only if no gas price is set

0 commit comments

Comments
 (0)