From 62f953c82788d975c5eb1c6eac2d0276f938296c Mon Sep 17 00:00:00 2001 From: LouisTsai Date: Thu, 5 Feb 2026 14:42:54 +0800 Subject: [PATCH] feat(test-benchmark): add gas limit check for BLS12_G2_MSM benchmark --- tests/benchmark/compute/precompile/test_bls12_381.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/benchmark/compute/precompile/test_bls12_381.py b/tests/benchmark/compute/precompile/test_bls12_381.py index 0d2ea91310..653473dac6 100644 --- a/tests/benchmark/compute/precompile/test_bls12_381.py +++ b/tests/benchmark/compute/precompile/test_bls12_381.py @@ -177,6 +177,7 @@ def test_bls12_g1_msm( def test_bls12_g2_msm( benchmark_test: BenchmarkTestFiller, fork: Fork, + gas_benchmark_value: int, k: int, ) -> None: """Benchmark BLS12_G2_MSM precompile with varying number of points.""" @@ -190,6 +191,13 @@ def test_bls12_g2_msm( * k ) + intrinsic_gas_cost = fork.transaction_intrinsic_cost_calculator()( + calldata=calldata + ) + + if intrinsic_gas_cost > gas_benchmark_value: + pytest.skip("k configuration exceeds the gas limit") + attack_block = Op.POP( Op.STATICCALL( gas=Op.GAS, address=precompile_address, args_size=Op.CALLDATASIZE