Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend/solidity): Implement BLS12-381 pairing precompile (0x0a). #1368 #1417

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

VolodymyrBg
Copy link
Contributor

@VolodymyrBg VolodymyrBg commented Feb 8, 2025

Description

This PR implements the BLS12-381 pairing precompile (0x0a) as specified in EIP-2537. The implementation provides a pairing check operation for BLS12-381 curve points, which is essential for various zero-knowledge proof applications and blockchain interoperability.
Key features:
Implements BLS12-381 pairing check precompile (0x0a)
Follows EIP-2537 specification for input/output format
Includes proper validation for input lengths and point formats
Performs subgroup checks for security
Returns standardized 32-byte output (1 for success, 0 for failure)
Fixes #1368

Type of change

[x] New feature (non-breaking change which adds functionality)
How has this been tested?
The implementation includes a comprehensive test suite in backend/solidity/bls12_381_pairing_test.go:
[x] Empty input test (verifies correct handling of empty input case)
[x] Invalid input length test (ensures proper error handling)
[x] Valid pairing check test (verifies correct pairing computation with generator points)

How has this been benchmarked?

The implementation uses the optimized pairing implementation from gnark-crypto library. No specific benchmarks were added as this is a standard precompile implementation following established specifications.

Checklist:

[x] I have performed a self-review of my code
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have added tests that prove my feature works
[x] I did not modify files generated from templates
[x] New and existing unit tests pass locally with my changes
[x] The implementation follows the EIP-2537 specification exactly
[x] The code handles all edge cases (empty input, invalid points, subgroup checks)

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.

feat: add Pairing precompile on BLS12-381
1 participant