Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(starknet_sequencer_node): set http server as active component #2578

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions config/sequencer/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -357,17 +357,7 @@
"components.http_server.execution_mode": {
"description": "The component execution mode.",
"privacy": "Public",
"value": "LocalExecutionWithRemoteEnabled"
},
"components.http_server.local_server_config.#is_none": {
"description": "Flag for an optional field.",
"privacy": "TemporaryValue",
"value": false
},
"components.http_server.local_server_config.channel_buffer_size": {
"description": "The communication channel buffer size.",
"privacy": "Public",
"value": 32
"value": "Enabled"
},
"components.http_server.remote_client_config.#is_none": {
"description": "Flag for an optional field.",
Expand All @@ -394,16 +384,6 @@
"privacy": "Public",
"value": "0.0.0.0:8080"
},
"components.http_server.remote_server_config.#is_none": {
"description": "Flag for an optional field.",
"privacy": "TemporaryValue",
"value": false
},
"components.http_server.remote_server_config.socket": {
"description": "The remote component server socket.",
"privacy": "Public",
"value": "0.0.0.0:8080"
},
"components.mempool.execution_mode": {
"description": "The component execution mode.",
"privacy": "Public",
Expand Down
5 changes: 3 additions & 2 deletions crates/starknet_integration_tests/src/config_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use starknet_sequencer_infra::component_definitions::{
use starknet_sequencer_infra::test_utils::get_available_socket;
use starknet_sequencer_node::config::component_config::ComponentConfig;
use starknet_sequencer_node::config::component_execution_config::{
ActiveComponentExecutionConfig,
ReactiveComponentExecutionConfig,
ReactiveComponentExecutionMode,
};
Expand Down Expand Up @@ -126,7 +127,7 @@ pub fn get_local_with_remote_enabled_component_config(

pub async fn get_http_only_component_config(gateway_socket: SocketAddr) -> ComponentConfig {
ComponentConfig {
http_server: ReactiveComponentExecutionConfig::http_server_default_config(),
http_server: ActiveComponentExecutionConfig::default(),
gateway: get_remote_component_config(gateway_socket),
monitoring_endpoint: Default::default(),
batcher: get_disabled_component_config(),
Expand All @@ -139,7 +140,7 @@ pub async fn get_http_only_component_config(gateway_socket: SocketAddr) -> Compo

pub async fn get_non_http_component_config(gateway_socket: SocketAddr) -> ComponentConfig {
ComponentConfig {
http_server: get_disabled_component_config(),
http_server: ActiveComponentExecutionConfig::disabled(),
monitoring_endpoint: Default::default(),
gateway: get_local_with_remote_enabled_component_config(gateway_socket),
..ComponentConfig::default()
Expand Down
5 changes: 2 additions & 3 deletions crates/starknet_sequencer_node/src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,13 @@ pub fn create_node_components(
ReactiveComponentExecutionMode::Disabled | ReactiveComponentExecutionMode::Remote => None,
};
let http_server = match config.components.http_server.execution_mode {
ReactiveComponentExecutionMode::LocalExecutionWithRemoteDisabled
| ReactiveComponentExecutionMode::LocalExecutionWithRemoteEnabled => {
ActiveComponentExecutionMode::Enabled => {
let gateway_client =
clients.get_gateway_shared_client().expect("Gateway Client should be available");

Some(create_http_server(config.http_server_config.clone(), gateway_client))
}
ReactiveComponentExecutionMode::Disabled | ReactiveComponentExecutionMode::Remote => None,
ActiveComponentExecutionMode::Disabled => None,
};

let (mempool_p2p_propagator, mempool_p2p_runner) = match config
Expand Down
10 changes: 5 additions & 5 deletions crates/starknet_sequencer_node/src/config/component_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ pub struct ComponentConfig {
#[validate]
pub gateway: ReactiveComponentExecutionConfig,
#[validate]
pub http_server: ReactiveComponentExecutionConfig,
#[validate]
pub mempool: ReactiveComponentExecutionConfig,
#[validate]
pub mempool_p2p: ReactiveComponentExecutionConfig,
#[validate]
pub state_sync: ReactiveComponentExecutionConfig,

// Reactive component configs.
// Active component configs.
pub http_server: ActiveComponentExecutionConfig,
pub monitoring_endpoint: ActiveComponentExecutionConfig,
}

impl Default for ComponentConfig {
fn default() -> Self {
Self {
// Reactive component configs.
batcher: ReactiveComponentExecutionConfig::batcher_default_config(),
consensus_manager: ReactiveComponentExecutionConfig::consensus_manager_default_config(),
gateway: ReactiveComponentExecutionConfig::gateway_default_config(),
http_server: ReactiveComponentExecutionConfig::http_server_default_config(),
mempool: ReactiveComponentExecutionConfig::mempool_default_config(),
mempool_p2p: ReactiveComponentExecutionConfig::mempool_p2p_default_config(),
state_sync: ReactiveComponentExecutionConfig::state_sync_default_config(),
// Reactive component configs.
// Active component configs.
http_server: Default::default(),
monitoring_endpoint: Default::default(),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl SerializeConfig for ActiveComponentExecutionConfig {

impl Default for ActiveComponentExecutionConfig {
fn default() -> Self {
Self { execution_mode: ActiveComponentExecutionMode::Enabled, remote_client_config: None }
ActiveComponentExecutionConfig::enabled()
}
}

Expand Down Expand Up @@ -166,6 +166,16 @@ impl ReactiveComponentExecutionConfig {
}
}

impl ActiveComponentExecutionConfig {
pub fn disabled() -> Self {
Self { execution_mode: ActiveComponentExecutionMode::Disabled, remote_client_config: None }
}

pub fn enabled() -> Self {
Self { execution_mode: ActiveComponentExecutionMode::Enabled, remote_client_config: None }
}
}

fn validate_reactive_component_execution_config(
component_config: &ReactiveComponentExecutionConfig,
) -> Result<(), ValidationError> {
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_sequencer_node/src/servers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ fn create_wrapper_servers(
&config.components.consensus_manager.execution_mode,
components.consensus_manager
);
let http_server = create_wrapper_server!(
let http_server = create_wrapper_server_for_active_component!(
&config.components.http_server.execution_mode,
components.http_server
);
Expand Down
Loading