Skip to content

Commit 4169ca3

Browse files
ShahakShamaclaude
andcommitted
apollo_l1_gas_price_config,apollo_node: add strk_to_usd_oracle_config
Goal: relocate the STRK/USD oracle currently wired ad-hoc into SequencerConsensusContext to live inside L1GasPriceProvider alongside the existing eth_to_strk oracle. This commit is PR 1 of a 6-PR Graphite stack; later PRs construct the oracle client in the provider, expose it on the client trait, switch the orchestrator to call it, and remove the dead wiring in apollo_consensus_manager. Change summary: adds `strk_to_usd_oracle_config: ExchangeRateOracleConfig` to `L1GasPriceProviderConfig` next to `eth_to_strk_oracle_config`, extends `Default`, dumps it as a nested sub-config, and registers the four new entries in `config_schema.json`. Pure additive; the field is unused. Decision points: - Kept the existing "eth to strk" wording in `ExchangeRateOracleConfig::dump` rather than generalizing to "exchange rate oracle". Generalizing would churn the eth-to-strk schema entries and force a regeneration of config_secrets_schema.json. Doing it here would balloon the diff; punting to a separate cosmetic PR. Action required after merge: run cargo run --bin update_apollo_node_config_schema to regenerate config_secrets_schema.json (sandbox cannot access it). The new private parameter `strk_to_usd_oracle_config.url_header_list` needs a matching schema entry, otherwise the `default_config_file_is_up_to_date` test will fail. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bfd0e2c commit 4169ca3

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

crates/apollo_l1_gas_price_config/src/config.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ pub struct L1GasPriceProviderConfig {
103103
pub max_time_gap_seconds: u64,
104104
#[validate(nested)]
105105
pub eth_to_strk_oracle_config: ExchangeRateOracleConfig,
106+
#[validate(nested)]
107+
pub strk_to_usd_oracle_config: ExchangeRateOracleConfig,
106108
}
107109

108110
impl Default for L1GasPriceProviderConfig {
@@ -114,6 +116,7 @@ impl Default for L1GasPriceProviderConfig {
114116
storage_limit: usize::try_from(10 * MEAN_NUMBER_OF_BLOCKS).unwrap(),
115117
max_time_gap_seconds: 900, // 15 minutes
116118
eth_to_strk_oracle_config: ExchangeRateOracleConfig::default(),
119+
strk_to_usd_oracle_config: ExchangeRateOracleConfig::default(),
117120
}
118121
}
119122
}
@@ -152,6 +155,10 @@ impl SerializeConfig for L1GasPriceProviderConfig {
152155
self.eth_to_strk_oracle_config.dump(),
153156
"eth_to_strk_oracle_config",
154157
));
158+
config.extend(prepend_sub_config_name(
159+
self.strk_to_usd_oracle_config.dump(),
160+
"strk_to_usd_oracle_config",
161+
));
155162
config
156163
}
157164
}

crates/apollo_node/resources/config_schema.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3314,6 +3314,26 @@
33143314
"privacy": "Public",
33153315
"value": 3000
33163316
},
3317+
"l1_gas_price_provider_config.strk_to_usd_oracle_config.lag_interval_seconds": {
3318+
"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.",
3319+
"privacy": "Public",
3320+
"value": 1
3321+
},
3322+
"l1_gas_price_provider_config.strk_to_usd_oracle_config.max_cache_size": {
3323+
"description": "The maximum number of cached conversion rates.",
3324+
"privacy": "Public",
3325+
"value": 100
3326+
},
3327+
"l1_gas_price_provider_config.strk_to_usd_oracle_config.query_timeout_sec": {
3328+
"description": "The timeout (seconds) for the query to the eth to strk oracle.",
3329+
"privacy": "Public",
3330+
"value": 10
3331+
},
3332+
"l1_gas_price_provider_config.strk_to_usd_oracle_config.url_header_list": {
3333+
"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. ",
3334+
"privacy": "Private",
3335+
"value": "https://api.example.com/api"
3336+
},
33173337
"l1_gas_price_scraper_config.#is_none": {
33183338
"description": "Flag for an optional field.",
33193339
"privacy": "TemporaryValue",

0 commit comments

Comments
 (0)