apollo_l1_gas_price_types,apollo_l1_gas_price: expose get_strk_to_usd_rate#14159
apollo_l1_gas_price_types,apollo_l1_gas_price: expose get_strk_to_usd_rate#14159ShahakShama wants to merge 1 commit into
Conversation
PR SummaryLow Risk Overview Adds Reviewed by Cursor Bugbot for commit 330b3a9. Bugbot is set up for automated code reviews on this repo. Configure here. |
722a966 to
7def26d
Compare
2819fb7 to
1d61ff5
Compare
1d61ff5 to
574ee1b
Compare
7def26d to
c291368
Compare
574ee1b to
5fa5e1a
Compare
570d530 to
a42b523
Compare
5fa5e1a to
486319b
Compare
a42b523 to
e413e9a
Compare
25184de to
febf852
Compare
e413e9a to
403c127
Compare
matanl-starkware
left a comment
There was a problem hiding this comment.
@matanl-starkware reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ShahakShama).
crates/apollo_l1_gas_price_types/src/lib.rs line 106 at r1 (raw file):
async fn get_rate(&self, timestamp: u64) -> L1GasPriceProviderClientResult<u128>; async fn get_strk_to_usd_rate(&self, timestamp: u64) -> L1GasPriceProviderClientResult<u128>;
I don't understand the meaning of the u128.
Current ratio is: 1 strk => 0.04$. 1$ ~= 24.5 strk.
So either you have a big rounding error or a truncation to zero.
I think we should use fri as for eth (and the interface should reflect that).
Code quote:
u128febf852 to
cc63bfd
Compare
403c127 to
8b42533
Compare
cc63bfd to
d745a8f
Compare
8b42533 to
1262c18
Compare
ShahakShama
left a comment
There was a problem hiding this comment.
@ShahakShama made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on matanl-starkware).
crates/apollo_l1_gas_price_types/src/lib.rs line 106 at r1 (raw file):
Previously, matanl-starkware (Matan Lior) wrote…
I don't understand the meaning of the u128.
Current ratio is: 1 strk => 0.04$. 1$ ~= 24.5 strk.
So either you have a big rounding error or a truncation to zero.
I think we should use fri as for eth (and the interface should reflect that).
We show the results with a fixed point decimal of 18 digits
Meaning that if 1$ ~= 24.5 strk the oracle returns 245 * 10^17
1262c18 to
cfcbbde
Compare
d745a8f to
c997caa
Compare
matanl-starkware
left a comment
There was a problem hiding this comment.
@matanl-starkware made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ShahakShama).
crates/apollo_l1_gas_price_types/src/lib.rs line 106 at r1 (raw file):
Previously, ShahakShama wrote…
We show the results with a fixed point decimal of 18 digits
Meaning that if 1$ ~= 24.5 strk the oracle returns 245 * 10^17
Should we at least document it somewhere?
Consider moving to FRI, which is a common unit we use everywhere.
c997caa to
bcabd9a
Compare
cfcbbde to
61d4412
Compare
bcabd9a to
5950d44
Compare
61d4412 to
266f09d
Compare
266f09d to
f988b4e
Compare
5950d44 to
dc3f241
Compare
ShahakShama
left a comment
There was a problem hiding this comment.
@ShahakShama made 1 comment.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on matanl-starkware).
crates/apollo_l1_gas_price_types/src/lib.rs line 106 at r1 (raw file):
Previously, matanl-starkware (Matan Lior) wrote…
Should we at least document it somewhere?
Consider moving to FRI, which is a common unit we use everywhere.
Documented. changing this means coordinating with pragma. Not sure it's worth it
matanl-starkware
left a comment
There was a problem hiding this comment.
@matanl-starkware reviewed 1 file and all commit messages, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ShahakShama).
…_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>
dc3f241 to
5c5827e
Compare
f988b4e to
330b3a9
Compare

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:
L1GasPriceRequest::GetStrkToUsdRate(u64)variant.L1GasPriceResponse::GetStrkToUsdRate(L1GasPriceProviderResult<u128>)variant.
L1GasPriceProviderClient::get_strk_to_usd_ratetrait method,implemented on the blanket impl mirroring
get_rate.apollo_l1_gas_price::communicationroutes to
L1GasPriceProvider::strk_to_usd_rate.Decision points:
get_rate(which dispatches toGetEthToFriRate) for symmetry; out of scope per the stack planand 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 ifdesired.
MockL1GasPriceProviderClientis automock-generated and picks upthe new method automatically.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com