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

epbs interop branch #14627

Open
wants to merge 77 commits into
base: epbs
Choose a base branch
from
Open

epbs interop branch #14627

wants to merge 77 commits into from

Conversation

terencechain
Copy link
Member

No description provided.

potuz and others added 30 commits November 4, 2024 07:06
This implements a helper to get the ptc committee from a state. It uses
the cached beacon committees if possible

It also implements a helper to compute the largest power of two of a
uint64 and a helper to test for nil payload attestation messages
* Add ePBS to db
* Modify `get_ptc` function to follow the Python spec

* Assign PTC members from the beginning of beacon committee array
* Add `remove_flag` and its unit test

* Add a test case trying to remove a flag that is not set
* Ensure EPBS state getters and setters check versions

* Rename to LatestExecutionPayloadHeaderEPBS

* Add minimal beacon state
* Add `IndexedPayloadAttestation` container

* Add `GetPayloadAttestingIndices` and its unit test

* Add `GetIndexedPayloadAttestation` and its unit test

* Add `is_valid_indexed_payload_attestation` and its unit test

* Create a smaller set of validators for faster unit test

* Pass context to `GetPayloadTimelinessCommittee`

* Iterate `ValidatorsReadOnly` instead of copying all validators
* Allow nodes with and without payload in forkchoice

    This PR takes care of adding nodes to forkchoice that may or may not
    have a corresponding payload. The rationale is as follows

    - The node structure is kept almost the same as today.
    - A zero payload hash is considered as if the node was empty (except for
      the tree root)
    - When inserting a node we check what the right parent node would be
      depending on whether the parent had a payload or not.
    - For pre-epbs forks all nodes are full, no logic changes except a new
      steps to gather the parent hash that is needed for block insertion.

    This PR had to change some core consensus types and interfaces.
    - It removed the ROBlockEPBS interface and added the corresponding ePBS
      fields to the ReadOnlyBeaconBlockBody
    - It moved the setters and getters to epbs dedicated files.

    It also added a checker for `IsParentFull` on forkchoice that simply
    checks for the parent hash of the parent node.

* review
* Read only payload attestation message with verifier

* Payload attestation tests (#14242)

* Payload attestation in verification package

* Feedback #1

---------

Co-authored-by: Md Amaan <[email protected]>
)

* Add `execution_payload` and `payload_attestation_message` topics

* Set `SourcePubkey` to 48 bytes long

* Add randomly populated `PayloadAttestationMessage` object

* Add tests for `execution_payload` and `payload_attestation_message` topics
* test-added

* nil check fix

* randomized inputs

* hardcoded inputs

* suggestions applied

* minor-typo fixed

* deleted
Adds the processing of execution payload envelope
Corrects the protos for attestations and slashings in Electra versions
Adds generators of full blocks for Electra
* Payload Attestation Sync package changes

* With verifier

* change idx back to uint64

* subscribe to topic

* add back error

---------

Co-authored-by: terence tsao <[email protected]>
* Add getter for payload attestation cache

* Check against status

* Feedback #1
terencechain and others added 13 commits November 4, 2024 07:06
* Share resources between empty and full nodes

- Share a block structure withing the forkchoice node. The surrounding
  envelope contains information about the payload presence and the
  children links, the inner structure contains the usual FFG and parent links.
- Reworked setOptimistictoInvalid
- Changed the PTC vote logic to have validity handled outside of
  forkchoice and have forkchoice only keep the total count of votes.

* Fix tests

* gazelle

* Update head twice pre-epbs

* only upadte best descendants without computing head

* skip forkchoice tests

* fix some blockchain tests

* Nil optimistic sync fix

* only count weight of empty nodes
These are some of the things that are left to be done

    - Process the payload
    - Change stategen to get the poststate of the block and the payload
      separately
    - Change the next slot cache to be safe for full/empty
* Send FCU on epbs

* handle late block tasks

* deal with reorgs by attestations

* save head on regular sync

* don't sleep 1 sec
@terencechain terencechain requested a review from a team as a code owner November 7, 2024 13:00
@terencechain terencechain requested review from rkapka, nisdas and james-prysm and removed request for a team November 7, 2024 13:00
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.

4 participants