Skip to content

Commit f3d700a

Browse files
authored
Enhance error handling in EoaExecutorWorker for transaction simulation (#36)
- Added a fallback case to handle transaction reverts during gas estimation, ensuring that fundamentally broken transactions fail appropriately.
1 parent 6f87137 commit f3d700a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

executors/src/eoa/worker/transaction.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,7 @@ impl<C: Chain> EoaExecutorWorker<C> {
210210
Ok(tx.with_gas_price(gas_price))
211211
}
212212
Err(legacy_error) => Err(EoaExecutorWorkerError::RpcError {
213-
message: format!(
214-
"Failed to get legacy gas price: {legacy_error}"
215-
),
213+
message: format!("Failed to get legacy gas price: {legacy_error}"),
216214
inner_error: legacy_error.to_engine_error(&self.chain),
217215
}),
218216
}
@@ -326,6 +324,17 @@ impl<C: Chain> EoaExecutorWorker<C> {
326324
),
327325
inner_error: e.to_engine_error(&self.chain),
328326
});
327+
} else if error_payload.message.to_lowercase().contains("revert") {
328+
// This is a revert - the transaction is fundamentally broken
329+
// This should fail the individual transaction, not the worker
330+
// We need this fallback case because some providers don't return revert data
331+
return Err(EoaExecutorWorkerError::TransactionSimulationFailed {
332+
message: format!(
333+
"Transaction reverted during gas estimation: {}",
334+
error_payload.message
335+
),
336+
inner_error: e.to_engine_error(&self.chain),
337+
});
329338
}
330339
}
331340

0 commit comments

Comments
 (0)