diff --git a/crates/apollo_deployments/resources/app_configs/replacer_state_sync_config.json b/crates/apollo_deployments/resources/app_configs/replacer_state_sync_config.json index 21252752244..dd180b658bb 100644 --- a/crates/apollo_deployments/resources/app_configs/replacer_state_sync_config.json +++ b/crates/apollo_deployments/resources/app_configs/replacer_state_sync_config.json @@ -60,5 +60,8 @@ "state_sync_config.storage_config.mmap_file_config.growth_step": 2147483648, "state_sync_config.storage_config.mmap_file_config.max_object_size": 1073741824, "state_sync_config.storage_config.mmap_file_config.max_size": 1099511627776, - "state_sync_config.storage_config.scope": "FullArchive" + "state_sync_config.storage_config.scope": "FullArchive", + "state_sync_config.storage_reader_server_config.enable": false, + "state_sync_config.storage_reader_server_config.ip": "0.0.0.0", + "state_sync_config.storage_reader_server_config.port": "$$$_STATE_SYNC_CONFIG-STORAGE_READER_SERVER_CONFIG-PORT_$$$" } diff --git a/crates/apollo_deployments/resources/app_configs/state_sync_config.json b/crates/apollo_deployments/resources/app_configs/state_sync_config.json index 80c052b056f..557e4fc993a 100644 --- a/crates/apollo_deployments/resources/app_configs/state_sync_config.json +++ b/crates/apollo_deployments/resources/app_configs/state_sync_config.json @@ -60,5 +60,8 @@ "state_sync_config.storage_config.mmap_file_config.growth_step": 2147483648, "state_sync_config.storage_config.mmap_file_config.max_object_size": 1073741824, "state_sync_config.storage_config.mmap_file_config.max_size": 1099511627776, - "state_sync_config.storage_config.scope": "FullArchive" + "state_sync_config.storage_config.scope": "FullArchive", + "state_sync_config.storage_reader_server_config.enable": false, + "state_sync_config.storage_reader_server_config.ip": "0.0.0.0", + "state_sync_config.storage_reader_server_config.port": 8080 } diff --git a/crates/apollo_node/resources/config_schema.json b/crates/apollo_node/resources/config_schema.json index 64f0b784c90..7fb37095aa6 100644 --- a/crates/apollo_node/resources/config_schema.json +++ b/crates/apollo_node/resources/config_schema.json @@ -3124,6 +3124,21 @@ "privacy": "Public", "value": "FullArchive" }, + "state_sync_config.storage_reader_server_config.enable": { + "description": "Whether to enable the storage reader HTTP server.", + "privacy": "Public", + "value": false + }, + "state_sync_config.storage_reader_server_config.ip": { + "description": "The IP address for the storage reader HTTP server.", + "privacy": "Public", + "value": "0.0.0.0" + }, + "state_sync_config.storage_reader_server_config.port": { + "description": "The port for the storage reader HTTP server.", + "privacy": "Public", + "value": 8080 + }, "strk_fee_token_address": { "description": "Address of the STRK fee token.", "privacy": "TemporaryValue", diff --git a/crates/apollo_state_sync/src/runner/mod.rs b/crates/apollo_state_sync/src/runner/mod.rs index 42898c9f61d..bf4eb80ac04 100644 --- a/crates/apollo_state_sync/src/runner/mod.rs +++ b/crates/apollo_state_sync/src/runner/mod.rs @@ -133,6 +133,7 @@ impl StateSyncRunner { network_config, revert_config, rpc_config, + storage_reader_server_config: _, } = config; let StateSyncResources { diff --git a/crates/apollo_state_sync_config/src/config.rs b/crates/apollo_state_sync_config/src/config.rs index 9479cfcf4e6..0e9d5c8458c 100644 --- a/crates/apollo_state_sync_config/src/config.rs +++ b/crates/apollo_state_sync_config/src/config.rs @@ -10,6 +10,7 @@ use apollo_p2p_sync_config::config::P2pSyncClientConfig; use apollo_reverts::RevertConfig; use apollo_rpc::RpcConfig; use apollo_storage::db::DbConfig; +use apollo_storage::storage_reader_server::ServerConfig; use apollo_storage::StorageConfig; use serde::{Deserialize, Serialize}; use validator::{Validate, ValidationError}; @@ -32,6 +33,8 @@ pub struct StateSyncConfig { pub revert_config: RevertConfig, #[validate(nested)] pub rpc_config: RpcConfig, + #[validate(nested)] + pub storage_reader_server_config: ServerConfig, } impl SerializeConfig for StateSyncConfig { @@ -41,6 +44,10 @@ impl SerializeConfig for StateSyncConfig { config.extend(ser_optional_sub_config(&self.network_config, "network_config")); config.extend(prepend_sub_config_name(self.revert_config.dump(), "revert_config")); config.extend(prepend_sub_config_name(self.rpc_config.dump(), "rpc_config")); + config.extend(prepend_sub_config_name( + self.storage_reader_server_config.dump(), + "storage_reader_server_config", + )); config.extend(ser_optional_sub_config( &self.p2p_sync_client_config, "p2p_sync_client_config", @@ -80,6 +87,7 @@ impl Default for StateSyncConfig { network_config: Some(NetworkConfig { port: STATE_SYNC_PORT, ..Default::default() }), revert_config: RevertConfig::default(), rpc_config: RpcConfig::default(), + storage_reader_server_config: ServerConfig::default(), } } } diff --git a/crates/apollo_storage/src/storage_reader_server.rs b/crates/apollo_storage/src/storage_reader_server.rs index 1371ae6f485..ce402bdaec5 100644 --- a/crates/apollo_storage/src/storage_reader_server.rs +++ b/crates/apollo_storage/src/storage_reader_server.rs @@ -14,6 +14,7 @@ use axum::{Json, Router}; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use tracing::{error, info}; +use validator::Validate; use crate::{StorageError, StorageReader}; @@ -22,7 +23,7 @@ use crate::{StorageError, StorageReader}; mod storage_reader_server_test; /// Configuration for the storage reader server. -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Validate)] pub struct ServerConfig { /// The socket address for the server. pub ip: IpAddr, diff --git a/deployments/sequencer2/configs/layouts/consolidated/services/node.yaml b/deployments/sequencer2/configs/layouts/consolidated/services/node.yaml index afd70eeb1c6..fc365dcbc83 100644 --- a/deployments/sequencer2/configs/layouts/consolidated/services/node.yaml +++ b/deployments/sequencer2/configs/layouts/consolidated/services/node.yaml @@ -46,6 +46,7 @@ config: state_sync_config_network_config_is_none: "$$$_STATE_SYNC_CONFIG-NETWORK_CONFIG-IS_NONE_$$$" state_sync_config_p2p_sync_client_config_is_none: "$$$_STATE_SYNC_CONFIG-P2P_SYNC_CLIENT_CONFIG-IS_NONE_$$$" state_sync_config_rpc_config_port: "$$$_STATE_SYNC_CONFIG-RPC_CONFIG-PORT_$$$" + state_sync_config_storage_reader_server_config_port: "$$$_STATE_SYNC_CONFIG-STORAGE_READER_SERVER_CONFIG-PORT_$$$" strk_fee_token_address: "$$$_STRK_FEE_TOKEN_ADDRESS_$$$" validator_id: "$$$_VALIDATOR_ID_$$$" diff --git a/deployments/sequencer2/configs/layouts/hybrid/services/core.yaml b/deployments/sequencer2/configs/layouts/hybrid/services/core.yaml index 448531dd8ed..55e5c9ba3f8 100644 --- a/deployments/sequencer2/configs/layouts/hybrid/services/core.yaml +++ b/deployments/sequencer2/configs/layouts/hybrid/services/core.yaml @@ -30,6 +30,7 @@ config: components_state_sync_port: 55009 components_state_sync_url: "sequencer-core-service" state_sync_config_network_config_port: 55010 + state_sync_config_storage_reader_server_config_port: 55012 # StatefulSet Configuration # See docs/STATEFULSET_CONFIGURATION.md for all available options diff --git a/deployments/sequencer2/configs/overlays/hybrid/testing/node-0/services/core.yaml b/deployments/sequencer2/configs/overlays/hybrid/testing/node-0/services/core.yaml index 6c823659482..5e69be1bdb2 100644 --- a/deployments/sequencer2/configs/overlays/hybrid/testing/node-0/services/core.yaml +++ b/deployments/sequencer2/configs/overlays/hybrid/testing/node-0/services/core.yaml @@ -51,6 +51,7 @@ config: state_sync_config_network_config_port: 55010 state_sync_config_p2p_sync_client_config_is_none: false state_sync_config_rpc_config_port: 8090 + state_sync_config_storage_reader_server_config_port: 55012 service: enabled: true