Skip to content

perf(arkworks): cyclotomic GT exponentiation and shared-squaring GT multi-exponentiation - #36

Merged
markosg04 merged 2 commits into
mainfrom
perf/gt-cyclotomic-multiexp
Nov 2, 2026
Merged

markosg04 merged 2 commits into
mainfrom
perf/gt-cyclotomic-multiexp

Conversation

@moodlezoup

@moodlezoup moodlezoup commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Cyclotomic scaling. ArkGT scaling (Group::scale, ArkFr * ArkGT) now goes through PairingOutput's scalar multiplication, which is arkworks' NAF cyclotomic_exp with Granger–Scott squaring, instead of the generic Fq12::pow.
  • PairingCurve::gt_msm. New trait method computing Σ kᵢ·tᵢ in GT. The default implementation scales each term. The BN254 backend overrides it with an interleaved width-5 wNAF multi-exponentiation: all terms share one chain of ~254 cyclotomic squarings, each base gets an 8-entry table of odd powers, and negative digits use conjugation. With parallel, inputs with more than 8 terms split into per-thread chains.
  • Verifier. process_round uses gt_msm for C, D₁ and D₂ (4, 3 and 3 terms). The verify_final right-hand side uses it too: 4 terms in transparent mode, 9 in ZK mode, where d²·(A − c₂·D₂_init) is expanded into two terms.

Group results are unchanged, so proofs are byte-identical.

Soundness

Cyclotomic squaring, and conjugation as the inverse, are valid only in the cyclotomic subgroup of Fq12, which contains GT. Every ArkGT the verifier exponentiates is one of:

Impact

Measured as instructions retired under Callgrind, in Jolt's single-threaded verifier (fib, trace length 2^16), counting only DoryScheme::verify:

dory-pcs DoryScheme::verify
0.4.2 (Fq12::pow) 839.9 M
cyclotomic scaling only 577.3 M (−31%)
this PR (cyclotomic scaling + gt_msm) 362.9 M (−57%)

Per-operation cost with full 254-bit scalars (Callgrind):

Operation Instructions
Fq12::pow 8.10 M
cyclotomic_exp 5.02 M
gt_msm, 3 terms 6.68 M (vs 15.1 M as 3 cyclotomic scalings)
gt_msm, 4 terms 8.06 M (vs 20.1 M)
gt_msm, 41 terms 59.2 M (vs 205.8 M)

Testing

  • New test. gt_msm_matches_naive compares gt_msm against per-term scale for 3, 5 and 40 terms; 40 terms exercises the parallel split. The inputs include an identity base, a zero scalar and a −1 scalar, and an empty-input case.
  • Local CI run. All of these passed locally:
    • cargo fmt --check;
    • clippy with -D warnings for transparent, zk and --no-default-features;
    • cargo doc with -D warnings;
    • nextest for both feature sets (86/86 and 143/143);
    • every CI example, including zk_statistical.
  • Downstream. perf(dory): cyclotomic GT exponentiation and GT multi-exponentiation jolt#2174 pins this commit. Jolt's clear and ZK guest matrices (10/10 each), the verifier fixtures and the jolt-dory/jolt-crypto suites pass against it.

🤖 Generated with Claude Code

…ulti-exponentiation

ArkGT scaling now uses PairingOutput's cyclotomic exponentiation instead of
generic Fq12::pow. PairingCurve gains gt_msm; the BN254 backend implements it
as an interleaved width-5 wNAF multi-exponentiation sharing one cyclotomic
squaring chain, and the verifier's multi-term GT updates (process_round C/D1/D2,
verify_final RHS in both modes) use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@markosg04
markosg04 merged commit 859a16f into main Nov 2, 2026
moodlezoup pushed a commit to a16z/jolt that referenced this pull request Nov 2, 2026
* chore(deps): bump dory-pcs to 0.5.0

Picks up atomic first-writer-wins setup files (a16z/dory#34), the
prepared-point cache prefix check (a16z/dory#35) and cyclotomic GT
exponentiation in the verifier (a16z/dory#36). Refreshes the two
scheme.rs comments that described the old dory behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(fuzz): bump dory-pcs to 0.5.0 in fuzz lockfiles

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
moodlezoup added a commit to a16z/jolt that referenced this pull request Nov 2, 2026
Main bumped dory-pcs to the 0.5.0 release (#2236), which includes
a16z/dory#36. Take main's version dependency and lockfiles in place of
this branch's git-rev pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moodlezoup added a commit to a16z/jolt that referenced this pull request Nov 3, 2026
…2174)

Point dory-pcs at a16z/dory#36, pinned by git rev until a dory-pcs release
includes it. ArkGT scaling there uses cyclotomic exponentiation, and the Dory
verifier's multi-term GT updates use the new PairingCurve::gt_msm, which
shares one cyclotomic squaring chain across all terms.

DoryScheme::combine uses gt_msm for the commitment combination, and
Bn254GT::scalar_mul/msm use cyclotomic_exp instead of Fq12::pow.

Cyclotomic arithmetic is valid only in the cyclotomic subgroup, so remove
Bn254GT's unchecked From<Fq12>, which had no callers. Every Bn254GT is now a
pairing output, a product of them, or subgroup-checked on deserialization.

Single-threaded verification of fib at 2^16 drops from 1.222B to 0.483B
instructions retired (Callgrind, -60%).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants