Skip to content

Commit

Permalink
refactor: rename crate sequencer_monitoring_endpoint to monitoring_en…
Browse files Browse the repository at this point in the history
…dpoint

commit-id:3224b8b1
  • Loading branch information
lev-starkware committed Oct 15, 2024
1 parent 3cf8ccc commit e301d12
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 108 deletions.
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ members = [
"crates/mempool_p2p_types",
"crates/mempool_test_utils",
"crates/mempool_types",
"crates/monitoring_endpoint",
"crates/native_blockifier",
"crates/papyrus_base_layer",
"crates/papyrus_common",
Expand All @@ -39,7 +40,6 @@ members = [
"crates/papyrus_storage",
"crates/papyrus_sync",
"crates/papyrus_test_utils",
"crates/sequencer_monitoring_endpoint",
"crates/sequencing/papyrus_consensus",
"crates/sequencing/papyrus_consensus_orchestrator",
"crates/starknet_api",
Expand Down Expand Up @@ -220,8 +220,8 @@ starknet_mempool_node = { path = "crates/mempool_node", version = "0.0.0" }
starknet_mempool_p2p = { path = "crates/mempool_p2p", version = "0.0.0" }
starknet_mempool_p2p_types = { path = "crates/mempool_p2p_types", version = "0.0.0" }
starknet_mempool_types = { path = "crates/mempool_types", version = "0.0.0" }
starknet_monitoring_endpoint = { path = "crates/monitoring_endpoint", version = "0.0.0" }
starknet_patricia = { path = "crates/starknet_patricia", version = "0.0.0" }
starknet_sequencer_monitoring_endpoint = { path = "crates/sequencer_monitoring_endpoint", version = "0.0.0" }
starknet_sierra_compile = { path = "crates/starknet_sierra_compile", version = "0.0.0" }
starknet_task_executor = { path = "crates/task_executor", version = "0.0.0" }
static_assertions = "1.1.0"
Expand Down
42 changes: 21 additions & 21 deletions config/mempool/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -484,57 +484,57 @@
"privacy": "Public",
"value": "0.0.0.0:8080"
},
"components.sequencer_monitoring.execute": {
"components.monitoring_endpoint.execute": {
"description": "The component execution flag.",
"privacy": "Public",
"value": true
},
"components.sequencer_monitoring.execution_mode": {
"components.monitoring_endpoint.execution_mode": {
"description": "The component execution mode.",
"privacy": "Public",
"value": "Remote"
},
"components.sequencer_monitoring.local_config.#is_none": {
"components.monitoring_endpoint.local_config.#is_none": {
"description": "Flag for an optional field.",
"privacy": "TemporaryValue",
"value": true
},
"components.sequencer_monitoring.local_config.channel_buffer_size": {
"components.monitoring_endpoint.local_config.channel_buffer_size": {
"description": "The communication channel buffer size.",
"privacy": "Public",
"value": 32
},
"components.sequencer_monitoring.remote_client_config.#is_none": {
"components.monitoring_endpoint.remote_client_config.#is_none": {
"description": "Flag for an optional field.",
"privacy": "TemporaryValue",
"value": false
},
"components.sequencer_monitoring.remote_client_config.idle_connections": {
"components.monitoring_endpoint.remote_client_config.idle_connections": {
"description": "The maximum number of idle connections to keep alive.",
"privacy": "Public",
"value": 18446744073709551615
},
"components.sequencer_monitoring.remote_client_config.idle_timeout": {
"components.monitoring_endpoint.remote_client_config.idle_timeout": {
"description": "The duration in seconds to keep an idle connection open before closing.",
"privacy": "Public",
"value": 90
},
"components.sequencer_monitoring.remote_client_config.retries": {
"components.monitoring_endpoint.remote_client_config.retries": {
"description": "The max number of retries for sending a message.",
"privacy": "Public",
"value": 3
},
"components.sequencer_monitoring.remote_client_config.socket": {
"components.monitoring_endpoint.remote_client_config.socket": {
"description": "The remote component server socket.",
"privacy": "Public",
"value": "0.0.0.0:8080"
},
"components.sequencer_monitoring.remote_server_config.#is_none": {
"components.monitoring_endpoint.remote_server_config.#is_none": {
"description": "Flag for an optional field.",
"privacy": "TemporaryValue",
"value": true
},
"components.sequencer_monitoring.remote_server_config.socket": {
"components.monitoring_endpoint.remote_server_config.socket": {
"description": "The remote component server socket.",
"privacy": "Public",
"value": "0.0.0.0:8080"
Expand Down Expand Up @@ -674,6 +674,16 @@
"privacy": "Public",
"value": 8080
},
"monitoring_endpoint_config.ip": {
"description": "The monitoring endpoint ip address.",
"privacy": "Public",
"value": "0.0.0.0"
},
"monitoring_endpoint_config.port": {
"description": "The monitoring endpoint port.",
"privacy": "Public",
"value": 8082
},
"rpc_state_reader_config.json_rpc_version": {
"description": "The json rpc version.",
"privacy": "Public",
Expand All @@ -683,15 +693,5 @@
"description": "The url of the rpc server.",
"privacy": "Public",
"value": ""
},
"sequencer_monitoring_config.ip": {
"description": "The sequencer monitoring endpoint ip address.",
"privacy": "Public",
"value": "0.0.0.0"
},
"sequencer_monitoring_config.port": {
"description": "The sequencer monitoring endpoint port.",
"privacy": "Public",
"value": 8082
}
}
2 changes: 1 addition & 1 deletion crates/mempool_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ starknet_mempool_infra.workspace = true
starknet_mempool_p2p.workspace = true
starknet_mempool_p2p_types.workspace = true
starknet_mempool_types.workspace = true
starknet_sequencer_monitoring_endpoint.workspace = true
starknet_monitoring_endpoint.workspace = true
starknet_sierra_compile.workspace = true
tokio.workspace = true
tracing.workspace = true
Expand Down
17 changes: 7 additions & 10 deletions crates/mempool_node/src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use starknet_consensus_manager::consensus_manager::ConsensusManager;
use starknet_gateway::gateway::{create_gateway, Gateway};
use starknet_http_server::http_server::{create_http_server, HttpServer};
use starknet_mempool::mempool::Mempool;
use starknet_sequencer_monitoring_endpoint::sequencer_monitoring_endpoint::{
create_sequencer_monitoring_endpoint,
SequencerMonitoringEndpoint,
use starknet_monitoring_endpoint::monitoring_endpoint::{
create_monitoring_endpoint,
MonitoringEndpoint,
};

use crate::communication::SequencerNodeClients;
Expand All @@ -18,7 +18,7 @@ pub struct SequencerNodeComponents {
pub gateway: Option<Gateway>,
pub http_server: Option<HttpServer>,
pub mempool: Option<Mempool>,
pub sequencer_monitoring: Option<SequencerMonitoringEndpoint>,
pub monitoring_endpoint: Option<MonitoringEndpoint>,
}

pub fn create_node_components(
Expand Down Expand Up @@ -66,11 +66,8 @@ pub fn create_node_components(

let mempool = if config.components.mempool.execute { Some(Mempool::empty()) } else { None };

let sequencer_monitoring = if config.components.sequencer_monitoring.execute {
Some(create_sequencer_monitoring_endpoint(
config.sequencer_monitoring_config.clone(),
VERSION_FULL,
))
let monitoring_endpoint = if config.components.monitoring_endpoint.execute {
Some(create_monitoring_endpoint(config.monitoring_endpoint_config.clone(), VERSION_FULL))
} else {
None
};
Expand All @@ -81,6 +78,6 @@ pub fn create_node_components(
gateway,
http_server,
mempool,
sequencer_monitoring,
monitoring_endpoint,
}
}
8 changes: 4 additions & 4 deletions crates/mempool_node/src/config/component_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct ComponentConfig {
#[validate]
pub mempool: ComponentExecutionConfig,
#[validate]
pub sequencer_monitoring: ComponentExecutionConfig,
pub monitoring_endpoint: ComponentExecutionConfig,
}

impl Default for ComponentConfig {
Expand All @@ -33,7 +33,7 @@ impl Default for ComponentConfig {
gateway: ComponentExecutionConfig::gateway_default_config(),
http_server: ComponentExecutionConfig::http_server_default_config(),
mempool: ComponentExecutionConfig::mempool_default_config(),
sequencer_monitoring: ComponentExecutionConfig::sequencer_monitoring_default_config(),
monitoring_endpoint: ComponentExecutionConfig::monitoring_endpoint_default_config(),
}
}
}
Expand All @@ -47,7 +47,7 @@ impl SerializeConfig for ComponentConfig {
append_sub_config_name(self.gateway.dump(), "gateway"),
append_sub_config_name(self.http_server.dump(), "http_server"),
append_sub_config_name(self.mempool.dump(), "mempool"),
append_sub_config_name(self.sequencer_monitoring.dump(), "sequencer_monitoring"),
append_sub_config_name(self.monitoring_endpoint.dump(), "monitoring_endpoint"),
];

sub_configs.into_iter().flatten().collect()
Expand All @@ -63,7 +63,7 @@ pub fn validate_components_config(components: &ComponentConfig) -> Result<(), Va
|| components.batcher.execute
|| components.http_server.execute
|| components.consensus_manager.execute
|| components.sequencer_monitoring.execute
|| components.monitoring_endpoint.execute
{
return Ok(());
}
Expand Down
4 changes: 2 additions & 2 deletions crates/mempool_node/src/config/component_execution_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ impl ComponentExecutionConfig {
}
}

// TODO(Tsabary/Lev): There's a bug here: the sequencer monitoring endpoint component does not
// TODO(Tsabary/Lev): There's a bug here: the monitoring endpoint 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 sequencer_monitoring_default_config() -> Self {
pub fn monitoring_endpoint_default_config() -> Self {
Self {
execute: true,
execution_mode: ComponentExecutionMode::Remote,
Expand Down
10 changes: 5 additions & 5 deletions crates/mempool_node/src/config/node_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use starknet_batcher::config::BatcherConfig;
use starknet_consensus_manager::config::ConsensusManagerConfig;
use starknet_gateway::config::{GatewayConfig, RpcStateReaderConfig};
use starknet_http_server::config::HttpServerConfig;
use starknet_sequencer_monitoring_endpoint::config::SequencerMonitoringEndpointConfig;
use starknet_monitoring_endpoint::config::MonitoringEndpointConfig;
use starknet_sierra_compile::config::SierraToCasmCompilationConfig;
use validator::Validate;

Expand Down Expand Up @@ -59,7 +59,7 @@ pub struct SequencerNodeConfig {
#[validate]
pub compiler_config: SierraToCasmCompilationConfig,
#[validate]
pub sequencer_monitoring_config: SequencerMonitoringEndpointConfig,
pub monitoring_endpoint_config: MonitoringEndpointConfig,
}

impl SerializeConfig for SequencerNodeConfig {
Expand All @@ -77,8 +77,8 @@ impl SerializeConfig for SequencerNodeConfig {
append_sub_config_name(self.rpc_state_reader_config.dump(), "rpc_state_reader_config"),
append_sub_config_name(self.compiler_config.dump(), "compiler_config"),
append_sub_config_name(
self.sequencer_monitoring_config.dump(),
"sequencer_monitoring_config",
self.monitoring_endpoint_config.dump(),
"monitoring_endpoint_config",
),
];

Expand All @@ -97,7 +97,7 @@ impl Default for SequencerNodeConfig {
http_server_config: Default::default(),
rpc_state_reader_config: Default::default(),
compiler_config: Default::default(),
sequencer_monitoring_config: Default::default(),
monitoring_endpoint_config: Default::default(),
}
}
}
Expand Down
27 changes: 12 additions & 15 deletions crates/mempool_node/src/servers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use starknet_mempool::communication::{create_mempool_server, LocalMempoolServer}
use starknet_mempool_infra::component_server::ComponentServerStarter;
use starknet_mempool_infra::errors::ComponentServerError;
use starknet_mempool_p2p_types::communication::SharedMempoolP2pPropagatorClient;
use starknet_sequencer_monitoring_endpoint::communication::{
create_sequencer_monitoring_server,
SequencerMonitoringServer,
use starknet_monitoring_endpoint::communication::{
create_monitoring_endpoint_server,
MonitoringEndpointServer,
};
use tracing::error;

Expand All @@ -34,7 +34,7 @@ pub struct LocalServers {
pub struct WrapperServers {
pub consensus_manager: Option<Box<ConsensusManagerServer>>,
pub http_server: Option<Box<HttpServer>>,
pub sequencer_monitoring: Option<Box<SequencerMonitoringServer>>,
pub monitoring_endpoint: Option<Box<MonitoringEndpointServer>>,
}

/// TODO(Tsabary): make these fields private, currently public to support the outdated e2e test.
Expand Down Expand Up @@ -89,11 +89,9 @@ pub fn create_node_servers(
None
};

let sequencer_monitoring_server = if config.components.sequencer_monitoring.execute {
Some(Box::new(create_sequencer_monitoring_server(
components
.sequencer_monitoring
.expect("Sequencer Monitoring Endpoint is not initialized."),
let monitoring_endpoint_server = if config.components.monitoring_endpoint.execute {
Some(Box::new(create_monitoring_endpoint_server(
components.monitoring_endpoint.expect("Monitoring Endpoint is not initialized."),
)))
} else {
None
Expand All @@ -105,7 +103,7 @@ pub fn create_node_servers(
let wrapper_servers = WrapperServers {
consensus_manager: consensus_manager_server,
http_server,
sequencer_monitoring: sequencer_monitoring_server,
monitoring_endpoint: monitoring_endpoint_server,
};

SequencerNodeServers { local_servers, wrapper_servers }
Expand All @@ -128,16 +126,15 @@ pub async fn run_component_servers(servers: SequencerNodeServers) -> anyhow::Res
let mempool_future = get_server_future(servers.local_servers.mempool);

// Sequencer Monitoring server.
let sequencer_monitoring_future =
get_server_future(servers.wrapper_servers.sequencer_monitoring);
let monitoring_endpoint_future = get_server_future(servers.wrapper_servers.monitoring_endpoint);

// Start servers.
let batcher_handle = tokio::spawn(batcher_future);
let consensus_manager_handle = tokio::spawn(consensus_manager_future);
let gateway_handle = tokio::spawn(gateway_future);
let http_server_handle = tokio::spawn(http_server_future);
let mempool_handle = tokio::spawn(mempool_future);
let sequencer_monitoring_handle = tokio::spawn(sequencer_monitoring_future);
let monitoring_endpoint_handle = tokio::spawn(monitoring_endpoint_future);

let result = tokio::select! {
res = batcher_handle => {
Expand All @@ -160,8 +157,8 @@ pub async fn run_component_servers(servers: SequencerNodeServers) -> anyhow::Res
error!("Mempool Server stopped.");
res?
}
res = sequencer_monitoring_handle => {
error!("Sequencer Monitoring Server stopped.");
res = monitoring_endpoint_handle => {
error!("Monitoring Endpoint Server stopped.");
res?
}
};
Expand Down
Loading

0 comments on commit e301d12

Please sign in to comment.