✨ feat(specs,tests): Implement EIP-7954#2276
Conversation
28db343 to
596239c
Compare
|
The mainnet tests that verify EVM opcodes for new sizes need not deploy their own contract and pollute state. I think we should reuse one of the contract deployed in the same suite. |
95ff84c to
1ddd772
Compare
|
@raxhvl had to rebase here to get CI working. Added some minor tweaks as well but going to review more thoroughly now 👀 |
1ddd772 to
95ff84c
Compare
95ff84c to
be62700
Compare
be62700 to
fbb0c0f
Compare
|
note: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## eips/amsterdam/eip-7954 #2276 +/- ##
===========================================================
- Coverage 85.85% 84.00% -1.85%
===========================================================
Files 599 642 +43
Lines 39428 42191 +2763
Branches 3776 4055 +279
===========================================================
+ Hits 33851 35444 +1593
- Misses 4946 6027 +1081
- Partials 631 720 +89
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5c82a52 to
a23b9e1
Compare
I lied, I was able to get to it today! 😄 I added a test case for testing max code WITH max init code together. I'd love your thoughts on it. I also added some simplifications on what you already had and double checked gas, etc. Anything I wasn't sure we wanted I left as comments. Please feel free to push back on any of what I added, comment, etc... and also please lmk if you think the new test case is overkill across all 3 of I'm ready to approve here once you mark these resolved 👀. Nicely done and ty for this! 🚀 |
92b1d44 to
173c9da
Compare
|
@fselmo thanks for this thorough review. responded to all your points. re overkill: i hoped my initial implementation wouldn't be considered overkill for literally changing a single line in the specification. the new test is a valuable addition, but we could a second opinion on whether it's needed for the transition; the other two are definitely required. Lastly, for the mainnet opcode test, can we reuse the deployed contract instead of creating a new one? |
Great thought. I used the |
|
The mainnet test file deploys 4 contract. I think for mainnet test lets only keep My question was can we get |
Yes! I like that. I extracted this to a fixture and used the deterministic deploy so we can reduce it to just this contract when possible, which can also be used in the non-mainnet file to DRY some of the same code over there 👌🏼 |
Done 👍🏼 |
- DRY max size contract for mainnet by including the superset in one and removing subset tests
8b4cef6 to
83d8240
Compare
93352e4
into
ethereum:eips/amsterdam/eip-7954
* ✨ feat: Tests for new contract size * ✨ feat: Gas metering of initcode * ✨ feat: Transition, Mainnet tests * 🧹 chore: Names * fix: use gas constant instead of hard-coded number * fix: remove references to old_max that are not in tests * fix: align with other forks; use 2*code_size for initcode size * chore: fix lint * refactor: simplify gas calculation with gas cost API; add post check * refactor: use opcode metadata for gas calc * feat(test): add max_code with max_init_code in same test * refactor: simplify calls to compute_create_address; no conditional necessary * 🧹 chore: Simplify docstring * 🧹 chore: Simplify opcode based testing * 🧹 chore: Better names * 🧹 chore: types * version Co-authored-by: felipe <fselmo2@gmail.com> * feat(test): use deterministic deploy for similar contracts * refactor: use same max-size self-checking contract for tests - DRY max size contract for mainnet by including the superset in one and removing subset tests --------- Co-authored-by: raxhvl <raxhvl@users.noreply.github.com> Co-authored-by: fselmo <fselmo2@gmail.com>
* ✨ feat: Tests for new contract size * ✨ feat: Gas metering of initcode * ✨ feat: Transition, Mainnet tests * 🧹 chore: Names * fix: use gas constant instead of hard-coded number * fix: remove references to old_max that are not in tests * fix: align with other forks; use 2*code_size for initcode size * chore: fix lint * refactor: simplify gas calculation with gas cost API; add post check * refactor: use opcode metadata for gas calc * feat(test): add max_code with max_init_code in same test * refactor: simplify calls to compute_create_address; no conditional necessary * 🧹 chore: Simplify docstring * 🧹 chore: Simplify opcode based testing * 🧹 chore: Better names * 🧹 chore: types * version Co-authored-by: felipe <fselmo2@gmail.com> * feat(test): use deterministic deploy for similar contracts * refactor: use same max-size self-checking contract for tests - DRY max size contract for mainnet by including the superset in one and removing subset tests --------- Co-authored-by: raxhvl <raxhvl@users.noreply.github.com> Co-authored-by: fselmo <fselmo2@gmail.com>
* ✨ feat: Tests for new contract size * ✨ feat: Gas metering of initcode * ✨ feat: Transition, Mainnet tests * 🧹 chore: Names * fix: use gas constant instead of hard-coded number * fix: remove references to old_max that are not in tests * fix: align with other forks; use 2*code_size for initcode size * chore: fix lint * refactor: simplify gas calculation with gas cost API; add post check * refactor: use opcode metadata for gas calc * feat(test): add max_code with max_init_code in same test * refactor: simplify calls to compute_create_address; no conditional necessary * 🧹 chore: Simplify docstring * 🧹 chore: Simplify opcode based testing * 🧹 chore: Better names * 🧹 chore: types * version Co-authored-by: felipe <fselmo2@gmail.com> * feat(test): use deterministic deploy for similar contracts * refactor: use same max-size self-checking contract for tests - DRY max size contract for mainnet by including the superset in one and removing subset tests --------- Co-authored-by: raxhvl <raxhvl@users.noreply.github.com> Co-authored-by: fselmo <fselmo2@gmail.com>
* ✨ feat: Tests for new contract size * ✨ feat: Gas metering of initcode * ✨ feat: Transition, Mainnet tests * 🧹 chore: Names * fix: use gas constant instead of hard-coded number * fix: remove references to old_max that are not in tests * fix: align with other forks; use 2*code_size for initcode size * chore: fix lint * refactor: simplify gas calculation with gas cost API; add post check * refactor: use opcode metadata for gas calc * feat(test): add max_code with max_init_code in same test * refactor: simplify calls to compute_create_address; no conditional necessary * 🧹 chore: Simplify docstring * 🧹 chore: Simplify opcode based testing * 🧹 chore: Better names * 🧹 chore: types * version Co-authored-by: felipe <fselmo2@gmail.com> * feat(test): use deterministic deploy for similar contracts * refactor: use same max-size self-checking contract for tests - DRY max size contract for mainnet by including the superset in one and removing subset tests --------- Co-authored-by: raxhvl <raxhvl@users.noreply.github.com> Co-authored-by: fselmo <fselmo2@gmail.com>
* ✨ feat: Tests for new contract size * ✨ feat: Gas metering of initcode * ✨ feat: Transition, Mainnet tests * 🧹 chore: Names * fix: use gas constant instead of hard-coded number * fix: remove references to old_max that are not in tests * fix: align with other forks; use 2*code_size for initcode size * chore: fix lint * refactor: simplify gas calculation with gas cost API; add post check * refactor: use opcode metadata for gas calc * feat(test): add max_code with max_init_code in same test * refactor: simplify calls to compute_create_address; no conditional necessary * 🧹 chore: Simplify docstring * 🧹 chore: Simplify opcode based testing * 🧹 chore: Better names * 🧹 chore: types * version Co-authored-by: felipe <fselmo2@gmail.com> * feat(test): use deterministic deploy for similar contracts * refactor: use same max-size self-checking contract for tests - DRY max size contract for mainnet by including the superset in one and removing subset tests --------- Co-authored-by: raxhvl <raxhvl@users.noreply.github.com> Co-authored-by: fselmo <fselmo2@gmail.com>
* ✨ feat: Tests for new contract size * ✨ feat: Gas metering of initcode * ✨ feat: Transition, Mainnet tests * 🧹 chore: Names * fix: use gas constant instead of hard-coded number * fix: remove references to old_max that are not in tests * fix: align with other forks; use 2*code_size for initcode size * chore: fix lint * refactor: simplify gas calculation with gas cost API; add post check * refactor: use opcode metadata for gas calc * feat(test): add max_code with max_init_code in same test * refactor: simplify calls to compute_create_address; no conditional necessary * 🧹 chore: Simplify docstring * 🧹 chore: Simplify opcode based testing * 🧹 chore: Better names * 🧹 chore: types * version Co-authored-by: felipe <fselmo2@gmail.com> * feat(test): use deterministic deploy for similar contracts * refactor: use same max-size self-checking contract for tests - DRY max size contract for mainnet by including the superset in one and removing subset tests --------- Co-authored-by: raxhvl <raxhvl@users.noreply.github.com> Co-authored-by: fselmo <fselmo2@gmail.com>
* ✨ feat: Tests for new contract size * ✨ feat: Gas metering of initcode * ✨ feat: Transition, Mainnet tests * 🧹 chore: Names * fix: use gas constant instead of hard-coded number * fix: remove references to old_max that are not in tests * fix: align with other forks; use 2*code_size for initcode size * chore: fix lint * refactor: simplify gas calculation with gas cost API; add post check * refactor: use opcode metadata for gas calc * feat(test): add max_code with max_init_code in same test * refactor: simplify calls to compute_create_address; no conditional necessary * 🧹 chore: Simplify docstring * 🧹 chore: Simplify opcode based testing * 🧹 chore: Better names * 🧹 chore: types * version Co-authored-by: felipe <fselmo2@gmail.com> * feat(test): use deterministic deploy for similar contracts * refactor: use same max-size self-checking contract for tests - DRY max size contract for mainnet by including the superset in one and removing subset tests --------- Co-authored-by: raxhvl <raxhvl@users.noreply.github.com> Co-authored-by: fselmo <fselmo2@gmail.com>
* ✨ feat: Tests for new contract size * ✨ feat: Gas metering of initcode * ✨ feat: Transition, Mainnet tests * 🧹 chore: Names * fix: use gas constant instead of hard-coded number * fix: remove references to old_max that are not in tests * fix: align with other forks; use 2*code_size for initcode size * chore: fix lint * refactor: simplify gas calculation with gas cost API; add post check * refactor: use opcode metadata for gas calc * feat(test): add max_code with max_init_code in same test * refactor: simplify calls to compute_create_address; no conditional necessary * 🧹 chore: Simplify docstring * 🧹 chore: Simplify opcode based testing * 🧹 chore: Better names * 🧹 chore: types * version Co-authored-by: felipe <fselmo2@gmail.com> * feat(test): use deterministic deploy for similar contracts * refactor: use same max-size self-checking contract for tests - DRY max size contract for mainnet by including the superset in one and removing subset tests --------- Co-authored-by: raxhvl <raxhvl@users.noreply.github.com> Co-authored-by: fselmo <fselmo2@gmail.com>
* ✨ feat: Tests for new contract size * ✨ feat: Gas metering of initcode * ✨ feat: Transition, Mainnet tests * 🧹 chore: Names * fix: use gas constant instead of hard-coded number * fix: remove references to old_max that are not in tests * fix: align with other forks; use 2*code_size for initcode size * chore: fix lint * refactor: simplify gas calculation with gas cost API; add post check * refactor: use opcode metadata for gas calc * feat(test): add max_code with max_init_code in same test * refactor: simplify calls to compute_create_address; no conditional necessary * 🧹 chore: Simplify docstring * 🧹 chore: Simplify opcode based testing * 🧹 chore: Better names * 🧹 chore: types * version Co-authored-by: felipe <fselmo2@gmail.com> * feat(test): use deterministic deploy for similar contracts * refactor: use same max-size self-checking contract for tests - DRY max size contract for mainnet by including the superset in one and removing subset tests --------- Co-authored-by: raxhvl <raxhvl@users.noreply.github.com> Co-authored-by: fselmo <fselmo2@gmail.com>
…2850) * ✨ feat(specs,tests): Implement EIP-7954 (#2276) * ✨ feat: Tests for new contract size * ✨ feat: Gas metering of initcode * ✨ feat: Transition, Mainnet tests * 🧹 chore: Names * fix: use gas constant instead of hard-coded number * fix: remove references to old_max that are not in tests * fix: align with other forks; use 2*code_size for initcode size * chore: fix lint * refactor: simplify gas calculation with gas cost API; add post check * refactor: use opcode metadata for gas calc * feat(test): add max_code with max_init_code in same test * refactor: simplify calls to compute_create_address; no conditional necessary * 🧹 chore: Simplify docstring * 🧹 chore: Simplify opcode based testing * 🧹 chore: Better names * 🧹 chore: types * version Co-authored-by: felipe <fselmo2@gmail.com> * feat(test): use deterministic deploy for similar contracts * refactor: use same max-size self-checking contract for tests - DRY max size contract for mainnet by including the superset in one and removing subset tests --------- Co-authored-by: raxhvl <raxhvl@users.noreply.github.com> Co-authored-by: fselmo <fselmo2@gmail.com> * fix(tests): Failing initcode test (#2355) * refactor(tests): remove gas metering test moved to EIP-8037 The 2D gas metering test for max initcode size via CREATE is an EIP-8037 concern and now lives in the 8037 test suite. The 7954 max initcode enforcement is covered by test_max_initcode_size_via_create. * fix(tests): Merge issues * refactor(tests): Condition EIP-7954 to EIP Inclusion * refactor(tests): gate pre-EIP-7954 code size tests before EIP7954 These ported_static tests hardcode sizes around the pre-EIP-7954 24 KiB MAX_CODE_SIZE / 48 KiB MAX_INITCODE_SIZE limits, so paths that previously failed now succeed on Amsterdam and break their Account.NONEXISTENT expectations. I marked them valid_before(EIP7954). The remaining 22 params still cover EIP-2929 warming on Amsterdam. Equivalent Amsterdam-side coverage is provided by eip7954_increase_max_contract_size/test_max_code_size.py and test_max_initcode_size.py, which size against fork.max_code_size() / fork.max_initcode_size() and follow the same creation-tx, CREATE, and CREATE2 paths with the new limits. * fix(tests): cover warm-after-failed-create over max code size --------- Co-authored-by: raxhvl <10168946+raxhvl@users.noreply.github.com> Co-authored-by: raxhvl <raxhvl@users.noreply.github.com> Co-authored-by: fselmo <fselmo2@gmail.com> Co-authored-by: Mario Vega <marioevz@gmail.com> Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
🗒️ Description
Adds specs and tests for EIP-7954, see test_casee.md for human readable test cases.
test_max_code_size.py:
test_max_initcode_size.py:
test_fork_transition.py:
test_eip_mainnet.py:
🔗 Related Issues or PRs
closes #2275
✅ Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx tox -e statictype(scope):.