@@ -5,7 +5,7 @@ use apollo_batcher_types::batcher_types::{CentralObjects, DecisionReachedRespons
55use apollo_batcher_types:: communication:: BatcherClientError ;
66use apollo_batcher_types:: errors:: BatcherError ;
77use apollo_consensus:: types:: { ConsensusContext , Round } ;
8- use apollo_consensus_orchestrator_config:: config:: ContextConfig ;
8+ use apollo_consensus_orchestrator_config:: config:: { ContextConfig , ContextDynamicConfig } ;
99use apollo_infra:: component_client:: ClientError ;
1010use apollo_l1_gas_price_types:: errors:: {
1111 EthToStrkOracleClientError ,
@@ -80,7 +80,8 @@ async fn validate_proposal_success() {
8080 // Initialize the context for a specific height, starting with round 0.
8181 context. set_height_and_round ( BlockNumber ( 0 ) , 0 ) . await ;
8282
83- let ( mut content_sender, content_receiver) = mpsc:: channel ( context. config . proposal_buffer_size ) ;
83+ let ( mut content_sender, content_receiver) =
84+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
8485 content_sender. send ( ProposalPart :: BlockInfo ( block_info ( BlockNumber ( 0 ) ) ) ) . await . unwrap ( ) ;
8586 content_sender
8687 . send ( ProposalPart :: Transactions ( TransactionBatch { transactions : TX_BATCH . to_vec ( ) } ) )
@@ -116,7 +117,8 @@ async fn dont_send_block_info() {
116117 // Initialize the context for a specific height, starting with round 0.
117118 context. set_height_and_round ( BlockNumber ( 0 ) , 0 ) . await ;
118119
119- let ( mut content_sender, content_receiver) = mpsc:: channel ( context. config . proposal_buffer_size ) ;
120+ let ( mut content_sender, content_receiver) =
121+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
120122 let fin_receiver =
121123 context. validate_proposal ( ProposalInit :: default ( ) , TIMEOUT , content_receiver) . await ;
122124 content_sender. close_channel ( ) ;
@@ -143,7 +145,8 @@ async fn validate_then_repropose(#[case] execute_all_txs: bool) {
143145 context. set_height_and_round ( BlockNumber ( 0 ) , 0 ) . await ;
144146
145147 // Receive a valid proposal.
146- let ( mut content_sender, content_receiver) = mpsc:: channel ( context. config . proposal_buffer_size ) ;
148+ let ( mut content_sender, content_receiver) =
149+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
147150 let block_info = ProposalPart :: BlockInfo ( block_info ( BlockNumber ( 0 ) ) ) ;
148151 content_sender. send ( block_info. clone ( ) ) . await . unwrap ( ) ;
149152 let transactions =
@@ -198,7 +201,8 @@ async fn proposals_from_different_rounds() {
198201 } ) ;
199202
200203 // The proposal from the past round is ignored.
201- let ( mut content_sender, content_receiver) = mpsc:: channel ( context. config . proposal_buffer_size ) ;
204+ let ( mut content_sender, content_receiver) =
205+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
202206 content_sender. send ( ProposalPart :: BlockInfo ( block_info ( BlockNumber ( 0 ) ) ) ) . await . unwrap ( ) ;
203207 content_sender. send ( prop_part_txs. clone ( ) ) . await . unwrap ( ) ;
204208 content_sender. send ( prop_part_executed_count. clone ( ) ) . await . unwrap ( ) ;
@@ -209,7 +213,8 @@ async fn proposals_from_different_rounds() {
209213 assert ! ( fin_receiver_past_round. await . is_err( ) ) ;
210214
211215 // The proposal from the current round should be validated.
212- let ( mut content_sender, content_receiver) = mpsc:: channel ( context. config . proposal_buffer_size ) ;
216+ let ( mut content_sender, content_receiver) =
217+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
213218 content_sender. send ( ProposalPart :: BlockInfo ( block_info ( BlockNumber ( 0 ) ) ) ) . await . unwrap ( ) ;
214219 content_sender. send ( prop_part_txs. clone ( ) ) . await . unwrap ( ) ;
215220 content_sender. send ( prop_part_executed_count. clone ( ) ) . await . unwrap ( ) ;
@@ -219,7 +224,8 @@ async fn proposals_from_different_rounds() {
219224 assert_eq ! ( fin_receiver_curr_round. await . unwrap( ) . 0 , STATE_DIFF_COMMITMENT . 0.0 ) ;
220225
221226 // The proposal from the future round should not be processed.
222- let ( mut content_sender, content_receiver) = mpsc:: channel ( context. config . proposal_buffer_size ) ;
227+ let ( mut content_sender, content_receiver) =
228+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
223229 content_sender. send ( ProposalPart :: BlockInfo ( block_info ( BlockNumber ( 0 ) ) ) ) . await . unwrap ( ) ;
224230 content_sender. send ( prop_part_txs. clone ( ) ) . await . unwrap ( ) ;
225231 content_sender. send ( prop_part_executed_count. clone ( ) ) . await . unwrap ( ) ;
@@ -247,12 +253,12 @@ async fn interrupt_active_proposal() {
247253 // Keep the sender open, as closing it or sending Fin would cause the validate to complete
248254 // without needing interrupt.
249255 let ( mut _content_sender_0, content_receiver) =
250- mpsc:: channel ( context. config . proposal_buffer_size ) ;
256+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
251257 let fin_receiver_0 =
252258 context. validate_proposal ( ProposalInit :: default ( ) , TIMEOUT , content_receiver) . await ;
253259
254260 let ( mut content_sender_1, content_receiver) =
255- mpsc:: channel ( context. config . proposal_buffer_size ) ;
261+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
256262 content_sender_1. send ( ProposalPart :: BlockInfo ( block_info ( BlockNumber ( 0 ) ) ) ) . await . unwrap ( ) ;
257263 content_sender_1
258264 . send ( ProposalPart :: Transactions ( TransactionBatch { transactions : TX_BATCH . to_vec ( ) } ) )
@@ -482,7 +488,7 @@ async fn batcher_not_ready(#[case] proposer: bool) {
482488 assert_eq ! ( fin_receiver. await , Err ( Canceled ) ) ;
483489 } else {
484490 let ( mut content_sender, content_receiver) =
485- mpsc:: channel ( context. config . proposal_buffer_size ) ;
491+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
486492 content_sender. send ( ProposalPart :: BlockInfo ( block_info ( BlockNumber ( 0 ) ) ) ) . await . unwrap ( ) ;
487493
488494 let fin_receiver =
@@ -547,7 +553,8 @@ async fn eth_to_fri_rate_out_of_range() {
547553 . return_const ( Ok ( ( ) ) ) ;
548554 let mut context = deps. build_context ( ) ;
549555 context. set_height_and_round ( BlockNumber ( 0 ) , 0 ) . await ;
550- let ( mut content_sender, content_receiver) = mpsc:: channel ( context. config . proposal_buffer_size ) ;
556+ let ( mut content_sender, content_receiver) =
557+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
551558 // Send a block info with an eth_to_fri_rate that is outside the margin of error.
552559 let mut block_info = block_info ( BlockNumber ( 0 ) ) ;
553560 block_info. eth_to_fri_rate *= 2 ;
@@ -567,7 +574,7 @@ async fn eth_to_fri_rate_out_of_range() {
567574async fn gas_price_limits ( #[ case] maximum : bool ) {
568575 let ( mut deps, _network) = create_test_and_network_deps ( ) ;
569576 deps. setup_deps_for_validate ( BlockNumber ( 0 ) , INTERNAL_TX_BATCH . len ( ) , 1 ) ;
570- let context_config = ContextConfig :: default ( ) ;
577+ let context_config = ContextDynamicConfig :: default ( ) ;
571578 let min_gas_price = context_config. min_l1_gas_price_wei ;
572579 let min_data_price = context_config. min_l1_data_gas_price_wei ;
573580 let max_gas_price = context_config. max_l1_gas_price_wei ;
@@ -591,7 +598,8 @@ async fn gas_price_limits(#[case] maximum: bool) {
591598 let mut context = deps. build_context ( ) ;
592599
593600 context. set_height_and_round ( BlockNumber ( 0 ) , 0 ) . await ;
594- let ( mut content_sender, content_receiver) = mpsc:: channel ( context. config . proposal_buffer_size ) ;
601+ let ( mut content_sender, content_receiver) =
602+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
595603
596604 let mut block_info = block_info ( BlockNumber ( 0 ) ) ;
597605
@@ -730,7 +738,7 @@ async fn oracle_fails_on_startup(#[case] l1_oracle_failure: bool) {
730738 panic ! ( "Expected ProposalPart::BlockInfo" ) ;
731739 } ;
732740
733- let default_context_config = ContextConfig :: default ( ) ;
741+ let default_context_config = ContextDynamicConfig :: default ( ) ;
734742 assert_eq ! ( info. eth_to_fri_rate, DEFAULT_ETH_TO_FRI_RATE ) ;
735743 // Despite the l1_gas_price_provider being set up not to fail, we still expect the default
736744 // values because eth_to_strk_rate_oracle_client failed.
@@ -827,7 +835,8 @@ async fn oracle_fails_on_second_block(#[case] l1_oracle_failure: bool) {
827835 // Initialize the context for a specific height, starting with round 0.
828836 context. set_height_and_round ( BlockNumber ( 0 ) , 0 ) . await ;
829837
830- let ( mut content_sender, content_receiver) = mpsc:: channel ( context. config . proposal_buffer_size ) ;
838+ let ( mut content_sender, content_receiver) =
839+ mpsc:: channel ( context. config . static_config . proposal_buffer_size ) ;
831840 content_sender. send ( ProposalPart :: BlockInfo ( block_info ( BlockNumber ( 0 ) ) ) ) . await . unwrap ( ) ;
832841 content_sender
833842 . send ( ProposalPart :: Transactions ( TransactionBatch { transactions : TX_BATCH . to_vec ( ) } ) )
@@ -974,17 +983,20 @@ async fn override_prices_behavior(
974983 deps. cende_ambassador . expect_prepare_blob_for_next_height ( ) . return_once ( |_| Ok ( ( ) ) ) ;
975984
976985 let context_config = ContextConfig {
977- override_l2_gas_price_fri,
978- override_l1_gas_price_wei,
979- override_l1_data_gas_price_wei,
980- override_eth_to_fri_rate,
986+ dynamic_config : ContextDynamicConfig {
987+ override_l2_gas_price_fri,
988+ override_l1_gas_price_wei,
989+ override_l1_data_gas_price_wei,
990+ override_eth_to_fri_rate,
991+ ..Default :: default ( )
992+ } ,
981993 ..Default :: default ( )
982994 } ;
983995 let mut context = deps. build_context ( ) ;
984996 context. config = context_config;
985997
986998 let min_gas_price = VersionedConstants :: latest_constants ( ) . min_gas_price . 0 ;
987- let gas_price_params = make_gas_price_params ( & context. config ) ;
999+ let gas_price_params = make_gas_price_params ( & context. config . dynamic_config ) ;
9881000 let mut expected_l1_prices = PriceInfo {
9891001 base_fee_per_gas : GasPrice ( TEMP_ETH_GAS_FEE_IN_WEI ) ,
9901002 blob_fee : GasPrice ( TEMP_ETH_BLOB_GAS_FEE_IN_WEI ) ,
0 commit comments