@@ -243,11 +243,10 @@ def test_worst_modexp(
243
243
],
244
244
)
245
245
@pytest .mark .parametrize (
246
- "precompile_address,precompile_gas_cost, input,length" ,
246
+ "precompile_address,input,length" ,
247
247
[
248
248
pytest .param (
249
249
0x01 ,
250
- 3_000 ,
251
250
[
252
251
"38D18ACB67D25C8BB9942764B62F18E17054F66A817BD4295423ADF9ED98873E" ,
253
252
"000000000000000000000000000000000000000000000000000000000000001B" ,
@@ -259,7 +258,6 @@ def test_worst_modexp(
259
258
),
260
259
pytest .param (
261
260
0x06 ,
262
- 150 ,
263
261
[
264
262
"18B18ACFB4C2C30276DB5411368E7185B311DD124691610C5D3B74034E093DC9" ,
265
263
"063C909C4720840CB5134CB9F59FA749755796819658D32EFC0D288198F37266" ,
@@ -271,7 +269,6 @@ def test_worst_modexp(
271
269
),
272
270
pytest .param (
273
271
0x07 ,
274
- 6_000 ,
275
272
[
276
273
"1A87B0584CE92F4593D161480614F2989035225609F08058CCFA3D0F940FEBE3" ,
277
274
"1A2F3C951F6DADCC7EE9007DFF81504B0FCD6D7CF59996EFDC33D92BF7F9F8F6" ,
@@ -282,27 +279,27 @@ def test_worst_modexp(
282
279
),
283
280
pytest .param (
284
281
0x08 ,
285
- 45_000 + 2 * 34_000 ,
286
282
[
283
+ # First pairing
287
284
"1C76476F4DEF4BB94541D57EBBA1193381FFA7AA76ADA664DD31C16024C43F59" ,
288
285
"3034DD2920F673E204FEE2811C678745FC819B55D3E9D294E45C9B03A76AEF41" ,
289
286
"209DD15EBFF5D46C4BD888E51A93CF99A7329636C63514396B4A452003A35BF7" ,
290
287
"04BF11CA01483BFA8B34B43561848D28905960114C8AC04049AF4B6315A41678" ,
291
288
"2BB8324AF6CFC93537A2AD1A445CFD0CA2A71ACD7AC41FADBF933C2A51BE344D" ,
292
289
"120A2A4CF30C1BF9845F20C6FE39E07EA2CCE61F0C9BB048165FE5E4DE877550" ,
290
+ # Second pairing
293
291
"111E129F1CF1097710D41C4AC70FCDFA5BA2023C6FF1CBEAC322DE49D1B6DF7C" ,
294
292
"103188585E2364128FE25C70558F1560F4F9350BAF3959E603CC91486E110936" ,
295
293
"198E9393920D483A7260BFB731FB5D25F1AA493335A9E71297E485B7AEF312C2" ,
296
294
"1800DEEF121F1E76426A00665E5C4479674322D4F75EDADD46DEBD5CD992F6ED" ,
297
295
"090689D0585FF075EC9E99AD690C3395BC4B313370B38EF355ACDADCD122975B" ,
298
296
"12C85EA5DB8C6DEB4AAB71808DCB408FE3D1E7690C43D37B4CE6CC0166FA7DAA" ,
299
297
],
300
- 32 * 12 ,
298
+ 32 * 2 * 6 ,
301
299
id = "bn128_pairing" ,
302
300
),
303
301
pytest .param (
304
302
0x09 ,
305
- 0xFFFF ,
306
303
[
307
304
"0000FFFF" ,
308
305
"48C9BDF267E6096A3BA7CA8485AE67BB2BF894FE72F36E3CF1361D5F3AF54FA5D182E6AD7F520E511F6C3E2B8C68059B6BBD41FBABD9831F79217E1319CDE05B" ,
@@ -317,7 +314,6 @@ def test_worst_modexp(
317
314
),
318
315
pytest .param (
319
316
0x0A ,
320
- 50_000 ,
321
317
[
322
318
"01E798154708FE7789429634053CBF9F99B619F9F084048927333FCE637F549B" ,
323
319
"564C0A11A0F704F4FC3E8ACFE0F8245F0AD1347B378FBF96E206DA11A5D36306" ,
@@ -330,14 +326,23 @@ def test_worst_modexp(
330
326
),
331
327
pytest .param (
332
328
0x0B ,
333
- 375 ,
334
329
[
335
330
"000000000000000000000000000000000572CBEA904D67468808C8EB50A9450C9721DB309128012543902D0AC358A62AE28F75BB8F1C7C42C39A8C5529BF0F4E00000000000000000000000000000000166A9D8CABC673A322FDA673779D8E3822BA3ECB8670E461F73BB9021D5FD76A" ,
336
331
"4C56D9D4CD16BD1BBA86881979749D280000000000000000000000000000000009ECE308F9D1F0131765212DECA99697B112D61F9BE9A5F1F3780A51335B3FF981747A0B2CA2179B96D2C0C9024E522400000000000000000000000000000000032B80D3A6F5B09F8A84623389C5F80C" ,
337
332
],
338
333
256 ,
339
334
id = "bls12_g1add" ,
340
335
),
336
+ pytest .param (
337
+ 0x0C ,
338
+ [
339
+ "0000000000000000000000000000000017f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb0000000000000000000000000000000008b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e10000000000000000000000000000000000000000000000000000000000000032" ,
340
+ "000000000000000000000000000000000e12039459c60491672b6a6282355d8765ba6272387fb91a3e9604fa2a81450cf16b870bb446fc3a3e0a187fff6f89450000000000000000000000000000000018b6c1ed9f45d3cbc0b01b9d038dcecacbd702eb26469a0eb3905bd421461712f67f782b4735849644c1772c93fe3d090000000000000000000000000000000000000000000000000000000000000033" ,
341
+ "00000000000000000000000000000000147b327c8a15b39634a426af70c062b50632a744eddd41b5a4686414ef4cd9746bb11d0a53c6c2ff21bbcf331e07ac9200000000000000000000000000000000078c2e9782fa5d9ab4e728684382717aa2b8fad61b5f5e7cf3baa0bc9465f57342bb7c6d7b232e70eebcdbf70f903a450000000000000000000000000000000000000000000000000000000000000034" ,
342
+ ],
343
+ 3 * 160 ,
344
+ id = "bls12_g1msm" ,
345
+ ),
341
346
],
342
347
)
343
348
def test_worst_precompile_fixed_cost (
@@ -346,7 +351,6 @@ def test_worst_precompile_fixed_cost(
346
351
fork : Fork ,
347
352
gas_limit : int ,
348
353
precompile_address : Address ,
349
- precompile_gas_cost : int ,
350
354
input : list [str ],
351
355
length : int ,
352
356
):
@@ -365,7 +369,7 @@ def test_worst_precompile_fixed_cost(
365
369
value_to_store = int .from_bytes (chunk , "big" )
366
370
calldata += Op .MSTORE (i , value_to_store )
367
371
368
- attack_block = Op .POP (Op .STATICCALL (precompile_gas_cost , precompile_address , 0 , length , 0 , 0 ))
372
+ attack_block = Op .POP (Op .STATICCALL (Op . GAS , precompile_address , 0 , length , 0 , 0 ))
369
373
code = code_loop_precompile_call (calldata , attack_block )
370
374
code_address = pre .deploy_contract (code = bytes (code ))
371
375
0 commit comments