From bb11c9b4ae1250e1869d483feb124502a2a426a3 Mon Sep 17 00:00:00 2001 From: Itay Tsabary Date: Mon, 9 Dec 2024 17:29:52 +0200 Subject: [PATCH] chore(starknet_sequencer_node): set consensus manager as active component commit-id:80cc5c87 --- config/sequencer/default_config.json | 22 +------------------ .../src/config_utils.rs | 2 +- .../tests/mempool_p2p_flow_test.rs | 7 ++---- .../starknet_sequencer_node/src/components.rs | 5 ++--- .../src/config/component_config.rs | 5 ++--- crates/starknet_sequencer_node/src/servers.rs | 2 +- 6 files changed, 9 insertions(+), 34 deletions(-) diff --git a/config/sequencer/default_config.json b/config/sequencer/default_config.json index 504a066836..e343a40676 100644 --- a/config/sequencer/default_config.json +++ b/config/sequencer/default_config.json @@ -257,17 +257,7 @@ "components.consensus_manager.execution_mode": { "description": "The component execution mode.", "privacy": "Public", - "value": "LocalExecutionWithRemoteDisabled" - }, - "components.consensus_manager.local_server_config.#is_none": { - "description": "Flag for an optional field.", - "privacy": "TemporaryValue", - "value": false - }, - "components.consensus_manager.local_server_config.channel_buffer_size": { - "description": "The communication channel buffer size.", - "privacy": "Public", - "value": 32 + "value": "Enabled" }, "components.consensus_manager.remote_client_config.#is_none": { "description": "Flag for an optional field.", @@ -294,16 +284,6 @@ "privacy": "Public", "value": "0.0.0.0:8080" }, - "components.consensus_manager.remote_server_config.#is_none": { - "description": "Flag for an optional field.", - "privacy": "TemporaryValue", - "value": true - }, - "components.consensus_manager.remote_server_config.socket": { - "description": "The remote component server socket.", - "privacy": "Public", - "value": "0.0.0.0:8080" - }, "components.gateway.execution_mode": { "description": "The component execution mode.", "privacy": "Public", diff --git a/crates/starknet_integration_tests/src/config_utils.rs b/crates/starknet_integration_tests/src/config_utils.rs index a95b5c1cd5..18e23179c0 100644 --- a/crates/starknet_integration_tests/src/config_utils.rs +++ b/crates/starknet_integration_tests/src/config_utils.rs @@ -131,7 +131,7 @@ pub async fn get_http_only_component_config(gateway_socket: SocketAddr) -> Compo gateway: get_remote_component_config(gateway_socket), monitoring_endpoint: Default::default(), batcher: get_disabled_component_config(), - consensus_manager: get_disabled_component_config(), + consensus_manager: ActiveComponentExecutionConfig::disabled(), mempool: get_disabled_component_config(), mempool_p2p: get_disabled_component_config(), state_sync: get_disabled_component_config(), diff --git a/crates/starknet_integration_tests/tests/mempool_p2p_flow_test.rs b/crates/starknet_integration_tests/tests/mempool_p2p_flow_test.rs index e42b01a2f9..fa8e3e5404 100644 --- a/crates/starknet_integration_tests/tests/mempool_p2p_flow_test.rs +++ b/crates/starknet_integration_tests/tests/mempool_p2p_flow_test.rs @@ -32,6 +32,7 @@ use starknet_mempool_p2p::config::MempoolP2pConfig; use starknet_mempool_p2p::MEMPOOL_TOPIC; use starknet_sequencer_node::config::component_config::ComponentConfig; use starknet_sequencer_node::config::component_execution_config::{ + ActiveComponentExecutionConfig, ReactiveComponentExecutionConfig, ReactiveComponentExecutionMode, }; @@ -63,11 +64,7 @@ async fn setup( // Derive the configuration for the mempool node. let components = ComponentConfig { - consensus_manager: ReactiveComponentExecutionConfig { - execution_mode: ReactiveComponentExecutionMode::Disabled, - local_server_config: None, - ..Default::default() - }, + consensus_manager: ActiveComponentExecutionConfig::disabled(), batcher: ReactiveComponentExecutionConfig { execution_mode: ReactiveComponentExecutionMode::Disabled, local_server_config: None, diff --git a/crates/starknet_sequencer_node/src/components.rs b/crates/starknet_sequencer_node/src/components.rs index f3ddcda5e7..8c06adff56 100644 --- a/crates/starknet_sequencer_node/src/components.rs +++ b/crates/starknet_sequencer_node/src/components.rs @@ -47,8 +47,7 @@ pub fn create_node_components( ReactiveComponentExecutionMode::Disabled | ReactiveComponentExecutionMode::Remote => None, }; let consensus_manager = match config.components.consensus_manager.execution_mode { - ReactiveComponentExecutionMode::LocalExecutionWithRemoteDisabled - | ReactiveComponentExecutionMode::LocalExecutionWithRemoteEnabled => { + ActiveComponentExecutionMode::Enabled => { let batcher_client = clients.get_batcher_shared_client().expect("Batcher Client should be available"); // TODO(shahak): Use the real client once we connect state sync to the node. @@ -59,7 +58,7 @@ pub fn create_node_components( state_sync_client, )) } - ReactiveComponentExecutionMode::Disabled | ReactiveComponentExecutionMode::Remote => None, + ActiveComponentExecutionMode::Disabled => None, }; let gateway = match config.components.gateway.execution_mode { ReactiveComponentExecutionMode::LocalExecutionWithRemoteDisabled diff --git a/crates/starknet_sequencer_node/src/config/component_config.rs b/crates/starknet_sequencer_node/src/config/component_config.rs index 432cb17681..2095da8e74 100644 --- a/crates/starknet_sequencer_node/src/config/component_config.rs +++ b/crates/starknet_sequencer_node/src/config/component_config.rs @@ -17,8 +17,6 @@ pub struct ComponentConfig { #[validate] pub batcher: ReactiveComponentExecutionConfig, #[validate] - pub consensus_manager: ReactiveComponentExecutionConfig, - #[validate] pub gateway: ReactiveComponentExecutionConfig, #[validate] pub mempool: ReactiveComponentExecutionConfig, @@ -28,6 +26,7 @@ pub struct ComponentConfig { pub state_sync: ReactiveComponentExecutionConfig, // Active component configs. + pub consensus_manager: ActiveComponentExecutionConfig, pub http_server: ActiveComponentExecutionConfig, pub monitoring_endpoint: ActiveComponentExecutionConfig, } @@ -37,12 +36,12 @@ impl Default for ComponentConfig { Self { // Reactive component configs. batcher: ReactiveComponentExecutionConfig::batcher_default_config(), - consensus_manager: ReactiveComponentExecutionConfig::consensus_manager_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(), } diff --git a/crates/starknet_sequencer_node/src/servers.rs b/crates/starknet_sequencer_node/src/servers.rs index c40eb3f04e..e1749a658f 100644 --- a/crates/starknet_sequencer_node/src/servers.rs +++ b/crates/starknet_sequencer_node/src/servers.rs @@ -304,7 +304,7 @@ fn create_wrapper_servers( config: &SequencerNodeConfig, components: &mut SequencerNodeComponents, ) -> WrapperServers { - let consensus_manager_server = create_wrapper_server!( + let consensus_manager_server = create_wrapper_server_for_active_component!( &config.components.consensus_manager.execution_mode, components.consensus_manager );