@@ -17,6 +17,7 @@ use crate::{
1717} ;
1818use alloy_chains:: Chain ;
1919use alloy_consensus:: BlockHeader ;
20+ use alloy_eips:: eip7840:: BlobParams ;
2021use alloy_genesis:: Genesis ;
2122use alloy_network:: { AnyNetwork , TransactionResponse } ;
2223use alloy_op_hardforks:: OpHardfork ;
@@ -65,7 +66,10 @@ use tokio::sync::RwLock as TokioRwLock;
6566use yansi:: Paint ;
6667
6768pub use foundry_common:: version:: SHORT_VERSION as VERSION_MESSAGE ;
68- use foundry_evm:: traces:: { CallTraceDecoderBuilder , identifier:: SignaturesIdentifier } ;
69+ use foundry_evm:: {
70+ traces:: { CallTraceDecoderBuilder , identifier:: SignaturesIdentifier } ,
71+ utils:: get_blob_params,
72+ } ;
6973use foundry_evm_networks:: NetworkConfigs ;
7074
7175/// Default port the rpc will open
@@ -533,6 +537,14 @@ impl NodeConfig {
533537 }
534538 }
535539
540+ /// Returns the [`BlobParams`] that should be used.
541+ pub fn get_blob_params ( & self ) -> BlobParams {
542+ get_blob_params (
543+ self . chain_id . unwrap_or ( Chain :: mainnet ( ) . id ( ) ) ,
544+ self . get_genesis_timestamp ( ) ,
545+ )
546+ }
547+
536548 /// Returns the hardfork to use
537549 pub fn get_hardfork ( & self ) -> ChainHardfork {
538550 if let Some ( hardfork) = self . hardfork {
@@ -1083,6 +1095,7 @@ impl NodeConfig {
10831095 !self . disable_min_priority_fee ,
10841096 self . get_gas_price ( ) ,
10851097 self . get_blob_excess_gas_and_price ( ) ,
1098+ self . get_blob_params ( ) ,
10861099 ) ;
10871100
10881101 let ( db, fork) : ( Arc < TokioRwLock < Box < dyn Db > > > , Option < ClientFork > ) =
@@ -1297,7 +1310,8 @@ latest block number: {latest_block}"
12971310 if let ( Some ( blob_excess_gas) , Some ( blob_gas_used) ) =
12981311 ( block. header . excess_blob_gas , block. header . blob_gas_used )
12991312 {
1300- let blob_base_fee_update_fraction = get_blob_base_fee_update_fraction (
1313+ // derive the blobparams that are active at this timestamp
1314+ let blob_params = get_blob_params (
13011315 fork_chain_id
13021316 . unwrap_or_else ( || U256 :: from ( Chain :: mainnet ( ) . id ( ) ) )
13031317 . saturating_to ( ) ,
@@ -1306,15 +1320,16 @@ latest block number: {latest_block}"
13061320
13071321 env. evm_env . block_env . blob_excess_gas_and_price = Some ( BlobExcessGasAndPrice :: new (
13081322 blob_excess_gas,
1309- blob_base_fee_update_fraction ,
1323+ blob_params . update_fraction as u64 ,
13101324 ) ) ;
13111325
1326+ fees. set_blob_params ( blob_params) ;
1327+
13121328 let next_block_blob_excess_gas =
13131329 fees. get_next_block_blob_excess_gas ( blob_excess_gas, blob_gas_used) ;
1314-
13151330 fees. set_blob_excess_gas_and_price ( BlobExcessGasAndPrice :: new (
13161331 next_block_blob_excess_gas,
1317- blob_base_fee_update_fraction ,
1332+ blob_params . update_fraction as u64 ,
13181333 ) ) ;
13191334 }
13201335 }
0 commit comments