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

EIP-4788: parent beacon block root #2135

Conversation

fselmo
Copy link
Collaborator

@fselmo fselmo commented Jan 23, 2024

What was wrong?

EIP-4788 needs implementation for the cancun network upgrade

How was it fixed?

Implement EIP-4788:

  • Incorporate the parent_beacon_block_root into block headers, beginning with Cancun.
  • Update the code at BEACON_ROOTS_ADDRESS at init of CancunVM if no code exists at that address.
  • Update the values at the specified slots for BEACON_ROOTS_ADDRESS as per specifications on EIP-4788.

Something we need to consider is how we want to handle the beacon roots contract when the tests don't initialize a pre-state with the right code at that address.[I opted to inject the code at init of the CancunVM if it doesn't already exist. We can revise this by the end of the Cancun changes if need be.]

Note: All related tests are passing except for:

  • 2 tests that test for a transaction with type=3 related to EIP-4844 not having been implemented yet
  • 1 test that tests the beacon root along with a test for EIP-6780, related to self-destruct, which has not been implemented yet

Reviewers can check the above tests ^ with the following command:

pytest tests/json-fixtures/blockchain/test_blockchain.py --fork Cancun -k beacon_root

Todo:

Cute Animal Picture

20240124_143930

@fselmo fselmo force-pushed the eip-4788-parent-beacon-block-root branch 2 times, most recently from dcb1981 to 9262f9e Compare January 23, 2024 20:58
- Should we make sure to update the Cancun state with the contract at
  BEACON_ROOTS_ADDRESS if it doesn't exist yet since it is vital to
  this EIP?
@fselmo fselmo force-pushed the eip-4788-parent-beacon-block-root branch from 9262f9e to 9628868 Compare January 24, 2024 20:32
@fselmo fselmo marked this pull request as ready for review January 24, 2024 22:20
Copy link
Collaborator

@pacrob pacrob left a comment

Choose a reason for hiding this comment

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

lgtm!

@fselmo fselmo merged commit 1666a58 into ethereum:cancun-network-upgrade Jan 25, 2024
45 checks passed
fselmo added a commit that referenced this pull request Jan 25, 2024
@fselmo fselmo deleted the eip-4788-parent-beacon-block-root branch January 25, 2024 18:11
fselmo added a commit to fselmo/py-evm that referenced this pull request Feb 14, 2024
pacrob pushed a commit to pacrob/py-evm that referenced this pull request Feb 21, 2024
pacrob added a commit that referenced this pull request Feb 21, 2024
* Fix error in epub docs build, add epub and pdf docs build to CI, delete unused auto-gen docs that appear with `make build-docs`

* set up separate validate-docs-ci make command to avoid heavy local latex reqs

* Compile release notes for v0.9.0-beta.1

* Bump version: 0.8.0-beta.1 → 0.9.0-beta.1

* fix: msg.data mutability

this commit modifies `msg.data` so that it is an immutable `bytes` copy
of the input. the issue is that right now it is a view of memory, which
means the caller can trample the msg.data buffer after the call returns
(and `msg.data` gets mutated). this is not necessarily a problem for the
VM correctness, but it is an issue for integrators that inspect
`msg.data` after a call, because `msg.data` will not retain its original
value.

as a refactor, since `Computation.memory_read()` is completely dead
(and more importantly, probably a footgun), this commit also removes
`memory_read()` from the `ComputationAPI` interface as well as the
`Computation` implementation.

* newsfragment for #2140

* Establish base feature branch for Cancun network upgrade

* Add cancun to tests / helpers

* Fix lint issues

* Create test run for cancun; silence in circleci for now

* Add Cancun network to chain_vm_configuration

* Update Cancun header to include new fields

- Update ``CancunMiningHeader``, ``CancunBlockHeader`` and ``CancunBlock`` to
  include the new fields: ``blob_gas_used``, ``excess_blob_gas``, and ``parent_beacon_block_root``.

- Inherit from ``ShanghaiBackwardsHeader`` and create a ``CanunBackwardsHeader`` that can serialize all known headers.

* newsfragment for #2134

* Get rid of Cancun mining header concept

* Implement most of EIP-4788 - considerations:

- Should we make sure to update the Cancun state with the contract at
  BEACON_ROOTS_ADDRESS if it doesn't exist yet since it is vital to
  this EIP?

* newsfragment for #2135

* If no code exists at the BEACON_ROOTS_ADDRESS, make it so.

---------

Co-authored-by: Charles Cooper <cooper.charles.m@gmail.com>
Co-authored-by: fselmo <fselmo2@gmail.com>
fselmo added a commit that referenced this pull request Feb 21, 2024
fselmo added a commit to fselmo/py-evm that referenced this pull request Mar 9, 2024
fselmo added a commit that referenced this pull request Mar 14, 2024
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

2 participants