Skip to content

Commit c6403a9

Browse files
spencer-tbmarioevz
authored andcommitted
feat(tests): EIP-2537: extra BLS12-381 coverage (ethereum#1350)
* feat(tests): bls point generator and extra coverage. * chore(tests): remove bls msm duplicates. * chore: fix tox issues. * feat(tests): Add more msm invalid tests --------- Co-authored-by: Mario Vega <[email protected]>
1 parent 4bcc468 commit c6403a9

17 files changed

+2002
-1291
lines changed

docs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Test fixtures for use by clients are available for each release on the [Github r
1818

1919
### 🧪 Test Cases
2020

21+
-[EIP-2573](https://eips.ethereum.org/EIPS/eip-2537): Includes a BLS12 point generator, alongside additional coverage many of the precompiles ([#1350](https://github.com/ethereum/execution-spec-tests/pull/1350)).
22+
2123
## [v4.3.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v4.3.0) - 2025-04-18
2224

2325
### 💥 Breaking Change

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ dependencies = [
5454
"ethereum-rlp>=0.1.3,<0.2",
5555
"pytest-regex>=0.2.0,<0.3",
5656
"eth-abi>=5.2.0",
57+
"joblib>=1.4.2",
5758
]
5859

5960
[project.urls]

stubs/joblib/__init__.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from typing import Any, Callable
2+
3+
class Memory:
4+
def __init__(self, location: str, verbose: int = ...) -> None: ...
5+
def cache(self, func: Callable[..., Any]) -> Callable[..., Any]: ...

tests/prague/eip2537_bls_12_381_precompiles/conftest.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from ethereum_test_tools import EOA, Address, Alloc, Bytecode, Storage, Transaction, keccak256
88
from ethereum_test_tools import Opcodes as Op
99

10+
from .helpers import BLSPointGenerator
1011
from .spec import GAS_CALCULATION_FUNCTION_MAP
1112

1213

@@ -187,3 +188,29 @@ def tx(
187188
to=call_contract_address,
188189
sender=sender,
189190
)
191+
192+
193+
NUM_TEST_POINTS = 5
194+
195+
# Random points not in the subgroup (fast to generate)
196+
G1_POINTS_NOT_IN_SUBGROUP = [
197+
BLSPointGenerator.generate_random_g1_point_not_in_subgroup(seed=i)
198+
for i in range(NUM_TEST_POINTS)
199+
]
200+
G2_POINTS_NOT_IN_SUBGROUP = [
201+
BLSPointGenerator.generate_random_g2_point_not_in_subgroup(seed=i)
202+
for i in range(NUM_TEST_POINTS)
203+
]
204+
# Field points that maps to the identity point using `BLS12_MAP_FP_TO_G1`
205+
G1_FIELD_POINTS_MAP_TO_IDENTITY = BLSPointGenerator.generate_g1_map_isogeny_kernel_points()
206+
207+
# Random points not on the curve (fast to generate)
208+
G1_POINTS_NOT_ON_CURVE = [
209+
BLSPointGenerator.generate_random_g1_point_not_on_curve(seed=i) for i in range(NUM_TEST_POINTS)
210+
]
211+
G2_POINTS_NOT_ON_CURVE = [
212+
BLSPointGenerator.generate_random_g2_point_not_on_curve(seed=i) for i in range(NUM_TEST_POINTS)
213+
]
214+
215+
# Field points that maps to the identity point using `BLS12_MAP_FP_TO_G2`
216+
G2_FIELD_POINTS_MAP_TO_IDENTITY = BLSPointGenerator.generate_g2_map_isogeny_kernel_points()

0 commit comments

Comments
 (0)