Skip to content

apollo_consensus_orchestrator,apollo_consensus_manager: route STRK/USD via L1GasPriceProvider#14161

Open
ShahakShama wants to merge 1 commit into
shahak/strk_usd_oracle_04_integration_overlaysfrom
shahak/strk_usd_oracle_05_orchestrator_uses_provider
Open

apollo_consensus_orchestrator,apollo_consensus_manager: route STRK/USD via L1GasPriceProvider#14161
ShahakShama wants to merge 1 commit into
shahak/strk_usd_oracle_04_integration_overlaysfrom
shahak/strk_usd_oracle_05_orchestrator_uses_provider

Conversation

@ShahakShama
Copy link
Copy Markdown
Collaborator

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

@cursor
Copy link
Copy Markdown

cursor Bot commented May 24, 2026

PR Summary

Medium Risk
Changes how proposers compute SNIP-35 fee targets at consensus time; behavior should match prior oracle paths but now depends entirely on the gas-price provider client being correct and available.

Overview
SNIP-35 fee proposal logic no longer uses a dedicated strk_to_usd_oracle on consensus context deps. compute_snip35_fee_proposal now calls l1_gas_price_provider.get_strk_to_usd_rate(timestamp); oracle errors and zero rates still freeze or clamp behavior as before, without an optional “oracle disabled” branch.

SequencerConsensusContextDeps, TestDeps, and consensus_manager wiring drop the extra oracle field. Tests mock STRK/USD on MockL1GasPriceProviderClient, register specific expectations before the default catch-all in setup_default_gas_price_provider, and use DEFAULT_STRK_TO_USD_RATE for build-proposal paths.

Reviewed by Cursor Bugbot for commit d3a6efb. Bugbot is set up for automated code reviews on this repo. Configure here.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Collaborator Author

ShahakShama commented May 24, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch from 27d9c21 to e330e97 Compare May 25, 2026 06:19
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch from e330e97 to c751cc6 Compare May 25, 2026 07:56
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_04_integration_overlays branch 2 times, most recently from 9be64f7 to ebb9c8e Compare May 25, 2026 08:18
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch from c751cc6 to 1ad0441 Compare May 25, 2026 08:18
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_04_integration_overlays branch from ebb9c8e to bf76248 Compare May 25, 2026 08:53
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch from 1ad0441 to 71a1b0c Compare May 25, 2026 08:53
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_04_integration_overlays branch from bf76248 to f533d86 Compare May 25, 2026 11:03
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch from 71a1b0c to c979a47 Compare May 25, 2026 11:03
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_04_integration_overlays branch from f533d86 to 6a5c326 Compare May 25, 2026 11:04
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch from c979a47 to 54bd7e1 Compare May 25, 2026 11:04
Copy link
Copy Markdown
Collaborator

@matanl-starkware matanl-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matanl-starkware reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: 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_target

@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch from 54bd7e1 to bb26675 Compare May 25, 2026 14:42
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_04_integration_overlays branch from 6a5c326 to d6f65ca Compare May 25, 2026 14:42
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch from bb26675 to e645bd3 Compare May 25, 2026 14:52
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_04_integration_overlays branch from d6f65ca to 76e550e Compare May 25, 2026 14:52
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch from e645bd3 to 9cb36f7 Compare May 26, 2026 10:01
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_04_integration_overlays branch from 355e1b6 to 911b2ee Compare May 26, 2026 11:24
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch 2 times, most recently from 2a8a70c to a4e4679 Compare May 26, 2026 13:30
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_04_integration_overlays branch from 911b2ee to 753bdfc Compare May 26, 2026 13:30
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch from a4e4679 to 7d54a5b Compare May 26, 2026 14:24
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_04_integration_overlays branch from 753bdfc to 7b8b3a6 Compare May 26, 2026 14:24
Copy link
Copy Markdown
Collaborator Author

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShahakShama reviewed 4 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on ShahakShama).

…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>
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_05_orchestrator_uses_provider branch from 7d54a5b to d3a6efb Compare May 26, 2026 15:00
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_04_integration_overlays branch from 7b8b3a6 to cb7f91e Compare May 26, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants