Skip to content

Feat: add purego ext 6 over koalabear and babybear fields#772

Open
yelhousni wants to merge 20 commits intomasterfrom
feat/smallfield-E6
Open

Feat: add purego ext 6 over koalabear and babybear fields#772
yelhousni wants to merge 20 commits intomasterfrom
feat/smallfield-E6

Conversation

@yelhousni
Copy link
Collaborator

@yelhousni yelhousni commented Dec 2, 2025

Description

We might need extension 6 over koalabear instead of 4 for higher security. This PR implements purego ext 6 over koala/baby bears.

Type of change

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

How has this been tested?

Corresponding tests implemented in e6_test.go

How has this been benchmarked?

Benchmarks in e6_test.go

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

Note

Adds pure-Go 𝔽r⁶ extensions (tower E6 and direct E6D) for babybear/koalabear, updates docs/generator, and renames non-residue ops in E2/E4 with full tests/benchmarks.

  • Extensions:
    • Add 𝔽r⁶ tower E6 and direct E6D implementations for babybear and koalabear with ops: Add/Sub/Mul/Square/Inverse/Exp/BatchInvertE6/Div/Halve/ButterflyE6.
    • Wire generation: new templates e6.go(.tmpl), e6_direct.go(.tmpl), and tests in generator; enable in generate_extensions.
  • API changes (E2/E4):
    • Rename MulByNonResidueMulByQuadraticNonResidue; remove inverse variant and add MulByCubicNonResidue (where applicable).
    • Update E4 to use MulByQuadraticNonResidue in Mul/Square/Inverse/norm; drop non-residue benchmarks.
    • Minor: SetOne comment clarified.
  • Docs:
    • Expand extensions/doc.go to document extension-6 constructions and equivalences for babybear/koalabear; clarify goldilocks extension-2.
  • Generator/Tooling:
    • Add goimports step to formatter; register new E6 files in extensions generator.
  • Tests/Benchmarks:
    • Add comprehensive property tests and benches for E6/E6D; update E2/E4 tests to new method names and benches accordingly.

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

@yelhousni yelhousni self-assigned this Dec 2, 2025
@yelhousni yelhousni added dep: linea Issues affecting downstream Linea proposition labels Dec 2, 2025
gbotrel
gbotrel previously approved these changes Dec 15, 2025
Copy link
Collaborator

@gbotrel gbotrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just add goimports to your flow half of the files are modified / staticcheck doesn't pass because of this :)

@yelhousni yelhousni requested a review from gbotrel December 15, 2025 22:26
@TomWambsgans
Copy link

Hello! I am curious, what is the current state of performance of the degree 6 extension for koala-bear (in particular vs degree 5 if you have any number), and which algorithm is the fastest on gnark? (is it Toom3?) Thanks in advance ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dep: linea Issues affecting downstream Linea proposition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants