Skip to content

apollo_consensus_orchestrator: add SNIP-35 module tests#13815

Open
sirandreww-starkware wants to merge 1 commit into04-20-apollo_consensus_orchestrator_add_snip-35_modulefrom
04-19-apollo_consensus_orchestrator_add_snip-35_fee_market_functions_and_tests
Open

apollo_consensus_orchestrator: add SNIP-35 module tests#13815
sirandreww-starkware wants to merge 1 commit into04-20-apollo_consensus_orchestrator_add_snip-35_modulefrom
04-19-apollo_consensus_orchestrator_add_snip-35_fee_market_functions_and_tests

Conversation

@sirandreww-starkware
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor Author

sirandreww-starkware commented Apr 19, 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.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_market_functions_and_tests branch from f24886f to f42b483 Compare April 19, 2026 17:43
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-starknet_api_add_fee_proposal_to_block_hash_calculator branch from 6902537 to 6068d78 Compare April 19, 2026 17:43
@sirandreww-starkware sirandreww-starkware changed the title apollo_consensus_orchestrator: add SNIP-35 fee_market functions and tests apollo_consensus_orchestrator: add SNIP-35 fee_market functions Apr 20, 2026
@sirandreww-starkware sirandreww-starkware changed the title apollo_consensus_orchestrator: add SNIP-35 fee_market functions apollo_consensus_orchestrator: add SNIP-35 module Apr 20, 2026
@sirandreww-starkware sirandreww-starkware changed the title apollo_consensus_orchestrator: add SNIP-35 module apollo_consensus_orchestrator: add SNIP-35 module tests Apr 20, 2026
@sirandreww-starkware sirandreww-starkware force-pushed the 04-20-apollo_consensus_orchestrator_add_snip-35_module branch from 28a4ee7 to ae638b6 Compare May 1, 2026 15:11
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_market_functions_and_tests branch from d28c88a to 47c092a Compare May 1, 2026 15:11
@sirandreww-starkware sirandreww-starkware force-pushed the 04-20-apollo_consensus_orchestrator_add_snip-35_module branch from ae638b6 to bf2a6d7 Compare May 1, 2026 15:44
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_market_functions_and_tests branch 2 times, most recently from d259d42 to 67f8dd0 Compare May 1, 2026 15:59
@sirandreww-starkware sirandreww-starkware force-pushed the 04-20-apollo_consensus_orchestrator_add_snip-35_module branch from bf2a6d7 to 09938eb Compare May 1, 2026 15:59
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_market_functions_and_tests branch from 67f8dd0 to c73832d Compare May 1, 2026 17:05
@sirandreww-starkware sirandreww-starkware changed the base branch from 04-20-apollo_consensus_orchestrator_add_snip-35_module to graphite-base/13815 May 1, 2026 17:45
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_market_functions_and_tests branch from c73832d to 4209e5f Compare May 3, 2026 07:01
@sirandreww-starkware sirandreww-starkware changed the base branch from graphite-base/13815 to 04-20-apollo_consensus_orchestrator_add_snip-35_module May 3, 2026 07:01
Copy link
Copy Markdown
Collaborator

@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 2 files and all commit messages, and made 6 comments.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on sirandreww-starkware).


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 6 at r1 (raw file):

