diff --git a/event_sidecar/src/lib.rs b/event_sidecar/src/lib.rs index b804a688..3348c991 100644 --- a/event_sidecar/src/lib.rs +++ b/event_sidecar/src/lib.rs @@ -64,9 +64,10 @@ pub async fn run( config: SseEventServerConfig, index_storage_folder: String, maybe_database: Option, + maybe_network_name: Option, ) -> Result { validate_config(&config)?; - let (event_listeners, sse_data_receivers) = build_event_listeners(&config)?; + let (event_listeners, sse_data_receivers) = build_event_listeners(&config, maybe_network_name)?; // This channel allows SseData to be sent from multiple connected nodes to the single EventStreamServer. let (outbound_sse_data_sender, outbound_sse_data_receiver) = mpsc_channel(config.outbound_channel_size.unwrap_or(DEFAULT_CHANNEL_SIZE)); @@ -238,6 +239,7 @@ pub async fn run_rest_server( fn build_event_listeners( config: &SseEventServerConfig, + maybe_network_name: Option, ) -> Result<(Vec, Vec>), Error> { let mut event_listeners = Vec::with_capacity(config.connections.len()); let mut sse_data_receivers = Vec::new(); @@ -245,7 +247,12 @@ fn build_event_listeners( let (inbound_sse_data_sender, inbound_sse_data_receiver) = mpsc_channel(config.inbound_channel_size.unwrap_or(DEFAULT_CHANNEL_SIZE)); sse_data_receivers.push(inbound_sse_data_receiver); - let event_listener = builder(connection, inbound_sse_data_sender)?.build(); + let event_listener = builder( + connection, + inbound_sse_data_sender, + maybe_network_name.clone(), + )? + .build(); event_listeners.push(event_listener?); } Ok((event_listeners, sse_data_receivers)) @@ -254,11 +261,13 @@ fn build_event_listeners( fn builder( connection: &Connection, inbound_sse_data_sender: Sender, + maybe_network_name: Option, ) -> Result { let node_interface = NodeConnectionInterface { ip_address: connection.ip_address, sse_port: connection.sse_port, rest_port: connection.rest_port, + network_name: maybe_network_name, }; let event_listener_builder = EventListenerBuilder { node: node_interface, diff --git a/event_sidecar/src/testing/testing_config.rs b/event_sidecar/src/testing/testing_config.rs index 9ed3d579..90e97c13 100644 --- a/event_sidecar/src/testing/testing_config.rs +++ b/event_sidecar/src/testing/testing_config.rs @@ -14,6 +14,7 @@ pub struct TestingConfig { pub(crate) event_server_config: SseEventServerConfig, pub(crate) storage_config: StorageConfig, pub(crate) rest_api_server_config: RestApiServerConfig, + pub(crate) network_name: Option, } #[cfg(test)] @@ -44,7 +45,11 @@ pub fn get_port() -> u16 { /// - The outbound server (REST & SSE) ports are set dynamically to free ports. /// - If `enable_db_storage` is set to false, the database storage is disabled. #[cfg(test)] -pub(crate) fn prepare_config(temp_storage: &TempDir, enable_db_storage: bool) -> TestingConfig { +pub(crate) fn prepare_config( + temp_storage: &TempDir, + enable_db_storage: bool, + maybe_network_name: Option, +) -> TestingConfig { let path_to_temp_storage = temp_storage.path().to_string_lossy().to_string(); let mut testing_config = TestingConfig::default(); @@ -52,6 +57,7 @@ pub(crate) fn prepare_config(temp_storage: &TempDir, enable_db_storage: bool) -> testing_config.storage_config.clear_db_storage(); } testing_config.set_storage_folder(path_to_temp_storage); + testing_config.set_network_name(maybe_network_name); testing_config.allocate_available_ports(); testing_config @@ -67,6 +73,7 @@ impl TestingConfig { event_server_config, storage_config, rest_api_server_config, + network_name: None, } } @@ -84,6 +91,10 @@ impl TestingConfig { self.storage_config = storage; } + pub(crate) fn set_network_name(&mut self, maybe_network_name: Option) { + self.network_name = maybe_network_name; + } + pub(crate) fn add_connection( &mut self, ip_address: Option, diff --git a/event_sidecar/src/tests/integration_tests.rs b/event_sidecar/src/tests/integration_tests.rs index d2dcf229..feabf53e 100644 --- a/event_sidecar/src/tests/integration_tests.rs +++ b/event_sidecar/src/tests/integration_tests.rs @@ -27,10 +27,10 @@ use crate::{ sse_events::{BlockAdded, Fault}, }, utils::tests::{ - any_string_contains, build_test_config, build_test_config_with_retries, - build_test_config_without_connections, build_test_config_without_db_storage, - start_nodes_and_wait, start_sidecar, start_sidecar_with_rest_api, stop_nodes_and_wait, - wait_for_n_messages, + any_string_contains, build_test_config, build_test_config_with_network_name, + build_test_config_with_retries, build_test_config_without_connections, + build_test_config_without_db_storage, start_nodes_and_wait, start_sidecar, + start_sidecar_with_rest_api, stop_nodes_and_wait, wait_for_n_messages, }, }; @@ -38,7 +38,7 @@ use crate::{ async fn should_not_allow_zero_max_attempts() { let temp_storage_dir = tempdir().expect("Should have created a temporary storage directory"); - let mut testing_config = prepare_config(&temp_storage_dir, true); + let mut testing_config = prepare_config(&temp_storage_dir, true, None); let sse_port_for_node = testing_config.add_connection(None, None, None); @@ -51,6 +51,7 @@ async fn should_not_allow_zero_max_attempts() { testing_config.inner(), storage_folder, Some(Database::SqliteDatabaseWrapper(sqlite_database)), + None, ) .await .expect_err("Sidecar should return an Err on shutdown"); @@ -290,7 +291,7 @@ async fn should_fail_to_reconnect() { node_port_for_sse_connection, node_port_for_rest_connection, event_stream_server_port, - ) = build_test_config_with_retries(2, 2, true); + ) = build_test_config_with_retries(2, 2, true, None); let (data_of_node, test_rng) = random_n_block_added(30, 0, test_rng); let mut node_mock = MockNodeBuilder { version: "2.0.0".to_string(), @@ -339,7 +340,7 @@ async fn should_reconnect() { node_port_for_sse_connection, node_port_for_rest_connection, event_stream_server_port, - ) = build_test_config_with_retries(10, 1, true); + ) = build_test_config_with_retries(10, 1, true, None); let (data_of_node, test_rng) = random_n_block_added(30, 0, test_rng); let mut node_mock = MockNodeBuilder { version: "2.0.0".to_string(), @@ -428,7 +429,50 @@ async fn connecting_to_node_prior_to_2_0_0_should_fail() { } .build(); start_nodes_and_wait(vec![&mut node_mock]).await; - start_sidecar(testing_config).await; + let sidecar_join = start_sidecar(testing_config).await; + let (join_handle, _) = fetch_data_from_endpoint_with_panic_flag( + "/events?start_from=0", + event_stream_server_port, + false, + ) + .await; + sleep(Duration::from_secs(10)).await; //Give some time for sidecar to read data from node (which it actually shouldn't do in this scenario) + stop_nodes_and_wait(vec![&mut node_mock]).await; + + let events_received = tokio::join!(join_handle).0.unwrap(); + assert_eq!(events_received.len(), 0); + + let shutdown_err = sidecar_join + .await + .unwrap() + .expect_err("Sidecar should return an Err message on shutdown"); + + assert_eq!( + shutdown_err.to_string(), + "Connected node(s) are unavailable" + ) +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 5)] +async fn connecting_to_node_with_wrong_network_name_should_fail() { + let ( + testing_config, + _temp_storage_dir, + node_port_for_sse_connection, + node_port_for_rest_connection, + event_stream_server_port, + ) = build_test_config_with_network_name("network-1"); + let mut node_mock = MockNodeBuilder { + version: "2.0.0".to_string(), + network_name: "not-network-1".to_string(), + data_of_node: sse_server_shutdown_2_0_0_data(), + cache_of_node: None, + sse_port: Some(node_port_for_sse_connection), + rest_port: Some(node_port_for_rest_connection), + } + .build(); + start_nodes_and_wait(vec![&mut node_mock]).await; + let sidecar_join = start_sidecar(testing_config).await; let (join_handle, _) = fetch_data_from_endpoint_with_panic_flag( "/events?start_from=0", event_stream_server_port, @@ -440,6 +484,16 @@ async fn connecting_to_node_prior_to_2_0_0_should_fail() { let events_received = tokio::join!(join_handle).0.unwrap(); assert_eq!(events_received.len(), 0); + + let shutdown_err = sidecar_join + .await + .unwrap() + .expect_err("Sidecar should return an Err message on shutdown"); + + assert_eq!( + shutdown_err.to_string(), + "Connected node(s) are unavailable" + ) } #[tokio::test(flavor = "multi_thread", worker_threads = 5)] @@ -825,7 +879,7 @@ pub fn build_testing_config_based_on_ports( ports_of_nodes: Vec<(u16, u16)>, ) -> (TestingConfig, u16, TempDir) { let (mut testing_config, temp_storage_dir, event_stream_server_port) = - build_test_config_without_connections(true); + build_test_config_without_connections(true, None); for (sse_port, rest_port) in ports_of_nodes { testing_config.add_connection(None, Some(sse_port), Some(rest_port)); testing_config.set_retries_for_node(sse_port, 5, 2); diff --git a/event_sidecar/src/tests/performance_tests.rs b/event_sidecar/src/tests/performance_tests.rs index 4db84eae..8d11de36 100644 --- a/event_sidecar/src/tests/performance_tests.rs +++ b/event_sidecar/src/tests/performance_tests.rs @@ -264,7 +264,7 @@ async fn performance_check(scenario: Scenario, duration: Duration, acceptable_la let test_rng = TestRng::new(); let temp_storage_dir = tempdir().expect("Should have created a temporary storage directory"); - let mut testing_config = prepare_config(&temp_storage_dir, true); + let mut testing_config = prepare_config(&temp_storage_dir, true, None); testing_config.add_connection(None, None, None); let node_port_for_sse_connection = testing_config .event_server_config @@ -293,6 +293,7 @@ async fn performance_check(scenario: Scenario, duration: Duration, acceptable_la ip_address, sse_port: node_port_for_sse_connection, rest_port: node_port_for_rest_connection, + network_name: None, }; let (node_event_tx, node_event_rx) = mpsc::channel(100); let mut node_event_listener = EventListenerBuilder { @@ -321,6 +322,7 @@ async fn performance_check(scenario: Scenario, duration: Duration, acceptable_la ip_address: IpAddr::from_str("127.0.0.1").expect("Couldn't parse IpAddr"), sse_port: node_port_for_sse_connection, rest_port: node_port_for_rest_connection, + network_name: None, }; let mut sidecar_event_listener = EventListenerBuilder { node: sidecar_node_interface, diff --git a/event_sidecar/src/utils.rs b/event_sidecar/src/utils.rs index 5d847f82..46734304 100644 --- a/event_sidecar/src/utils.rs +++ b/event_sidecar/src/utils.rs @@ -274,19 +274,27 @@ pub mod tests { } pub fn build_test_config() -> (TestingConfig, TempDir, u16, u16, u16) { - build_test_config_with_retries(10, 1, true) + build_test_config_with_retries(10, 1, true, None) } pub fn build_test_config_without_db_storage() -> (TestingConfig, TempDir, u16, u16, u16) { - build_test_config_with_retries(10, 1, false) + build_test_config_with_retries(10, 1, false, None) + } + + pub fn build_test_config_with_network_name( + network_name: &str, + ) -> (TestingConfig, TempDir, u16, u16, u16) { + build_test_config_with_retries(10, 1, true, Some(network_name.into())) } pub fn build_test_config_without_connections( enable_db_storage: bool, + maybe_network_name: Option, ) -> (TestingConfig, TempDir, u16) { let temp_storage_dir = tempdir().expect("Should have created a temporary storage directory"); - let testing_config = prepare_config(&temp_storage_dir, enable_db_storage); + let testing_config = + prepare_config(&temp_storage_dir, enable_db_storage, maybe_network_name); let event_stream_server_port = testing_config.event_stream_server_port(); (testing_config, temp_storage_dir, event_stream_server_port) } @@ -294,9 +302,10 @@ pub mod tests { max_attempts: usize, delay_between_retries: usize, enable_db_storage: bool, + maybe_network_name: Option, ) -> (TestingConfig, TempDir, u16, u16, u16) { let (mut testing_config, temp_storage_dir, event_stream_server_port) = - build_test_config_without_connections(enable_db_storage); + build_test_config_without_connections(enable_db_storage, maybe_network_name); testing_config.add_connection(None, None, None); let node_port_for_sse_connection = testing_config .event_server_config @@ -406,7 +415,7 @@ pub mod tests { let context = build_postgres_database().await.unwrap(); let temp_storage_dir = tempdir().expect("Should have created a temporary storage directory"); - let mut testing_config = prepare_config(&temp_storage_dir, true); + let mut testing_config = prepare_config(&temp_storage_dir, true, None); let event_stream_server_port = testing_config.event_stream_server_port(); testing_config.set_storage(StorageConfig::postgres_with_port(context.port)); testing_config.add_connection(None, None, None); @@ -467,6 +476,12 @@ pub mod tests { run_rest_server(rest_api_server_config, database_for_rest_api).await }); } - run(sse_config, storage_folder, maybe_database).await + run( + sse_config, + storage_folder, + maybe_database, + testing_config.network_name, + ) + .await } } diff --git a/listener/src/lib.rs b/listener/src/lib.rs index b63135fa..49b47f2a 100644 --- a/listener/src/lib.rs +++ b/listener/src/lib.rs @@ -250,6 +250,14 @@ impl EventListener { let fetch_result = self.version_fetcher.fetch().await; match fetch_result { Ok(node_metadata) => { + // check if reveived network name matches optional configuration + if let Some(network_name) = &self.node.network_name { + if *network_name != node_metadata.network_name { + let msg = format!("Network name {network_name} does't match name {} configured for node connection", node_metadata.network_name); + error!("{msg}"); + return GetNodeMetadataResult::Error(Error::msg(msg)); + } + } if self.node_metadata != node_metadata { return GetNodeMetadataResult::Ok(Some(node_metadata)); } diff --git a/listener/src/types.rs b/listener/src/types.rs index 85609f3f..5b26645c 100644 --- a/listener/src/types.rs +++ b/listener/src/types.rs @@ -11,6 +11,7 @@ pub struct NodeConnectionInterface { pub ip_address: IpAddr, pub sse_port: u16, pub rest_port: u16, + pub network_name: Option, } #[cfg(test)] @@ -20,6 +21,7 @@ impl Default for NodeConnectionInterface { ip_address: "127.0.0.1".parse().unwrap(), sse_port: 100, rest_port: 200, + network_name: None, } } } diff --git a/rpc_sidecar/src/lib.rs b/rpc_sidecar/src/lib.rs index 574a199c..7419ed51 100644 --- a/rpc_sidecar/src/lib.rs +++ b/rpc_sidecar/src/lib.rs @@ -34,9 +34,12 @@ pub const SUPPORTED_PROTOCOL_VERSION: ProtocolVersion = ProtocolVersion::from_pa pub const CLIENT_SHUTDOWN_EXIT_CODE: u8 = 0x3; pub type MaybeRpcServerReturn<'a> = Result>>, Error>; -pub async fn build_rpc_server<'a>(config: RpcServerConfig) -> MaybeRpcServerReturn<'a> { +pub async fn build_rpc_server<'a>( + config: RpcServerConfig, + maybe_network_name: Option, +) -> MaybeRpcServerReturn<'a> { let (node_client, reconnect_loop, keepalive_loop) = - FramedNodeClient::new(config.node_client.clone()).await?; + FramedNodeClient::new(config.node_client.clone(), maybe_network_name).await?; let node_client: Arc = Arc::new(node_client); let mut futures = Vec::new(); let main_server_config = config.main_server; diff --git a/rpc_sidecar/src/node_client.rs b/rpc_sidecar/src/node_client.rs index 0948def8..b95f59c2 100644 --- a/rpc_sidecar/src/node_client.rs +++ b/rpc_sidecar/src/node_client.rs @@ -823,6 +823,7 @@ pub struct FramedNodeClient { impl FramedNodeClient { pub async fn new( config: NodeClientConfig, + maybe_network_name: Option, ) -> Result< ( Self, @@ -852,18 +853,26 @@ impl FramedNodeClient { Arc::clone(¤t_request_id), ); - Ok(( - Self { - client: Arc::clone(&stream), - request_limit: Semaphore::new(config.request_limit as usize), - reconnect, - shutdown, - config, - current_request_id, - }, - reconnect_loop, - keepalive_loop, - )) + let node_client = Self { + client: Arc::clone(&stream), + request_limit: Semaphore::new(config.request_limit as usize), + reconnect, + shutdown, + config, + current_request_id: AtomicU16::new(INITIAL_REQUEST_ID).into(), + }; + + // validate network name + if let Some(network_name) = maybe_network_name { + let node_status = node_client.read_node_status().await?; + if network_name != node_status.chainspec_name { + let msg = format!("Network name {} does't match name {network_name} configured for node RPC connection", node_status.chainspec_name); + error!("{msg}"); + return Err(AnyhowError::msg(msg)); + } + } + + Ok((node_client, reconnect_loop, keepalive_loop)) } fn next_id(&self) -> u16 { @@ -1221,13 +1230,14 @@ where mod tests { use crate::testing::{ get_dummy_request, get_dummy_request_payload, get_port, start_mock_binary_port, + start_mock_binary_port_responding_with_given_response, start_mock_binary_port_responding_with_stored_value, }; use super::*; - use casper_binary_port::BinaryRequestHeader; + use casper_binary_port::{BinaryRequestHeader, ReactorStateName}; use casper_types::testing::TestRng; - use casper_types::{CLValue, SemVer}; + use casper_types::{BlockSynchronizerStatus, CLValue, SemVer, TimeDiff, Timestamp}; use futures::FutureExt; use tokio::time::sleep; @@ -1317,7 +1327,7 @@ mod tests { #[tokio::test] async fn given_client_and_no_node_should_fail_after_tries() { let config = NodeClientConfig::new_with_port_and_retries(1111, 2); - let res = FramedNodeClient::new(config).await; + let res = FramedNodeClient::new(config, None).await; assert!(res.is_err()); let error_message = res.err().unwrap().to_string(); @@ -1339,7 +1349,7 @@ mod tests { ) .await; let config = NodeClientConfig::new_with_port_and_retries(port, 2); - let (c, _, _) = FramedNodeClient::new(config).await.unwrap(); + let (c, _, _) = FramedNodeClient::new(config, None).await.unwrap(); let res = query_global_state_for_string_value(&mut rng, &c) .await @@ -1364,7 +1374,7 @@ mod tests { .await; }); let config = NodeClientConfig::new_with_port_and_retries(port, 5); - let (client, _, _) = FramedNodeClient::new(config).await.unwrap(); + let (client, _, _) = FramedNodeClient::new(config, None).await.unwrap(); let res = query_global_state_for_string_value(&mut rng, &client) .await @@ -1373,6 +1383,53 @@ mod tests { assert_eq!(res, StoredValue::CLValue(CLValue::from_t("Foo").unwrap())) } + #[tokio::test] + async fn should_fail_to_connect_if_network_name_does_not_match() { + // prepare node status response with network name + let mut rng = TestRng::new(); + let protocol_version = ProtocolVersion::from_parts(2, 0, 0); + let value = NodeStatus { + protocol_version, + peers: Peers::random(&mut rng), + build_version: rng.random_string(5..10), + chainspec_name: "network-1".into(), + starting_state_root_hash: Digest::random(&mut rng), + last_added_block_info: None, + our_public_signing_key: None, + round_length: None, + next_upgrade: None, + uptime: TimeDiff::from_millis(0), + reactor_state: ReactorStateName::new(rng.random_string(5..10)), + last_progress: Timestamp::random(&mut rng), + available_block_range: AvailableBlockRange::random(&mut rng), + block_sync: BlockSynchronizerStatus::random(&mut rng), + latest_switch_block_hash: None, + }; + let response = BinaryResponse::from_value(value, protocol_version); + + // setup mock binary port with node status response + let port = get_port(); + let shutdown = Arc::new(tokio::sync::Notify::new()); + let request_id = Some(INITIAL_REQUEST_ID); + let _mock_server_handle = start_mock_binary_port_responding_with_given_response( + port, + request_id, + None, + Arc::clone(&shutdown), + response, + ) + .await; + + let config = NodeClientConfig::new_with_port_and_retries(port, 2); + let network_name = Some("not-network-1".into()); + let res = FramedNodeClient::new(config, network_name).await; + + assert!(res.is_err()); + let error_message = res.err().unwrap().to_string(); + + assert_eq!(error_message, "Network name network-1 does't match name not-network-1 configured for node RPC connection"); + } + async fn query_global_state_for_string_value( rng: &mut TestRng, client: &FramedNodeClient, @@ -1404,7 +1461,7 @@ mod tests { .await; let config = NodeClientConfig::new_with_port(port); - let (c, reconnect_loop, _) = FramedNodeClient::new(config).await.unwrap(); + let (c, reconnect_loop, _) = FramedNodeClient::new(config, None).await.unwrap(); let scenario = async { // Request id = 1 @@ -1472,7 +1529,7 @@ mod tests { let shutdown = Arc::new(tokio::sync::Notify::new()); let _mock_server_handle = start_mock_binary_port(port, vec![], 1, Arc::clone(&shutdown)).await; - let (c, _, _) = FramedNodeClient::new(config).await.unwrap(); + let (c, _, _) = FramedNodeClient::new(config, None).await.unwrap(); let generated_ids: Vec<_> = (INITIAL_REQUEST_ID..INITIAL_REQUEST_ID + 10) .map(|_| { @@ -1552,7 +1609,7 @@ mod tests { ) .await; let config = NodeClientConfig::new_with_port_and_retries(port, 2); - let (c, _, _) = FramedNodeClient::new(config).await.unwrap(); + let (c, _, _) = FramedNodeClient::new(config, None).await.unwrap(); let res = query_global_state_for_string_value(&mut rng, &c) .await @@ -1576,7 +1633,7 @@ mod tests { ) .await; let config = NodeClientConfig::new_with_port_and_retries(port, 2); - let (c, _, _) = FramedNodeClient::new(config).await.unwrap(); + let (c, _, _) = FramedNodeClient::new(config, None).await.unwrap(); let res = query_global_state_for_string_value(&mut rng, &c) .await diff --git a/rpc_sidecar/src/testing/mod.rs b/rpc_sidecar/src/testing/mod.rs index 119a4a2c..cbbb47ec 100644 --- a/rpc_sidecar/src/testing/mod.rs +++ b/rpc_sidecar/src/testing/mod.rs @@ -103,6 +103,25 @@ pub async fn start_mock_binary_port_responding_with_stored_value( .await } +pub async fn start_mock_binary_port_responding_with_given_response( + port: u16, + request_id: Option, + number_of_responses: Option, + shutdown: Arc, + binary_response: BinaryResponse, +) -> JoinHandle<()> { + let request = get_dummy_request_payload(request_id); + let response = + BinaryResponseAndRequest::new(binary_response, &request, request_id.unwrap_or_default()); + start_mock_binary_port( + port, + response.to_bytes().unwrap(), + number_of_responses.unwrap_or(1), // Single response by default + shutdown, + ) + .await +} + pub async fn start_mock_binary_port( port: u16, data: Vec, diff --git a/sidecar/src/component.rs b/sidecar/src/component.rs index ae7fc4f1..17abdc9d 100644 --- a/sidecar/src/component.rs +++ b/sidecar/src/component.rs @@ -112,6 +112,7 @@ impl Component for SseServerComponent { sse_server_config.clone(), storage_config.storage_folder.clone(), maybe_database, + config.network_name.clone(), ) .map(|res| res.map_err(|e| ComponentError::runtime_error(self.name(), e))); Ok(Some(Box::pin(future))) @@ -203,9 +204,9 @@ impl Component for RpcApiComponent { &self, config: &SidecarConfig, ) -> Result>>, ComponentError> { - if let Some(config) = config.rpc_server.as_ref() { - let is_main_exec_defined = config.main_server.enable_server; - let is_speculative_exec_defined = config + if let Some(rpc_server_config) = config.rpc_server.as_ref() { + let is_main_exec_defined = rpc_server_config.main_server.enable_server; + let is_speculative_exec_defined = rpc_server_config .speculative_exec_server .as_ref() .map(|x| x.enable_server) @@ -221,7 +222,8 @@ impl Component for RpcApiComponent { if !is_speculative_exec_defined { info!("Speculative RPC API server is disabled. Only main RPC API will be running."); } - let res = build_rpc_server(config.clone()).await; + let res = + build_rpc_server(rpc_server_config.clone(), config.network_name.clone()).await; match res { Ok(None) => Ok(None), Ok(Some(fut)) => { diff --git a/sidecar/src/config.rs b/sidecar/src/config.rs index 5c564dcc..4af83a9f 100644 --- a/sidecar/src/config.rs +++ b/sidecar/src/config.rs @@ -11,6 +11,7 @@ use thiserror::Error; pub struct SidecarConfigTarget { max_thread_count: Option, max_blocking_thread_count: Option, + network_name: Option, storage: Option, rest_api_server: Option, admin_api_server: Option, @@ -23,6 +24,7 @@ pub struct SidecarConfigTarget { pub struct SidecarConfig { pub max_thread_count: Option, pub max_blocking_thread_count: Option, + pub network_name: Option, pub sse_server: Option, pub rpc_server: Option, pub storage: Option, @@ -118,6 +120,7 @@ impl TryFrom for SidecarConfig { Ok(SidecarConfig { max_thread_count: value.max_thread_count, max_blocking_thread_count: value.max_blocking_thread_count, + network_name: value.network_name, sse_server: sse_server_config, rpc_server: rpc_server_config, storage: storage_config,