Skip to content

Move component log sizes from proof claim to Statement#476

Open
ilyalesokhin-starkware wants to merge 1 commit intomainfrom
ilya/log_sizes
Open

Move component log sizes from proof claim to Statement#476
ilyalesokhin-starkware wants to merge 1 commit intomainfrom
ilya/log_sizes

Conversation

@ilyalesokhin-starkware
Copy link
Copy Markdown
Contributor

The Statement trait now exposes get_component_log_sizes; verify reads log sizes from the statement instead of proof.claim. The Claim struct is removed (claimed_sums is now a top-level field on Proof), shrinking the serialized proof by one packed-u8 entry per component.

CircuitStatement derives the per-component log sizes from n_blake_compress (added to CircuitParams/CircuitConfig) plus preprocessed column log sizes, and now takes &CircuitConfig instead of seven individual fields. Cairo's component log sizes ride along on public_claim, removing the dedicated field on CairoVerifierConfig.

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 29, 2026

PR Summary

Medium Risk
Touches proof wire format and verifier channel mixing inputs, so any mismatch between prover/statement-derived component sizing and serialized proofs could cause verification failures across integrations.

Overview
Per-component log sizes are no longer carried inside the STARK Proof. The Claim struct is removed, Proof now stores only claimed_sums, and serialization/deserialization + ProofInfo sizing are updated accordingly (shrinking proof bytes).

Verifier channel mixing now sources component log sizes from the Statement. The Statement trait gains get_component_log_sizes(), and verify mixes these sizes (and validates them) instead of reading them from the proof.

Circuit/Cairo statements/configs are updated to provide those log sizes. CircuitConfig/CircuitParams add n_blake_compress; CircuitStatement::new now takes a &CircuitConfig and derives blake-related component log sizes via a new component_log_sizes() helper. Cairo verification appends component_log_sizes to the public_claim and parses/stores them in CairoStatement for get_component_log_sizes().

Tests/examples are adjusted for the new APIs and updated expected proof size totals.

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

@reviewable-StarkWare
Copy link
Copy Markdown
Collaborator

This change is Reviewable

@ilyalesokhin-starkware
Copy link
Copy Markdown
Contributor Author

Will revisit after moving to blake in gates.

Copy link
Copy Markdown
Contributor Author

ilyalesokhin-starkware commented Apr 29, 2026

The Statement trait now exposes get_component_log_sizes; verify reads
log sizes from the statement instead of proof.claim. The Claim struct is
removed (claimed_sums is now a top-level field on Proof), shrinking the
serialized proof by one packed-u8 entry per component.

CircuitStatement derives the per-component log sizes from n_blake_compress
(added to CircuitParams/CircuitConfig) plus preprocessed column log sizes,
and now takes &CircuitConfig instead of seven individual fields. Cairo's
component log sizes ride along on public_claim, removing the dedicated
field on CairoVerifierConfig.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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 ce255e1. Configure here.

pub const VERIFY_BITWISE_XOR_9: u32 = 18;
pub const RANGE_CHECK_15: u32 = 15;
pub const RANGE_CHECK_16: u32 = 16;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hardcoded log size constants risk diverging from source

Medium Severity

The component_log_size module hardcodes literal values for seven constants (BLAKE_ROUND_SIGMA, VERIFY_BITWISE_XOR_8, VERIFY_BITWISE_XOR_4, VERIFY_BITWISE_XOR_7, VERIFY_BITWISE_XOR_9, RANGE_CHECK_15, RANGE_CHECK_16) while VERIFY_BITWISE_XOR_12 correctly references super::verify_bitwise_xor_12::LOG_SIZE. Since all these component modules are already imported, the other constants could similarly reference their canonical LOG_SIZE source. If a component's LOG_SIZE changes in the future, the hardcoded verifier values would silently become stale, causing valid proofs to be rejected (a Fiat-Shamir transcript mismatch).

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ce255e1. Configure here.

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