Skip to content

Commit

Permalink
fix: receipt for non EIP-4844 transactions (paradigmxyz#7129)
Browse files Browse the repository at this point in the history
  • Loading branch information
greged93 authored Mar 13, 2024
1 parent 8fbab73 commit c9c269b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/rpc/rpc/src/eth/api/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,11 @@ pub(crate) fn build_transaction_receipt_with_block_receipts(
.unwrap_or_default()
};

let blob_gas_used = transaction.transaction.blob_gas_used().map(U128::from);
// Blob gas price should only be present if the transaction is a blob transaction
let blob_gas_price =
blob_gas_used.and_then(|_| meta.excess_blob_gas.map(calc_blob_gasprice).map(U128::from));

#[allow(clippy::needless_update)]
let mut res_receipt = TransactionReceipt {
transaction_hash: Some(meta.tx_hash),
Expand All @@ -1526,8 +1531,8 @@ pub(crate) fn build_transaction_receipt_with_block_receipts(
logs_bloom: receipt.bloom_slow(),
status_code: if receipt.success { Some(U64::from(1)) } else { Some(U64::from(0)) },
// EIP-4844 fields
blob_gas_price: meta.excess_blob_gas.map(calc_blob_gasprice).map(U128::from),
blob_gas_used: transaction.transaction.blob_gas_used().map(U128::from),
blob_gas_price,
blob_gas_used,
..Default::default()
};

Expand Down

0 comments on commit c9c269b

Please sign in to comment.