Skip to content

Commit 369ba52

Browse files
authored
Increase gas estimation buffer +50k (#101)
* Increase gas estimation buffer +50k When gas is not provided, increase the safety margin applied to provider's estimate: change from a 10% buffer to a 20% buffer and add a fixed 50,000 gas units overhead. This reduces risk of out-of-gas failures for transactions using estimated limits. * constant
1 parent c440cd5 commit 369ba52

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

executors/src/eoa/worker/transaction.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
use std::time::Duration;
22

3-
use alloy::{
3+
/// Fixed overhead added to gas estimates to account for estimation inaccuracies
4+
const GAS_ESTIMATION_FIXED_OVERHEAD: u64 = 50_000;
5+
6+
use alloy:{
47
consensus::{
58
SignableTransaction, Signed, TxEip4844Variant, TxEip4844WithSidecar, TypedTransaction,
69
},
@@ -310,7 +313,7 @@ impl<C: Chain> EoaExecutorWorker<C> {
310313
if tx_request.gas.is_none() {
311314
match self.chain.provider().estimate_gas(tx_request.clone()).await {
312315
Ok(gas_limit) => {
313-
tx_request = tx_request.with_gas_limit(gas_limit * 110 / 100); // 10% buffer
316+
tx_request = tx_request.with_gas_limit(gas_limit * 120 / 100 + GAS_ESTIMATION_FIXED_OVERHEAD); // 20% buffer + fixed overhead
314317
}
315318
Err(e) => {
316319
// Check if this is a revert

0 commit comments

Comments
 (0)