Skip to content

Commit 34e3463

Browse files
committed
Check for insufficient allowance error
1 parent a21820c commit 34e3463

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

node/src/ethereum_l1/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ mod l1_contracts_bindings;
55
mod monitor_transaction;
66
mod propose_batch_builder;
77
pub mod slot_clock;
8+
mod tools;
89
pub mod transaction_error;
910
pub mod ws_provider;
1011

node/src/ethereum_l1/monitor_transaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::metrics::Metrics;
22

3-
use super::{transaction_error::TransactionError, ws_provider::WsProvider};
3+
use super::{tools, transaction_error::TransactionError, ws_provider::WsProvider};
44
use alloy::{
55
consensus::{TxEip4844Variant, TxEnvelope, TxType},
66
network::{Network, ReceiptResponse, TransactionBuilder, TransactionBuilder4844},
@@ -375,7 +375,7 @@ impl TransactionMonitorThread {
375375
.await;
376376
return None;
377377
}
378-
} else if err.message.contains("insufficient funds") {
378+
} else if tools::check_for_insufficient_funds(&err.message) {
379379
error!("Failed to send transaction: {}", e);
380380
self.send_error_signal(TransactionError::InsufficientFunds)
381381
.await;

node/src/ethereum_l1/propose_batch_builder.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::ethereum_l1::{
2-
l1_contracts_bindings::*, transaction_error::TransactionError, ws_provider::WsProvider,
1+
use super::{
2+
l1_contracts_bindings::*, tools, transaction_error::TransactionError, ws_provider::WsProvider,
33
};
44
use alloy::{
55
network::{TransactionBuilder, TransactionBuilder4844},
@@ -185,6 +185,9 @@ impl ProposeBatchBuilder {
185185
if err_str.contains("0x3d32ffdb") || err_str.contains("0x2b44f010") {
186186
return TransactionError::EstimationTooEarly;
187187
}
188+
if tools::check_for_insufficient_funds(&err_str) {
189+
return TransactionError::InsufficientFunds;
190+
}
188191
TransactionError::EstimationFailed
189192
}
190193

node/src/ethereum_l1/tools.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub fn check_for_insufficient_funds(err_str: &str) -> bool {
2+
err_str.contains("insufficient funds") || err_str.contains("insufficient allowance")
3+
}

0 commit comments

Comments
 (0)