Skip to content

Commit a9df61a

Browse files
feat(test-benchmark): add gas limit check for BLS12_G2_MSM benchmark (#2143)
1 parent 26918e5 commit a9df61a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/benchmark/compute/precompile/test_bls12_381.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def test_bls12_g1_msm(
177177
def test_bls12_g2_msm(
178178
benchmark_test: BenchmarkTestFiller,
179179
fork: Fork,
180+
gas_benchmark_value: int,
180181
k: int,
181182
) -> None:
182183
"""Benchmark BLS12_G2_MSM precompile with varying number of points."""
@@ -190,6 +191,13 @@ def test_bls12_g2_msm(
190191
* k
191192
)
192193

194+
intrinsic_gas_cost = fork.transaction_intrinsic_cost_calculator()(
195+
calldata=calldata
196+
)
197+
198+
if intrinsic_gas_cost > gas_benchmark_value:
199+
pytest.skip("k configuration exceeds the gas limit")
200+
193201
attack_block = Op.POP(
194202
Op.STATICCALL(
195203
gas=Op.GAS, address=precompile_address, args_size=Op.CALLDATASIZE

0 commit comments

Comments
 (0)