diff --git a/client/rpc/src/eth/transaction.rs b/client/rpc/src/eth/transaction.rs index 3eb5066cc2..dd43c964a2 100644 --- a/client/rpc/src/eth/transaction.rs +++ b/client/rpc/src/eth/transaction.rs @@ -214,7 +214,6 @@ where block, receipts, statuses, - substrate_hash, .. } = block_info.clone(); match (block, statuses, receipts) { @@ -288,14 +287,25 @@ where let effective_gas_price = match transaction { EthereumTransaction::Legacy(t) => t.gas_price, EthereumTransaction::EIP2930(t) => t.gas_price, - EthereumTransaction::EIP1559(t) => self - .client - .runtime_api() - .gas_price(substrate_hash) - .unwrap_or_default() - .checked_add(t.max_priority_fee_per_gas) - .unwrap_or_else(U256::max_value) - .min(t.max_fee_per_gas), + EthereumTransaction::EIP1559(t) => { + let parent_eth_hash = block.header.parent_hash; + let parent_substrate_hash = frontier_backend_client::load_hash::( + self.client.as_ref(), + self.backend.as_ref(), + parent_eth_hash, + ) + .await + .map_err(|err| internal_err(format!("{:?}", err)))? + .ok_or(internal_err("Failed to retrieve substrate parent block hash"))?; + + self.client + .runtime_api() + .gas_price(parent_substrate_hash) + .unwrap_or_default() + .checked_add(t.max_priority_fee_per_gas) + .unwrap_or_else(U256::max_value) + .min(t.max_fee_per_gas) + } }; return Ok(Some(Receipt {