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 📜: add BLS12-381 precompiles #3197

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

Conversation

pLabarta
Copy link
Contributor

@pLabarta pLabarta commented Feb 24, 2025

What does it do?

Adds the requires BLS12-381 precompiles as specified by EIP-2537.

Precompiles are available at the following addresses:

Name Address
BLS12_G1ADD 0x000000000000000000000000000000000000000b
BLS12_G1MSM 0x000000000000000000000000000000000000000c
BLS12_G2ADD 0x000000000000000000000000000000000000000d
BLS12_G2MSM 0x000000000000000000000000000000000000000e
BLS12_PAIRING_CHECK 0x000000000000000000000000000000000000000f
BLS12_MAP_FP_TO_G1 0x0000000000000000000000000000000000000010
BLS12_MAP_FP2_TO_G2 0x0000000000000000000000000000000000000011

What important points should reviewers know?

Since precompiles are imported from frontier and its tests include all the test vectors detailed in the EIP, this PR does not duplicate those tests. Instead, it only includes one e2e test that calls each precompile from the BLS12381Helper1 & BLS12381Helper2 contracts and check for the first case in the specified test vectors.

Including the precompiles also broke a few tests by causing an small increase in gas costs. Most just had their inlineSnapshot updated, but one required extra funding.

Is there something left for follow-up PRs?

This PR is a pre-requirement for supporting Ethereum's Pectra upgrade.

@pLabarta pLabarta added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D3-trivial PR contains trivial changes in a runtime directory that do not require an audit not-breaking Does not need to be mentioned in breaking changes labels Feb 24, 2025
Copy link
Contributor

github-actions bot commented Feb 24, 2025

WASM runtime size check:

Compared to target branch

Moonbase runtime: 2532 KB (+112 KB) 🚨

Moonbeam runtime: 2512 KB (+104 KB) 🚨

Moonriver runtime: 2512 KB (+100 KB) 🚨

Compared to latest release (runtime-3501)

Moonbase runtime: 2532 KB (+580 KB compared to latest release) 🚨

Moonbeam runtime: 2512 KB (+572 KB compared to latest release) 🚨

Moonriver runtime: 2512 KB (+572 KB compared to latest release) 🚨

Copy link
Contributor

github-actions bot commented Feb 24, 2025

Coverage Report

@@                      Coverage Diff                      @@
##           master   pablo/bls12-381-precompile     +/-   ##
=============================================================
  Coverage   74.51%                       74.51%   0.00%     
  Files         381                          381             
  Lines       96551                        96551             
=============================================================
  Hits        71940                        71940             
  Misses      24611                        24611             
Files Changed Coverage

Coverage generated Tue Feb 25 13:41:34 UTC 2025

@pLabarta pLabarta marked this pull request as ready for review February 25, 2025 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D3-trivial PR contains trivial changes in a runtime directory that do not require an audit not-breaking Does not need to be mentioned in breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant