Skip to content

apollo_l1_gas_price,apollo_l1_gas_price_config: move exchange_rate_decimals const to config#13881

Closed
sirandreww-starkware wants to merge 1 commit into
04-20-apollo_consensus_orchestrator_add_snip-35_proposer-validator_symmetry_testsfrom
04-26-apollo_l1_gas_price_apollo_l1_gas_price_config_move_exchange_rate_decimals_const_to_config
Closed

apollo_l1_gas_price,apollo_l1_gas_price_config: move exchange_rate_decimals const to config#13881
sirandreww-starkware wants to merge 1 commit into
04-20-apollo_consensus_orchestrator_add_snip-35_proposer-validator_symmetry_testsfrom
04-26-apollo_l1_gas_price_apollo_l1_gas_price_config_move_exchange_rate_decimals_const_to_config

Conversation

@sirandreww-starkware

Copy link
Copy Markdown
Contributor

No description provided.

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@sirandreww-starkware sirandreww-starkware self-assigned this Apr 26, 2026

sirandreww-starkware commented Apr 26, 2026

Copy link
Copy Markdown
Contributor Author

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

@sirandreww-starkware sirandreww-starkware marked this pull request as ready for review April 26, 2026 16:25
@cursor

cursor Bot commented Apr 26, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Behavior is unchanged at the default of 18; only misconfiguration or a mismatched oracle feed would alter L1 gas price conversion validation.

Overview
Makes the expected oracle decimals field configurable instead of a hard-coded constant, so ETH→STRK and STRK→USD oracles can each declare their own precision.

ExchangeRateOracleConfig gains exchange_rate_decimals (default 18, documented for ETH/STRK), with serialization in config_schema.json. ExchangeRateOracleClient drops EXCHANGE_RATE_DECIMALS and rejects API responses whose decimals do not match the configured value. Integration tests stop depending on apollo_l1_gas_price for that constant and return decimals: 18 from the fake oracle.

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

@ShahakShama ShahakShama left a comment

Copy link
Copy Markdown
Collaborator

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, and made 3 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on ob1337 and sirandreww-starkware).


a discussion (no related file):
I'll make sure with @ob1337 that this is indeed needed


crates/apollo_integration_tests/src/utils.rs line 573 at r1 (raw file):

    // tests.
    let price = format!("0x{DEFAULT_ETH_TO_FRI_RATE:x}");
    let response = json!({ "timestamp": query.timestamp ,"price": price, "decimals": 18 });

If the decimals are already part of the response, why do we need them as config?


crates/apollo_l1_gas_price_config/src/config.rs line 31 at r1 (raw file):

    pub max_cache_size: usize,
    pub query_timeout_sec: u64,
    pub exchange_rate_decimals: u64,

I prefer this won't be a config and will instead be a separate parameter in the ctor. Then, when you initialize eth to strk you'll use 10^18 constant and when you use strk to usd you'll use a different constant

@sirandreww-starkware sirandreww-starkware changed the base branch from 04-26-apollo_l1_gas_price_deployment_rename_eth_to_strk_oracle_to_price_oracle to graphite-base/13881 April 27, 2026 08:06
@sirandreww-starkware sirandreww-starkware force-pushed the 04-26-apollo_l1_gas_price_apollo_l1_gas_price_config_move_exchange_rate_decimals_const_to_config branch from af7a9a3 to 4c28248 Compare April 27, 2026 08:06
@sirandreww-starkware sirandreww-starkware force-pushed the 04-26-apollo_l1_gas_price_apollo_l1_gas_price_config_move_exchange_rate_decimals_const_to_config branch from 906347d to 88cb588 Compare May 6, 2026 12:00
@sirandreww-starkware sirandreww-starkware force-pushed the 04-20-apollo_consensus_orchestrator_add_snip-35_proposer-validator_symmetry_tests branch from 2a7878e to 38bafeb Compare May 6, 2026 12:00
@sirandreww-starkware sirandreww-starkware force-pushed the 04-26-apollo_l1_gas_price_apollo_l1_gas_price_config_move_exchange_rate_decimals_const_to_config branch from 88cb588 to e00cfff Compare May 8, 2026 12:36
@sirandreww-starkware sirandreww-starkware force-pushed the 04-20-apollo_consensus_orchestrator_add_snip-35_proposer-validator_symmetry_tests branch from 38bafeb to 8e2ea16 Compare May 8, 2026 12:36
@sirandreww-starkware sirandreww-starkware force-pushed the 04-26-apollo_l1_gas_price_apollo_l1_gas_price_config_move_exchange_rate_decimals_const_to_config branch from e00cfff to 76a3b5b Compare May 10, 2026 09:02
@sirandreww-starkware sirandreww-starkware force-pushed the 04-20-apollo_consensus_orchestrator_add_snip-35_proposer-validator_symmetry_tests branch from 14d696c to 9747f33 Compare May 10, 2026 09:07
@sirandreww-starkware sirandreww-starkware force-pushed the 04-26-apollo_l1_gas_price_apollo_l1_gas_price_config_move_exchange_rate_decimals_const_to_config branch 2 times, most recently from 44769b8 to 429514c Compare May 10, 2026 12:16
@sirandreww-starkware sirandreww-starkware force-pushed the 04-20-apollo_consensus_orchestrator_add_snip-35_proposer-validator_symmetry_tests branch from 9747f33 to 2c92f9a Compare May 10, 2026 12:16
@sirandreww-starkware sirandreww-starkware force-pushed the 04-26-apollo_l1_gas_price_apollo_l1_gas_price_config_move_exchange_rate_decimals_const_to_config branch from 429514c to bbf45a2 Compare May 14, 2026 07:00
@sirandreww-starkware sirandreww-starkware force-pushed the 04-20-apollo_consensus_orchestrator_add_snip-35_proposer-validator_symmetry_tests branch from 87143d3 to 7895fa9 Compare May 14, 2026 09:06

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 04875da. Configure here.

Comment thread crates/apollo_node/resources/config_schema.json

@matanl-starkware matanl-starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@matanl-starkware reviewed 6 files and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on ob1337, ShahakShama, and sirandreww-starkware).


crates/apollo_integration_tests/src/utils.rs line 573 at r1 (raw file):

Previously, ShahakShama wrote…

If the decimals are already part of the response, why do we need them as config?

+1


crates/apollo_l1_gas_price_config/src/config.rs line 31 at r1 (raw file):

Previously, ShahakShama wrote…

I prefer this won't be a config and will instead be a separate parameter in the ctor. Then, when you initialize eth to strk you'll use 10^18 constant and when you use strk to usd you'll use a different constant

Why do we need it as a parameter of the struct at all?
Take whatever value the response contains and use it for conversion.

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