Skip to content

perf(zkatdlog): optimize IPA prover using native gnark-crypto arithmetic - #2154

Open
SurbhiAgarwal1 wants to merge 2 commits into
LFDT-Panurus:mainfrom
SurbhiAgarwal1:perf/zkp-ipa-optimization
Open

perf(zkatdlog): optimize IPA prover using native gnark-crypto arithmetic#2154
SurbhiAgarwal1 wants to merge 2 commits into
LFDT-Panurus:mainfrom
SurbhiAgarwal1:perf/zkp-ipa-optimization

Conversation

@SurbhiAgarwal1

Copy link
Copy Markdown
Contributor

Description

This PR introduces native gnark-crypto field arithmetic for the Inner Product Argument (IPA) prover to eliminate the allocation overhead of the generic mathlib wrapper in tight reduction loops. Supersedes #1912.

As discussed in #1432 and the parent performance epic (#954), the core curve layer heavily relies on mathlib interface allocations, which becomes a bottleneck during Bulletproof/IPA proof generation.

Changes Made

  • Native IPA Execution: Created ipa_native.go containing nativeIPAReduce to execute round reductions natively.
  • Dynamic Curve Dispatch: Updated ipaProver.reduce to dynamically dispatch execution based on the underlying curve via math.DispatchCurve (BLS12-381 and BN254).
  • In-Place Generic Arithmetic: Converted vectors into gnark-crypto native array types (math.GnarkFr[T]) for in-place scalar computations.

Related Issues

Type of Change

  • Performance Improvement (optimizing code execution and memory allocations)

Testing Done

  • Unit tests passed (make unit-tests)
  • Verified against all bit-lengths and tampering test cases.

@SurbhiAgarwal1
SurbhiAgarwal1 force-pushed the perf/zkp-ipa-optimization branch from aca7240 to d4f768b Compare August 6, 2026 09:30
Signed-off-by: Surbhi Agarwal <SurbhiAgarwal1@users.noreply.github.com>
@SurbhiAgarwal1
SurbhiAgarwal1 force-pushed the perf/zkp-ipa-optimization branch from d4f768b to 4b48652 Compare August 6, 2026 09:43
@SurbhiAgarwal1

Copy link
Copy Markdown
Contributor Author

Hi @adecaro and @AkramBitar ,

I have updated the PR branch (perf/zkp-ipa-optimization) to resolve the CI build and check failures:

  1. Fixed Module Import Paths: Updated imports in token/core/zkatdlog/nogh/v1/crypto/rp/bulletproof/ from legacy github.com/hyperledger-labs/fabric-token-sdk to github.com/LFDT-Panurus/panurus matching go.mod.
  2. Code Formatting: Applied gofmt -s -w across all modified files in bulletproof to resolve the make checks formatting failure.
  3. Verification:
    • All unit tests in token/core/zkatdlog/nogh/v1/crypto/rp/bulletproof pass locally (go test ./... PASS).
    • cgo-check builds (tokengen, artifactgen) compile with CGO_ENABLED=0.
    • DCO sign-off is included in the commit.

Could you please trigger/re-run the CI workflows and let me know if any further changes are needed? Thanks!

@AkramBitar

Copy link
Copy Markdown
Contributor

@SurbhiAgarwal1

Thanks a lot for submitting this PR!
I also want to apologize in advance if it takes me some time to review it. I'll get to it as soon as possible.

Regards,
Akram

@AkramBitar

Copy link
Copy Markdown
Contributor

@neetance

Could you please help to review this PR?

Thanks a lot,
Akram

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.

Optimize ZKP Computation Using CPU SIMD and Specialized Instructions

2 participants