apollo_consensus_orchestrator,apollo_consensus_manager: route STRK/USD via L1GasPriceProvider#14161
Conversation
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit 18fee91. Bugbot is set up for automated code reviews on this repo. Configure here. |
27d9c21 to
e330e97
Compare
e330e97 to
c751cc6
Compare
9be64f7 to
ebb9c8e
Compare
c751cc6 to
1ad0441
Compare
ebb9c8e to
bf76248
Compare
1ad0441 to
71a1b0c
Compare
bf76248 to
f533d86
Compare
71a1b0c to
c979a47
Compare
f533d86 to
6a5c326
Compare
c979a47 to
54bd7e1
Compare
matanl-starkware
left a comment
There was a problem hiding this comment.
@matanl-starkware reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ShahakShama).
crates/apollo_consensus_orchestrator/src/sequencer_consensus_context.rs line 457 at r1 (raw file):
SNIP35_FEE_ACTUAL.set_lossy(fee_actual.0); let fee_target = match self.deps.l1_gas_price_provider.get_strk_to_usd_rate(timestamp).await
Should verify the units.
IIUC, the fee should be in FRI.
Code quote:
let fee_target54bd7e1 to
bb26675
Compare
6a5c326 to
d6f65ca
Compare
bb26675 to
e645bd3
Compare
d6f65ca to
76e550e
Compare
e645bd3 to
9cb36f7
Compare
355e1b6 to
911b2ee
Compare
2a8a70c to
a4e4679
Compare
911b2ee to
753bdfc
Compare
a4e4679 to
7d54a5b
Compare
753bdfc to
7b8b3a6
Compare
ShahakShama
left a comment
There was a problem hiding this comment.
@ShahakShama reviewed 4 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ShahakShama).
7d54a5b to
d3a6efb
Compare
7b8b3a6 to
cb7f91e
Compare
d3a6efb to
ee795af
Compare
cb7f91e to
62290e1
Compare
…_rate Goal: PR 3 of 6 in the stack moving the STRK/USD oracle into L1GasPriceProvider. Surfaces the inherent method added in PR 2 on the client trait so cross-process callers (notably the consensus orchestrator in PR 5) can request a STRK/USD rate without holding their own oracle. Change summary: - New `L1GasPriceRequest::GetStrkToUsdRate(u64)` variant. - New `L1GasPriceResponse::GetStrkToUsdRate(L1GasPriceProviderResult<u128>)` variant. - New `L1GasPriceProviderClient::get_strk_to_usd_rate` trait method, implemented on the blanket impl mirroring `get_rate`. - Server-side dispatch arm in `apollo_l1_gas_price::communication` routes to `L1GasPriceProvider::strk_to_usd_rate`. Decision points: - Did not rename the existing `get_rate` (which dispatches to `GetEthToFriRate`) for symmetry; out of scope per the stack plan and would churn unrelated call sites in consensus orchestrator. The trait now has slightly asymmetric naming: `get_rate` (ETH/FRI) vs `get_strk_to_usd_rate`. Renaming is a separate cleanup if desired. - `MockL1GasPriceProviderClient` is automock-generated and picks up the new method automatically. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… overlays Goal: PR 4 of 6 in the stack moving the STRK/USD oracle into L1GasPriceProvider. Lands BEFORE the orchestrator behavior flip (PR 5) so that every test and deployment overlay already points the new `strk_to_usd_oracle_config.url_header_list` at a working endpoint. When PR 5 lands, integration runs immediately exercise the new path with realistic data instead of silently freezing fee_proposal at fee_actual. Change summary: - `create_node_config` takes a new `strk_to_usd_oracle_config: ExchangeRateOracleConfig` argument and plumbs it into `L1GasPriceProviderConfig`. - Callers in `flow_test_setup.rs` and `integration_test_manager.rs` reuse the same dummy `spawn_local_eth_to_strk_oracle` URL for both oracles (the handler returns a constant rate, so semantically equivalent). - `SecretsConfigOverride` in `apollo_deployments::test_utils` gains a `strk_to_usd_oracle_config.url_header_list` field so the generated secrets file covers the new private parameter. - Deployment app-config presets (`l1_gas_price_provider_config.json`, `replacer_l1_gas_price_provider_config.json`) gain the same three per-oracle overrides (`lag_interval_seconds=900`, `max_cache_size=100`, `query_timeout_sec=10`) for STRK/USD, mirroring eth_to_strk. Decision points: - One dummy oracle process serving both feeds instead of spawning two. The fake handler is rate-agnostic — same response shape, single port allocation, same join handle. If we ever need rate-specific dummy values, splitting into two processes is a localized change. Action required after merge (cannot run from this sandbox): - `cargo run --bin update_apollo_node_config_schema` to regenerate `config_secrets_schema.json` (it gains a new private parameter from PR 1's earlier addition). - `cargo run --bin deployment_generator` to regenerate `testing_secrets.json` with the new strk_to_usd entry from `SecretsConfigOverride`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…D via L1GasPriceProvider Goal: PR 5 of 5 in the stack moving the STRK/USD oracle into L1GasPriceProvider. This is the behavior flip: `compute_snip35_fee_proposal` now asks the gas-price provider client for the STRK/USD rate instead of holding its own `ExchangeRateOracleClientTrait` object. With this in, the orchestrator no longer has direct oracle plumbing — every external rate goes through the existing `SharedL1GasPriceClient` seam. Change summary: - `SequencerConsensusContext::compute_snip35_fee_proposal` calls `self.deps.l1_gas_price_provider.get_strk_to_usd_rate(timestamp)`. The previous `Option<Arc<dyn ExchangeRateOracleClientTrait>>` outer match collapses into a plain `Result` match; the "freeze fee_proposal" fallback is preserved on `Err` and zero-rate. - `SequencerConsensusContextDeps::strk_to_usd_oracle` removed. - `TestDeps::strk_to_usd_oracle` removed and the `From` impl simplified. - `consensus_manager.rs` drops the now-invalid `strk_to_usd_oracle: None` field initializer. - Unused imports cleaned up: `ExchangeRateOracleClientTrait` and `MockExchangeRateOracleClientTrait` from orchestrator; `debug` from `tracing` (only used by the dead `None` branch). - `setup_default_gas_price_provider` registers a catch-all `expect_get_strk_to_usd_rate` returning `DEFAULT_STRK_TO_USD_RATE` so existing build_proposal tests keep working without per-test expectations. - The two SNIP-35 fee-proposal tests reorder their per-test mock registration to run BEFORE `setup_default_expectations`, since mockall matches expectations in oldest-first order — same pattern the codebase already uses for state_sync_client.expect_get_block. - `OracleBehavior::NotConfigured` variant removed; the `no_oracle_freezes_at_fee_actual` test case removed (redundant with `oracle_err_freezes_at_fee_actual` — both freeze at fee_actual now that there is no on/off switch). Decision points: - Original 6-PR plan included a "cleanup" PR removing the oracle wiring from `apollo_consensus_manager`. That PR collapsed into this one because this branch forks from BEFORE the wiring was added, so the cleanup is one line and shares the same compile-unit constraint. - The `setup_default_gas_price_provider` catch-all is needed because every build_proposal test now hits `compute_snip35_fee_proposal`, which always queries the provider. The alternative (per-test expectations) would have churned ~9 build_proposal call sites. - `DEFAULT_STRK_TO_USD_RATE = 3e17` was picked because the SNIP-35 test cases treat it as in-bounds. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ee795af to
18fee91
Compare
62290e1 to
bcd87e3
Compare
sirandreww-starkware
left a comment
There was a problem hiding this comment.
@sirandreww-starkware partially reviewed 4 files.
Reviewable status: 4 of 10 files reviewed, all discussions resolved (waiting on matanl-starkware).
sirandreww-starkware
left a comment
There was a problem hiding this comment.
@sirandreww-starkware reviewed 6 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ShahakShama).

