Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use feeHistory when estimating blob fee #1764

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, the last entry should be the estimated next one

.ok_or(RpcError::NullResp)
.copied()
}

async fn fill(
Expand Down
Loading