Skip to content

Commit ba6d4d8

Browse files
apollo_http_server: add allow new txs flag to config
1 parent b50486d commit ba6d4d8

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

crates/apollo_deployments/resources/app_configs/http_server_config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"http_server_config.dynamic_config.accept_new_txs": true,
23
"http_server_config.dynamic_config.max_sierra_program_size": 4194304,
34
"http_server_config.static_config.ip": "0.0.0.0",
45
"http_server_config.static_config.port": ""

crates/apollo_deployments/resources/app_configs/replacer_http_server_config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"http_server_config.dynamic_config.accept_new_txs": true,
23
"http_server_config.dynamic_config.max_sierra_program_size": 4194304,
34
"http_server_config.static_config.ip": "0.0.0.0",
45
"http_server_config.static_config.port": "$$$_HTTP_SERVER_CONFIG-STATIC_CONFIG-PORT_$$$"

crates/apollo_http_server_config/src/config.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ impl SerializeConfig for HttpServerConfig {
2828
impl HttpServerConfig {
2929
pub fn new(ip: IpAddr, port: u16, max_sierra_program_size: usize) -> Self {
3030
Self {
31-
dynamic_config: HttpServerDynamicConfig { max_sierra_program_size },
31+
dynamic_config: HttpServerDynamicConfig {
32+
accept_new_txs: true,
33+
max_sierra_program_size,
34+
},
3235
static_config: HttpServerStaticConfig { ip, port },
3336
}
3437
}
@@ -61,22 +64,31 @@ impl Default for HttpServerStaticConfig {
6164

6265
#[derive(Clone, Debug, Serialize, Deserialize, Validate, PartialEq)]
6366
pub struct HttpServerDynamicConfig {
67+
pub accept_new_txs: bool,
6468
pub max_sierra_program_size: usize,
6569
}
6670

6771
impl SerializeConfig for HttpServerDynamicConfig {
6872
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
69-
BTreeMap::from_iter([ser_param(
70-
"max_sierra_program_size",
71-
&self.max_sierra_program_size,
72-
"The maximum size of a sierra program in bytes.",
73-
ParamPrivacyInput::Public,
74-
)])
73+
BTreeMap::from_iter([
74+
ser_param(
75+
"accept_new_txs",
76+
&self.accept_new_txs,
77+
"Enables accepting new txs.",
78+
ParamPrivacyInput::Public,
79+
),
80+
ser_param(
81+
"max_sierra_program_size",
82+
&self.max_sierra_program_size,
83+
"The maximum size of a sierra program in bytes.",
84+
ParamPrivacyInput::Public,
85+
),
86+
])
7587
}
7688
}
7789

7890
impl Default for HttpServerDynamicConfig {
7991
fn default() -> Self {
80-
Self { max_sierra_program_size: DEFAULT_MAX_SIERRA_PROGRAM_SIZE }
92+
Self { accept_new_txs: true, max_sierra_program_size: DEFAULT_MAX_SIERRA_PROGRAM_SIZE }
8193
}
8294
}

crates/apollo_node/resources/config_schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2509,6 +2509,11 @@
25092509
"privacy": "TemporaryValue",
25102510
"value": false
25112511
},
2512+
"http_server_config.dynamic_config.accept_new_txs": {
2513+
"description": "Enables accepting new txs.",
2514+
"privacy": "Public",
2515+
"value": true
2516+
},
25122517
"http_server_config.dynamic_config.max_sierra_program_size": {
25132518
"description": "The maximum size of a sierra program in bytes.",
25142519
"privacy": "Public",

0 commit comments

Comments
 (0)