Skip to content

apollo_consensus_orchestrator: add SNIP-35 fee_proposal validation#13819

Open
sirandreww-starkware wants to merge 1 commit into04-19-apollo_consensus_orchestrator_wire_snip-35_fee_proposal_into_build_proposalfrom
04-19-apollo_consensus_orchestrator_add_snip-35_fee_proposal_validation
Open

apollo_consensus_orchestrator: add SNIP-35 fee_proposal validation#13819
sirandreww-starkware wants to merge 1 commit into04-19-apollo_consensus_orchestrator_wire_snip-35_fee_proposal_into_build_proposalfrom
04-19-apollo_consensus_orchestrator_add_snip-35_fee_proposal_validation

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_proposal_validation branch 2 times, most recently from c66659e to 79105cf Compare April 27, 2026 12:10
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_wire_snip-35_fee_proposal_into_build_proposal branch from 34eefaa to 3fbc573 Compare April 27, 2026 12:10
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_proposal_validation branch 2 times, most recently from d756021 to 397780c Compare April 27, 2026 12:54
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_wire_snip-35_fee_proposal_into_build_proposal branch from 8842b22 to 1d1a4ac Compare April 27, 2026 12:54
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_proposal_validation branch from 397780c to def2345 Compare April 28, 2026 07:38
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_wire_snip-35_fee_proposal_into_build_proposal branch from 1d52c47 to dfeb913 Compare April 28, 2026 07:51
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_proposal_validation branch 2 times, most recently from 04360da to abc579f Compare April 28, 2026 08:30
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_wire_snip-35_fee_proposal_into_build_proposal branch 2 times, most recently from 8cf6fde to b15a802 Compare April 28, 2026 11:29
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_proposal_validation branch from abc579f to 040849d Compare April 28, 2026 11:29
@sirandreww-starkware sirandreww-starkware self-assigned this Apr 28, 2026
@sirandreww-starkware sirandreww-starkware marked this pull request as ready for review April 28, 2026 12:28
@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 28, 2026

PR Summary

High Risk
Adds new consensus-critical validation rules for fee_proposal_fri (version gating and bounds vs. sliding-window fee_actual), which can cause validators to reject proposals if nodes disagree on window state or margins.

Overview
Adds SNIP-35 validation for ProposalInit.fee_proposal_fri: it must be present for Starknet >= V0_14_3 and absent before, and when a sliding-window fee_actual is available it must fall within the configured parts-per-thousand margin.

Threads fee_actual (computed from the node’s fee-proposal window) through SequencerConsensusContext into ProposalInitValidation, and updates tests/helpers to populate the new field and to provide a default fee_proposal_fri for LATEST versions.

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

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 040849d. Configure here.

let lower_bound =
fee_actual.0.saturating_mul(PPT_DENOMINATOR) / (PPT_DENOMINATOR + margin_ppt);
let upper_bound =
fee_actual.0.saturating_mul(PPT_DENOMINATOR + margin_ppt) / PPT_DENOMINATOR;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Duplicated fee bounds formula risks future inconsistency

Medium Severity

The lower/upper bound computation in the validator (validate_proposal.rs) is copy-pasted from the proposer path in compute_fee_proposal (snip35/mod.rs). Both use the same saturating_mul/division formula with PPT_DENOMINATOR and margin_ppt. If the bounds formula is ever updated in one location but not the other, honest proposers would be rejected by validators — a consensus-breaking bug. Extracting a shared helper (e.g., returning (lower, upper)) from the snip35 module would eliminate this risk.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 040849d. Configure here.

@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_proposal_validation branch from 040849d to 522bb06 Compare April 30, 2026 11:45
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_wire_snip-35_fee_proposal_into_build_proposal branch from 0a69e61 to 5adf1d4 Compare April 30, 2026 12:25
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_proposal_validation branch 3 times, most recently from ab23186 to 41b964d Compare May 1, 2026 15:11
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_wire_snip-35_fee_proposal_into_build_proposal branch 2 times, most recently from 19deb71 to d86d400 Compare May 1, 2026 15:44
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_proposal_validation branch from 41b964d to 5896df2 Compare May 1, 2026 15:44
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_wire_snip-35_fee_proposal_into_build_proposal branch from d86d400 to f48b9c1 Compare May 1, 2026 15:59
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_proposal_validation branch from 5896df2 to ef7e93b Compare May 1, 2026 15:59
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_add_snip-35_fee_proposal_validation branch from ef7e93b to a965ac1 Compare May 1, 2026 17:05
@sirandreww-starkware sirandreww-starkware force-pushed the 04-19-apollo_consensus_orchestrator_wire_snip-35_fee_proposal_into_build_proposal branch from f48b9c1 to 78fa661 Compare May 1, 2026 17:05
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.

2 participants