Bind useful_bits + const_pin into statement digest; pin hash walkers#2
Open
aryaethn wants to merge 1 commit into
Open
Bind useful_bits + const_pin into statement digest; pin hash walkers#2aryaethn wants to merge 1 commit into
aryaethn wants to merge 1 commit into
Conversation
Addresses two items from the security audit (succinctlabs#1): - statement_digest() now absorbs useful_bits and const_pin (tag bumped v0 -> v1, with a length-unambiguous Option encoding). Both fields change the lincheck / padding semantics, so omitting them left a statement-substitution gap in the Fiat-Shamir binding. - Blake3LincheckCircuit / Sha2LincheckCircuit now override const_pin_col() -> Some(Z_CONST_POS), so the lincheck beta-pin term is not silently dropped when those circuits are used directly. Adds regression tests: digest-change coverage for both fields, and walker-vs-sparse constant-pin alignment for both hashes. Full suite green (337 tests). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SipengXie2024
added a commit
to SipengXie2024/flock
that referenced
this pull request
Jul 2, 2026
Review findings (36 agents, 86 candidates, 15 confirmed): Fixed: - succinctlabs#7: SSE2 convert-table dispatch missing in s_hat_v partial path (copy-paste omission — x86 fell back to scalar in boundary window) - succinctlabs#8/#12: multi_base.rs imported route.rs (FANOUT=4) instead of route_f32.rs (FANOUT=32). Any fanout>4 would panic. Fixed import + updated acceptance test to use RouteF32Witness. Skipped (documented, not fixable without larger changes): - succinctlabs#1/succinctlabs#3/succinctlabs#6: route_single.rs 3 soundness gaps (documented in header, needs wiring sumcheck) - succinctlabs#2/succinctlabs#4/succinctlabs#9/succinctlabs#10: files >700 LOC (route 810, route_f32 936, route_single 950 — needs structural refactor, separate PR) - succinctlabs#5: multi_base missing padding skip (perf-only, not correctness) - #11: PaddingSpec inconsistency in hash_only PCS open (no effect — padding skip only applies to zerocheck, not PCS) - #13/#14/#15: Ligerito floor magic number, PCS PaddingSpec, target_feature annotation — all by-design or no-impact 338 tests pass (279 flock-core + 50 mhot unit + 8 acceptance + 1 profile).
SipengXie2024
added a commit
to SipengXie2024/flock
that referenced
this pull request
Jul 2, 2026
Review findings (36 agents, 86 candidates, 15 confirmed): Fixed: - succinctlabs#7: SSE2 convert-table dispatch missing in s_hat_v partial path (copy-paste omission — x86 fell back to scalar in boundary window) - succinctlabs#8/#12: multi_base.rs imported route.rs (FANOUT=4) instead of route_f32.rs (FANOUT=32). Any fanout>4 would panic. Fixed import + updated acceptance test to use RouteF32Witness. Skipped (documented, not fixable without larger changes): - succinctlabs#1/succinctlabs#3/succinctlabs#6: route_single.rs 3 soundness gaps (documented in header, needs wiring sumcheck) - succinctlabs#2/succinctlabs#4/succinctlabs#9/succinctlabs#10: files >700 LOC (route 810, route_f32 936, route_single 950 — needs structural refactor, separate PR) - succinctlabs#5: multi_base missing padding skip (perf-only, not correctness) - #11: PaddingSpec inconsistency in hash_only PCS open (no effect — padding skip only applies to zerocheck, not PCS) - #13/#14/#15: Ligerito floor magic number, PCS PaddingSpec, target_feature annotation — all by-design or no-impact 338 tests pass (279 flock-core + 50 mhot unit + 8 acceptance + 1 profile).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses two items from the security audit (#1), both under "bind
useful_bits,const_pin, circuit ID":1. Statement digest completeness.
BlockR1cs::statement_digest()absorbedm,k_log,k_skip, and the three matrices, but omitteduseful_bitsandconst_pin— both of which change protocol semantics:useful_bitsis the padding boundary (which rows carry witness vs. zero padding), so it changes the lincheck equation.const_pindrives the lincheck β-pin term.Two instances differing only in those fields produced the same digest, so the Fiat-Shamir binding in
bind_statementdidn't separate them. This PR absorbs both (with a length-unambiguousOptionencoding forconst_pin) and bumps the domain tagflock-r1cs-stmt-v0→v1, so a v0 transcript can never collide with a v1.2. Hash walkers advertise the constant pin.
Blake3LincheckCircuitandSha2LincheckCircuitdidn't overrideconst_pin_col(), so they inherited the trait defaultNone— silently dropping the lincheck β-pin term if used directly. (The live matrix path already carries the pin viaBlockR1cs::{sparse,csc}_lincheck_circuit.) Both now returnSome(Z_CONST_POS), matching the setup, closing the all-zero-witness gap if these public circuits are used directly.Tests
statement_digest_binds_useful_bits_and_const_pin: determinism, plus distinct digests whenuseful_bits,const_pinpresence, or the pin column index changes.lincheck_circuit_matches_sparse(blake3 + sha2) to assert the walker'sconst_pin_col()matches the pinned sparse circuit.Notes