#[test]
fn test_compute_fee_actual_with_10_identical_values() {

This is way too many test cases. IMO you can have a test case with a random list of size 12 you've generated on ipython and pasted here and precompute the result, another 3 cases for when you return None and that's it


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 72 at r1 (raw file):

    // Target: $3e-9/gas = 3_000_000_000 atto-USD. STRK at $0.50 = 500_000_000_000_000_000.
    // floor = 3_000_000_000 * 10^18 / 500_000_000_000_000_000 = 6_000_000_000.
    let target = compute_fee_target(3_000_000_000, 500_000_000_000_000_000, 0, u128::MAX);

The meaning of each parameter here is unclear. See https://github.com/starkware-industries/code-quality/blob/main/style_guide/rust_style_guide.md#unnamed-function-parameters
Same for other tests


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 78 at r1 (raw file):

#[test]
fn test_compute_fee_target_clamp_min() {
    let target = compute_fee_target(1, 10u128.pow(18), 100, u128::MAX);

Set a constant for MIN and use it here and in the assert_eq below. Same for the max test and the zero rate test


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 91 at r1 (raw file):

#[test]
fn test_compute_fee_target_zero_rate() {

Append to the test name the expected result: ..._returns_max


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 117 at r1 (raw file):

#[test]
fn test_compute_fee_proposal_target_within_bounds() {

Test for both directions (can be done in the same test)


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 131 at r1 (raw file):

#[test]
fn test_compute_fee_actual_window_size_below_minimum_returns_none() {

Move this to the other actual fee tests

@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_market_functions_and_tests branch from 4209e5f to f6b6e1b Compare May 3, 2026 12:59
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_market_functions_and_tests branch from f6b6e1b to 50f8d9e Compare May 3, 2026 13:11
@sirandreww-starkware sirandreww-starkware force-pushed the 04-20-apollo_consensus_orchestrator_add_snip-35_module branch from 7234dce to 1848f04 Compare May 3, 2026 13:11
@sirandreww-starkware sirandreww-starkware changed the base branch from 04-20-apollo_consensus_orchestrator_add_snip-35_module to graphite-base/13815 May 3, 2026 14:26
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_market_functions_and_tests branch from 50f8d9e to bd54653 Compare May 3, 2026 14:34
Comment thread crates/apollo_consensus_orchestrator/src/snip35/test.rs Outdated
Copy link
Copy Markdown
Contributor Author

@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.

@sirandreww-starkware made 6 comments.
Reviewable status: 0 of 2 files reviewed, 6 unresolved discussions (waiting on ShahakShama).


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 6 at r1 (raw file):

Previously, ShahakShama wrote…

This is way too many test cases. IMO you can have a test case with a random list of size 12 you've generated on ipython and pasted here and precompute the result, another 3 cases for when you return None and that's it

Done


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 72 at r1 (raw file):

Previously, ShahakShama wrote…

The meaning of each parameter here is unclear. See https://github.com/starkware-industries/code-quality/blob/main/style_guide/rust_style_guide.md#unnamed-function-parameters
Same for other tests

Done


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 78 at r1 (raw file):

Previously, ShahakShama wrote…

Set a constant for MIN and use it here and in the assert_eq below. Same for the max test and the zero rate test

Done
Added FLOOR_MIN_FRI and FLOOR_MAX_FRI constants at the top of the test module and reused them in the clamp_min, clamp_max, and zero_rate_returns_max rstest cases (both as the input bound and the expected GasPrice)


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 91 at r1 (raw file):

Previously, ShahakShama wrote…

Append to the test name the expected result: ..._returns_max

Done
the case is now case::zero_rate_returns_max in the test_compute_fee_target rstest


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 117 at r1 (raw file):

Previously, ShahakShama wrote…

Test for both directions (can be done in the same test)

Done.


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 131 at r1 (raw file):

Previously, ShahakShama wrote…

Move this to the other actual fee tests

Done.

Copy link
Copy Markdown
Collaborator

@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 2 files and all commit messages, made 2 comments, and resolved 6 discussions.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on sirandreww-starkware).


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 11 at r3 (raw file):

#[test]
fn test_compute_fee_actual_random_window() {

What I meant was 12 with window size 10. You can do that in a new test if you prefer. Make sure that one of the first numbers outside of the window would've affected the median if it were in the window (And state it in comments)


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 51 at r3 (raw file):

// Very low STRK price → very high floor, clamped down to FLOOR_MAX_FRI.
#[case::clamp_max(FRI_DECIMALS_SCALE, 1, 0, FLOOR_MAX_FRI, GasPrice(FLOOR_MAX_FRI))]
#[case::zero_rate_returns_max(100, 0, 0, FLOOR_MAX_FRI, GasPrice(FLOOR_MAX_FRI))]

Why 100 and not FRI_DECIMALS_SCALE? It should be a constant anyway

Copy link
Copy Markdown
Contributor Author

@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.

@sirandreww-starkware made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on ShahakShama).


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 11 at r3 (raw file):

Previously, ShahakShama wrote…

What I meant was 12 with window size 10. You can do that in a new test if you prefer. Make sure that one of the first numbers outside of the window would've affected the median if it were in the window (And state it in comments)

Done


crates/apollo_consensus_orchestrator/src/snip35/test.rs line 51 at r3 (raw file):

Previously, ShahakShama wrote…

Why 100 and not FRI_DECIMALS_SCALE? It should be a constant anyway

Done

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 ff91417. Configure here.

Comment thread crates/apollo_consensus_orchestrator/src/snip35/test.rs Outdated
Copy link
Copy Markdown
Collaborator

@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.

:lgtm:

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

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