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: deposit tx gasPrice must be 0 #12486

Merged
merged 1 commit into from
Nov 12, 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
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
Loading