From 7efb60b47c27c89b0e16946eaf82d80bdb598a98 Mon Sep 17 00:00:00 2001 From: MartinquaXD Date: Thu, 7 May 2026 08:45:55 +0000 Subject: [PATCH 1/2] Simulate txs on the `latest` block instead of `pending` --- crates/driver/src/infra/blockchain/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/driver/src/infra/blockchain/mod.rs b/crates/driver/src/infra/blockchain/mod.rs index 8b3211998f..3d983be5e0 100644 --- a/crates/driver/src/infra/blockchain/mod.rs +++ b/crates/driver/src/infra/blockchain/mod.rs @@ -205,7 +205,10 @@ impl Ethereum { token::Erc20::new(self, address) } - /// Estimate gas used by a transaction. + /// Estimate gas used by a transaction with `eth_estimateGas` on the `latest` + /// block. We use the `latest` instead of `pending` to avoid false positive + /// reverts that happen when we re-check the tx on a later block after we + /// already submitted the tx to the mempool. pub async fn estimate_gas(&self, tx: eth::Tx) -> Result { let tx = TransactionRequest::default() .from(tx.from) @@ -223,7 +226,7 @@ impl Ethereum { .web3 .provider .estimate_gas(tx) - .pending() + .latest() .await .map_err(Error::Rpc)? .into(); From 23e94d6b42300a44f69d23424fca62101b6a9d69 Mon Sep 17 00:00:00 2001 From: MartinquaXD Date: Thu, 7 May 2026 09:00:16 +0000 Subject: [PATCH 2/2] cargo fmt --- crates/driver/src/infra/blockchain/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/driver/src/infra/blockchain/mod.rs b/crates/driver/src/infra/blockchain/mod.rs index 3d983be5e0..b79337589a 100644 --- a/crates/driver/src/infra/blockchain/mod.rs +++ b/crates/driver/src/infra/blockchain/mod.rs @@ -205,10 +205,10 @@ impl Ethereum { token::Erc20::new(self, address) } - /// Estimate gas used by a transaction with `eth_estimateGas` on the `latest` - /// block. We use the `latest` instead of `pending` to avoid false positive - /// reverts that happen when we re-check the tx on a later block after we - /// already submitted the tx to the mempool. + /// Estimate gas used by a transaction with `eth_estimateGas` on the + /// `latest` block. We use the `latest` instead of `pending` to avoid + /// false positive reverts that happen when we re-check the tx on a + /// later block after we already submitted the tx to the mempool. pub async fn estimate_gas(&self, tx: eth::Tx) -> Result { let tx = TransactionRequest::default() .from(tx.from)