Goal: PR 5 of 5 in the stack moving the STRK/USD oracle into
L1GasPriceProvider. This is the behavior flip:
compute_snip35_fee_proposalnow asks the gas-price provider client for the STRK/USD rate instead
of holding its own
ExchangeRateOracleClientTraitobject. With thisin, the orchestrator no longer has direct oracle plumbing — every
external rate goes through the existing
SharedL1GasPriceClientseam.Change summary:
SequencerConsensusContext::compute_snip35_fee_proposalcallsself.deps.l1_gas_price_provider.get_strk_to_usd_rate(timestamp).The previous
Option<Arc<dyn ExchangeRateOracleClientTrait>>outermatch collapses into a plain
Resultmatch; the "freeze fee_proposal"fallback is preserved on
Errand zero-rate.SequencerConsensusContextDeps::strk_to_usd_oracleremoved.TestDeps::strk_to_usd_oracleremoved and theFromimpl simplified.consensus_manager.rsdrops the now-invalidstrk_to_usd_oracle: Nonefield initializer.
ExchangeRateOracleClientTraitandMockExchangeRateOracleClientTraitfrom orchestrator;debugfromtracing(only used by the deadNonebranch).setup_default_gas_price_providerregisters a catch-allexpect_get_strk_to_usd_ratereturningDEFAULT_STRK_TO_USD_RATEso existing build_proposal tests keep working without per-test
expectations.
registration to run BEFORE
setup_default_expectations, sincemockall matches expectations in oldest-first order — same pattern
the codebase already uses for state_sync_client.expect_get_block.
OracleBehavior::NotConfiguredvariant removed; theno_oracle_freezes_at_fee_actualtest case removed (redundant withoracle_err_freezes_at_fee_actual— both freeze at fee_actual nowthat there is no on/off switch).
Decision points:
wiring from
apollo_consensus_manager. That PR collapsed into thisone because this branch forks from BEFORE the wiring was added, so
the cleanup is one line and shares the same compile-unit constraint.
setup_default_gas_price_providercatch-all is needed becauseevery build_proposal test now hits
compute_snip35_fee_proposal,which always queries the provider. The alternative (per-test
expectations) would have churned ~9 build_proposal call sites.
DEFAULT_STRK_TO_USD_RATE = 3e17was picked because the SNIP-35test cases treat it as in-bounds.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com