@@ -278,8 +278,9 @@ impl Default for SequencerNodeConfig {
278
278
}
279
279
}
280
280
281
- macro_rules! ensure_component_config_matches_mode {
281
+ macro_rules! validate_component_config_is_set_iff_running_locally {
282
282
( $self: ident, $component_field: ident, $config_field: ident) => { {
283
+ // The component config should be set iff its running locally.
283
284
if $self. components. $component_field. is_running_locally( ) != $self. $config_field. is_some( ) {
284
285
let execution_mode = & $self. components. $component_field. execution_mode;
285
286
let component_config_availability =
@@ -314,33 +315,57 @@ impl SequencerNodeConfig {
314
315
315
316
fn cross_member_validations ( & self ) -> Result < ( ) , ConfigError > {
316
317
// TODO(Tsabary): should be based on iteration of `ComponentConfig` fields.
317
- ensure_component_config_matches_mode ! ( self , batcher, batcher_config) ;
318
- ensure_component_config_matches_mode ! ( self , class_manager, class_manager_config) ;
319
- ensure_component_config_matches_mode ! ( self , gateway, gateway_config) ;
320
- ensure_component_config_matches_mode ! (
318
+ validate_component_config_is_set_iff_running_locally ! ( self , batcher, batcher_config) ;
319
+ validate_component_config_is_set_iff_running_locally ! (
320
+ self ,
321
+ class_manager,
322
+ class_manager_config
323
+ ) ;
324
+ validate_component_config_is_set_iff_running_locally ! ( self , gateway, gateway_config) ;
325
+ validate_component_config_is_set_iff_running_locally ! (
321
326
self ,
322
327
l1_endpoint_monitor,
323
328
l1_endpoint_monitor_config
324
329
) ;
325
- ensure_component_config_matches_mode ! ( self , l1_provider, l1_provider_config) ;
326
- ensure_component_config_matches_mode ! (
330
+ validate_component_config_is_set_iff_running_locally ! (
331
+ self ,
332
+ l1_provider,
333
+ l1_provider_config
334
+ ) ;
335
+ validate_component_config_is_set_iff_running_locally ! (
327
336
self ,
328
337
l1_gas_price_provider,
329
338
l1_gas_price_provider_config
330
339
) ;
331
- ensure_component_config_matches_mode ! ( self , mempool, mempool_config) ;
332
- ensure_component_config_matches_mode ! ( self , mempool_p2p, mempool_p2p_config) ;
333
- ensure_component_config_matches_mode ! ( self , sierra_compiler, sierra_compiler_config) ;
334
- ensure_component_config_matches_mode ! ( self , state_sync, state_sync_config) ;
335
- ensure_component_config_matches_mode ! ( self , consensus_manager, consensus_manager_config) ;
336
- ensure_component_config_matches_mode ! ( self , http_server, http_server_config) ;
337
- ensure_component_config_matches_mode ! ( self , l1_scraper, l1_scraper_config) ;
338
- ensure_component_config_matches_mode ! (
340
+ validate_component_config_is_set_iff_running_locally ! ( self , mempool, mempool_config) ;
341
+ validate_component_config_is_set_iff_running_locally ! (
342
+ self ,
343
+ mempool_p2p,
344
+ mempool_p2p_config
345
+ ) ;
346
+ validate_component_config_is_set_iff_running_locally ! (
347
+ self ,
348
+ sierra_compiler,
349
+ sierra_compiler_config
350
+ ) ;
351
+ validate_component_config_is_set_iff_running_locally ! ( self , state_sync, state_sync_config) ;
352
+ validate_component_config_is_set_iff_running_locally ! (
353
+ self ,
354
+ consensus_manager,
355
+ consensus_manager_config
356
+ ) ;
357
+ validate_component_config_is_set_iff_running_locally ! (
358
+ self ,
359
+ http_server,
360
+ http_server_config
361
+ ) ;
362
+ validate_component_config_is_set_iff_running_locally ! ( self , l1_scraper, l1_scraper_config) ;
363
+ validate_component_config_is_set_iff_running_locally ! (
339
364
self ,
340
365
l1_gas_price_scraper,
341
366
l1_gas_price_scraper_config
342
367
) ;
343
- ensure_component_config_matches_mode ! (
368
+ validate_component_config_is_set_iff_running_locally ! (
344
369
self ,
345
370
monitoring_endpoint,
346
371
monitoring_endpoint_config
0 commit comments