Skip to content

apollo_l1_gas_price: hold strk_to_usd oracle client + strk_to_usd_rate#14158

Merged
sirandreww-starkware merged 1 commit into
mainfrom
shahak/strk_usd_oracle_02_provider_holds_oracle
May 26, 2026
Merged

apollo_l1_gas_price: hold strk_to_usd oracle client + strk_to_usd_rate#14158
sirandreww-starkware merged 1 commit into
mainfrom
shahak/strk_usd_oracle_02_provider_holds_oracle

Conversation

@ShahakShama
Copy link
Copy Markdown
Collaborator

Goal: PR 2 of 6 in the stack moving the STRK/USD oracle from the
ad-hoc wiring in SequencerConsensusContext into L1GasPriceProvider.
This commit adds the field and inherent method on the provider but
nothing calls it yet — the seam is established without behavior
change.

Change summary:

  • L1GasPriceProvider gains a second Arc<dyn ExchangeRateOracleClientTrait>
    field (strk_to_usd_oracle_client), positionally after the existing
    eth_to_strk_oracle_client.
  • new takes a second oracle client parameter.
  • new_with_oracle reads config.strk_to_usd_oracle_config (added in
    the previous commit on this stack) and constructs the client.
  • New inherent method strk_to_usd_rate(timestamp) mirrors the
    existing eth_to_fri_rate.
  • Unit tests in l1_gas_price_provider_test.rs updated to pass a
    second mock to the constructor.

Decision points:

  • Positional constructor argument over a builder. The struct has two
    oracle clients now; if a third lands later, builder pattern is the
    right move. For two, positional is fine.
  • Same ExchangeRateOracleClientError propagation via the existing
    L1GasPriceProviderError::ExchangeRateOracleClientError variant.
    No new error variant needed — the two oracles are semantically
    identical, only differ by URL.

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

Low Risk
Constructor/API extension and unused method; no new call sites or pricing logic changes in this commit.

Overview
L1GasPriceProvider now owns a second exchange-rate oracle (strk_to_usd_oracle_client) alongside the existing ETH→STRK client, wired from config.strk_to_usd_oracle_config in new_with_oracle with STRK_TO_USD_ORACLE_METRICS.

new takes an extra Arc<dyn ExchangeRateOracleClientTrait> argument, and a new strk_to_usd_rate(timestamp) method mirrors eth_to_fri_rate (same error mapping). Unit tests pass a second mock into the constructor.

Nothing in this diff calls strk_to_usd_rate yet—this establishes the seam for later stack PRs to move STRK/USD fetching off ad-hoc sequencer wiring.

Reviewed by Cursor Bugbot for commit dc3f241. 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

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

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2819fb7. Configure here.

Comment thread crates/apollo_l1_gas_price/src/l1_gas_price_provider.rs Outdated
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_01_config_field branch from f4acf9f to e33b1ff Compare May 25, 2026 06:19
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_02_provider_holds_oracle branch from 2819fb7 to 1d61ff5 Compare May 25, 2026 06:19
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_01_config_field branch from e33b1ff to b274ca6 Compare May 25, 2026 07:56
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_02_provider_holds_oracle branch from 1d61ff5 to 574ee1b Compare May 25, 2026 07:56
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_01_config_field branch from b274ca6 to d6dfb69 Compare May 25, 2026 08:18
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_02_provider_holds_oracle branch 2 times, most recently from 5fa5e1a to 486319b Compare May 25, 2026 08:53
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_01_config_field branch 2 times, most recently from 1afda6d to bb29293 Compare May 25, 2026 11:03
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_02_provider_holds_oracle branch 2 times, most recently from 25184de to febf852 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 2 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ShahakShama).

Comment thread crates/apollo_l1_gas_price/src/l1_gas_price_provider.rs Outdated
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_02_provider_holds_oracle branch from febf852 to cc63bfd Compare May 25, 2026 14:42
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_01_config_field branch 2 times, most recently from 0c03914 to 74a40a0 Compare May 25, 2026 14:52
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_02_provider_holds_oracle branch from cc63bfd to d745a8f Compare May 25, 2026 14:52
@ShahakShama ShahakShama changed the base branch from shahak/strk_usd_oracle_01_config_field to graphite-base/14158 May 26, 2026 10:01
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_02_provider_holds_oracle branch from d745a8f to c997caa Compare May 26, 2026 10:01
@ShahakShama ShahakShama changed the base branch from graphite-base/14158 to shahak/strk_usd_oracle_01_5_param_oracle_metrics May 26, 2026 10:01
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 1 file and all commit messages, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on ShahakShama).

Copy link
Copy Markdown
Contributor

@sirandreww-starkware sirandreww-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

@sirandreww-starkware made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on ShahakShama).

@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_02_provider_holds_oracle branch from c997caa to bcabd9a Compare May 26, 2026 11:24
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_01_5_param_oracle_metrics branch 2 times, most recently from 2a6a5dd to fc131d4 Compare May 26, 2026 13:30
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_02_provider_holds_oracle branch from bcabd9a to 5950d44 Compare May 26, 2026 13:30
@sirandreww-starkware sirandreww-starkware changed the base branch from shahak/strk_usd_oracle_01_5_param_oracle_metrics to main May 26, 2026 13:55
@sirandreww-starkware sirandreww-starkware force-pushed the shahak/strk_usd_oracle_02_provider_holds_oracle branch from 5950d44 to 19792bb Compare May 26, 2026 13:58
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented May 26, 2026

Merge activity

  • May 26, 1:58 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.

Goal: PR 2 of 6 in the stack moving the STRK/USD oracle from the
ad-hoc wiring in SequencerConsensusContext into L1GasPriceProvider.
This commit adds the field and inherent method on the provider but
nothing calls it yet — the seam is established without behavior
change.

Change summary:
- `L1GasPriceProvider` gains a second `Arc<dyn ExchangeRateOracleClientTrait>`
  field (`strk_to_usd_oracle_client`), positionally after the existing
  `eth_to_strk_oracle_client`.
- `new` takes a second oracle client parameter.
- `new_with_oracle` reads `config.strk_to_usd_oracle_config` (added in
  the previous commit on this stack) and constructs the client.
- New inherent method `strk_to_usd_rate(timestamp)` mirrors the
  existing `eth_to_fri_rate`.
- Unit tests in `l1_gas_price_provider_test.rs` updated to pass a
  second mock to the constructor.

Decision points:
- Positional constructor argument over a builder. The struct has two
  oracle clients now; if a third lands later, builder pattern is the
  right move. For two, positional is fine.
- Same `ExchangeRateOracleClientError` propagation via the existing
  `L1GasPriceProviderError::ExchangeRateOracleClientError` variant.
  No new error variant needed — the two oracles are semantically
  identical, only differ by URL.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ShahakShama ShahakShama force-pushed the shahak/strk_usd_oracle_02_provider_holds_oracle branch from 19792bb to dc3f241 Compare May 26, 2026 14:24
@sirandreww-starkware sirandreww-starkware added this pull request to the merge queue May 26, 2026
Merged via the queue into main with commit 602411d May 26, 2026
18 checks passed
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.

4 participants