Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions crates/primitives/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,10 @@ impl Env {
///
/// [EIP-4844]: https://eips.ethereum.org/EIPS/eip-4844
#[inline]
pub fn calc_data_fee(&self) -> Option<u64> {
self.block
.get_blob_gasprice()
.map(|blob_gas_price| blob_gas_price * self.tx.get_total_blob_gas())
pub fn calc_data_fee(&self) -> Option<U256> {
self.block.get_blob_gasprice().map(|blob_gas_price| {
U256::from(blob_gas_price).saturating_mul(U256::from(self.tx.get_total_blob_gas()))
})
}

/// Validate the block environment.
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/evm_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> Transact<DB::Error>
// EIP-4844
if GSPEC::enabled(CANCUN) {
let data_fee = self.data.env.calc_data_fee().expect("already checked");
gas_cost = gas_cost.saturating_add(U256::from(data_fee));
gas_cost = gas_cost.saturating_add(data_fee);
}

caller_account.info.balance = caller_account.info.balance.saturating_sub(gas_cost);
Expand Down