Skip to content

implemented geometric_till in gnark and some small optimizations#274

Merged
ashpect merged 5 commits into
worldfnd:mainfrom
x-senpai-x:gnark/gtill
Feb 9, 2026
Merged

implemented geometric_till in gnark and some small optimizations#274
ashpect merged 5 commits into
worldfnd:mainfrom
x-senpai-x:gnark/gtill

Conversation

@x-senpai-x
Copy link
Copy Markdown
Collaborator

@x-senpai-x x-senpai-x commented Feb 6, 2026

resolves #258
Implements geometricTill optimization for computing multilinear extension of geometric sequences in gnark circuits.

Changes

  • Replaced O(2^m) EQ polynomial approach with O(m) geometricTill algorithm
  • Added equivalence and edge case tests

Performance

Constraint reduction scales with domain size:

  • m=10: 42.77x fewer constraints (2063 → 47)
  • m=14: 507.1x fewer constraints (32963 → 65)

Reduced zkPassport attestation circuit t_attest from 5,252,539 → 5,114,167 constraints (~138k reduction, ~2.6% improvement).

Copilot AI review requested due to automatic review settings February 6, 2026 17:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the geometricTill (“geometric_till”) approach for evaluating public-input geometric weights inside the gnark recursive verifier, and applies small constraint-count optimizations by precomputing RLC powers in batch paths.

Changes:

  • Add geometricTill and switch computePublicWeightEvaluation to use it (replacing the O(2^m) EQ-polynomial dot product).
  • Optimize batch RLC combinations by precomputing powers (γ powers in RunZKWhirBatch, and B powers in rlcBatchedLeaves).
  • Extend test/fixture parsing to include public_weights_evaluations and adjust witness linear statement sizing when public inputs are present; add a new benchmark/test file for constraint comparisons.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
recursive-verifier/app/circuit/whir.go Precomputes γ powers once and reuses them for batch RLC combinations to reduce repeated multiplications.
recursive-verifier/app/circuit/mtUtilities.go Precomputes B powers in rlcBatchedLeaves to avoid recomputing powers per element.
recursive-verifier/app/circuit/matrix_evaluation.go Adds geometricTill implementation for O(k) MLE evaluation of geometric vectors; introduces fmt import.
recursive-verifier/app/circuit/circuit.go Switches public weight evaluation to geometricTill and removes the unused m parameter.
recursive-verifier/app/circuit/circuit_test.go Parses public_weights_evaluations, allocates/assigns PublicInputs and PubWitnessEvaluations, and adjusts witness eval sizing when public inputs exist.
recursive-verifier/app/circuit/public_weight_bench_test.go Adds new tests/benchmarks comparing naive vs optimized approaches (constraint counts + Groth16 benchmark).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread recursive-verifier/app/circuit/matrix_evaluation.go
Comment thread recursive-verifier/app/circuit/public_weight_bench_test.go Outdated
Comment thread recursive-verifier/app/circuit/public_weight_bench_test.go Outdated
Comment thread recursive-verifier/app/circuit/matrix_evaluation.go Outdated
Copy link
Copy Markdown
Collaborator

@ashpect ashpect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, added some comments for tests robustness.

Also please add description about constraints saved switching to geometric_till and more details.

Comment thread recursive-verifier/app/circuit/public_weight_bench_test.go
Comment thread recursive-verifier/app/circuit/public_weight_bench_test.go
@x-senpai-x x-senpai-x requested a review from ashpect February 9, 2026 14:50
@ashpect ashpect merged commit bd9ad84 into worldfnd:main Feb 9, 2026
4 of 5 checks passed
dcbuild3r pushed a commit that referenced this pull request May 16, 2026
implemented geometric_till in gnark and some small optimizations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use geometric till in gnark

3 participants