Skip to content

Conversation

@ivokub
Copy link
Collaborator

@ivokub ivokub commented May 16, 2025

Description

This PR adds capability for the multiplication checks in the field emulation to be performed in small fields. Namely, for the multiplication checks we sample the challenge in field extension and use it instead of a field element.

Depends on #1492, #1493 and #1494. Will rebase after other PRs are merged. For reviewing, have a look at the latest non-merge commits (particularly 1d314a1).

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

Added tests to compile and solve (both with actual solver and test engine) over small fields.

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

ivokub added 30 commits May 13, 2025 12:13
@ivokub ivokub requested review from ThomasPiellard and Copilot May 16, 2025 14:35
@ivokub ivokub self-assigned this May 16, 2025
@ivokub ivokub added type: consolidate strengthen an existing feature priority: P1-high Issue priority: high labels May 16, 2025
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 implements field emulation over small fields by replacing legacy API calls (emulated.ValueOf) with the new element constructors (e.g., fp.NewElement, fr.NewElement) and updating schema and witness handling to propagate the underlying field modulus.

  • Updated algebra and pairing modules to use the new element constructors.
  • Modified schema and witness functions to pass the field modulus, ensuring proper initialization of circuit variables.
  • Adjusted tests and CSV statistics to reflect changes for small field support.

Reviewed Changes

Copilot reviewed 54 out of 54 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
std/algebra/emulated/sw_bls12381/g2.go Replaced emulated.ValueOf by fp.NewElement and updated pointer usage.
std/algebra/emulated/sw_bls12381/g1.go Similar API update replacing emulated.ValueOf with ba.NewElement.
std/algebra/emulated/fields_bw6761/e6_pairing.go Updated element constructors to new API in pairing computations.
frontend/witness.go, schema/, cs/ Updated Walk calls to pass the field modulus and propagate field info.
internal/smallfields/circuits_test.go Extended tests for small field compilation and witness initialization.
backend/witness/* Adjusted witness JSON serialization/deserialization to align with new schema parameter.

@ivokub ivokub force-pushed the feat/emulation-over-smallfield branch from ae3dc3c to dbebbe9 Compare May 19, 2025 11:38
Base automatically changed from feat/widecommitter to master May 20, 2025 10:16
@ivokub ivokub merged commit 6b578ec into master May 20, 2025
6 checks passed
@ivokub ivokub deleted the feat/emulation-over-smallfield branch May 20, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: P1-high Issue priority: high type: consolidate strengthen an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants