Skip to content

Commit bfd8a52

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

File tree

11 files changed

+48
-54
lines changed

11 files changed

+48
-54
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_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,
@@ -68,10 +66,6 @@ impl SerializeConfig for ConsensusManagerConfig {
6866
]);
6967
config.extend(prepend_sub_config_name(self.consensus_config.dump(), "consensus_config"));
7068
config.extend(prepend_sub_config_name(self.context_config.dump(), "context_config"));
71-
config.extend(prepend_sub_config_name(
72-
self.eth_to_strk_oracle_config.dump(),
73-
"eth_to_strk_oracle_config",
74-
));
7569
config.extend(prepend_sub_config_name(
7670
self.stream_handler_config.dump(),
7771
"stream_handler_config",
@@ -88,7 +82,6 @@ impl Default for ConsensusManagerConfig {
8882
ConsensusManagerConfig {
8983
consensus_config: ConsensusConfig::default(),
9084
context_config: ContextConfig::default(),
91-
eth_to_strk_oracle_config: EthToStrkOracleConfig::default(),
9285
stream_handler_config: StreamHandlerConfig::default(),
9386
cende_config: CendeConfig::default(),
9487
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::{
@@ -238,8 +237,10 @@ impl FlowSequencerSetup {
238237

239238
let (eth_to_strk_oracle_url_headers, _join_handle) =
240239
spawn_local_eth_to_strk_oracle(available_ports.get_next_port());
241-
consensus_manager_config.eth_to_strk_oracle_config.url_header_list =
242-
Some(vec![eth_to_strk_oracle_url_headers]);
240+
let eth_to_strk_oracle_config = EthToStrkOracleConfig {
241+
url_header_list: Some(vec![eth_to_strk_oracle_url_headers]),
242+
..Default::default()
243+
};
243244

244245
let validator_id = set_validator_id(&mut consensus_manager_config, node_index);
245246

@@ -261,6 +262,7 @@ impl FlowSequencerSetup {
261262
storage_config,
262263
state_sync_config,
263264
consensus_manager_config,
265+
eth_to_strk_oracle_config,
264266
mempool_p2p_config,
265267
monitoring_endpoint_config,
266268
component_config,
@@ -325,10 +327,6 @@ pub fn create_consensus_manager_configs_and_channels(
325327
for (i, config) in consensus_manager_configs.iter_mut().enumerate() {
326328
config.context_config.builder_address =
327329
ContractAddress::try_from(BUILDER_BASE_ADDRESS + Felt::from(i)).unwrap();
328-
config.eth_to_strk_oracle_config.url_header_list = Some(vec![UrlAndHeaders {
329-
url: Url::parse("https://eth_to_strk_oracle_url").expect("Should be a valid URL"),
330-
headers: BTreeMap::new(),
331-
}]);
332330
}
333331

334332
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_monitoring_endpoint::config::MonitoringEndpointConfig;
1516
use apollo_monitoring_endpoint::test_utils::MonitoringClient;
1617
use apollo_network::network_manager::test_utils::create_connected_network_configs;
@@ -881,8 +882,11 @@ pub async fn get_sequencer_setup_configs(
881882
let state_sync_config = state_sync_configs.remove(0);
882883

883884
consensus_manager_config.cende_config.recorder_url = recorder_url.clone();
884-
consensus_manager_config.eth_to_strk_oracle_config.url_header_list =
885-
Some(vec![eth_to_strk_oracle_url.clone()]);
885+
let eth_to_strk_oracle_config = EthToStrkOracleConfig {
886+
url_header_list: Some(vec![eth_to_strk_oracle_url.clone()]),
887+
..Default::default()
888+
};
889+
886890
let validator_id = set_validator_id(&mut consensus_manager_config, node_index);
887891
let chain_info = chain_info.clone();
888892

@@ -904,6 +908,7 @@ pub async fn get_sequencer_setup_configs(
904908
storage_setup.storage_config.clone(),
905909
state_sync_config,
906910
consensus_manager_config,
911+
eth_to_strk_oracle_config,
907912
mempool_p2p_config,
908913
MonitoringEndpointConfig::default(),
909914
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,
@@ -264,6 +265,7 @@ pub fn create_node_config(
264265
l1_provider_config,
265266
l1_endpoint_monitor_config,
266267
l1_gas_price_provider_config,
268+
eth_to_strk_oracle_config,
267269
..Default::default()
268270
},
269271
config_pointers_map,
@@ -305,15 +307,6 @@ pub(crate) fn create_consensus_manager_configs_from_network_configs(
305307
skip_write_height: Some(BlockNumber(1)),
306308
..Default::default()
307309
},
308-
eth_to_strk_oracle_config: EthToStrkOracleConfig {
309-
url_header_list: Some(vec![
310-
UrlAndHeaders{
311-
url: Url::parse("https://eth_to_strk_oracle_url").expect("Should be a valid URL"),
312-
headers: Default::default(),
313-
}
314-
]),
315-
..Default::default()
316-
},
317310
assume_no_malicious_validators: true,
318311
..Default::default()
319312
})

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
@@ -1069,26 +1069,6 @@
10691069
"privacy": "Public",
10701070
"value": 10000
10711071
},
1072-
"consensus_manager_config.eth_to_strk_oracle_config.lag_interval_seconds": {
1073-
"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.",
1074-
"privacy": "Public",
1075-
"value": 1
1076-
},
1077-
"consensus_manager_config.eth_to_strk_oracle_config.max_cache_size": {
1078-
"description": "The maximum number of cached conversion rates.",
1079-
"privacy": "Public",
1080-
"value": 100
1081-
},
1082-
"consensus_manager_config.eth_to_strk_oracle_config.query_timeout_sec": {
1083-
"description": "The timeout (seconds) for the query to the eth to strk oracle.",
1084-
"privacy": "Public",
1085-
"value": 3
1086-
},
1087-
"consensus_manager_config.eth_to_strk_oracle_config.url_header_list": {
1088-
"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. ",
1089-
"privacy": "Private",
1090-
"value": "https://api.example.com/api"
1091-
},
10921072
"consensus_manager_config.immediate_active_height": {
10931073
"description": "The height at which the node may actively participate in consensus.",
10941074
"privacy": "Public",
@@ -1214,6 +1194,26 @@
12141194
"privacy": "TemporaryValue",
12151195
"value": "PointerTarget"
12161196
},
1197+
"eth_to_strk_oracle_config.lag_interval_seconds": {
1198+
"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.",
1199+
"privacy": "Public",
1200+
"value": 1
1201+
},
1202+
"eth_to_strk_oracle_config.max_cache_size": {
1203+
"description": "The maximum number of cached conversion rates.",
1204+
"privacy": "Public",
1205+
"value": 100
1206+
},
1207+
"eth_to_strk_oracle_config.query_timeout_sec": {
1208+
"description": "The timeout (seconds) for the query to the eth to strk oracle.",
1209+
"privacy": "Public",
1210+
"value": 3
1211+
},
1212+
"eth_to_strk_oracle_config.url_header_list": {
1213+
"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. ",
1214+
"privacy": "Private",
1215+
"value": "https://api.example.com/api"
1216+
},
12171217
"gateway_config.authorized_declarer_accounts": {
12181218
"description": "Authorized declarer accounts. If set, only these accounts can declare new contracts. Addresses are in hex format and separated by a comma with no space.",
12191219
"privacy": "Public",

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: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,8 @@ pub async fn create_node_components(
371371
let l1_gas_price_provider = match config.components.l1_gas_price_provider.execution_mode {
372372
ReactiveComponentExecutionMode::LocalExecutionWithRemoteDisabled
373373
| ReactiveComponentExecutionMode::LocalExecutionWithRemoteEnabled => {
374-
let eth_to_strk_oracle_client = EthToStrkOracleClient::new(
375-
config.consensus_manager_config.eth_to_strk_oracle_config.clone(),
376-
);
374+
let eth_to_strk_oracle_client =
375+
EthToStrkOracleClient::new(config.eth_to_strk_oracle_config.clone());
377376
Some(L1GasPriceProvider::new(
378377
config.l1_gas_price_provider_config.clone(),
379378
Arc::new(eth_to_strk_oracle_client),

0 commit comments

Comments
 (0)