ethereum / evmone

Fast Ethereum Virtual Machine implementation
Apache License 2.0
864 stars 286 forks source link

precompilles: Implement mapping of field elements to `BLS12-381` curve points #1012

Closed rodiazet closed 2 months ago

rodiazet commented 2 months ago

Implementation of the bls12_map_fp_to_g1 and bls12_map_fp2_to_g2 precompiles: mapping of fp field element to a point on E1 curve (BLS12-381) and mapping fp2 extension field element to a point on E2 curve (BLS12-381) according to the EIP-2537 spec https://eips.ethereum.org/EIPS/eip-2537#abi-for-mapping-fp-element-to-g1-point and https://eips.ethereum.org/EIPS/eip-2537#abi-for-mapping-fp2-element-to-g2-point.

Depends on: https://github.com/ethereum/evmone/pull/1010

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.15%. Comparing base (7c6a3ce) to head (dac8d4d). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1012 +/- ## ========================================== + Coverage 94.08% 94.15% +0.06% ========================================== Files 147 147 Lines 15748 15796 +48 ========================================== + Hits 14816 14872 +56 + Misses 932 924 -8 ``` | [Flag](https://app.codecov.io/gh/ethereum/evmone/pull/1012/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | Coverage Δ | | |---|---|---| | [eof_execution_spec_tests](https://app.codecov.io/gh/ethereum/evmone/pull/1012/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | `17.31% <0.00%> (-0.06%)` | :arrow_down: | | [ethereum_tests](https://app.codecov.io/gh/ethereum/evmone/pull/1012/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | `27.36% <0.00%> (-0.09%)` | :arrow_down: | | [ethereum_tests_silkpre](https://app.codecov.io/gh/ethereum/evmone/pull/1012/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | `19.21% <0.00%> (-0.07%)` | :arrow_down: | | [execution_spec_tests](https://app.codecov.io/gh/ethereum/evmone/pull/1012/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | `20.12% <80.55%> (+0.20%)` | :arrow_up: | | [unittests](https://app.codecov.io/gh/ethereum/evmone/pull/1012/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | `88.83% <69.44%> (-0.07%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/ethereum/evmone/pull/1012?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | Coverage Δ | | |---|---|---| | [lib/evmone\_precompiles/bls.cpp](https://app.codecov.io/gh/ethereum/evmone/pull/1012?src=pr&el=tree&filepath=lib%2Fevmone_precompiles%2Fbls.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#diff-bGliL2V2bW9uZV9wcmVjb21waWxlcy9ibHMuY3Bw) | `100.00% <100.00%> (ø)` | | | [test/state/precompiles.cpp](https://app.codecov.io/gh/ethereum/evmone/pull/1012?src=pr&el=tree&filepath=test%2Fstate%2Fprecompiles.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#diff-dGVzdC9zdGF0ZS9wcmVjb21waWxlcy5jcHA=) | `97.65% <100.00%> (+3.34%)` | :arrow_up: | | [test/unittests/precompiles\_bls\_test.cpp](https://app.codecov.io/gh/ethereum/evmone/pull/1012?src=pr&el=tree&filepath=test%2Funittests%2Fprecompiles_bls_test.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#diff-dGVzdC91bml0dGVzdHMvcHJlY29tcGlsZXNfYmxzX3Rlc3QuY3Bw) | `100.00% <100.00%> (ø)` | |