Skip to content

Commit e5a2bfe

Browse files
committed
apollo_node: remove eth/strk config from consensus_manager and make it top level
1 parent f8fc9e2 commit e5a2bfe

File tree

11 files changed

+48
-56
lines changed

11 files changed

+48
-56
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/apollo_consensus_manager/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ apollo_consensus.workspace = true
1919
apollo_consensus_orchestrator.workspace = true
2020
apollo_infra.workspace = true
2121
apollo_infra_utils.workspace = true
22-
apollo_l1_gas_price.workspace = true
2322
apollo_l1_gas_price_types.workspace = true
2423
apollo_metrics.workspace = true
2524
apollo_network.workspace = true

crates/apollo_consensus_manager/src/config.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use apollo_config::{ParamPath, ParamPrivacyInput, SerializedParam};
55
use apollo_consensus::config::{ConsensusConfig, StreamHandlerConfig};
66
use apollo_consensus_orchestrator::cende::CendeConfig;
77
use apollo_consensus_orchestrator::config::ContextConfig;
8-
use apollo_l1_gas_price::eth_to_strk_oracle::EthToStrkOracleConfig;
98
use apollo_network::NetworkConfig;
109
use apollo_reverts::RevertConfig;
1110
use serde::{Deserialize, Serialize};
@@ -17,7 +16,6 @@ use validator::Validate;
1716
pub struct ConsensusManagerConfig {
1817
pub consensus_manager_config: ConsensusConfig,
1918
pub context_config: ContextConfig,
20-
pub eth_to_strk_oracle_config: EthToStrkOracleConfig,
2119
pub stream_handler_config: StreamHandlerConfig,
2220
#[validate]
2321
pub network_config: NetworkConfig,
@@ -71,10 +69,6 @@ impl SerializeConfig for ConsensusManagerConfig {
7169
"consensus_manager_config",
7270
));
7371
config.extend(prepend_sub_config_name(self.context_config.dump(), "context_config"));
74-
config.extend(prepend_sub_config_name(
75-
self.eth_to_strk_oracle_config.dump(),
76-
"eth_to_strk_oracle_config",
77-
));
7872
config.extend(prepend_sub_config_name(
7973
self.stream_handler_config.dump(),
8074
"stream_handler_config",
@@ -91,7 +85,6 @@ impl Default for ConsensusManagerConfig {
9185
ConsensusManagerConfig {
9286
consensus_manager_config: ConsensusConfig::default(),
9387
context_config: ContextConfig::default(),
94-
eth_to_strk_oracle_config: EthToStrkOracleConfig::default(),
9588
stream_handler_config: StreamHandlerConfig::default(),
9689
cende_config: CendeConfig::default(),
9790
network_config: NetworkConfig::default(),

crates/apollo_integration_tests/src/flow_test_setup.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
use std::collections::{BTreeMap, HashMap};
1+
use std::collections::HashMap;
22
use std::net::SocketAddr;
33
use std::sync::Arc;
44

55
use alloy::node_bindings::AnvilInstance;
6-
use apollo_config::converters::UrlAndHeaders;
76
use apollo_consensus_manager::config::ConsensusManagerConfig;
87
use apollo_http_server::config::HttpServerConfig;
98
use apollo_http_server::test_utils::HttpTestClient;
109
use apollo_infra_utils::test_utils::AvailablePorts;
10+
use apollo_l1_gas_price::eth_to_strk_oracle::EthToStrkOracleConfig;
1111
use apollo_mempool_p2p::config::MempoolP2pConfig;
1212
use apollo_monitoring_endpoint::config::MonitoringEndpointConfig;
1313
use apollo_monitoring_endpoint::test_utils::MonitoringClient;
@@ -51,7 +51,6 @@ use starknet_api::transaction::{TransactionHash, TransactionHasher, TransactionV
5151
use starknet_types_core::felt::Felt;
5252
use tokio::sync::Mutex;
5353
use tracing::{debug, instrument, Instrument};
54-
use url::Url;
5554

5655
use crate::state_reader::{StorageTestHandles, StorageTestSetup};
5756
use crate::utils::{
@@ -246,8 +245,10 @@ impl FlowSequencerSetup {
246245

247246
let (eth_to_strk_oracle_url_headers, _join_handle) =
248247
spawn_local_eth_to_strk_oracle(available_ports.get_next_port());
249-
consensus_manager_config.eth_to_strk_oracle_config.url_header_list =
250-
Some(vec![eth_to_strk_oracle_url_headers]);
248+
let eth_to_strk_oracle_config = EthToStrkOracleConfig {
249+
url_header_list: Some(vec![eth_to_strk_oracle_url_headers]),
250+
..Default::default()
251+
};
251252

252253
let validator_id = set_validator_id(&mut consensus_manager_config, node_index);
253254

@@ -269,6 +270,7 @@ impl FlowSequencerSetup {
269270
storage_config,
270271
state_sync_config,
271272
consensus_manager_config,
273+
eth_to_strk_oracle_config,
272274
mempool_p2p_config,
273275
monitoring_endpoint_config,
274276
component_config,
@@ -337,10 +339,6 @@ pub fn create_consensus_manager_configs_and_channels(
337339
for (i, config) in consensus_manager_configs.iter_mut().enumerate() {
338340
config.context_config.builder_address =
339341
ContractAddress::try_from(BUILDER_BASE_ADDRESS + Felt::from(i)).unwrap();
340-
config.eth_to_strk_oracle_config.url_header_list = Some(vec![UrlAndHeaders {
341-
url: Url::parse("https://eth_to_strk_oracle_url").expect("Should be a valid URL"),
342-
headers: BTreeMap::new(),
343-
}]);
344342
}
345343

346344
let broadcast_channels = network_config_into_broadcast_channels(

crates/apollo_integration_tests/src/integration_test_manager.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use apollo_http_server::test_utils::HttpTestClient;
1111
use apollo_infra_utils::dumping::serialize_to_file;
1212
use apollo_infra_utils::test_utils::{AvailablePortsGenerator, TestIdentifier};
1313
use apollo_infra_utils::tracing::{CustomLogger, TraceLevel};
14+
use apollo_l1_gas_price::eth_to_strk_oracle::EthToStrkOracleConfig;
1415
use apollo_l1_gas_price::l1_gas_price_scraper::L1GasPriceScraperConfig;
1516
use apollo_monitoring_endpoint::config::MonitoringEndpointConfig;
1617
use apollo_monitoring_endpoint::test_utils::MonitoringClient;
@@ -917,8 +918,11 @@ pub async fn get_sequencer_setup_configs(
917918
let state_sync_config = state_sync_configs.remove(0);
918919

919920
consensus_manager_config.cende_config.recorder_url = recorder_url.clone();
920-
consensus_manager_config.eth_to_strk_oracle_config.url_header_list =
921-
Some(vec![eth_to_strk_oracle_url.clone()]);
921+
let eth_to_strk_oracle_config = EthToStrkOracleConfig {
922+
url_header_list: Some(vec![eth_to_strk_oracle_url.clone()]),
923+
..Default::default()
924+
};
925+
922926
let validator_id = set_validator_id(&mut consensus_manager_config, node_index);
923927
let chain_info = chain_info.clone();
924928

@@ -940,6 +944,7 @@ pub async fn get_sequencer_setup_configs(
940944
storage_setup.storage_config.clone(),
941945
state_sync_config,
942946
consensus_manager_config,
947+
eth_to_strk_oracle_config,
943948
mempool_p2p_config,
944949
MonitoringEndpointConfig::default(),
945950
ComponentConfig::default(),

crates/apollo_integration_tests/src/utils.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ pub fn create_node_config(
168168
storage_config: StorageTestConfig,
169169
mut state_sync_config: StateSyncConfig,
170170
consensus_manager_config: ConsensusManagerConfig,
171+
eth_to_strk_oracle_config: EthToStrkOracleConfig,
171172
mempool_p2p_config: MempoolP2pConfig,
172173
monitoring_endpoint_config: MonitoringEndpointConfig,
173174
component_config: ComponentConfig,
@@ -265,6 +266,7 @@ pub fn create_node_config(
265266
l1_provider_config: Some(l1_provider_config),
266267
l1_endpoint_monitor_config: Some(l1_endpoint_monitor_config),
267268
l1_gas_price_provider_config: Some(l1_gas_price_provider_config),
269+
eth_to_strk_oracle_config: Some(eth_to_strk_oracle_config),
268270
..Default::default()
269271
},
270272
config_pointers_map,
@@ -306,15 +308,6 @@ pub(crate) fn create_consensus_manager_configs_from_network_configs(
306308
skip_write_height: Some(BlockNumber(1)),
307309
..Default::default()
308310
},
309-
eth_to_strk_oracle_config: EthToStrkOracleConfig {
310-
url_header_list: Some(vec![
311-
UrlAndHeaders{
312-
url: Url::parse("https://eth_to_strk_oracle_url").expect("Should be a valid URL"),
313-
headers: Default::default(),
314-
}
315-
]),
316-
..Default::default()
317-
},
318311
assume_no_malicious_validators: true,
319312
..Default::default()
320313
})

crates/apollo_l1_gas_price/src/eth_to_strk_oracle.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use serde_json;
2222
use tokio_util::task::AbortOnDropHandle;
2323
use tracing::{debug, info, instrument, warn};
2424
use url::Url;
25+
use validator::Validate;
2526

2627
use crate::metrics::{
2728
register_eth_to_strk_metrics,
@@ -47,7 +48,7 @@ fn btreemap_to_headermap(hash_map: BTreeMap<String, String>) -> HeaderMap {
4748
header_map
4849
}
4950

50-
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
51+
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Validate)]
5152
pub struct EthToStrkOracleConfig {
5253
#[serde(deserialize_with = "deserialize_optional_list_with_url_and_headers")]
5354
pub url_header_list: Option<Vec<UrlAndHeaders>>,

crates/apollo_node/resources/config_schema.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,26 +1074,6 @@
10741074
"privacy": "Public",
10751075
"value": 10000
10761076
},
1077-
"consensus_manager_config.eth_to_strk_oracle_config.lag_interval_seconds": {
1078-
"description": "The size of the interval (seconds) that the eth to strk rate is taken on. The lag refers to the fact that the interval `[T, T+k)` contains the conversion rate for queries in the interval `[T+k, T+2k)`. Should be configured in alignment with relevant query parameters in `url_header_list`, if required.",
1079-
"privacy": "Public",
1080-
"value": 1
1081-
},
1082-
"consensus_manager_config.eth_to_strk_oracle_config.max_cache_size": {
1083-
"description": "The maximum number of cached conversion rates.",
1084-
"privacy": "Public",
1085-
"value": 100
1086-
},
1087-
"consensus_manager_config.eth_to_strk_oracle_config.query_timeout_sec": {
1088-
"description": "The timeout (seconds) for the query to the eth to strk oracle.",
1089-
"privacy": "Public",
1090-
"value": 3
1091-
},
1092-
"consensus_manager_config.eth_to_strk_oracle_config.url_header_list": {
1093-
"description": "A list of Url+HTTP headers for the eth to strk oracle. The url is followed by a comma and then headers as key^value pairs, separated by commas. For example: `https://api.example.com/api,key1^value1,key2^value2`. Each URL+headers is separated by a pipe `|` character. The `timestamp` parameter is appended dynamically when making requests, in order to have a stable mapping from block timestamp to conversion rate. ",
1094-
"privacy": "Private",
1095-
"value": "https://api.example.com/api"
1096-
},
10971077
"consensus_manager_config.immediate_active_height": {
10981078
"description": "The height at which the node may actively participate in consensus.",
10991079
"privacy": "Public",
@@ -1219,6 +1199,26 @@
12191199
"privacy": "TemporaryValue",
12201200
"value": "PointerTarget"
12211201
},
1202+
"eth_to_strk_oracle_config.lag_interval_seconds": {
1203+
"description": "The size of the interval (seconds) that the eth to strk rate is taken on. The lag refers to the fact that the interval `[T, T+k)` contains the conversion rate for queries in the interval `[T+k, T+2k)`. Should be configured in alignment with relevant query parameters in `url_header_list`, if required.",
1204+
"privacy": "Public",
1205+
"value": 1
1206+
},
1207+
"eth_to_strk_oracle_config.max_cache_size": {
1208+
"description": "The maximum number of cached conversion rates.",
1209+
"privacy": "Public",
1210+
"value": 100
1211+
},
1212+
"eth_to_strk_oracle_config.query_timeout_sec": {
1213+
"description": "The timeout (seconds) for the query to the eth to strk oracle.",
1214+
"privacy": "Public",
1215+
"value": 3
1216+
},
1217+
"eth_to_strk_oracle_config.url_header_list": {
1218+
"description": "A list of Url+HTTP headers for the eth to strk oracle. The url is followed by a comma and then headers as key^value pairs, separated by commas. For example: `https://api.example.com/api,key1^value1,key2^value2`. Each URL+headers is separated by a pipe `|` character. The `timestamp` parameter is appended dynamically when making requests, in order to have a stable mapping from block timestamp to conversion rate. ",
1219+
"privacy": "Private",
1220+
"value": "https://api.example.com/api"
1221+
},
12221222
"gateway_config.#is_none": {
12231223
"description": "Flag for an optional field.",
12241224
"privacy": "TemporaryValue",

crates/apollo_node/resources/config_secrets_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
"base_layer_config.node_url",
3-
"consensus_manager_config.eth_to_strk_oracle_config.url_header_list",
43
"consensus_manager_config.network_config.secret_key",
4+
"eth_to_strk_oracle_config.url_header_list",
55
"l1_endpoint_monitor_config.ordered_l1_endpoint_urls",
66
"mempool_p2p_config.network_config.secret_key",
77
"recorder_url",

crates/apollo_node/src/components.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,11 @@ pub async fn create_node_components(
441441
.as_ref()
442442
.expect("L1 Gas Price Provider config should be set");
443443
let eth_to_strk_oracle_config = config
444-
.consensus_manager_config
445-
.as_ref()
446-
.expect("Consensus Manager config should be set")
447444
.eth_to_strk_oracle_config
448-
.clone();
449-
let eth_to_strk_oracle_client = EthToStrkOracleClient::new(eth_to_strk_oracle_config);
445+
.as_ref()
446+
.expect("Eth to Strk oracle config should be set");
447+
let eth_to_strk_oracle_client =
448+
EthToStrkOracleClient::new(eth_to_strk_oracle_config.clone());
450449
Some(L1GasPriceProvider::new(
451450
l1_gas_price_provider_config.clone(),
452451
Arc::new(eth_to_strk_oracle_client),

0 commit comments

Comments
 (0)