@@ -264,11 +264,10 @@ def test_worst_modexp(
264
264
],
265
265
)
266
266
@pytest .mark .parametrize (
267
- "precompile_address,precompile_gas_cost, input,length" ,
267
+ "precompile_address,input,length" ,
268
268
[
269
269
pytest .param (
270
270
0x01 ,
271
- 3_000 ,
272
271
[
273
272
"38D18ACB67D25C8BB9942764B62F18E17054F66A817BD4295423ADF9ED98873E" ,
274
273
"000000000000000000000000000000000000000000000000000000000000001B" ,
@@ -280,7 +279,6 @@ def test_worst_modexp(
280
279
),
281
280
pytest .param (
282
281
0x06 ,
283
- 150 ,
284
282
[
285
283
"18B18ACFB4C2C30276DB5411368E7185B311DD124691610C5D3B74034E093DC9" ,
286
284
"063C909C4720840CB5134CB9F59FA749755796819658D32EFC0D288198F37266" ,
@@ -292,7 +290,6 @@ def test_worst_modexp(
292
290
),
293
291
pytest .param (
294
292
0x07 ,
295
- 6_000 ,
296
293
[
297
294
"1A87B0584CE92F4593D161480614F2989035225609F08058CCFA3D0F940FEBE3" ,
298
295
"1A2F3C951F6DADCC7EE9007DFF81504B0FCD6D7CF59996EFDC33D92BF7F9F8F6" ,
@@ -303,27 +300,27 @@ def test_worst_modexp(
303
300
),
304
301
pytest .param (
305
302
0x08 ,
306
- 45_000 + 2 * 34_000 ,
307
303
[
304
+ # First pairing
308
305
"1C76476F4DEF4BB94541D57EBBA1193381FFA7AA76ADA664DD31C16024C43F59" ,
309
306
"3034DD2920F673E204FEE2811C678745FC819B55D3E9D294E45C9B03A76AEF41" ,
310
307
"209DD15EBFF5D46C4BD888E51A93CF99A7329636C63514396B4A452003A35BF7" ,
311
308
"04BF11CA01483BFA8B34B43561848D28905960114C8AC04049AF4B6315A41678" ,
312
309
"2BB8324AF6CFC93537A2AD1A445CFD0CA2A71ACD7AC41FADBF933C2A51BE344D" ,
313
310
"120A2A4CF30C1BF9845F20C6FE39E07EA2CCE61F0C9BB048165FE5E4DE877550" ,
311
+ # Second pairing
314
312
"111E129F1CF1097710D41C4AC70FCDFA5BA2023C6FF1CBEAC322DE49D1B6DF7C" ,
315
313
"103188585E2364128FE25C70558F1560F4F9350BAF3959E603CC91486E110936" ,
316
314
"198E9393920D483A7260BFB731FB5D25F1AA493335A9E71297E485B7AEF312C2" ,
317
315
"1800DEEF121F1E76426A00665E5C4479674322D4F75EDADD46DEBD5CD992F6ED" ,
318
316
"090689D0585FF075EC9E99AD690C3395BC4B313370B38EF355ACDADCD122975B" ,
319
317
"12C85EA5DB8C6DEB4AAB71808DCB408FE3D1E7690C43D37B4CE6CC0166FA7DAA" ,
320
318
],
321
- 32 * 12 ,
319
+ 32 * 2 * 6 ,
322
320
id = "bn128_pairing" ,
323
321
),
324
322
pytest .param (
325
323
0x09 ,
326
- 0xFFFF ,
327
324
[
328
325
"0000FFFF" ,
329
326
"48C9BDF267E6096A3BA7CA8485AE67BB2BF894FE72F36E3CF1361D5F3AF54FA5D182E6AD7F520E511F6C3E2B8C68059B6BBD41FBABD9831F79217E1319CDE05B" ,
@@ -338,7 +335,6 @@ def test_worst_modexp(
338
335
),
339
336
pytest .param (
340
337
0x0A ,
341
- 50_000 ,
342
338
[
343
339
"01E798154708FE7789429634053CBF9F99B619F9F084048927333FCE637F549B" ,
344
340
"564C0A11A0F704F4FC3E8ACFE0F8245F0AD1347B378FBF96E206DA11A5D36306" ,
@@ -351,14 +347,23 @@ def test_worst_modexp(
351
347
),
352
348
pytest .param (
353
349
0x0B ,
354
- 375 ,
355
350
[
356
351
"000000000000000000000000000000000572CBEA904D67468808C8EB50A9450C9721DB309128012543902D0AC358A62AE28F75BB8F1C7C42C39A8C5529BF0F4E00000000000000000000000000000000166A9D8CABC673A322FDA673779D8E3822BA3ECB8670E461F73BB9021D5FD76A" ,
357
352
"4C56D9D4CD16BD1BBA86881979749D280000000000000000000000000000000009ECE308F9D1F0131765212DECA99697B112D61F9BE9A5F1F3780A51335B3FF981747A0B2CA2179B96D2C0C9024E522400000000000000000000000000000000032B80D3A6F5B09F8A84623389C5F80C" ,
358
353
],
359
354
256 ,
360
355
id = "bls12_g1add" ,
361
356
),
357
+ pytest .param (
358
+ 0x0C ,
359
+ [
360
+ "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000032" ,
361
+ "000000000000000000000000000000000e12039459c60491672b6a6282355d8765ba6272387fb91a3e9604fa2a81450cf16b870bb446fc3a3e0a187fff6f89450000000000000000000000000000000018b6c1ed9f45d3cbc0b01b9d038dcecacbd702eb26469a0eb3905bd421461712f67f782b4735849644c1772c93fe3d090000000000000000000000000000000000000000000000000000000000000033" ,
362
+ "00000000000000000000000000000000147b327c8a15b39634a426af70c062b50632a744eddd41b5a4686414ef4cd9746bb11d0a53c6c2ff21bbcf331e07ac9200000000000000000000000000000000078c2e9782fa5d9ab4e728684382717aa2b8fad61b5f5e7cf3baa0bc9465f57342bb7c6d7b232e70eebcdbf70f903a450000000000000000000000000000000000000000000000000000000000000034" ,
363
+ ],
364
+ 3 * 160 ,
365
+ id = "bls12_g1msm" ,
366
+ ),
362
367
],
363
368
)
364
369
def test_worst_precompile_fixed_cost (
@@ -367,7 +372,6 @@ def test_worst_precompile_fixed_cost(
367
372
fork : Fork ,
368
373
gas_limit : int ,
369
374
precompile_address : Address ,
370
- precompile_gas_cost : int ,
371
375
input : list [str ],
372
376
length : int ,
373
377
):
@@ -386,7 +390,7 @@ def test_worst_precompile_fixed_cost(
386
390
value_to_store = int .from_bytes (chunk , "big" )
387
391
calldata += Op .MSTORE (i , value_to_store )
388
392
389
- attack_block = Op .POP (Op .STATICCALL (precompile_gas_cost , precompile_address , 0 , length , 0 , 0 ))
393
+ attack_block = Op .POP (Op .STATICCALL (Op . GAS , precompile_address , 0 , length , 0 , 0 ))
390
394
code = code_loop_precompile_call (calldata , attack_block )
391
395
code_address = pre .deploy_contract (code = bytes (code ))
392
396
0 commit comments