Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shanghai hard fork support #2093

Merged
merged 16 commits into from Apr 6, 2023
Merged

Conversation

fselmo
Copy link
Collaborator

@fselmo fselmo commented Feb 27, 2023

What was wrong?

Shanghai fork support needed:

How was it fixed?

  • Implement the above EIPs for Shanghai hard fork support

Notes:
- The fixtures submodule (ethereum/tests) was updated to the latest v12.
- There are many Shanghai ethereum/tests related to EOF even though this was kicked down the line to the Cancun hard fork. I've turned these off for now with a TODO to turn these back on once EOF is implemented. Currently, all other Shanghai-related tests are passing.

Todo:

  • Clean up commit history
  • Add entry to the release notes
  • Properly set up the Shanghai transition tests (will fail for now)
  • Configure core tests with Shanghai
  • Silence and document issue for newly failing Merge and London tests from ethereum/tests fixture update
  • Add cute animal picture :)
  • Clean up / refactoring
  • Any more tests?

Cute Animal Picture

20230227_170915

- Implement base classes for Shanghai fork, inheriting from Paris
- Implement EIP-3651: Warm COINBASE
- Implement EIP-3855: PUSH0 instruction
- Implement EIP-3860: Limit and meter initcode
- Implement EIP-6049: Deprecate SELFDESTRUCT
@fselmo fselmo changed the title Initial shanghai changes Shanghai hard fork support Feb 27, 2023
Copy link
Collaborator Author

@fselmo fselmo left a comment

Choose a reason for hiding this comment

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

I just left some TODO notes for myself refactoring from the first set of commits... nothing to see here yet 👀

eth/db/chain.py Outdated Show resolved Hide resolved
eth/db/chain.py Outdated Show resolved Hide resolved
eth/db/chain.py Outdated Show resolved Hide resolved
eth/db/trie.py Outdated Show resolved Hide resolved
eth/rlp/sedes.py Outdated Show resolved Hide resolved
eth/vm/computation.py Outdated Show resolved Hide resolved
eth/vm/forks/london/blocks.py Outdated Show resolved Hide resolved
eth/vm/state.py Outdated Show resolved Hide resolved
eth/vm/state.py Outdated Show resolved Hide resolved
eth/vm/state.py Outdated Show resolved Hide resolved
fselmo added a commit to fselmo/py-evm that referenced this pull request Feb 28, 2023
fselmo added a commit to fselmo/py-evm that referenced this pull request Feb 28, 2023
@fselmo fselmo marked this pull request as ready for review February 28, 2023 00:16
fselmo added a commit to fselmo/py-evm that referenced this pull request Feb 28, 2023
fselmo added a commit to fselmo/py-evm that referenced this pull request Mar 1, 2023
- Implement EIP-4895: Beacon chain push withdrawals as operations
- Clean up some logic along the way and tighten up typing
- Update ``ethereum/tests`` (fixtures subdirectory)
@fselmo fselmo force-pushed the initial-shanghai-changes branch 4 times, most recently from d3dac44 to f9d89cd Compare March 7, 2023 00:48
@fselmo fselmo requested a review from kclowes March 7, 2023 18:29
@fselmo fselmo force-pushed the initial-shanghai-changes branch 3 times, most recently from 9d445ed to 87d4417 Compare March 7, 2023 19:33
@fselmo fselmo mentioned this pull request Mar 13, 2023
7 tasks
@fselmo fselmo force-pushed the initial-shanghai-changes branch 2 times, most recently from 1ee17e9 to fd99f36 Compare March 16, 2023 20:35
- Validate withdrawal fields as per EIP-4895
- Add some gut check tests for validation of withdrawal fields
- Simplify empty account cleanup logic when withdrawal amount is 0
- Check for empty accounts to delete after applying all withdrawals, much in the same way we check at the end of transaction computations.
- Add a test for testing withdrawal retrieval from the chaindb
- Minor refactoring and fixes
- Add a deprecate method wrapper
- Use this to wrap the opcode instructions for ``SELFDESTRUCT`` in the ``SHANGHAI_OPCODES``
- Add tests to make sure the deprecation warning is only listed for ``SELFDESTRUCT`` and only within the Shanghai VM
- Update ``eth-typing`` to ``3.3.0``
- Use ``ForkName.Shanghai`` value in tests
- Create a more general class method for validating the create message as a whole and bring the initcode size validation into that. This way, if other fields of the create message need validation in the future, we have a more useful method that's already abstracted and can be invoked in the proper VM computation class.

- Consume the initcode cost before the computation starts for create transactions and handle initcode cost in the opcode implementations for ``CREATE`` and ``CREATE2``.
- All test vectors now applied to ``Shanghai`` rules.
- Tests that fit into the INCORRECT_UPSTREAM_TESTS in ``test_blockchain.py``
- Tests that time out
Copy link
Collaborator

@kclowes kclowes left a comment

Choose a reason for hiding this comment

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

Looks good to me! I just left a tiny nit and a question.

eth/vm/base.py Outdated Show resolved Hide resolved
eth/vm/forks/byzantium/headers.py Show resolved Hide resolved
@fselmo fselmo merged commit 72bb43e into ethereum:master Apr 6, 2023
33 checks passed
fselmo added a commit that referenced this pull request Apr 6, 2023
fselmo added a commit that referenced this pull request Apr 6, 2023
@fselmo fselmo deleted the initial-shanghai-changes branch April 6, 2023 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants