From bd6ee015fd167912e3087b71fdc34b048230d448 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Sat, 7 Dec 2024 09:20:00 +0400 Subject: [PATCH] fix: use `feeHistory` when estimating blob fee (#1764) fix: use feeHistory when estimating blob fee --- crates/provider/src/fillers/gas.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/crates/provider/src/fillers/gas.rs b/crates/provider/src/fillers/gas.rs index e6d9c173a5e..6de402d28db 100644 --- a/crates/provider/src/fillers/gas.rs +++ b/crates/provider/src/fillers/gas.rs @@ -6,11 +6,9 @@ use crate::{ utils::Eip1559Estimation, Provider, }; -use alloy_consensus::BlockHeader; use alloy_eips::eip4844::BLOB_TX_MIN_BLOB_GASPRICE; use alloy_json_rpc::RpcError; use alloy_network::{Network, TransactionBuilder, TransactionBuilder4844}; -use alloy_network_primitives::{BlockResponse, BlockTransactionsKind}; use alloy_rpc_types_eth::BlockNumberOrTag; use alloy_transport::{Transport, TransportResult}; use futures::FutureExt; @@ -226,17 +224,13 @@ where } } - let latest_block = provider - .get_block_by_number(BlockNumberOrTag::Latest, BlockTransactionsKind::Hashes) + provider + .get_fee_history(2, BlockNumberOrTag::Latest, &[]) .await? - .ok_or(RpcError::NullResp)?; - - let latest_header = latest_block.header().as_ref(); - - latest_header - .next_block_blob_fee() - .map(Into::into) - .ok_or(RpcError::UnsupportedFeature("eip4844")) + .base_fee_per_blob_gas + .last() + .ok_or(RpcError::NullResp) + .copied() } async fn fill(