Skip to content

Commit 8bb86d0

Browse files
martyallclaude
andauthored
Xhat step (#112)
* match xhat_step_circuit to OCaml constraint system PublicInputCommit changes: - Add CorrectionMode (PureCorrections | InCircuitCorrections) to control how correction points are combined - PureCorrections: match OCaml's multiscale_known map-then-reduce structure: Phase 1 runs all scaleFast2' (collecting results), Phase 2 reduces results pairwise with addComplete, Phase 3 adds correction sum as constant point - Corrections summed as pure field arithmetic (addPurePt) matching OCaml where add_fast on constant corrections is optimized away - Plumb correctionMode through IncrementallyVerifyProofParams, WrapParams, and all callers Fixture fix: - Fix xhat_step_circuit domain from 2^15 to 2^16 in dump_circuit_impl.ml (step circuit uses Nat.N16, wrap uses Nat.N15) - Regenerate fixture with correct Lagrange commitments Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * pedantic build --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 90fa371 commit 8bb86d0

File tree

17 files changed

+208
-160
lines changed

17 files changed

+208
-160
lines changed

mina

packages/pickles-circuit-diffs-types/spago.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@ package:
22
name: pickles-circuit-diffs-types
33
dependencies:
44
- maybe
5-
- prelude
6-
- simple-json

packages/pickles-circuit-diffs/circuits/ocaml/xhat_step_circuit.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/pickles-circuit-diffs/circuits/ocaml/xhat_step_circuit_cached_constants.json

Lines changed: 93 additions & 93 deletions
Large diffs are not rendered by default.

packages/pickles-circuit-diffs/package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/pickles-circuit-diffs/spago.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ package:
2929
test:
3030
main: Test.Pickles.CircuitDiffs.Main
3131
dependencies:
32+
- aff
3233
- effect
3334
- exceptions
3435
- node-buffer

packages/pickles-circuit-diffs/test/Test/Pickles/CircuitDiffs/Main.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ spec =
410410
{ lagrangeComms: (coerce $ vestaSrsLagrangeCommitments stepSrs 16 30) :: Array (AffinePoint (F Fp))
411411
, blindingH: (coerce $ vestaSrsBlindingGenerator stepSrs) :: AffinePoint (F Fp)
412412
}
413-
pending "xhat_step_circuit"
414-
-- exactMatch "xhat_step_circuit" (fromCompiledCircuit $ compileXhatStep stepSrsData)
413+
-- pending "xhat_step_circuit"
414+
exactMatch "xhat_step_circuit" (fromCompiledCircuit $ compileXhatStep stepSrsData)
415415
describe "Pickles Wrap sub-circuits" do
416416
exactMatch "finalize_other_proof_wrap_circuit" (fromCompiledCircuit compileFopWrap)
417417
exactMatch "group_map_wrap_circuit" (fromCompiledCircuit compileGroupMap)

packages/pickles-circuit-diffs/visualizer/src/CircuitDiffTable.purs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ computeCachedConstantRows ps ocaml =
7878
let
7979
p = Array.index psConsts i
8080
o = Array.index ocamlConsts i
81+
-- Compare by positional index and value only.
82+
-- Variable numbers differ between PS (scattered) and OCaml (sequential)
83+
-- because of different internal variable allocation strategies.
8184
m = case p, o of
82-
Just a, Just b -> a.variable == b.variable && a.varType == b.varType && a.value == b.value
85+
Just a, Just b -> a.value == b.value
8386
_, _ -> false
8487
in
8588
{ ps: p, ocaml: o, match: m }

packages/pickles-circuit-diffs/visualizer/src/Main.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ mkApp circuitDiffTable = component "App" \_ -> React.do
8383
pure (pure unit)
8484

8585
let
86-
matches = Array.filter (\e -> e.status == "match") manifest
87-
mismatches = Array.filter (\e -> e.status /= "match") manifest
86+
matches = Array.sortWith _.name $ Array.filter (\e -> e.status == "match") manifest
87+
mismatches = Array.sortWith _.name $ Array.filter (\e -> e.status /= "match") manifest
8888

8989
statusDot :: String -> JSX
9090
statusDot status =

packages/pickles/spago.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package:
55
- blake2
66
- curves
77
- effect
8+
- either
89
- exceptions
910
- foldable-traversable
1011
- identity

0 commit comments

Comments
 (0)