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 precompile modules (G1/G2 add, msm, map, pairing, point-eval) into zkEVM and adds generators/fixtures for comprehensive tests.

  • zkEVM Integration:
    • Wire new BLS modules into zkevm (Settings, ZkEvm, constructors): G1/G2 add, G1/G2 msm, G1/G2 map, pairing check, and point evaluation.
  • BLS Test Data:
    • Add testdata generators and helpers in prover/zkevm/prover/bls/testdata (including trusted setup) to cover success/failure cases for add/msm/map/pairing/point-eval.
    • Commit generated CSV fixtures for pairing and point-eval inputs.

Written by Cursor Bugbot for commit 5fdb039. 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.21%. Comparing base (c7bc631) to head (5fdb039).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #915   +/-   ##
=========================================
  Coverage     65.21%   65.21%           
  Complexity     1476     1476           
=========================================
  Files           369      369           
  Lines         14354    14354           
  Branches       1378     1378           
=========================================
  Hits           9361     9361           
  Misses         4393     4393           
  Partials        600      600           
Flag Coverage Δ *Carryforward flag
hardhat 97.33% <ø> (ø)
kotlin 63.16% <ø> (ø) Carriedforward from c7bc631

*This pull request uses carry forward flags. Click here to find out more.

🚀 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
Copy link
Contributor Author

ivokub commented Sep 29, 2025

BLS glue itself is ready, but there are a few blockers:

  • to update to the latest zkevm_prague we need need go-corset dependency.
  • there is potentially memory regression with GKR, see Perf: Improve gkr-mimc memory use gnark#1616. I have to check how it works and possibly backport it on top of gnark master

I also have some temp branch locally where I have tested implementation against actual traces, but it updates go-corset and I don't want to force it right now in this PR as different versions seem to be incompatible with each other.

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.

4 participants