Skip to content

Commit

Permalink
fix: use feeHistory when estimating blob fee (#1764)
Browse files Browse the repository at this point in the history
fix: use feeHistory when estimating blob fee
  • Loading branch information
klkvr authored Dec 7, 2024
1 parent 7bda8ec commit bd6ee01
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions crates/provider/src/fillers/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit bd6ee01

Please sign in to comment.