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

chore(tests): EIP-2537: remove BLS MUL precompiles (MVP) #1039

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions src/ethereum_test_forks/forks/forks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,16 +1133,14 @@ def precompiles(cls, block_number: int = 0, timestamp: int = 0) -> List[Address]
At Prague, pre-compile for BLS operations are added:

G1ADD = 0x0B
G1MUL = 0x0C
G1MSM = 0x0D
G2ADD = 0x0E
G2MUL = 0x0F
G2MSM = 0x10
PAIRING = 0x11
MAP_FP_TO_G1 = 0x12
MAP_FP2_TO_G2 = 0x13
"""
return list(Address(i) for i in range(0xB, 0x13 + 1)) + super(Prague, cls).precompiles(
G1MSM = 0x0C
G2ADD = 0x0D
G2MSM = 0x0E
PAIRING = 0x0F
MAP_FP_TO_G1 = 0x10
MAP_FP2_TO_G2 = 0x11
"""
return list(Address(i) for i in range(0xB, 0x11 + 1)) + super(Prague, cls).precompiles(
block_number, timestamp
)

Expand Down
16 changes: 6 additions & 10 deletions tests/prague/eip2537_bls_12_381_precompiles/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,12 @@ class Spec:

# Addresses
G1ADD = 0x0B
G1MUL = 0x0C
G1MSM = 0x0D
G2ADD = 0x0E
G2MUL = 0x0F
G2MSM = 0x10
PAIRING = 0x11
MAP_FP_TO_G1 = 0x12
MAP_FP2_TO_G2 = 0x13
G1MSM = 0x0C
G2ADD = 0x0D
G2MSM = 0x0E
PAIRING = 0x0F
MAP_FP_TO_G1 = 0x10
MAP_FP2_TO_G2 = 0x11

# Gas constants
G1ADD_GAS = 375
Expand Down Expand Up @@ -288,10 +286,8 @@ def pairing_gas(input_length: int) -> int:

GAS_CALCULATION_FUNCTION_MAP = {
Spec.G1ADD: lambda _: Spec.G1ADD_GAS,
Spec.G1MUL: lambda _: Spec.G1MUL_GAS,
Spec.G1MSM: msm_gas_func_gen(BLS12Group.G1, len(PointG1() + Scalar()), Spec.G1MUL_GAS),
Spec.G2ADD: lambda _: Spec.G2ADD_GAS,
Spec.G2MUL: lambda _: Spec.G2MUL_GAS,
Spec.G2MSM: msm_gas_func_gen(BLS12Group.G2, len(PointG2() + Scalar()), Spec.G2MUL_GAS),
Spec.PAIRING: pairing_gas,
Spec.MAP_FP_TO_G1: lambda _: Spec.MAP_FP_TO_G1_GAS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

pytestmark = [
pytest.mark.valid_from("Prague"),
pytest.mark.parametrize("precompile_address", [Spec.G1MUL], ids=[""]),
pytest.mark.parametrize("precompile_address", [Spec.G1MSM], ids=[""]),
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

pytestmark = [
pytest.mark.valid_from("Prague"),
pytest.mark.parametrize("precompile_address", [Spec.G2MUL], ids=[""]),
pytest.mark.parametrize("precompile_address", [Spec.G2MSM], ids=[""]),
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
Spec.INF_G1 + Scalar(0),
id="G1MSM",
),
pytest.param(
Spec.G1MUL,
Spec.INF_G1 + Scalar(0),
id="G1MUL",
),
pytest.param(
Spec.G2ADD,
Spec.INF_G2 + Spec.INF_G2,
Expand All @@ -44,11 +39,6 @@
Spec.INF_G2 + Scalar(0),
id="G2MSM",
),
pytest.param(
Spec.G2MUL,
Spec.INF_G2 + Scalar(0),
id="G2MUL",
),
pytest.param(
Spec.PAIRING,
Spec.INF_G1 + Spec.INF_G2,
Expand Down
Loading