Skip to content

Commit e0ddd78

Browse files
apollo_state_sync_config: add storage_reader_server_config to the state sync config
1 parent b5e3c94 commit e0ddd78

File tree

6 files changed

+34
-3
lines changed

6 files changed

+34
-3
lines changed

crates/apollo_deployments/resources/app_configs/replacer_state_sync_config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,8 @@
6060
"state_sync_config.storage_config.mmap_file_config.growth_step": 2147483648,
6161
"state_sync_config.storage_config.mmap_file_config.max_object_size": 1073741824,
6262
"state_sync_config.storage_config.mmap_file_config.max_size": 1099511627776,
63-
"state_sync_config.storage_config.scope": "FullArchive"
63+
"state_sync_config.storage_config.scope": "FullArchive",
64+
"state_sync_config.storage_reader_server_config.enable": false,
65+
"state_sync_config.storage_reader_server_config.ip": "0.0.0.0",
66+
"state_sync_config.storage_reader_server_config.port": "$$$_STATE_SYNC_CONFIG-STORAGE_READER_SERVER_CONFIG-PORT_$$$"
6467
}

crates/apollo_deployments/resources/app_configs/state_sync_config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,8 @@
6060
"state_sync_config.storage_config.mmap_file_config.growth_step": 2147483648,
6161
"state_sync_config.storage_config.mmap_file_config.max_object_size": 1073741824,
6262
"state_sync_config.storage_config.mmap_file_config.max_size": 1099511627776,
63-
"state_sync_config.storage_config.scope": "FullArchive"
63+
"state_sync_config.storage_config.scope": "FullArchive",
64+
"state_sync_config.storage_reader_server_config.enable": false,
65+
"state_sync_config.storage_reader_server_config.ip": "0.0.0.0",
66+
"state_sync_config.storage_reader_server_config.port": 8080
6467
}

crates/apollo_node/resources/config_schema.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3249,6 +3249,21 @@
32493249
"privacy": "Public",
32503250
"value": "FullArchive"
32513251
},
3252+
"state_sync_config.storage_reader_server_config.enable": {
3253+
"description": "Whether to enable the storage reader HTTP server.",
3254+
"privacy": "Public",
3255+
"value": false
3256+
},
3257+
"state_sync_config.storage_reader_server_config.ip": {
3258+
"description": "The IP address for the storage reader HTTP server.",
3259+
"privacy": "Public",
3260+
"value": "0.0.0.0"
3261+
},
3262+
"state_sync_config.storage_reader_server_config.port": {
3263+
"description": "The port for the storage reader HTTP server.",
3264+
"privacy": "Public",
3265+
"value": 8080
3266+
},
32523267
"strk_fee_token_address": {
32533268
"description": "Address of the STRK fee token.",
32543269
"privacy": "TemporaryValue",

crates/apollo_state_sync/src/runner/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ impl StateSyncRunner {
133133
network_config,
134134
revert_config,
135135
rpc_config,
136+
storage_reader_server_config: _,
136137
} = config;
137138

138139
let StateSyncResources {

crates/apollo_state_sync_config/src/config.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use apollo_p2p_sync_config::config::P2pSyncClientConfig;
1010
use apollo_reverts::RevertConfig;
1111
use apollo_rpc::RpcConfig;
1212
use apollo_storage::db::DbConfig;
13+
use apollo_storage::storage_reader_server::ServerConfig;
1314
use apollo_storage::StorageConfig;
1415
use serde::{Deserialize, Serialize};
1516
use validator::{Validate, ValidationError};
@@ -32,6 +33,8 @@ pub struct StateSyncConfig {
3233
pub revert_config: RevertConfig,
3334
#[validate(nested)]
3435
pub rpc_config: RpcConfig,
36+
#[validate(nested)]
37+
pub storage_reader_server_config: ServerConfig,
3538
}
3639

3740
impl SerializeConfig for StateSyncConfig {
@@ -41,6 +44,10 @@ impl SerializeConfig for StateSyncConfig {
4144
config.extend(ser_optional_sub_config(&self.network_config, "network_config"));
4245
config.extend(prepend_sub_config_name(self.revert_config.dump(), "revert_config"));
4346
config.extend(prepend_sub_config_name(self.rpc_config.dump(), "rpc_config"));
47+
config.extend(prepend_sub_config_name(
48+
self.storage_reader_server_config.dump(),
49+
"storage_reader_server_config",
50+
));
4451
config.extend(ser_optional_sub_config(
4552
&self.p2p_sync_client_config,
4653
"p2p_sync_client_config",
@@ -80,6 +87,7 @@ impl Default for StateSyncConfig {
8087
network_config: Some(NetworkConfig { port: STATE_SYNC_PORT, ..Default::default() }),
8188
revert_config: RevertConfig::default(),
8289
rpc_config: RpcConfig::default(),
90+
storage_reader_server_config: ServerConfig::default(),
8391
}
8492
}
8593
}

crates/apollo_storage/src/storage_reader_server.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use axum::{Json, Router};
1414
use serde::de::DeserializeOwned;
1515
use serde::{Deserialize, Serialize};
1616
use tracing::{error, info};
17+
use validator::Validate;
1718

1819
use crate::{StorageError, StorageReader};
1920

@@ -22,7 +23,7 @@ use crate::{StorageError, StorageReader};
2223
mod storage_reader_server_test;
2324

2425
/// Configuration for the storage reader server.
25-
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
26+
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Validate)]
2627
pub struct ServerConfig {
2728
/// The socket address for the server.
2829
pub ip: IpAddr,

0 commit comments

Comments
 (0)