@pytest.mark.parametrize(
"input_data, expected_output",
[
pytest.param(
Spec.G1 + Spec.G2,
Spec.PAIRING_FALSE,
id="one_pair",
),
pytest.param(
Spec.G1 + Spec.G2 + Spec.G1 + Spec.G2,
Spec.PAIRING_FALSE,
id="two_point_fail_1",
),
pytest.param(
PointG1(
0x105456A333E6D636854F987EA7BB713DFD0AE8371A72AEA313AE0C32C0BF1016,
0x0CF031D41B41557F3E7E3BA0C51BEBE5DA8E6ECD855EC50FC87EFCDEAC168BCC,
)
+ PointG2(
(
0x0476BE093A6D2B4BBF907172049874AF11E1B6267606E00804D3FF0037EC57FD,
0x3010C68CB50161B7D1D96BB71EDFEC9880171954E56871ABF3D93CC94D745FA1,
),
(
0x14C059D74E5B6C4EC14AE5864EBE23A71781D86C29FB8FB6CCE94F70D3DE7A21,
0x01B33461F39D9E887DBB100F170A2345DDE3C07E256D1DFA2B657BA5CD030427,
),
)
+ Spec.G1
+ PointG2(
(
0x105384B6DD6C48634B9FE89CB3E19667C1FE6736C69DF070D674C95A42B3B824,
0x2C0D8E67F0F2C14C43734B430D8BE4265AF8C4F7A67DEB0B029FD2DFF99CC6B9,
),
(
0x015EAEC465D922580C7DE5D4A5C26DE75EAF2AF6841B7412EF2EEBD1E051076F,
0x1B4C21849E48DE12D1BAE2BAD3299717AA8664ADE430E19DEC72A6E10A39B0AB,
),
),
Spec.PAIRING_FALSE,
id="two_point_fail_2",
),
pytest.param(
Spec.G1 + Spec.INF_G2 + Spec.G1 + Spec.G2,
Spec.PAIRING_FALSE,
id="two_points_with_one_g2_zero",
),
pytest.param(
PointG1(
0x105456A333E6D636854F987EA7BB713DFD0AE8371A72AEA313AE0C32C0BF1016,
0x0CF031D41B41557F3E7E3BA0C51BEBE5DA8E6ECD855EC50FC87EFCDEAC168BCC,
)
+ PointG2(
(
0x0476BE093A6D2B4BBF907172049874AF11E1B6267606E00804D3FF0037EC57FD,
0x3010C68CB50161B7D1D96BB71EDFEC9880171954E56871ABF3D93CC94D745FA1,
),
(
0x14C059D74E5B6C4EC14AE5864EBE23A71781D86C29FB8FB6CCE94F70D3DE7A21,
0x01B33461F39D9E887DBB100F170A2345DDE3C07E256D1DFA2B657BA5CD030427,
),
)
+ Spec.G1
+ PointG2(
(
0x1A2C3013D2EA92E13C800CDE68EF56A294B883F6AC35D25F587C09B1B3C635F7,
0x290158A80CD3D66530F74DC94C94ADB88F5CDB481ACCA997B6E60071F08A115F,
),
(
0x00CACF3523CAF879D7D05E30549F1E6FDCE364CBB8724B0329C6C2A39D4F018E,
0x0692E55DB067300E6E3FE56218FA2F940054E57E7EF92BF7D475A9D8A8502FD2,
),
)
+ Spec.G1
+ Spec.G2,
Spec.PAIRING_FALSE,
id="three_point_fail_1",
),
],
)
@pytest.mark.ported_from(
[
"https://github.com/ethereum/legacytests/tree/master/Cancun/GeneralStateTests/stZeroKnowledge/ecpairing_one_point_failFiller.json",
"https://github.com/ethereum/legacytests/tree/master/Cancun/GeneralStateTests/stZeroKnowledge/ecpairing_two_point_fail_1Filler.json",
"https://github.com/ethereum/legacytests/tree/master/Cancun/GeneralStateTests/stZeroKnowledge/ecpairing_two_point_fail_2Filler.json",
"https://github.com/ethereum/legacytests/tree/master/Cancun/GeneralStateTests/stZeroKnowledge/ecpairing_two_points_with_one_g2_zeroFiller.json",
"https://github.com/ethereum/legacytests/tree/master/Cancun/GeneralStateTests/stZeroKnowledge/ecpairing_three_point_fail_1Filler.json",
],
pr=["https://github.com/ethereum/execution-specs/pull/2422"],
)
def test_fail(
state_test: StateTestFiller,
pre: Alloc,
post: dict,
tx: Transaction,
) -> None:
"""Test valid inputs where the pairing check fails."""
state_test(
env=Environment(),
pre=pre,
tx=tx,
post=post,
)