Skip to content

Commit

Permalink
fix: deposit tx gasPrice must be 0 (#12486)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Nov 12, 2024
1 parent 3c56686 commit 115a20e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions crates/optimism/rpc/src/eth/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,18 @@ where
block_hash, block_number, index: transaction_index, base_fee, ..
} = tx_info;

let effective_gas_price = base_fee
.map(|base_fee| {
inner.effective_tip_per_gas(base_fee as u64).unwrap_or_default() + base_fee
})
.unwrap_or_else(|| inner.max_fee_per_gas());
let effective_gas_price = if inner.is_deposit() {
// For deposits, we must always set the `gasPrice` field to 0 in rpc
// deposit tx don't have a gas price field, but serde of `Transaction` will take care of
// it
0
} else {
base_fee
.map(|base_fee| {
inner.effective_tip_per_gas(base_fee as u64).unwrap_or_default() + base_fee
})
.unwrap_or_else(|| inner.max_fee_per_gas())
};

Ok(Transaction {
inner: alloy_rpc_types_eth::Transaction {
Expand Down

0 comments on commit 115a20e

Please sign in to comment.