Repository navigation
Use circuit hash instead of pp_root to uniquely identify the circuit - #634
Conversation
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit df80d01. Bugbot is set up for automated code reviews on this repo. Configure here. |
c2beb4a to
d8deee5
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
d8deee5 to
1f34819
Compare
65ad54b to
8432a9b
Compare
1f34819 to
8334079
Compare
8432a9b to
06d9a70
Compare
8334079 to
1f44a92
Compare
06d9a70 to
c42b562
Compare
1f44a92 to
5de8712
Compare
5de8712 to
891b203
Compare
leo-starkware
left a comment
There was a problem hiding this comment.
@leo-starkware reviewed 6 files and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on Gali-StarkWare and ilyalesokhin-starkware).
crates/circuit_multiverifier/src/test_utils.rs line 72 at r2 (raw file):
/// Computes the circuit hash for a given preprocessed root with the multiverifier's shared config. pub fn multiverifier_leaf_circuit_hash(preprocessed_root: [u32; 8]) -> [u32; 8] {
Suggestion:
leaf_circuit_hash(preprocessed_root: [u32; 8], preprocessed_column_log_sizes: OrderedHashMap<PreProcessedColumnId, u32>)crates/circuit_multiverifier/src/verify_test.rs line 367 at r2 (raw file):
// followed by the eight raw output words. let cairo_input_preimage_words: Vec<u32> = multiverifier_leaf_circuit_hash(PRIVACY_CAIRO_VERIFIER_PREPROCESSED_ROOT)
Suggestion:
leaf_circuit_hash(PRIVACY_CAIRO_VERIFIER_PREPROCESSED_ROOT, shared_config.preprocessed_column_log_sizes)
leo-starkware
left a comment
There was a problem hiding this comment.
@leo-starkware made 1 comment.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on Gali-StarkWare and ilyalesokhin-starkware).
crates/circuit_multiverifier/src/verify.rs line 90 at r2 (raw file):
verify(&mut context, &proof_vars, &shared_config.proof_config, &statement); // Reuse the statement's `circuit_hash` (the same hash mixed into the sub-proof's channel) // so the outer hash commits to it.
This comment is a bit confusing. Maybe claude can improve it
Code quote:
// Reuse the statement's `circuit_hash` (the same hash mixed into the sub-proof's channel)
// so the outer hash commits to it.891b203 to
9fe694d
Compare
|
I passed the shared config. Note, however, that it is a test_utils function. for example it return u32s and not Blake2sHash like compute_circuit_hash( |
ilyalesokhin-starkware
left a comment
There was a problem hiding this comment.
@ilyalesokhin-starkware made 2 comments.
Reviewable status: 0 of 6 files reviewed, 3 unresolved discussions (waiting on Gali-StarkWare and leo-starkware).
crates/circuit_multiverifier/src/verify.rs line 90 at r2 (raw file):
Previously, leo-starkware wrote…
This comment is a bit confusing. Maybe claude can improve it
Done.
crates/circuit_multiverifier/src/verify_test.rs line 367 at r2 (raw file):
// followed by the eight raw output words. let cairo_input_preimage_words: Vec<u32> = multiverifier_leaf_circuit_hash(PRIVACY_CAIRO_VERIFIER_PREPROCESSED_ROOT)
Done.
leo-starkware
left a comment
There was a problem hiding this comment.
@leo-starkware reviewed 6 files and all commit messages, made 2 comments, and resolved 3 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on Gali-StarkWare).
crates/circuit_multiverifier/src/test_utils.rs line 72 at r2 (raw file):
Previously, ilyalesokhin-starkware wrote…
I passed the shared config.
Note, however, that it is a test_utils function.
So I think it should be optimized for the call-sites.for example it return u32s and not Blake2sHash like compute_circuit_hash(
makes sense, but i think that taking the argument explicitly is more readable here.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9fe694d to
df80d01
Compare
ilyalesokhin-starkware
left a comment
There was a problem hiding this comment.
@ilyalesokhin-starkware reviewed 6 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on Gali-StarkWare).

Monday task: Consider propagating sizes instead of hardcoding them (similar to what we did with ppt)
Summary
In the multiverifier, each verified inner circuit is now identified in the outer output preimage by a circuit hash —
blake2s(config_words ‖ preprocessed_root)— instead of the barepreprocessed_root.A preprocessed root does not, by itself, commit to the config it is interpreted under (per-component trace log sizes + the FRI
log_blowup_factor). Emitting only the root in the multiverifier's output leaves it open to a reinterpretation attack: a valid preprocessed root can be paired withconfig_wordsother than the ones actually used, so a consumer of the output hash cannot tell which configuration the root was verified under. Hashingconfig_wordstogether with the root binds the full(config, root)pair, so the output commits to the exact configuration the circuit was verified with.🤖 Generated with Claude Code