File tree Expand file tree Collapse file tree 1 file changed +25
-8
lines changed Expand file tree Collapse file tree 1 file changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -287,14 +287,31 @@ where
287
287
let effective_gas_price = match transaction {
288
288
EthereumTransaction :: Legacy ( t) => t. gas_price ,
289
289
EthereumTransaction :: EIP2930 ( t) => t. gas_price ,
290
- EthereumTransaction :: EIP1559 ( t) => self
291
- . client
292
- . runtime_api ( )
293
- . gas_price ( substrate_hash)
294
- . unwrap_or_default ( )
295
- . checked_add ( t. max_priority_fee_per_gas )
296
- . unwrap_or_else ( U256 :: max_value)
297
- . min ( t. max_fee_per_gas ) ,
290
+ EthereumTransaction :: EIP1559 ( t) => {
291
+ let parent_eth_hash = block. header . parent_hash ;
292
+ let base_fee_block_substrate_hash = if parent_eth_hash. is_zero ( ) {
293
+ substrate_hash
294
+ } else {
295
+ frontier_backend_client:: load_hash :: < B , C > (
296
+ self . client . as_ref ( ) ,
297
+ self . backend . as_ref ( ) ,
298
+ parent_eth_hash,
299
+ )
300
+ . await
301
+ . map_err ( |err| internal_err ( format ! ( "{:?}" , err) ) ) ?
302
+ . ok_or ( internal_err (
303
+ "Failed to retrieve substrate parent block hash" ,
304
+ ) ) ?
305
+ } ;
306
+
307
+ self . client
308
+ . runtime_api ( )
309
+ . gas_price ( base_fee_block_substrate_hash)
310
+ . unwrap_or_default ( )
311
+ . checked_add ( t. max_priority_fee_per_gas )
312
+ . unwrap_or_else ( U256 :: max_value)
313
+ . min ( t. max_fee_per_gas )
314
+ }
298
315
} ;
299
316
300
317
return Ok ( Some ( Receipt {
You can’t perform that action at this time.
0 commit comments