Skip to content

Commit 1c7d28e

Browse files
committed
feat(test): turn on more ported static w/ proper gas accounting
1 parent 201f40b commit 1c7d28e

3 files changed

Lines changed: 84 additions & 60 deletions

File tree

tests/ported_static/amsterdam_skip_list.txt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,26 +1160,6 @@ stPreCompiledContracts2/test_modexp_0_0_0_35000.py::test_modexp_0_0_0_35000[fork
11601160
# stRevertTest (1)
11611161
stRevertTest/test_revert_in_create_in_init_paris.py::test_revert_in_create_in_init_paris[fork_Amsterdam]
11621162

1163-
# stSStoreTest (16) — EIP-7976 raises the calldata floor cost to 64 gas/byte;
1164-
# these tests' hardcoded gas budgets fall below the resulting intrinsic floor
1165-
# (`INTRINSIC_GAS_BELOW_FLOOR_GAS_COST`).
1166-
stSStoreTest/test_sstore_change_from_external_call_in_init_code.py::test_sstore_change_from_external_call_in_init_code[fork_Amsterdam-d10]
1167-
stSStoreTest/test_sstore_change_from_external_call_in_init_code.py::test_sstore_change_from_external_call_in_init_code[fork_Amsterdam-d11]
1168-
stSStoreTest/test_sstore_change_from_external_call_in_init_code.py::test_sstore_change_from_external_call_in_init_code[fork_Amsterdam-d12]
1169-
stSStoreTest/test_sstore_change_from_external_call_in_init_code.py::test_sstore_change_from_external_call_in_init_code[fork_Amsterdam-d13]
1170-
stSStoreTest/test_sstore_change_from_external_call_in_init_code.py::test_sstore_change_from_external_call_in_init_code[fork_Amsterdam-d14]
1171-
stSStoreTest/test_sstore_change_from_external_call_in_init_code.py::test_sstore_change_from_external_call_in_init_code[fork_Amsterdam-d15]
1172-
stSStoreTest/test_sstore_change_from_external_call_in_init_code.py::test_sstore_change_from_external_call_in_init_code[fork_Amsterdam-d2]
1173-
stSStoreTest/test_sstore_change_from_external_call_in_init_code.py::test_sstore_change_from_external_call_in_init_code[fork_Amsterdam-d6]
1174-
stSStoreTest/test_sstore_change_from_external_call_in_init_code.py::test_sstore_change_from_external_call_in_init_code[fork_Amsterdam-d8]
1175-
stSStoreTest/test_sstore_change_from_external_call_in_init_code.py::test_sstore_change_from_external_call_in_init_code[fork_Amsterdam-d9]
1176-
stSStoreTest/test_sstore_gas_left.py::test_sstore_gas_left[fork_Amsterdam-d0]
1177-
stSStoreTest/test_sstore_gas_left.py::test_sstore_gas_left[fork_Amsterdam-d1]
1178-
stSStoreTest/test_sstore_gas_left.py::test_sstore_gas_left[fork_Amsterdam-d3]
1179-
stSStoreTest/test_sstore_gas_left.py::test_sstore_gas_left[fork_Amsterdam-d4]
1180-
stSStoreTest/test_sstore_gas_left.py::test_sstore_gas_left[fork_Amsterdam-d6]
1181-
stSStoreTest/test_sstore_gas_left.py::test_sstore_gas_left[fork_Amsterdam-d7]
1182-
11831163
# stStaticCall (31)
11841164
stStaticCall/test_static_call_ask_more_gas_on_depth2_then_transaction_has.py::test_static_call_ask_more_gas_on_depth2_then_transaction_has[fork_Amsterdam-d0]
11851165
stStaticCall/test_static_call_sha256_1_nonzero_value.py::test_static_call_sha256_1_nonzero_value[fork_Amsterdam]

tests/ported_static/stSStoreTest/test_sstore_change_from_external_call_in_init_code.py

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,14 @@ def test_sstore_change_from_external_call_in_init_code(
257257

258258
tx_data = [
259259
Op.CALL(
260-
gas=0x186A0,
260+
gas=100_000,
261261
address=contract_0,
262262
value=0x0,
263263
args_offset=0x0,
264264
args_size=0x0,
265265
ret_offset=0x0,
266266
ret_size=0x0,
267+
inner_call_cost=100_000,
267268
)
268269
+ Op.STOP,
269270
Op.PUSH1[0x0]
@@ -274,13 +275,14 @@ def test_sstore_change_from_external_call_in_init_code(
274275
+ Op.STOP * 2
275276
+ Op.INVALID
276277
+ Op.CALL(
277-
gas=0x186A0,
278+
gas=100_000,
278279
address=contract_0,
279280
value=0x0,
280281
args_offset=0x0,
281282
args_size=0x0,
282283
ret_offset=0x0,
283284
ret_size=0x0,
285+
inner_call_cost=100_000,
284286
)
285287
+ Op.STOP,
286288
Op.PUSH1[0x0]
@@ -292,13 +294,14 @@ def test_sstore_change_from_external_call_in_init_code(
292294
+ Op.STOP * 2
293295
+ Op.INVALID
294296
+ Op.CALL(
295-
gas=0x186A0,
297+
gas=100_000,
296298
address=contract_0,
297299
value=0x0,
298300
args_offset=0x0,
299301
args_size=0x0,
300302
ret_offset=0x0,
301303
ret_size=0x0,
304+
inner_call_cost=100_000,
302305
)
303306
+ Op.STOP,
304307
Op.PUSH1[0x0]
@@ -308,35 +311,38 @@ def test_sstore_change_from_external_call_in_init_code(
308311
+ Op.POP(Op.CREATE2)
309312
+ Op.POP(
310313
Op.CALL(
311-
gas=0x30D40,
314+
gas=200_000,
312315
address=contract_1,
313316
value=0x0,
314317
args_offset=0x0,
315318
args_size=0x0,
316319
ret_offset=0x0,
317320
ret_size=0x0,
321+
inner_call_cost=200_000,
318322
)
319323
)
320324
+ Op.STOP * 2
321325
+ Op.INVALID
322326
+ Op.CALL(
323-
gas=0x186A0,
327+
gas=100_000,
324328
address=contract_0,
325329
value=0x0,
326330
args_offset=0x0,
327331
args_size=0x0,
328332
ret_offset=0x0,
329333
ret_size=0x0,
334+
inner_call_cost=100_000,
330335
)
331336
+ Op.STOP,
332337
Op.CALLCODE(
333-
gas=0x186A0,
338+
gas=100_000,
334339
address=contract_0,
335340
value=0x0,
336341
args_offset=0x0,
337342
args_size=0x0,
338343
ret_offset=0x0,
339344
ret_size=0x0,
345+
inner_call_cost=100_000,
340346
)
341347
+ Op.STOP,
342348
Op.PUSH1[0x0]
@@ -347,13 +353,14 @@ def test_sstore_change_from_external_call_in_init_code(
347353
+ Op.STOP * 2
348354
+ Op.INVALID
349355
+ Op.CALLCODE(
350-
gas=0x186A0,
356+
gas=100_000,
351357
address=contract_0,
352358
value=0x0,
353359
args_offset=0x0,
354360
args_size=0x0,
355361
ret_offset=0x0,
356362
ret_size=0x0,
363+
inner_call_cost=100_000,
357364
)
358365
+ Op.STOP,
359366
Op.PUSH1[0x0]
@@ -365,13 +372,14 @@ def test_sstore_change_from_external_call_in_init_code(
365372
+ Op.STOP * 2
366373
+ Op.INVALID
367374
+ Op.CALLCODE(
368-
gas=0x186A0,
375+
gas=100_000,
369376
address=contract_0,
370377
value=0x0,
371378
args_offset=0x0,
372379
args_size=0x0,
373380
ret_offset=0x0,
374381
ret_size=0x0,
382+
inner_call_cost=100_000,
375383
)
376384
+ Op.STOP,
377385
Op.PUSH1[0x0]
@@ -381,29 +389,31 @@ def test_sstore_change_from_external_call_in_init_code(
381389
+ Op.POP(Op.CREATE2)
382390
+ Op.POP(
383391
Op.CALL(
384-
gas=0x30D40,
392+
gas=200_000,
385393
address=contract_1,
386394
value=0x0,
387395
args_offset=0x0,
388396
args_size=0x0,
389397
ret_offset=0x0,
390398
ret_size=0x0,
399+
inner_call_cost=200_000,
391400
)
392401
)
393402
+ Op.STOP * 2
394403
+ Op.INVALID
395404
+ Op.CALLCODE(
396-
gas=0x186A0,
405+
gas=100_000,
397406
address=contract_0,
398407
value=0x0,
399408
args_offset=0x0,
400409
args_size=0x0,
401410
ret_offset=0x0,
402411
ret_size=0x0,
412+
inner_call_cost=100_000,
403413
)
404414
+ Op.STOP,
405415
Op.DELEGATECALL(
406-
gas=0x186A0,
416+
gas=100_000,
407417
address=contract_0,
408418
args_offset=0x0,
409419
args_size=0x0,
@@ -419,7 +429,7 @@ def test_sstore_change_from_external_call_in_init_code(
419429
+ Op.STOP * 2
420430
+ Op.INVALID
421431
+ Op.DELEGATECALL(
422-
gas=0x186A0,
432+
gas=100_000,
423433
address=contract_0,
424434
args_offset=0x0,
425435
args_size=0x0,
@@ -436,7 +446,7 @@ def test_sstore_change_from_external_call_in_init_code(
436446
+ Op.STOP * 2
437447
+ Op.INVALID
438448
+ Op.DELEGATECALL(
439-
gas=0x186A0,
449+
gas=100_000,
440450
address=contract_0,
441451
args_offset=0x0,
442452
args_size=0x0,
@@ -451,19 +461,20 @@ def test_sstore_change_from_external_call_in_init_code(
451461
+ Op.POP(Op.CREATE2)
452462
+ Op.POP(
453463
Op.CALL(
454-
gas=0x30D40,
464+
gas=200_000,
455465
address=contract_1,
456466
value=0x0,
457467
args_offset=0x0,
458468
args_size=0x0,
459469
ret_offset=0x0,
460470
ret_size=0x0,
471+
inner_call_cost=200_000,
461472
)
462473
)
463474
+ Op.STOP * 2
464475
+ Op.INVALID
465476
+ Op.DELEGATECALL(
466-
gas=0x186A0,
477+
gas=100_000,
467478
address=contract_0,
468479
args_offset=0x0,
469480
args_size=0x0,
@@ -472,7 +483,7 @@ def test_sstore_change_from_external_call_in_init_code(
472483
)
473484
+ Op.STOP,
474485
Op.STATICCALL(
475-
gas=0x186A0,
486+
gas=100_000,
476487
address=contract_0,
477488
args_offset=0x0,
478489
args_size=0x0,
@@ -488,7 +499,7 @@ def test_sstore_change_from_external_call_in_init_code(
488499
+ Op.STOP * 2
489500
+ Op.INVALID
490501
+ Op.STATICCALL(
491-
gas=0x186A0,
502+
gas=100_000,
492503
address=contract_0,
493504
args_offset=0x0,
494505
args_size=0x0,
@@ -505,7 +516,7 @@ def test_sstore_change_from_external_call_in_init_code(
505516
+ Op.STOP * 2
506517
+ Op.INVALID
507518
+ Op.STATICCALL(
508-
gas=0x186A0,
519+
gas=100_000,
509520
address=contract_0,
510521
args_offset=0x0,
511522
args_size=0x0,
@@ -520,19 +531,20 @@ def test_sstore_change_from_external_call_in_init_code(
520531
+ Op.POP(Op.CREATE2)
521532
+ Op.POP(
522533
Op.CALL(
523-
gas=0x30D40,
534+
gas=200_000,
524535
address=contract_1,
525536
value=0x0,
526537
args_offset=0x0,
527538
args_size=0x0,
528539
ret_offset=0x0,
529540
ret_size=0x0,
541+
inner_call_cost=200_000,
530542
)
531543
)
532544
+ Op.STOP * 2
533545
+ Op.INVALID
534546
+ Op.STATICCALL(
535-
gas=0x186A0,
547+
gas=100_000,
536548
address=contract_0,
537549
args_offset=0x0,
538550
args_size=0x0,
@@ -541,7 +553,15 @@ def test_sstore_change_from_external_call_in_init_code(
541553
)
542554
+ Op.STOP,
543555
]
544-
tx_gas = [200000]
556+
# Fork-aware gas budget: contract-creation intrinsic from the
557+
# fork's calculator, plus the bytecode's own gas cost (which
558+
# already includes the gas forwarded to inner CALLs via opcode
559+
# metadata).
560+
intrinsic = fork.transaction_intrinsic_cost_calculator()(
561+
calldata=tx_data[d],
562+
contract_creation=True,
563+
)
564+
tx_gas = [intrinsic + tx_data[d].gas_cost(fork)]
545565

546566
tx = Transaction(
547567
sender=sender,

0 commit comments

Comments
 (0)