Repository navigation
cairo_verifier: Output the program's digest words directly - #649
Conversation
PR SummaryHigh Risk Overview
Multiverifier privacy fixture constants Reviewed by Cursor Bugbot for commit a7d2570. Bugbot is set up for automated code reviews on this repo. Configure here. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
5b7da14 to
20c984b
Compare
25935b9 to
2acee73
Compare
20c984b to
cc6bd06
Compare
2acee73 to
eed489e
Compare
cc6bd06 to
ae3e005
Compare
eed489e to
a50c138
Compare
ae3e005 to
d31392e
Compare
a50c138 to
9958a68
Compare
9958a68 to
48b5b55
Compare
d31392e to
168a958
Compare
48b5b55 to
a8e8385
Compare
168a958 to
c68a1ff
Compare
a8e8385 to
3ceed06
Compare
Gali-StarkWare
left a comment
There was a problem hiding this comment.
@Gali-StarkWare reviewed 6 files and all commit messages, and made 2 comments.
Reviewable status: 6 of 7 files reviewed, 2 unresolved discussions (waiting on ilyalesokhin-starkware and yuvalsw).
crates/cairo_verifier/src/statement.rs line 402 at r3 (raw file):
let n_components = components.len(); let output_hash = output_hash.guess(context); context.set_outputs(&output_hash.iter().map(|word| *word.get()).collect_vec());
Where did we do context.set_output(output_hash) before (for the hash of the limbs)?
crates/cairo_verifier/src/statement.rs line 505 at r3 (raw file):
let n_output_bytes = 4 * output_limb_vars.len(); let output_limb_words = to_padded_u32_words(context, output_limb_vars); let output_hash = blake2s_u32s(context, output_limb_words, n_output_bytes);
I think we have a const for it. Just a suggestion
Suggestion:
// Mix the outputs as 9-bit limbs into the channel.
let output_limb_vars = outputs.iter().flatten().map(|limb| *limb.get()).collect_vec();
let output_limb_words = to_padded_u32_words(context, output_limb_vars);
let n_output_bytes = BYTES_IN_WORD * output_limb_words.len();
let output_hash = blake2s_u32s(context, output_limb_words, n_output_bytes);|
Previously, Gali-StarkWare wrote…
in claims_to_mix. |
|
Previously, Gali-StarkWare wrote…
We use 4 in other places N_U8S_PER_U32 is the closest that I could find |
Gali-StarkWare
left a comment
There was a problem hiding this comment.
@Gali-StarkWare made 1 comment.
Reviewable status: 6 of 7 files reviewed, 3 unresolved discussions (waiting on ilyalesokhin-starkware and yuvalsw).
crates/cairo_verifier/src/statement.rs line 347 at r3 (raw file):
/// Splits the digest `hash` into its [`N_OUTPUTS`] `u128` halves, each decomposed into /// nine-bit limbs (little-endian).
You wrote N_OUTPUTS and then halves, it reads a bit weird
Code quote:
/// Splits the digest `hash` into its [`N_OUTPUTS`] `u128` halves, each decomposed into
/// nine-bit limbs (little-endian).
Gali-StarkWare
left a comment
There was a problem hiding this comment.
@Gali-StarkWare reviewed 1 file.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on ilyalesokhin-starkware and yuvalsw).
Gali-StarkWare
left a comment
There was a problem hiding this comment.
@Gali-StarkWare made 1 comment and resolved 2 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ilyalesokhin-starkware and yuvalsw).
crates/cairo_verifier/src/statement.rs line 402 at r3 (raw file):
Previously, ilyalesokhin-starkware wrote…
in claims_to_mix.
Oh right
Gali-StarkWare
left a comment
There was a problem hiding this comment.
@Gali-StarkWare made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ilyalesokhin-starkware and yuvalsw).
The program's output is already a Blake2s digest stored across the output memory cells. Instead of re-hashing those cells and exposing the hash as the circuit output, guess the eight digest words, split them back into the output cells (binding them to the public memory), and expose the words themselves. The output cells' nine-bit limbs are still mixed into the channel as blake2s(limbs) to match the Cairo prover (PublicData::mix_into). Also generalize `From<Blake2sHash>` from `HashValue<QM31>` to a generic `HashValue<Value>` so the guess path can reuse it. Regenerates the multiverifier/recursion proof fixtures and updates the cairo-verifier preprocessed-root and output-value regression constants. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3ceed06 to
a7d2570
Compare
|
Previously, Gali-StarkWare wrote…
done |
Gali-StarkWare
left a comment
There was a problem hiding this comment.
@Gali-StarkWare reviewed 1 file and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on yuvalsw).

The program's output is already a Blake2s digest stored across the output
memory cells. Instead of re-hashing those cells and exposing the hash as the
circuit output, guess the eight digest words, split them back into the output
cells (binding them to the public memory), and expose the words themselves.
The output cells' nine-bit limbs are still mixed into the channel as
blake2s(limbs) to match the Cairo prover (PublicData::mix_into).
Also generalize
From<Blake2sHash>fromHashValue<QM31>to a genericHashValue<Value>so the guess path can reuse it.Regenerates the multiverifier/recursion proof fixtures and updates the
cairo-verifier preprocessed-root and output-value regression constants.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com