Skip to content

Commit

Permalink
chore: add disabled function to ComponentConfig
Browse files Browse the repository at this point in the history
commit-id:9673c1ca
  • Loading branch information
nadin-Starkware committed Dec 23, 2024
1 parent 47ab72c commit 8488fa1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
29 changes: 11 additions & 18 deletions crates/starknet_integration_tests/src/end_to_end_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,31 +139,24 @@ pub async fn end_to_end_integration(mut tx_generator: MultiAccountTransactionGen

#[cfg(any(feature = "testing", test))]
pub async fn get_http_only_component_config(gateway_socket: SocketAddr) -> ComponentConfig {
ComponentConfig {
http_server: ActiveComponentExecutionConfig::default(),
gateway: ReactiveComponentExecutionConfig::remote(gateway_socket),
monitoring_endpoint: Default::default(),
batcher: ReactiveComponentExecutionConfig::disabled(),
consensus_manager: ActiveComponentExecutionConfig::disabled(),
mempool: ReactiveComponentExecutionConfig::disabled(),
mempool_p2p: ReactiveComponentExecutionConfig::disabled(),
state_sync: ReactiveComponentExecutionConfig::disabled(),
l1_provider: ReactiveComponentExecutionConfig::disabled(),
}
let mut config = ComponentConfig::disabled();
config.http_server = ActiveComponentExecutionConfig::default();
config.gateway = ReactiveComponentExecutionConfig::remote(gateway_socket);
config.monitoring_endpoint = ActiveComponentExecutionConfig::default();
config
}

#[cfg(any(feature = "testing", test))]
async fn get_non_http_component_config(gateway_socket: SocketAddr) -> ComponentConfig {
ComponentConfig {
http_server: ActiveComponentExecutionConfig::disabled(),
monitoring_endpoint: Default::default(),
gateway: ReactiveComponentExecutionConfig::local_with_remote_enabled(gateway_socket),
..ComponentConfig::default()
}
let mut config = ComponentConfig::default();
config.http_server = ActiveComponentExecutionConfig::disabled();
config.gateway = ReactiveComponentExecutionConfig::local_with_remote_enabled(gateway_socket);
config.monitoring_endpoint = ActiveComponentExecutionConfig::default();
config
}

#[cfg(any(feature = "testing", test))]
pub async fn get_remote_flow_test_config() -> Vec<ComponentConfig> {
pub async fn get_remote_test_config() -> Vec<ComponentConfig> {
let gateway_socket = get_available_socket().await;
vec![
get_http_only_component_config(gateway_socket).await,
Expand Down
16 changes: 16 additions & 0 deletions crates/starknet_sequencer_node/src/config/component_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,19 @@ impl SerializeConfig for ComponentConfig {
sub_configs.into_iter().flatten().collect()
}
}

impl ComponentConfig {
pub fn disabled() -> ComponentConfig {
ComponentConfig {
batcher: ReactiveComponentExecutionConfig::disabled(),
gateway: ReactiveComponentExecutionConfig::disabled(),
mempool: ReactiveComponentExecutionConfig::disabled(),
mempool_p2p: ReactiveComponentExecutionConfig::disabled(),
state_sync: ReactiveComponentExecutionConfig::disabled(),
l1_provider: ReactiveComponentExecutionConfig::disabled(),
consensus_manager: ActiveComponentExecutionConfig::disabled(),
http_server: ActiveComponentExecutionConfig::disabled(),
monitoring_endpoint: ActiveComponentExecutionConfig::disabled(),
}
}
}

0 comments on commit 8488fa1

Please sign in to comment.