From aff955bac7af4b4373933194648a1ce5efc16aa0 Mon Sep 17 00:00:00 2001 From: Mario Vega Date: Fri, 10 Jan 2025 10:45:47 -0600 Subject: [PATCH] new(tests): EIP-2537: Add G2 MSM test for max discount (#1038) * new(tests): EIP-2537: Max discount G2 MSM test * docs: changelog --- docs/CHANGELOG.md | 1 + .../test_bls12_g2msm.py | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4e703fe1a3..6ba31b4bc3 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -19,6 +19,7 @@ Test fixtures for use by clients are available for each release on the [Github r - ✨ [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) set code of non-empty-storage account test ([#948](https://github.com/ethereum/execution-spec-tests/pull/948)) - ✨ [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) Remove delegation behavior of EXTCODE* ([#984](https://github.com/ethereum/execution-spec-tests/pull/984)) - ✨ [EIP-7623](https://eips.ethereum.org/EIPS/eip-7623) Increase calldata cost ([#1004](https://github.com/ethereum/execution-spec-tests/pull/1004)) +- ✨ Add test for [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) which uses the full discount table of G2 MSM ([#1038](https://github.com/ethereum/execution-spec-tests/pull/1038)) ### 🛠️ Framework diff --git a/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g2msm.py b/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g2msm.py index 67346fef85..7103580cae 100644 --- a/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g2msm.py +++ b/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g2msm.py @@ -20,7 +20,24 @@ ] -@pytest.mark.parametrize("input_data,expected_output", vectors_from_file("multiexp_G2_bls.json")) +@pytest.mark.parametrize( + "input_data,expected_output", + vectors_from_file("multiexp_G2_bls.json") + + [ + pytest.param( + (Spec.P2 + Scalar(Spec.Q)) * (len(Spec.G2MSM_DISCOUNT_TABLE) - 1), + Spec.INF_G2, + id="max_discount", + marks=pytest.mark.slow, + ), + pytest.param( + (Spec.P2 + Scalar(Spec.Q)) * len(Spec.G2MSM_DISCOUNT_TABLE), + Spec.INF_G2, + id="max_discount_plus_1", + marks=pytest.mark.slow, + ), + ], +) def test_valid( state_test: StateTestFiller, pre: Alloc,