Skip to content

Commit ce548cf

Browse files
apollo_deployments: convert loaded config to dynamic loaded config (#9455)
1 parent b14573e commit ce548cf

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

crates/apollo_config_manager/src/config_manager_runner.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,7 @@ impl ConfigManagerRunner {
4848
&self,
4949
) -> Result<NodeDynamicConfig, Box<dyn std::error::Error + Send + Sync>> {
5050
let config = load_and_validate_config(self.cli_args.clone())?;
51-
52-
// Extract consensus dynamic config from the loaded config
53-
let consensus_manager_config = config
54-
.consensus_manager_config
55-
.as_ref()
56-
.expect("consensus_manager_config must be present");
57-
58-
let node_dynamic_config = NodeDynamicConfig {
59-
consensus_dynamic_config: Some(
60-
consensus_manager_config.consensus_manager_config.dynamic_config.clone(),
61-
),
62-
};
63-
51+
let node_dynamic_config = NodeDynamicConfig::from(&config);
6452
info!("Extracted NodeDynamicConfig: {:?}", node_dynamic_config);
6553

6654
// TODO(Nadin/Tsabary): Store the last loaded config, compare for changes and only send the

crates/apollo_config_manager/src/config_manager_tests.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ async fn test_config_manager_update_config() {
1111
let config = ConfigManagerConfig::default();
1212

1313
let consensus_dynamic_config = ConsensusDynamicConfig::default();
14-
let node_dynamic_config =
15-
NodeDynamicConfig { consensus_dynamic_config: Some(consensus_dynamic_config) };
14+
let node_dynamic_config = NodeDynamicConfig {
15+
consensus_dynamic_config: Some(consensus_dynamic_config),
16+
..Default::default()
17+
};
1618
let mut config_manager = ConfigManager::new(config, node_dynamic_config.clone());
1719

1820
// Get the consensus dynamic config and assert it is the expected one.
@@ -38,6 +40,7 @@ async fn test_config_manager_update_config() {
3840
config_manager
3941
.set_node_dynamic_config(NodeDynamicConfig {
4042
consensus_dynamic_config: Some(new_consensus_dynamic_config.clone()),
43+
..Default::default()
4144
})
4245
.expect("Failed to set node dynamic config");
4346

crates/apollo_node_config/src/node_config.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use apollo_l1_gas_price_provider_config::config::{
3131
};
3232
use apollo_l1_provider_config::config::L1ProviderConfig;
3333
use apollo_l1_scraper_config::config::L1ScraperConfig;
34-
use apollo_mempool_config::config::MempoolConfig;
34+
use apollo_mempool_config::config::{MempoolConfig, MempoolDynamicConfig};
3535
use apollo_mempool_p2p_config::config::MempoolP2pConfig;
3636
use apollo_monitoring_endpoint_config::config::MonitoringEndpointConfig;
3737
use apollo_reverts::RevertConfig;
@@ -290,6 +290,8 @@ impl Default for SequencerNodeConfig {
290290
pub struct NodeDynamicConfig {
291291
#[validate]
292292
pub consensus_dynamic_config: Option<ConsensusDynamicConfig>,
293+
#[validate]
294+
pub mempool_dynamic_config: Option<MempoolDynamicConfig>,
293295
}
294296

295297
impl From<&SequencerNodeConfig> for NodeDynamicConfig {
@@ -300,7 +302,11 @@ impl From<&SequencerNodeConfig> for NodeDynamicConfig {
300302
consensus_manager_config.consensus_manager_config.dynamic_config.clone()
301303
},
302304
);
303-
Self { consensus_dynamic_config }
305+
let mempool_dynamic_config = sequencer_node_config
306+
.mempool_config
307+
.as_ref()
308+
.map(|mempool_config| mempool_config.dynamic_config.clone());
309+
Self { consensus_dynamic_config, mempool_dynamic_config }
304310
}
305311
}
306312

0 commit comments

Comments
 (0)