Skip to content

Conversation

@ivokub
Copy link
Contributor

@ivokub ivokub commented Apr 29, 2025

Adds glue for integrating BLS precompiles from gnark with the data provided in the arithmetization.

  • I also ported changes from the smallfield branch to gkr-mimc cc @Tabaie.
  • fixed gnark interface update for logderivative lookup tables which are now interfaces (to hide generic parameter for supporting small fields)
  • updated gnark dependency to include BLS circuits
  • added testdata generator for BLS precompiles which should handle all possible succeeding and failing input cases. To generate the tests, run go generate prover/zkevm/prover/bls/testdata and then run the tests in prover/zkevm/prover/bls

Checklist

  • I wrote new tests for my new core changes.
  • I have successfully ran tests, style checker and build against my new changes locally.
  • I have informed the team of any breaking changes if there are any.

Note

Integrates BLS12-381 precompiles (G1/G2 add, MSM, map, pairing, point-eval) into zkEVM and adds exhaustive testdata generators/fixtures.

  • zkEVM Integration:
    • Wire new BLS modules into zkEVM: BlsG1Add, BlsG2Add, BlsG1Msm, BlsG2Msm, BlsG1Map, BlsG2Map, BlsPairingCheck, PointEval in zkevm.go (construction and prover assignment).
    • Extend Settings with Bls limits in settings.go.
    • Add BLS module constructors in prover/zkevm/prover/bls/zkevm_modules.go using zkEVM range-check options.
  • Test Data & Utils:
    • Add comprehensive generators for BLS test vectors (ADD/MSM/MAP/PAIRING/POINT EVAL) under prover/zkevm/prover/bls/testdata/*, incl. trusted setup loader and unit test.
    • Commit generated CSV fixtures for pairing and point-eval: bls_pairing_inputs-0.csv, bls_pointeval_inputs-0.csv.

Written by Cursor Bugbot for commit dbfe394. This will update automatically on new commits. Configure here.

@ivokub ivokub added the Prover Tag to use for all work impacting the prover label Apr 29, 2025
@ivokub ivokub self-assigned this Apr 29, 2025
@codecov-commenter
Copy link

codecov-commenter commented Apr 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.56%. Comparing base (cbf344e) to head (dbfe394).
⚠️ Report is 32 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #915      +/-   ##
============================================
- Coverage     65.67%   65.56%   -0.11%     
+ Complexity     1522     1476      -46     
============================================
  Files           389      390       +1     
  Lines         14117    14546     +429     
  Branches       1454     1444      -10     
============================================
+ Hits           9271     9537     +266     
- Misses         4236     4409     +173     
+ Partials        610      600      -10     
Flag Coverage Δ *Carryforward flag
hardhat 96.29% <ø> (+0.09%) ⬆️
kotlin 63.16% <ø> (-0.12%) ⬇️ Carriedforward from 343757f

*This pull request uses carry forward flags. Click here to find out more.
see 238 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ivokub ivokub force-pushed the feat/bls-glue branch 2 times, most recently from 371dab0 to e8420b0 Compare September 2, 2025 10:44
@ivokub ivokub marked this pull request as ready for review September 2, 2025 12:11
Copy link
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

This PR adds integration for BLS12-381 precompiles from gnark with the ZKEVM arithmetization system, along with comprehensive test data generation capabilities.

  • Introduces ZKEVM-specific wrapper functions for BLS precompile operations (G1/G2 add, MSM, pairing, mapping, point evaluation)
  • Adds extensive CSV test data for BLS point evaluation operations with various success and failure scenarios
  • Includes CSV test data for BLS G2 field element to curve point mapping operations

Reviewed Changes

Copilot reviewed 41 out of 45 changed files in this pull request and generated no comments.

File Description
prover/zkevm/prover/bls/zkevm_modules.go Provides ZKEVM integration wrappers for all BLS precompile operations
prover/zkevm/prover/bls/testdata/bls_pointeval_inputs-0.csv Test data for BLS point evaluation with 50 test cases covering success/failure scenarios
prover/zkevm/prover/bls/testdata/bls_g2_map_inputs.csv Test data for BLS G2 mapping operations with 4 test cases

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ivokub ivokub mentioned this pull request Nov 17, 2025
3 tasks
ivokub added a commit that referenced this pull request Nov 24, 2025
commit c5117f9
Author: Ivo Kubjas <[email protected]>
Date:   Wed Nov 19 02:48:12 2025 +0000

    feat: add default circuit sizes

commit 439b911
Author: Ivo Kubjas <[email protected]>
Date:   Sun Nov 16 21:08:48 2025 +0000

    fix: more unique constraint names

commit be09cf7
Author: Ivo Kubjas <[email protected]>
Date:   Sun Nov 16 20:52:05 2025 +0000

    fix: incorrect limb count for scalar

commit 206ee01
Author: Ivo Kubjas <[email protected]>
Date:   Sun Nov 16 20:48:05 2025 +0000

    fix: ensure unique constraints

commit afbfaee
Author: Ivo Kubjas <[email protected]>
Date:   Sun Nov 16 20:43:31 2025 +0000

    fix: store new rangechecker

commit dd4e1eb
Author: Ivo Kubjas <[email protected]>
Date:   Sun Nov 16 20:20:59 2025 +0000

    chore: clarify error message

commit f76c7c4
Author: Ivo Kubjas <[email protected]>
Date:   Sun Nov 16 20:18:36 2025 +0000

    chore: remove excessive logging

commit b83d78c
Author: Ivo Kubjas <[email protected]>
Date:   Sun Nov 16 20:14:15 2025 +0000

    fix: compilation errors

commit 6f60e01
Merge: 5fdb039 cbf344e
Author: Ivo Kubjas <[email protected]>
Date:   Sun Nov 16 20:12:33 2025 +0000

    Merge branch 'main' into feat/bls-glue

commit 5fdb039
Author: Ivo Kubjas <[email protected]>
Date:   Fri Sep 26 08:14:18 2025 +0000

    test: make source local

commit 4d526ed
Author: Ivo Kubjas <[email protected]>
Date:   Mon Sep 29 22:18:09 2025 +0000

    feat: integrate BLS precompile with zkevm

commit 81a8876
Author: Ivo Kubjas <[email protected]>
Date:   Mon Sep 29 22:17:48 2025 +0000

    docs: limits documentation

commit a102526
Author: Ivo Kubjas <[email protected]>
Date:   Mon Sep 29 22:17:26 2025 +0000

    feat: precise bls source getters

commit d312c3d
Author: Ivo Kubjas <[email protected]>
Date:   Mon Sep 29 13:14:35 2025 +0000

    test: regenerate testdata

commit b392c30
Author: Ivo Kubjas <[email protected]>
Date:   Mon Sep 29 11:36:29 2025 +0000

    fix: align G2 tower order with gnark

commit e823165
Author: Ivo Kubjas <[email protected]>
Date:   Fri Sep 26 13:09:09 2025 +0000

    feat: remove circuit number limits

commit 152d2a0
Author: Ivo Kubjas <[email protected]>
Date:   Wed Sep 24 11:28:54 2025 +0000

    test: update included test files

commit 3bf1ff6
Author: Ivo Kubjas <[email protected]>
Date:   Wed Sep 24 10:49:29 2025 +0000

    fix: change ordering of serialized values

commit c1bb5b6
Author: Ivo Kubjas <[email protected]>
Date:   Thu Sep 18 09:36:56 2025 +0000

    chore: go mod tidy

commit 9b138df
Author: Ivo Kubjas <[email protected]>
Date:   Fri Sep 5 11:37:24 2025 +0000

    test: add BLS testdata generator

commit 44d9251
Author: Ivo Kubjas <[email protected]>
Date:   Tue Sep 2 11:05:12 2025 +0000

    test: include minimal number of test files

commit 81d4abf
Author: Ivo Kubjas <[email protected]>
Date:   Fri Aug 29 15:09:24 2025 +0000

    feat: add BLS precompile glue

commit 6902d28
Author: Ivo Kubjas <[email protected]>
Date:   Fri Aug 29 15:09:01 2025 +0000

    feat: csvtraces fill up to column size

commit ae6bc69
Author: Ivo Kubjas <[email protected]>
Date:   Fri Aug 29 15:07:38 2025 +0000

    fix: gnark schema walker field

commit 896ba98
Author: Ivo Kubjas <[email protected]>
Date:   Fri Aug 29 15:07:17 2025 +0000

    fix: typed builder

commit af228c7
Author: Ivo Kubjas <[email protected]>
Date:   Fri Aug 29 15:06:50 2025 +0000

    fix: remove unused test engine option

commit 8bbd5ba
Author: Ivo Kubjas <[email protected]>
Date:   Fri Aug 29 15:06:38 2025 +0000

    fix: gnark logderiv interface change

commit 2d1d55e
Author: Ivo Kubjas <[email protected]>
Date:   Fri Aug 29 15:05:50 2025 +0000

    chore: cherry pick gkr changes from smallfield

commit b6a374a
Author: Ivo Kubjas <[email protected]>
Date:   Thu Sep 18 09:35:46 2025 +0000

    chore: gnark dependency update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Prover Tag to use for all work impacting the prover

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants