Commit aa67845
chore: respond to veridise findings (#287)
# Veridise audit response — barretenberg recursive verifiers
Addresses findings from the Veridise audit of barretenberg's recursive verifier
stack (sumcheck, Gemini/Shplonk/Shplemini, small-subgroup-IPA, ECCVM/translator,
pairing points). The changes are correctness hardening, defense-in-depth
assertions, dead-code removal, and documentation/comment fixes.
No proving behavior changes on valid inputs — the fixes are guards/asserts on
edge cases, comment corrections, and removal of unreachable code — so verification
keys are unaffected. The one behavioral change (1165) only affects malformed
mixed-infinity pairing accumulators that honest execution never produces.
A living tracking doc, `veridise-audit-issues.md`, records the per-finding and
per-sub-item disposition (fixed / won't-fix / N-A / open) with rationale.
## Correctness / hardening fixes
- **1212** — recursive verifier ctors guard against an empty/all-constant proof (`stdlib::Proof::get_context`).
- **1215** — reject empty `multivariate_challenge` in Shplemini / SmallSubgroupIPA.
- **1158** — skip G1 points at infinity (and their precomputed lines) in `reduced_ate_pairing_batch_precomputed`.
- **1165** — `PairingPoints::aggregate` rejects mixed-infinity accumulators instead of treating them as uninitialized.
- **1217** — remove the dead, argument-swapped `VKAndHash_` alias from the goblin recursive flavors.
- **1222** — enforce ZK-sumcheck API invariants (single callable `prove()` per flavor; side-effect-free ZK-correction handler).
- **1225** — remove the unreachable masking-tail machinery in the Gemini batcher (dead since masking moved to the trace top), eliminating a latent `add_scaled` precondition hazard.
## Umbrella findings
- **1219** (core primitive input/range/init checks) — **resolved**: 12 fixed, 4 won't-fix, 4 N-A. Notably, `SumcheckProverRound` now owns its round state: `round_size` is private and a `round_index`/`multivariate_d` pair (derived per round) drives a new `advance_round()`, letting `compute_virtual_contribution` assert `is_virtual_round()`. Deriving `multivariate_d` per round keeps this correct for the batched translator's two differently-sized rounds.
- **1220** (documentation/comment hygiene + magic literals) — 21 done, 1 won't-fix, 4 N-A. Comment/formula/doc corrections across sumcheck/relations/polynomials/PCS, plus centralizing the masking-length constant (`WITNESS_MASKING_TERM_LENGTH`) in `constants.hpp` (removing three duplicated copies that must agree).
- **1221** (code-quality / API-hygiene, defense-in-depth) — most items done: `[[nodiscard]]`s, a `BatchOpeningClaim` consistency assert, `ShplonkVerifier` `finalize`/`export` mutual-exclusion guard, `has_zk`-consistency check, single-use asserts in small-subgroup-IPA, null-SRS guards, and removal of the dead default ctor + `g1_identity` member on the recursive `VerifierCommitmentKey`.
## Accepted / won't-fix (with rationale in the doc)
- **1156** — verifier-internal IPA randomness is sound; the real gap was closed separately.
- **1159** — `handle_edge_cases=false` is safe (random challenges make collisions negligible); doc-only.
- **1214** — the fixed transcript layout gives positional binding in place of explicit label domain separation.
- **1223** — `compute_effective_round_size` invariants hold at the current commit; the hot-path hardening is deferred.
## Still open (decision needed)
- **1213** — whether to add a transcript-level "fully consumed" check (`num_frs_read == proof_data.size()`) or accept the existing msgpack trailing-data rejection as sufficient. (Finding 1221 #19 rides on this.)
## Cross-cutting decisions worth noting
- **Consistency over local "correctness"**: transcript labels kept hardcoded (1220 #15) since tests independently pin the wire strings; `serialize_from_buffer`/`read` names kept (1221 #1, 1219 #2/#3) as the codebase-wide serialization convention.
- **Assert-once vs. idempotency**: single-use small-subgroup-IPA builders assert at-most-once (fail loudly on a re-call) rather than silently recompute.
- **Post-rebase N-A**: two fixes (1220 #18 Shplonk reservation, 1221 #9 IPA `assert_consistent` call site) were dropped when rebasing onto `next`, which had since refactored the code they targeted; both are documented as N-A.
- Also includes a fix making the `gate_challenges.size()` sumcheck-prover assertion flavor-aware (zero for multilinear-batching flavors, `>= multivariate_d` otherwise).
---------
Co-authored-by: AztecBot <tech@aztec-labs.com>
Co-authored-by: federicobarbacovi <171914500+federicobarbacovi@users.noreply.github.com>
Co-authored-by: ledwards2225 <l.edwards.d@gmail.com>1 parent 62d09b5 commit aa67845
35 files changed
Lines changed: 379 additions & 340 deletions
File tree
- barretenberg/cpp/src/barretenberg
- chonk/batched_honk_translator
- commitment_schemes
- gemini
- kzg
- shplonk
- small_subgroup_ipa
- eccvm
- ecc/curves/bn254
- polynomials
- relations
- stdlib
- eccvm_verifier
- primitives
- proof
- translator_vm_verifier
- sumcheck
- translator_vm
This file was deleted.
barretenberg/cpp/src/barretenberg/chonk/batched_honk_translator/batched_honk_translator_prover.cpp
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
| 241 | + | |
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
Lines changed: 0 additions & 52 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | 136 | | |
142 | 137 | | |
143 | 138 | | |
144 | 139 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | 140 | | |
151 | 141 | | |
152 | 142 | | |
| |||
161 | 151 | | |
162 | 152 | | |
163 | 153 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | 154 | | |
174 | 155 | | |
175 | 156 | | |
| |||
200 | 181 | | |
201 | 182 | | |
202 | 183 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | 184 | | |
218 | 185 | | |
219 | | - | |
220 | 186 | | |
221 | 187 | | |
222 | 188 | | |
223 | 189 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | 190 | | |
229 | | - | |
230 | 191 | | |
231 | 192 | | |
232 | 193 | | |
233 | 194 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | 195 | | |
239 | 196 | | |
240 | 197 | | |
| |||
252 | 209 | | |
253 | 210 | | |
254 | 211 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | 212 | | |
261 | 213 | | |
262 | 214 | | |
| |||
265 | 217 | | |
266 | 218 | | |
267 | 219 | | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | 220 | | |
273 | 221 | | |
274 | 222 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | | - | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
131 | | - | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
167 | 171 | | |
168 | 172 | | |
169 | 173 | | |
| |||
0 commit comments