Skip to content
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
21 changes: 1 addition & 20 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3120,26 +3120,7 @@ impl Backend {
alloy_eips::eip4844::calc_blob_gasprice(excess_blob_gas.unwrap_or_default());
let blob_gas_used = transaction.blob_gas_used();

let effective_gas_price = match transaction.transaction {
TypedTransaction::Legacy(t) => t.tx().gas_price,
TypedTransaction::EIP2930(t) => t.tx().gas_price,
TypedTransaction::EIP1559(t) => block
.header
.base_fee_per_gas
.map_or(self.base_fee() as u128, |g| g as u128)
.saturating_add(t.tx().max_priority_fee_per_gas),
TypedTransaction::EIP4844(t) => block
.header
.base_fee_per_gas
.map_or(self.base_fee() as u128, |g| g as u128)
.saturating_add(t.tx().tx().max_priority_fee_per_gas),
TypedTransaction::EIP7702(t) => block
.header
.base_fee_per_gas
.map_or(self.base_fee() as u128, |g| g as u128)
.saturating_add(t.tx().max_priority_fee_per_gas),
TypedTransaction::Deposit(_) => 0_u128,
};
let effective_gas_price = transaction.effective_gas_price(block.header.base_fee_per_gas);
Copy link
Contributor Author

@mablr mablr Nov 23, 2025

Choose a reason for hiding this comment

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

Imo using block.header.base_fee_per_gas as base fee arg is okay and non-breaking, despite self.base_fee() not being used anymore

Indeed after careful review of the blocks init/mining logic, I've not found any scenario where block.header.base_fee_per_gas could be None at this point. Which would mean that in the previous implementation we never had a fallback to the default value self.base_fee() (giving always base_fee_per_gas + max_priority_fee_per_gas for TXs >= eip1559).

So Alloy's impl would "more correct", I guess.

Let me know, if you think i'm wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If my observation is correct, we could improve robustness by making base_fee non-optional in block header ?


let receipts = self.get_receipts(block.body.transactions.iter().map(|tx| tx.hash()));
let next_log_index = receipts[..index].iter().map(|r| r.logs().len()).sum::<usize>();
Expand Down
Loading