From 84fdef7d4170cac5feea5c2a70e7d37c539f4793 Mon Sep 17 00:00:00 2001 From: Itay Tsabary Date: Mon, 9 Dec 2024 20:47:14 +0200 Subject: [PATCH] chore(starknet_sequencer_node): cleanup explicit default config fns commit-id:c320383b --- .../src/config/component_config.rs | 19 +---- .../src/config/component_execution_config.rs | 69 ------------------- 2 files changed, 1 insertion(+), 87 deletions(-) diff --git a/crates/starknet_sequencer_node/src/config/component_config.rs b/crates/starknet_sequencer_node/src/config/component_config.rs index e1e7a198bca..1cde4770425 100644 --- a/crates/starknet_sequencer_node/src/config/component_config.rs +++ b/crates/starknet_sequencer_node/src/config/component_config.rs @@ -11,7 +11,7 @@ use crate::config::component_execution_config::{ }; /// The components configuration. -#[derive(Clone, Debug, Serialize, Deserialize, Validate, PartialEq)] +#[derive(Clone, Debug, Default, Serialize, Deserialize, Validate, PartialEq)] pub struct ComponentConfig { // Reactive component configs. #[validate] @@ -34,23 +34,6 @@ pub struct ComponentConfig { pub monitoring_endpoint: ActiveComponentExecutionConfig, } -impl Default for ComponentConfig { - fn default() -> Self { - Self { - // Reactive component configs. - batcher: ReactiveComponentExecutionConfig::batcher_default_config(), - gateway: ReactiveComponentExecutionConfig::gateway_default_config(), - mempool: ReactiveComponentExecutionConfig::mempool_default_config(), - mempool_p2p: ReactiveComponentExecutionConfig::mempool_p2p_default_config(), - state_sync: ReactiveComponentExecutionConfig::state_sync_default_config(), - // Active component configs. - consensus_manager: Default::default(), - http_server: Default::default(), - monitoring_endpoint: Default::default(), - } - } -} - impl SerializeConfig for ComponentConfig { fn dump(&self) -> BTreeMap { let sub_configs = vec![ diff --git a/crates/starknet_sequencer_node/src/config/component_execution_config.rs b/crates/starknet_sequencer_node/src/config/component_execution_config.rs index b7a289da465..03af9e5e782 100644 --- a/crates/starknet_sequencer_node/src/config/component_execution_config.rs +++ b/crates/starknet_sequencer_node/src/config/component_execution_config.rs @@ -98,75 +98,6 @@ impl Default for ActiveComponentExecutionConfig { } } -/// Specific components default configurations. -impl ReactiveComponentExecutionConfig { - pub fn gateway_default_config() -> Self { - Self { - execution_mode: ReactiveComponentExecutionMode::LocalExecutionWithRemoteDisabled, - local_server_config: Some(LocalServerConfig::default()), - remote_client_config: None, - remote_server_config: None, - } - } - - // TODO(Tsabary/Lev): There's a bug here: the http server component does not need a local nor a - // remote config. However, the validation function requires that at least one of them is set. As - // a workaround I've set the local one, but this should be addressed. - pub fn http_server_default_config() -> Self { - Self { - execution_mode: ReactiveComponentExecutionMode::LocalExecutionWithRemoteEnabled, - local_server_config: Some(LocalServerConfig::default()), - remote_client_config: None, - remote_server_config: Some(RemoteServerConfig::default()), - } - } - - pub fn mempool_default_config() -> Self { - Self { - execution_mode: ReactiveComponentExecutionMode::LocalExecutionWithRemoteDisabled, - local_server_config: Some(LocalServerConfig::default()), - remote_client_config: None, - remote_server_config: None, - } - } - - pub fn batcher_default_config() -> Self { - Self { - execution_mode: ReactiveComponentExecutionMode::LocalExecutionWithRemoteDisabled, - local_server_config: Some(LocalServerConfig::default()), - remote_client_config: None, - remote_server_config: None, - } - } - - pub fn consensus_manager_default_config() -> Self { - Self { - execution_mode: ReactiveComponentExecutionMode::LocalExecutionWithRemoteDisabled, - local_server_config: Some(LocalServerConfig::default()), - remote_client_config: None, - remote_server_config: None, - } - } - - pub fn mempool_p2p_default_config() -> Self { - Self { - execution_mode: ReactiveComponentExecutionMode::LocalExecutionWithRemoteDisabled, - local_server_config: Some(LocalServerConfig::default()), - remote_client_config: None, - remote_server_config: None, - } - } - - pub fn state_sync_default_config() -> Self { - Self { - execution_mode: ReactiveComponentExecutionMode::LocalExecutionWithRemoteDisabled, - local_server_config: Some(LocalServerConfig::default()), - remote_client_config: None, - remote_server_config: None, - } - } -} - impl ActiveComponentExecutionConfig { pub fn disabled() -> Self { Self { execution_mode: ActiveComponentExecutionMode::Disabled, remote_client_config: None }