Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
373f22f
feat(spec-specs): Add transfer log for all `CALL*` and `SELFDESTRUCT`
Carsons-Eels Jan 13, 2026
ff628ac
fix(spec-specs): emit account closure logs in lexicographical order
Carsons-Eels Jan 22, 2026
ea93db6
feat(test-tests): add eip-7708 eth transfer log tests
spencer-tb Jan 16, 2026
a198590
fix(spec-specs): Refactor topic strings to match EIP
Carsons-Eels Jan 22, 2026
f3d23d2
fix(spec-tests): formatting fixes so static checks pass
Carsons-Eels Jan 22, 2026
da403a9
fix(spec-specs): Move account closure log emission before priority fe…
Carsons-Eels Jan 23, 2026
c30d80f
feat(test-specs): add extra eip-7708 test coverage (#2062)
spencer-tb Jan 23, 2026
96346cb
feat(spec,test): EIP-7708 spec updates for self as target (#2086)
fselmo Jan 29, 2026
16c35ac
feat(test): extend EIP-7708 tests from cases in tracker (#1875) (#2106)
fselmo Jan 30, 2026
5c504d1
fix(test): Use new ``pre_alloc_mutable`` marker for eip7708 test (#2199)
fselmo Feb 12, 2026
71dd85a
fix(test): Update test to account for recent Initcode updates
fselmo Feb 13, 2026
92b7eeb
🧹 chore: Remove duplicate test (#2210)
fselmo Feb 13, 2026
3cdb51c
♻️ refactor(tests): Rename EIP 7708 selfdestruct log to burn (#2211)
raxhvl Feb 25, 2026
e704779
fix(specs): Merge issues
marioevz Mar 24, 2026
c1013d7
fix(tests): Merge issues
marioevz Mar 24, 2026
d942fec
refactor(test-forks): Add EIP-7708
marioevz Apr 8, 2026
622d2b8
refactor(tests): Condition EIP-7708 tests to EIP inclusion
marioevz Apr 8, 2026
d5e75c3
feat(tests): EIP-7708 - finalization burn log ordering + coinbase fee…
spencer-tb Apr 20, 2026
310fe1b
fix(tests): rename GAS_CODE_DEPOSIT_PER_BYTE to CODE_DEPOSIT_PER_BYTE
spencer-tb Apr 20, 2026
7c9e53d
feat(spec-specs): Implement EIP-7778 Block Gas Accounting without Ref…
nerolation Jan 20, 2026
b79fc9f
fix(tests): fix legacy tests to run with eip-7778 (#2048)
gurukamath Jan 21, 2026
519be09
feat(spec-tests): add basic eip7778 test (#2045)
LouisTsai-Csie Jan 22, 2026
407ddd6
feat(spec-tests): add eip-7778 tests for calldata checks (#2060)
gurukamath Jan 22, 2026
45126e3
fix(tests): Fix gas used/spent in EIP-7702 tests (#2068)
marioevz Jan 23, 2026
48343e0
feat(spec-specs): use post refund gas in receipts in EIP-7778 (#2073)
gurukamath Jan 26, 2026
2a03dec
fix(test): Update refspec for EIP-7778 to match latest revision (#2093)
fselmo Jan 28, 2026
29a79d7
feat(test-forks): Add EIP-7778
marioevz Apr 8, 2026
79588e3
refactor(tests): Condition EIP-7778 tests to EIP inclusion
marioevz Apr 8, 2026
99d204d
fix(test): use deterministic iteration order for refund types
spencer-tb Mar 30, 2026
b98a4a9
feat(src): Initial EIP-7843 (SLOTNUM) Implementation (#2007)
felix314159 Jan 21, 2026
dd4ecf2
fix(tests): minor fixes and updates for eip7843 (#2057)
fselmo Jan 21, 2026
75cca87
execution-api 7843 pr 731 implemented (#2101)
felix314159 Jan 29, 2026
a92ef6d
src(fix): framework bug fix for slotnum (#2108)
felix314159 Jan 30, 2026
d473218
refactor(tests): Condition EIP-7843 tests to EIP inclusion
marioevz Apr 8, 2026
d2431f0
fix(specs): align EIP-7843 SLOTNUM gas references with renamed constants
spencer-tb Apr 20, 2026
67cc284
Merge eips/amsterdam/eip-7708 into devnets/bal/4
spencer-tb Apr 20, 2026
a960efa
Merge eips/amsterdam/eip-7778 into devnets/bal/4
spencer-tb Apr 20, 2026
cead727
Merge eips/amsterdam/eip-7843 into devnets/bal/4
spencer-tb Apr 20, 2026
f782360
✨ feat(specs,tests): Implement EIP-7954 (#2276)
raxhvl Feb 25, 2026
d6e15a0
fix(tests): Failing initcode test (#2355)
marioevz Feb 27, 2026
f39ac0a
refactor(tests): remove gas metering test moved to EIP-8037
spencer-tb Mar 12, 2026
0b5934e
fix(tests): Merge issues
marioevz Mar 24, 2026
fc1d9d6
refactor(tests): Condition EIP-7954 to EIP Inclusion
marioevz Apr 8, 2026
d9e35ed
Merge eips/amsterdam/eip-7954 into devnets/bal/4
spencer-tb Apr 20, 2026
fad811a
feat: devnet script optimization to avoid merge conflicts
felix314159 Apr 13, 2026
79555c5
feat: mario feedback
felix314159 Apr 14, 2026
5f0218e
feat(src): EIP-8024 tests added (#2021)
felix314159 Jan 23, 2026
572d12b
feat(test): update EIP-8024 refspec and align on latest changes to EI…
fselmo Jan 29, 2026
b11c8c1
feat(test): EIP-8024 update (#2301)
felix314159 Feb 26, 2026
7e64b34
refactor(tests): Condition EIP-8024 tests to EIP inclusion
marioevz Apr 8, 2026
f0b5688
fix(tests-eip-8024): Fix cross-eip failures (EIP-8037) (#2656)
marioevz Apr 13, 2026
16dc8f6
fix: mypy
felix314159 Apr 16, 2026
d769453
fix(specs): align EIP-8024 DUPN/SWAPN/EXCHANGE gas references
spencer-tb Apr 20, 2026
fb733ff
Merge eips/amsterdam/eip-8024 into devnets/bal/4
spencer-tb Apr 20, 2026
eebfdaa
fix(tests): rename GAS_VERY_LOW to VERY_LOW in EIP-8024 mixin
spencer-tb Apr 20, 2026
f0f571a
feat(tests): adds EIP-7976 test and required framework changes (#2115)
felix314159 Feb 24, 2026
4667bc3
refactor(tests-eip-7976): Condition tests to EIP inclusion
marioevz Apr 13, 2026
7acf44a
chores: update refspec
felix314159 Apr 20, 2026
997e423
fix(tests): drop GAS_ prefix from gas_costs attribute references
spencer-tb Apr 20, 2026
b742d05
Merge eips/amsterdam/eip-7976 into devnets/bal/4
spencer-tb Apr 20, 2026
9d34fc4
feat: devnet script optimization to avoid merge conflicts
felix314159 Apr 13, 2026
ed9122c
feat: mario feedback
felix314159 Apr 14, 2026
2c8b993
refactor: 8037+7981 harmonization, add zero-valued access list token …
felix314159 Apr 14, 2026
2a9bd74
fix: add comment
felix314159 Apr 14, 2026
e99f1a4
feat(tests): adds EIP-7981 test and required framework changes (#2144)
felix314159 Feb 24, 2026
be278d0
refactor(tests-eip-7981): Constrain tests to EIP inclusion
marioevz Apr 14, 2026
275cf2c
fix: harmonize with 8037, correct access list token placement and rem…
felix314159 Apr 14, 2026
1ace451
fix(specs,tests): EIP-7981 - Update implementation and specs (#2682)
nerolation Apr 17, 2026
246fe44
chores: update refspec
felix314159 Apr 17, 2026
030c92e
fix(tests): drop GAS_ prefix from gas_costs attribute references
spencer-tb Apr 20, 2026
a255109
Merge eips/amsterdam/eip-7981 into devnets/bal/4
spencer-tb Apr 20, 2026
ecad2d4
fix(tests): compose EIP-7976 floor cost via calldata_gas_calculator
spencer-tb Apr 20, 2026
1c7b604
feat: devnet script optimization to avoid merge conflicts
felix314159 Apr 13, 2026
175c1ea
feat: mario feedback
felix314159 Apr 14, 2026
c3eb317
refactor: 8037+7981 harmonization, add zero-valued access list token …
felix314159 Apr 14, 2026
7ab495a
fix: add comment
felix314159 Apr 14, 2026
4ea37de
feat(specs, tests): implement EIP-8037 state creation gas cost increa…
spencer-tb Feb 28, 2026
d1c59ad
chore(specs, tests): restore spilled state gas to reservoir on revert…
spencer-tb Mar 6, 2026
7dc23c8
feat(tests): add EIP-8037 multi-block and exact coinbase fee tests
spencer-tb Mar 6, 2026
b67cce1
feat(tests): add EIP-8037 gas validation edge cases from #2426
spencer-tb Mar 6, 2026
e674d68
chore(tests): fix tests and make bulletproof
spencer-tb Mar 6, 2026
1d9588a
refactor(tests,forks): add state gas calculators and use fork methods
spencer-tb Mar 6, 2026
d593147
feat(tests): add new_account variant to insufficient balance CALL test
spencer-tb Mar 6, 2026
e325c48
chore(tests): add valid_until marker to initcode over-limit exception…
spencer-tb Mar 6, 2026
43c82bc
feat(tests): add max initcode 2D gas metering test
spencer-tb Mar 12, 2026
ac482f1
fix(tests): resolve gas constant renames and gas limits after rebase
spencer-tb Mar 17, 2026
7f9ecc6
fix(tests): prevent `tx_gas_limit` double-accumulation across fixture…
felix314159 Mar 20, 2026
4043690
feat(specs,tests): EIP-8037 state gas ordering and clarifications (#2…
spencer-tb Mar 28, 2026
72fa329
fix(specs, tests): remove per-tx state gas pre-check and add 2D block…
spencer-tb Mar 28, 2026
49c4b0b
fix(ported-tests): bump gas limits for Amsterdam (EIP-8037 state gas)
spencer-tb Mar 31, 2026
d7882d2
fix(spec,tests): code deposit ordering and regression tests
spencer-tb Mar 10, 2026
63e0536
fix(spec): track collision-burned gas in regular_gas_used
spencer-tb Mar 10, 2026
9439047
feat(tests): update state gas creation tests with max_code_size case …
spencer-tb Mar 11, 2026
14cd0fd
chore(tests): remove obsolete static test skip list
spencer-tb Mar 31, 2026
58f821e
fix(execute): use configurable gas limit for funding txs (EIP-8037) (…
qu0b Apr 1, 2026
6fbbdc8
chore(lint): fix import sorting and stale type annotation for static …
spencer-tb Apr 1, 2026
9b42e43
feat(tests): EIP-8037 - code deposit halt must discard initcode state…
qu0b Apr 1, 2026
f465f61
feat(tests): EIP-8037 blockchain header gas_used tests (#2611)
spencer-tb Apr 1, 2026
bf03db9
feat(tests): block-level 2D gas accounting tests for EIP-8037 (#2610)
qu0b Apr 1, 2026
29b1fc1
feat(spec-specs): EIP-8037 - move CREATE state gas charge after initc…
spencer-tb Apr 2, 2026
863bb56
refactor(tests-eip8037): Condition tests to EIP inclusion
marioevz Apr 9, 2026
95da1d4
fix(tests): Use `pytest.mark.valid_before` for EIP-8037
marioevz Apr 9, 2026
2247b25
fix(specs-amsterdam): Lint fails
marioevz Apr 10, 2026
4576059
fix(fill): use fork_at(), use is_eip_enabled(eip_number=7976) to pick…
felix314159 Apr 14, 2026
98b2780
fix: mypy
felix314159 Apr 16, 2026
a890d31
feat(spec-specs, tests): EIP-8037 - zero execution state gas on top-l…
kclowes Apr 19, 2026
922f3bd
feat(spec-specs, tests): EIP-8037 - CREATE failure refunds state gas …
spencer-tb Apr 19, 2026
8fa777f
feat(spec-specs, tests): EIP-8037 - 0 to x to 0 SSTORE refunds to sta…
spencer-tb Apr 19, 2026
a04fe34
feat(tests): EIP-8037 - CALL with value to selfdestructed account (#2…
kclowes Apr 19, 2026
f181300
feat(spec-specs, tests): EIP-8037 - SELFDESTRUCT same-tx refunds stat…
spencer-tb Apr 19, 2026
3d0975f
feat(spec-specs, tests): EIP-8037 - immutable intrinsic state gas for…
spencer-tb Apr 19, 2026
83199af
feat(spec-specs, tests): EIP-8037 - per-dimension block gas limit che…
kclowes Apr 19, 2026
954bc64
feat(tests): EIP-8073 - remove stale header verify on CALL to selfde…
spencer-tb Apr 20, 2026
0272ae1
chore(tests): restore and extend Amsterdam ported static skip list (#…
spencer-tb Apr 20, 2026
80ddcb3
feat(spec-specs, tests): EIP-8037 SSTORE refund clamp and initcode fi…
spencer-tb Apr 20, 2026
a519d24
feat(spec-specs, tests): EIP-8037 - apply calldata floor to sender re…
spencer-tb Apr 20, 2026
c47cdea
feat(spec-specs,tests): EIP-8037 nested child frame refunds (#2733)
fselmo Apr 20, 2026
9db6487
feat(tests): EIP-8037 additional state gas coverage (#2718)
spencer-tb Apr 20, 2026
f2049fb
feat(tests, spec-specs): add full cost per state byte pricing functio…
spencer-tb Apr 21, 2026
f83131f
fix(rebase): align EIP-8037 with forks/amsterdam GasCosts refactor
spencer-tb Apr 21, 2026
897ca4b
Merge eips/amsterdam/eip-8037 into devnets/bal/4
spencer-tb Apr 21, 2026
fdd8fc6
fix(tests): harmonize cross-EIP tests with EIP-8037 state-gas model
spencer-tb Apr 21, 2026
1ccdbe5
fix(ci): use --until=Amsterdam for bal fixture release
spencer-tb Apr 21, 2026
90a819f
fix(tests): harmonize cross-EIP tests with EIP-8037 state-gas model
spencer-tb Apr 21, 2026
1d253af
fix(tests): EIP-8037 workaround
marioevz Apr 21, 2026
1608701
fix(tests): EIP-8037 workaround
marioevz Apr 21, 2026
0c8f07f
feat(test-forks): EIP-8037 add SELFDESTRUCT refund
marioevz Apr 21, 2026
524b446
fix(tests): EIP-7708 + 8037 cross-EIP fixes
marioevz Apr 21, 2026
6e839ee
feat(specs): EIP-8037: Make CPSB fixed
marioevz Apr 27, 2026
6f86b75
feat(test-forks): EIP-8037: Make CPSB fixed
marioevz Apr 27, 2026
28e6130
feat(github): Github feature snøbal-devnet-4
marioevz Apr 27, 2026
f1d9853
refactor(test-execute): include EIP-8037 state-gas in contract deploy…
qu0b Apr 27, 2026
befad1c
fix: calculate and return regular gas and deploy gas limit
fselmo Apr 27, 2026
98eec05
Merge remote-tracking branch 'upstream/forks/amsterdam' into devnets/…
spencer-tb Apr 28, 2026
cecfb0c
fix(test-forks): EIP-8037: Regular cost/state cost
marioevz Apr 30, 2026
d3e0e75
fix(tests): EIP-8037: All test changes
marioevz Apr 30, 2026
38610f0
feat(specs): EIP-8037: Frame-level accounting
marioevz Apr 30, 2026
a81fee3
feat(specs): EIP-8037: Revert frame-level accounting
marioevz Apr 30, 2026
67749af
fix(tests): EIP-8037: Revert frame-level test changes
spencer-tb Apr 30, 2026
ffeb862
fix(tests): EIP-8037: Revert frame-level mcopy test changes
spencer-tb Apr 30, 2026
dc8efdf
fix(test): fix bal test by reverting back to forks/amsterdam state
fselmo Apr 30, 2026
f99909b
fix(test): re-calculate the gas forwarded and burned for create colli…
fselmo Apr 30, 2026
c23f9cf
fix(test): fix test with proper gas accounting with metadata
fselmo Apr 30, 2026
a0d0fc4
chore: just fix + just static linting
fselmo Apr 30, 2026
deb39ca
fix(test): Fix some remaining failing tests; remove some related to o…
fselmo Apr 30, 2026
625bf26
feat(tests, spec-specs): correct/new halt/reservior behavior
spencer-tb Apr 30, 2026
354f4b7
feat(tests): fix ported static stCreate2
spencer-tb Apr 30, 2026
d1518f1
feat(tests): fix ported static stRevertTest
spencer-tb Apr 30, 2026
249cbff
feat(tests): fix ported static stCreate2
spencer-tb Apr 30, 2026
f30c431
chore(ci): bump snobal 6
spencer-tb Apr 30, 2026
b0533bf
test(tests): Add a nested CALL frame test for reservoir check on halt…
fselmo Apr 30, 2026
8b2adfb
feat(tests): state -> blockchain test to check header gas used for ne…
fselmo Apr 30, 2026
03e0c33
fix(tests): fix withdrawals test setup while filling
fselmo Apr 30, 2026
18f96b8
chore(ci,docs): enable HTML artifact publish for devnets/snobal/6
danceratopz Apr 30, 2026
78977c2
fix: turn on skipped EIP-7702 tests
fselmo May 1, 2026
7167eba
feat(test): calculate gas and header verify for create collision test
fselmo May 1, 2026
3178c2a
fix(spec-specs): correct gas accounting for blocks under create colli…
fselmo May 1, 2026
c288bcd
feat(test): configure block gas used with header_verify
fselmo May 1, 2026
9b3961a
Snobal tests for bad 7702 state gas accounting
Carsons-Eels May 1, 2026
c94f3c9
chore: re-skip tests that are not for devnet6
fselmo May 1, 2026
14389ab
chore(ported_static): sync from forks/amsterdam onto snøbal/6 (#2783)
leolara May 5, 2026
e87390b
fix(ported_static): fork-specific Amsterdam balance for OoG refund te…
leolara May 5, 2026
40ce50b
feat(spec-specs, tests): EIP-8037 halt refunds spilled state gas (#2815)
spencer-tb May 7, 2026
5416cbb
fix(spec,test): 7702 refund block-level gas accounting for EIP-8037 (…
fselmo May 7, 2026
85b7f8a
feat(tests): 8037-Add tests for 7702 interactions (#2722)
kclowes May 7, 2026
eb80b43
feat(spec-specs, tests): EIP-8037 more refund fixes (#2823)
spencer-tb May 8, 2026
9d3906e
feat(spec-specs, tests): 8037 more 2d edge cases (#2735)
kclowes May 8, 2026
2e707c2
feat(spec,test): update bal-devnet-7 EIP-8037 bytes values; CPSB 1174…
fselmo May 10, 2026
676afaf
feat(spec-specs, tests): EIP-8037 tx created contracts destroyed in s…
spencer-tb May 10, 2026
7b3e801
feat(spec-specs, tests): eip-8037 system transaction gas state reservoir
spencer-tb May 10, 2026
bcc2a87
feat(tests): eip-8037 cover CALL+value+new_account state-gas refund
spencer-tb May 11, 2026
3a951c7
fix(ported_static): bump gas budgets for EIP-8037 state-gas headroom …
leolara May 11, 2026
a0a1ed1
fix(spec,test): align with latest EIP-8037 auth refund changes (#2836)
fselmo May 12, 2026
8148f2e
feat(spec-specs, tests): remove SD state gas refunds from EIP-8037 (#…
spencer-tb May 12, 2026
b7860ca
fix(ported_static): fork-conditional gas bumps for ~340 EIP-8037 Amst…
leolara May 12, 2026
7546b83
feat(tests): EIP-8037 create OOG state gas boundary coverage (#2847)
spencer-tb May 13, 2026
e321b62
Merge remote-tracking branch 'upstream/forks/amsterdam' into devnets/…
spencer-tb May 13, 2026
73083f0
fix(tests): post-merge artifacts and SD state-gas bump
spencer-tb May 13, 2026
cc3b3f8
fix(tests): post-merge static lint and typecheck
spencer-tb May 13, 2026
b4db478
fix(tests): drop unused gas_sstore in legacy gas harness generator
spencer-tb May 13, 2026
bcb8dc5
feat(tests, spec-specs): refill auth state gas on delegation clear fo…
spencer-tb May 13, 2026
1912e04
chore(test-client-clis): update NethermindExceptionMapper strings for…
DarkLord017 May 18, 2026
fdfb8b1
feat(tests): EIP-7981 zero-byte calldata floor cost rejection
chfast May 18, 2026
dffc4cf
Merge remote-tracking branch 'upstream/forks/amsterdam' into devnets/…
spencer-tb May 18, 2026
1f6a553
fix(tests): harmonize EIP-7928 cross-tx BAL tests with EIP-8037 gas m…
spencer-tb May 18, 2026
8eb54b4
feat(tests, spec-specs): eip8037 sstore/collision clear dynamics (#2863)
fselmo May 18, 2026
a3e5201
feat(tests): EIP-8037 isolate intrinsic-regular > cap with floor < ca…
chfast May 18, 2026
15ee1b1
fix: linting issue
LouisTsai-Csie May 20, 2026
765f607
fix(test-benchmark): disable cache strats except NO_CACHE for now (#2…
CPerezz Apr 30, 2026
3c11409
refactor(test-benchmark): increase auth tx gas limit for storage benc…
LouisTsai-Csie Apr 29, 2026
159d43b
chore: bump gas budget
LouisTsai-Csie May 12, 2026
2eee485
chore: change base address for funding account
LouisTsai-Csie May 15, 2026
8a911bb
refactor(test-benchmark): support 8037 for `SSTORE` benchmark (#2787)
LouisTsai-Csie May 7, 2026
ea8c452
fix: import issue
LouisTsai-Csie May 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .github/configs/docs-branches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ branches:
label: "Amsterdam"
- path: "devnets/bal/4"
label: "bal-devnet-4"
- path: "devnets/snobal/6"
label: "bal-devnet-6"
7 changes: 6 additions & 1 deletion .github/configs/feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@ benchmark_fast:

bal:
evm-type: eels
fill-params: --fork=Amsterdam
fill-params: --until=Amsterdam
feature_only: true

snobal-devnet-6:
evm-type: eels
fill-params: --until=Amsterdam
feature_only: true
4 changes: 4 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ignores:
- EIP8037_REMAINING_FAILURES.md
- EIP8037_PORTED_STATIC_FAILURES.md
- EIP8037_IMPLEMENTATION.md
2 changes: 1 addition & 1 deletion docs/writing_tests/test_markers.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Useful to mark tests to fail if a new refund type is introduced by a future fork
```python
import pytest

from execution_testing import Address, Alloc, RefundTypes, StateTestFiller
from execution_testing import Address, Alloc, RefundType, StateTestFiller

@pytest.mark.with_all_refund_types
@pytest.mark.valid_from("Prague")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def deploy_deterministic_factory_contract(
fund_tx = Transaction(
to=deploy_tx_sender,
value=fund_amount,
gas_limit=200_000,
gas_price=gas_price,
sender=seed_key,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_recover_funds(
del index

remaining_balance = eth_rpc.get_balance(eoa)
refund_gas_limit = 21_000
refund_gas_limit = 200_000
tx_cost = refund_gas_limit * gas_price
if remaining_balance < tx_cost:
pytest.skip(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,55 @@ class _DeferredFundAddress:
minimum_balance: bool


def _compute_deploy_gas_limit(
fork: Fork,
*,
deploy_code_size: int,
initcode: Bytes | Initcode,
storage_slots: int = 0,
) -> Tuple[int, int]:
"""
Compute the gas_limit for a contract-deploy transaction, split
into the EIP-7825 cap-bound regular portion and the total
(regular + state) deploy gas.

Per EIP-8037, the per-tx 2^24 cap binds only the regular-gas
portion of intrinsic gas; state gas is drawn from the per-block
reservoir and may push tx.gas above the cap. We therefore return
both values: callers compare ``regular_gas`` against
``transaction_gas_limit_cap()`` and use ``deploy_gas_limit`` as
the actual ``tx.gas`` field. Pre-Amsterdam, the state-gas helpers
return 0 and ``deploy_gas_limit == regular_gas``.

The regular portion is doubled as a safety buffer (gas estimation
is approximate); the state portion is exact and is not doubled.
"""
gas_costs = fork.gas_costs()
memory_expansion_gas_calculator = fork.memory_expansion_gas_calculator()
calldata_gas_calculator = fork.calldata_gas_calculator()

# Regular-gas portion (subject to EIP-7825 cap). On EIP-8037 forks
# `TX_CREATE` folds in the new-account state gas; back that out so
# we only count regular gas here.
regular_gas = gas_costs.TX_BASE + gas_costs.TX_CREATE
regular_gas -= fork.transaction_intrinsic_state_gas(contract_creation=True)
regular_gas += storage_slots * 22_600
regular_gas += deploy_code_size * gas_costs.CODE_DEPOSIT_PER_BYTE
regular_gas += memory_expansion_gas_calculator(
new_bytes=len(bytes(initcode))
)
regular_gas += calldata_gas_calculator(data=initcode)
regular_gas = regular_gas * 2

# State-gas portion (drawn from block reservoir, not capped).
state_gas = fork.transaction_intrinsic_state_gas(contract_creation=True)
state_gas += fork.code_deposit_state_gas(code_size=deploy_code_size)
state_gas += storage_slots * fork.sstore_state_gas()

deploy_gas_limit = regular_gas + state_gas
return regular_gas, deploy_gas_limit


class Alloc(SharedAlloc):
"""A custom class that inherits from the original Alloc class."""

Expand Down Expand Up @@ -257,6 +306,7 @@ def __init__(
address_stubs: AddressStubs | None = None,
block_number: int = 0,
timestamp: int = 0,
funding_gas_limit: int = 200_000,
**kwargs: Any,
) -> None:
"""Initialize the pre-alloc with the given parameters."""
Expand All @@ -269,6 +319,7 @@ def __init__(
self._address_stubs = address_stubs or AddressStubs(root={})
self._block_number = block_number
self._timestamp = timestamp
self._funding_gas_limit = funding_gas_limit

def code_pre_processor(self, code: Bytecode) -> Bytecode:
"""Pre-processes the code before setting it."""
Expand Down Expand Up @@ -321,11 +372,6 @@ def _deterministic_deploy_contract(
fork = self._fork.fork_at(
block_number=self._block_number, timestamp=self._timestamp
)
gas_costs = fork.gas_costs()
memory_expansion_gas_calculator = (
fork.memory_expansion_gas_calculator()
)
calldata_gas_calculator = fork.calldata_gas_calculator()
if not isinstance(deploy_code, Bytes):
deploy_code = Bytes(deploy_code)
if initcode is None:
Expand All @@ -348,18 +394,18 @@ def _deterministic_deploy_contract(
raise ValueError(
f"initcode too large {len(initcode)} > {max_initcode_size}"
)
deploy_gas_limit = gas_costs.TX_BASE + gas_costs.TX_CREATE
deploy_gas_limit += len(deploy_code) * gas_costs.CODE_DEPOSIT_PER_BYTE
deploy_gas_limit += memory_expansion_gas_calculator(
new_bytes=len(initcode)
regular_gas, deploy_gas_limit = _compute_deploy_gas_limit(
fork,
deploy_code_size=len(deploy_code),
initcode=initcode,
)
deploy_gas_limit += calldata_gas_calculator(data=initcode)
deploy_gas_limit = deploy_gas_limit * 2
# Per EIP-8037, the per-tx 2^24 cap (EIP-7825) binds only the
# regular-gas portion; state gas is drawn from the block reservoir.
tx_gas_limit_cap = fork.transaction_gas_limit_cap()
if tx_gas_limit_cap and deploy_gas_limit > tx_gas_limit_cap:
if tx_gas_limit_cap and regular_gas > tx_gas_limit_cap:
raise ValueError(
f"deterministic deploy gas limit exceeds the transaction "
f"gas limit cap: {deploy_gas_limit} > {tx_gas_limit_cap}"
f"deterministic deploy regular gas exceeds the transaction "
f"gas limit cap: {regular_gas} > {tx_gas_limit_cap}"
)

# Defer the on-chain check; the deploy tx (if needed) and the
Expand Down Expand Up @@ -403,11 +449,6 @@ def _deploy_contract(
fork = self._fork.fork_at(
block_number=self._block_number, timestamp=self._timestamp
)
gas_costs = fork.gas_costs()
memory_expansion_gas_calculator = (
fork.memory_expansion_gas_calculator()
)
calldata_gas_calculator = fork.calldata_gas_calculator()

if not isinstance(storage, Storage):
storage = Storage(storage) # type: ignore
Expand Down Expand Up @@ -443,13 +484,10 @@ def _deploy_contract(

initcode_prefix = Bytecode()

deploy_gas_limit = gas_costs.TX_BASE + gas_costs.TX_CREATE

if len(storage.root) > 0:
initcode_prefix += sum(
Op.SSTORE(key, value) for key, value in storage.root.items()
)
deploy_gas_limit += len(storage.root) * 22_600

assert isinstance(code, Bytecode), (
f"incompatible code type: {type(code)}"
Expand All @@ -460,14 +498,9 @@ def _deploy_contract(
if len(code) > max_code_size:
raise ValueError(f"code too large: {len(code)} > {max_code_size}")

deploy_gas_limit += len(code) * gas_costs.CODE_DEPOSIT_PER_BYTE

prepared_initcode = Initcode(
deploy_code=code, initcode_prefix=initcode_prefix
)
deploy_gas_limit += memory_expansion_gas_calculator(
new_bytes=len(bytes(prepared_initcode))
)

max_initcode_size = fork.max_initcode_size()
initcode_len = len(prepared_initcode)
Expand All @@ -476,14 +509,19 @@ def _deploy_contract(
f"initcode too large {initcode_len} > {max_initcode_size}"
)

deploy_gas_limit += calldata_gas_calculator(data=prepared_initcode)

deploy_gas_limit = deploy_gas_limit * 2
regular_gas, deploy_gas_limit = _compute_deploy_gas_limit(
fork,
deploy_code_size=len(code),
initcode=prepared_initcode,
storage_slots=len(storage.root),
)
# Per EIP-8037, the per-tx 2^24 cap (EIP-7825) binds only the
# regular-gas portion; state gas is drawn from the block reservoir.
tx_gas_limit_cap = fork.transaction_gas_limit_cap()
if tx_gas_limit_cap and deploy_gas_limit > tx_gas_limit_cap:
if tx_gas_limit_cap and regular_gas > tx_gas_limit_cap:
raise ValueError(
f"deploy gas limit exceeds the transaction gas limit cap: "
f"{deploy_gas_limit} > {tx_gas_limit_cap}"
f"deploy regular gas exceeds the transaction gas limit cap: "
f"{regular_gas} > {tx_gas_limit_cap}"
)

deploy_tx = self._add_pending_tx(
Expand Down Expand Up @@ -557,21 +595,36 @@ def _fund_eoa(
# Send a transaction to fund the EOA
fund_tx: PendingTransaction | None = None
if delegation is not None or storage is not None:
fork = self._fork.fork_at(
block_number=self._block_number, timestamp=self._timestamp
)
intrinsic_calc = fork.transaction_intrinsic_cost_calculator()

if storage is not None:
if not isinstance(storage, Storage):
storage = Storage.model_validate(storage)
logger.debug(
f"Deploying storage contract for EOA {eoa} "
f"with {len(storage)} storage slots"
)
sstore_address = self.deploy_contract(
code=(
sum(
Op.SSTORE(key, value)
for key, value in storage.items()

storage_init_code = (
sum(
Op.SSTORE(
key,
value,
# gas accounting
key_warm=False,
original_value=0,
current_value=0,
new_value=1,
)
+ Op.STOP
for key, value in storage.items()
)
+ Op.STOP
)
sstore_address = self.deploy_contract(
code=storage_init_code,
)
logger.debug(
f"Storage contract deployed at {sstore_address} "
Expand All @@ -591,7 +644,11 @@ def _fund_eoa(
signer=eoa,
),
],
gas_limit=100_000,
gas_limit=(
intrinsic_calc(authorization_list_or_count=1)
+ storage_init_code.gas_cost(fork)
+ 500_000
),
Comment on lines +647 to +651

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the hardcoded gas limit, adjust to dynamic gas cost calculation and leave some buffer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This applies to other changes within the file.

)
eoa.nonce = Number(eoa.nonce + 1)

Expand All @@ -616,7 +673,7 @@ def _fund_eoa(
signer=eoa,
),
],
gas_limit=100_000,
gas_limit=(intrinsic_calc(authorization_list_or_count=1)),
)
eoa.nonce = Number(eoa.nonce + 1)
else:
Expand All @@ -634,7 +691,7 @@ def _fund_eoa(
signer=eoa,
),
],
gas_limit=100_000,
gas_limit=intrinsic_calc(authorization_list_or_count=1),
)
eoa.nonce = Number(eoa.nonce + 1)

Expand All @@ -645,6 +702,7 @@ def _fund_eoa(
target=label,
to=eoa,
value=amount,
gas_limit=self._funding_gas_limit,
)

if fund_tx is not None:
Expand Down Expand Up @@ -862,6 +920,7 @@ def _resolve_fund_addresses(self) -> None:
target=d.address.label,
to=d.address,
value=d.amount - current_balance,
gas_limit=self._funding_gas_limit,
)
new_balance = d.amount
else:
Expand All @@ -876,6 +935,7 @@ def _resolve_fund_addresses(self) -> None:
target=d.address.label,
to=d.address,
value=d.amount,
gas_limit=self._funding_gas_limit,
)
new_balance = current_balance + d.amount

Expand Down Expand Up @@ -985,6 +1045,7 @@ def pre(
max_fee_per_gas: int,
max_priority_fee_per_gas: int,
dry_run: bool,
sender_fund_refund_gas_limit: int,
request: pytest.FixtureRequest,
) -> Generator[Alloc, None, None]:
"""Return default pre allocation for all tests (Empty alloc)."""
Expand All @@ -1009,6 +1070,7 @@ def pre(
chain_id=chain_config.chain_id,
node_id=request.node.nodeid,
address_stubs=address_stubs,
funding_gas_limit=sender_fund_refund_gas_limit,
)

# Yield the pre-alloc for usage during the test
Expand All @@ -1034,7 +1096,7 @@ def pre(
# Build refund transactions
refund_txs: List[Transaction] = []
skipped_refunds = 0
refund_gas_limit = 21_000
refund_gas_limit = sender_fund_refund_gas_limit
tx_cost = refund_gas_limit * max_fee_per_gas
for idx, eoa in enumerate(funded_eoas):
account = eth_rpc.get_account(eoa, skip_code=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def pytest_addoption(parser: pytest.Parser) -> None:
action="store",
dest="sender_fund_refund_gas_limit",
type=Wei,
default=21_000,
default=200_000,
help=(
"Gas limit set for the funding transactions of each worker's sender key." # noqa: E501
),
Expand Down
Loading