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

Add payload attestation helper functions #14258

Merged

Conversation

jihoonsong
Copy link

@jihoonsong jihoonsong commented Jul 24, 2024

What type of PR is this?
This PR adds three payload attestation helper functions and their unit tests: get_payload_attesting_indices, get_indexed_payload_attestation, and is_valid_indexed_payload_attestation.

@jihoonsong jihoonsong requested a review from a team as a code owner July 24, 2024 07:36
@jihoonsong jihoonsong requested review from potuz, nisdas and james-prysm and removed request for a team July 24, 2024 07:36
@jihoonsong jihoonsong force-pushed the feature/payload-attestation-helpers branch from 2972723 to b299d38 Compare July 24, 2024 11:50
@jihoonsong jihoonsong changed the title Add get_payload_attesting_indices and get_indexed_payload_attestation Add payload attestation helper functions Jul 24, 2024
@@ -41,3 +41,9 @@ message PayloadAttestationMessage {
PayloadAttestationData data = 2;
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
}

message IndexedPayloadAttestation {
Copy link
Member

Choose a reason for hiding this comment

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

IndexedPayloadAttestation doesn't have to be a protobuf; it can be a native Go type. We only define something as a protobuf when we need SSZ functionality, like hash tree roots, but IndexedPayloadAttestation doesn't require consensus.

domain, err := signing.Domain(
state.Fork(),
slots.ToEpoch(state.Slot()),
params.BeaconConfig().DomainBeaconAttester,
Copy link
Member

Choose a reason for hiding this comment

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

This is the wrong domain

Copy link
Author

Choose a reason for hiding this comment

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

Good catch, thank you

@jihoonsong jihoonsong force-pushed the feature/payload-attestation-helpers branch from 7e64ff5 to 473ef04 Compare July 24, 2024 14:01
@shyam-patel-kira
Copy link
Contributor

Hi @jihoonsong, there's only one function pending for helpers get_attesting_indices, can you include that as well? It only requires small modification, Did you miss to include it?

@jihoonsong jihoonsong force-pushed the feature/payload-attestation-helpers branch from 473ef04 to 8c5ba98 Compare July 25, 2024 07:37
@jihoonsong
Copy link
Author

This PR is for those three functions as described.

Comment on lines 258 to 264
// Create 10 committees. Total 40960 validators.
committeeCount := uint64(10)
validatorCount := committeeCount * params.BeaconConfig().TargetCommitteeSize * uint64(params.BeaconConfig().SlotsPerEpoch)
validators := make([]*ethpb.Validator, validatorCount)
_, secretKeys, err := util.DeterministicDepositsAndKeys(validatorCount)
require.NoError(t, err)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this number of validators to test the Indexed payload attestation? This takes a long time ~30s on my laptop which is lengthy fo ra unit test

Copy link
Author

Choose a reason for hiding this comment

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

It's a really good point! Modified it to create 350 validators. Can be reduced further if needed.

return nil, errPreEPBSState
}

ptc, err := GetPayloadTimelinessCommittee(context.Background(), state, slot)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be in the background, get a context here and pass it along

@@ -0,0 +1,32 @@
package eth
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be in the consensus-types package and not in the proto directory

@jihoonsong jihoonsong force-pushed the feature/payload-attestation-helpers branch from 55959c5 to 13ad607 Compare July 31, 2024 12:42

// Verify aggregate signature.
publicKeys := make([]bls.PublicKey, len(indices))
validators := state.Validators()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is too expensive, please get the read only validator for each index without copying them all

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for pointing it out, modified it.


// Verify aggregate signature.
publicKeys := make([]bls.PublicKey, len(indices))
validators := state.ValidatorsReadOnly()
Copy link
Contributor

Choose a reason for hiding this comment

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

This still allocates about a million pointers when you can have a maximum of 512 signatures in the attestation.

@jihoonsong jihoonsong force-pushed the feature/payload-attestation-helpers branch from c2b7587 to 2ad81c7 Compare July 31, 2024 15:10
Copy link
Contributor

@potuz potuz left a comment

Choose a reason for hiding this comment

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

LGTM

@potuz potuz merged commit bd3afef into prysmaticlabs:epbs Jul 31, 2024
9 of 10 checks passed
potuz pushed a commit that referenced this pull request Jul 31, 2024
* 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
potuz pushed a commit that referenced this pull request Aug 2, 2024
* 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
potuz pushed a commit that referenced this pull request Aug 6, 2024
* 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
potuz pushed a commit that referenced this pull request Aug 13, 2024
* 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
potuz pushed a commit that referenced this pull request Aug 14, 2024
* 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
potuz pushed a commit that referenced this pull request Aug 14, 2024
* 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
potuz added a commit that referenced this pull request Aug 27, 2024
* Add protos for ePBS except state

* Add ePBS beacon state proto

* ePBS configuration constants

* Helper for Payload Attestation Signing (#13901)

* Add ePBS stuff to consensus-types: block

* Add testing utility methods to return randomly populated ePBS objects

* Add ePBS to state (#13926)

* Implement get_ptc

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 slashing params

* Add ePBS to db (#13971)

* Add ePBS to db

* Fix GetPayloadTimelinessCommittee to return correct PTC size (#14012)

* Change gwei math to primitives package for ePBS state

* use Keymanager() in validator client

* Add PTC assignment support for Duty endpoint (#14032)

* Enable validator client to submit payload attestation message (#14064)

* Remove inclusion list from epbs (#14188)

* Modify `get_ptc` function to follow the Python spec (#14256)

* 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 (#14260)

* Add `remove_flag` and its unit test

* Add a test case trying to remove a flag that is not set

* Ensure epbs state getters & setters check versions (#14276)

* Ensure EPBS state getters and setters check versions

* Rename to LatestExecutionPayloadHeaderEPBS

* Add minimal beacon state

* Use slot for latest message in forkchoice (#14279)

* Add payload attestation helper functions (#14258)

* 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

* Use BeaconCommittees helper to get the ptc (#14286)

* Allow nodes with and without payload in forkchoice (#14288)

* 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 (#14222)

* Read only payload attestation message with verifier

* Payload attestation tests (#14242)

* Payload attestation in verification package

* Feedback #1

---------

Co-authored-by: Md Amaan <114795592+Redidacove@users.noreply.github.com>

* Broadcast signed execution payload header to peer (#14300)

* Add `execution_payload` and `payload_attestation_message` topics (#14304)

* 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

* Indexed paylaod attestation test (#14299)

* test-added

* nil check fix

* randomized inputs

* hardcoded inputs

* suggestions applied

* minor-typo fixed

* deleted

* Process Execution Payload Envelope in Chain Service (#14295)

Adds the processing of execution payload envelope
Corrects the protos for attestations and slashings in Electra versions
Adds generators of full blocks for Electra

* Implement OnPayloadAttestationMessage; add setters and required fields

* Update ptcVote from byte to primitives; update functions

* Update fields in struct

* fix lint error: unnecessary conversion

* fix lint error: unnecessary conversion

* organize code; move ptcVote to node from store

* add check to avoid computation if the payload boost is already applied

* cleanup

* update code to loop over bitfield

* fix deepsource errors

* use preset value instead of .len()

* Payload Attestation Sync package changes (#13989)

* Payload Attestation Sync package changes

* With verifier

* change idx back to uint64

* subscribe to topic

* add back error

---------

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

* change the name of the function; Add comprehensive comments

* Add comprehensive unit tests for updateVotes function

* fix unused var

* fix nits

* only updateBoosts onDemand

* handle potential equivocation

* Add protos for ePBS except state

* Add ePBS beacon state proto

* ePBS configuration constants

* Helper for Payload Attestation Signing (#13901)

* Add ePBS stuff to consensus-types: block

* Add testing utility methods to return randomly populated ePBS objects

* Add ePBS to state (#13926)

* Implement get_ptc

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 slashing params

* Add ePBS to db (#13971)

* Add ePBS to db

* Fix GetPayloadTimelinessCommittee to return correct PTC size (#14012)

* Change gwei math to primitives package for ePBS state

* use Keymanager() in validator client

* Add PTC assignment support for Duty endpoint (#14032)

* Enable validator client to submit payload attestation message (#14064)

* Remove inclusion list from epbs (#14188)

* Modify `get_ptc` function to follow the Python spec (#14256)

* 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 (#14260)

* Add `remove_flag` and its unit test

* Add a test case trying to remove a flag that is not set

* Ensure epbs state getters & setters check versions (#14276)

* Ensure EPBS state getters and setters check versions

* Rename to LatestExecutionPayloadHeaderEPBS

* Add minimal beacon state

* Use slot for latest message in forkchoice (#14279)

* Add payload attestation helper functions (#14258)

* 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

* Use BeaconCommittees helper to get the ptc (#14286)

* Allow nodes with and without payload in forkchoice (#14288)

* 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 (#14222)

* Read only payload attestation message with verifier

* Payload attestation tests (#14242)

* Payload attestation in verification package

* Feedback #1

---------

Co-authored-by: Md Amaan <114795592+Redidacove@users.noreply.github.com>

* Broadcast signed execution payload header to peer (#14300)

* Add `execution_payload` and `payload_attestation_message` topics (#14304)

* 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

* Indexed paylaod attestation test (#14299)

* test-added

* nil check fix

* randomized inputs

* hardcoded inputs

* suggestions applied

* minor-typo fixed

* deleted

* Process Execution Payload Envelope in Chain Service (#14295)

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 (#13989)

* Payload Attestation Sync package changes

* With verifier

* change idx back to uint64

* subscribe to topic

* add back error

---------

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

* Add getter for payload attestation cache (#14328)

* Add getter for payload attestation cache

* Check against status

* Feedback #1

* Initialize payload att message verfier in sync (#14323)

* Enable validator client to sign execution header (#14333)

* Enable validator client to sign execution header

* Update proto/prysm/v1alpha1/validator-client/keymanager.proto

---------

Co-authored-by: Potuz <potuz@prysmaticlabs.com>

* Process withdrawal (#14297)

* process_withdrawal_fn and isParentfull test

* suggestions applied

* minor change

* removed

* lint

* lint fix

* removed Latestheader

* test added with nil error

* tests passing

* IsParentNode Test added

* lint

* fix test

* updated godoc

* fix in godoc

* comment removed

* fixed braces

* removed var

* removed var

* Update beacon-chain/core/blocks/withdrawals.go

* Update beacon-chain/core/blocks/withdrawals_test.go

* gazelle

* test added and removed previous changes in Testprocesswithdrawal

* added check for nil state

* decrease chromatic complexity

---------

Co-authored-by: Potuz <potuz@potuz.net>
Co-authored-by: Potuz <potuz@prysmaticlabs.com>

* Update tests

* undo changes

* UpdateVote independent of timing; updatePayloadboosts if the block is early

* fix deep source

* remove timinng checks; move to onDemand payloadBoosts; update testCases for the changes

* update errors and returns; update test cases for the changes

* fix deep source errors

* reduce cyclomatic complexity

* gazelle fix

* remove a comment

Co-authored-by: Potuz <potuz@potuz.net>

* fix duplication in beacon-chain config

* fix config tests

* fix number of config params

---------

Co-authored-by: Potuz <potuz@prysmaticlabs.com>
Co-authored-by: terence <terence@prysmaticlabs.com>
Co-authored-by: JihoonSong <jihoonsong@users.noreply.github.com>
Co-authored-by: Md Amaan <114795592+Redidacove@users.noreply.github.com>
Co-authored-by: Potuz <potuz@potuz.net>
potuz pushed a commit that referenced this pull request Aug 29, 2024
* 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
potuz added a commit that referenced this pull request Aug 29, 2024
* Add protos for ePBS except state

* Add ePBS beacon state proto

* ePBS configuration constants

* Helper for Payload Attestation Signing (#13901)

* Add ePBS stuff to consensus-types: block

* Add testing utility methods to return randomly populated ePBS objects

* Add ePBS to state (#13926)

* Implement get_ptc

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 slashing params

* Add ePBS to db (#13971)

* Add ePBS to db

* Fix GetPayloadTimelinessCommittee to return correct PTC size (#14012)

* Change gwei math to primitives package for ePBS state

* use Keymanager() in validator client

* Add PTC assignment support for Duty endpoint (#14032)

* Enable validator client to submit payload attestation message (#14064)

* Remove inclusion list from epbs (#14188)

* Modify `get_ptc` function to follow the Python spec (#14256)

* 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 (#14260)

* Add `remove_flag` and its unit test

* Add a test case trying to remove a flag that is not set

* Ensure epbs state getters & setters check versions (#14276)

* Ensure EPBS state getters and setters check versions

* Rename to LatestExecutionPayloadHeaderEPBS

* Add minimal beacon state

* Use slot for latest message in forkchoice (#14279)

* Add payload attestation helper functions (#14258)

* 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

* Use BeaconCommittees helper to get the ptc (#14286)

* Allow nodes with and without payload in forkchoice (#14288)

* 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 (#14222)

* Read only payload attestation message with verifier

* Payload attestation tests (#14242)

* Payload attestation in verification package

* Feedback #1

---------

Co-authored-by: Md Amaan <114795592+Redidacove@users.noreply.github.com>

* Broadcast signed execution payload header to peer (#14300)

* Add `execution_payload` and `payload_attestation_message` topics (#14304)

* 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

* Indexed paylaod attestation test (#14299)

* test-added

* nil check fix

* randomized inputs

* hardcoded inputs

* suggestions applied

* minor-typo fixed

* deleted

* Process Execution Payload Envelope in Chain Service (#14295)

Adds the processing of execution payload envelope
Corrects the protos for attestations and slashings in Electra versions
Adds generators of full blocks for Electra

* Implement OnPayloadAttestationMessage; add setters and required fields

* Update ptcVote from byte to primitives; update functions

* Update fields in struct

* fix lint error: unnecessary conversion

* fix lint error: unnecessary conversion

* organize code; move ptcVote to node from store

* add check to avoid computation if the payload boost is already applied

* cleanup

* update code to loop over bitfield

* fix deepsource errors

* use preset value instead of .len()

* Payload Attestation Sync package changes (#13989)

* Payload Attestation Sync package changes

* With verifier

* change idx back to uint64

* subscribe to topic

* add back error

---------

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

* change the name of the function; Add comprehensive comments

* Add comprehensive unit tests for updateVotes function

* fix unused var

* fix nits

* only updateBoosts onDemand

* handle potential equivocation

* Add protos for ePBS except state

* Add ePBS beacon state proto

* ePBS configuration constants

* Helper for Payload Attestation Signing (#13901)

* Add ePBS stuff to consensus-types: block

* Add testing utility methods to return randomly populated ePBS objects

* Add ePBS to state (#13926)

* Implement get_ptc

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 slashing params

* Add ePBS to db (#13971)

* Add ePBS to db

* Fix GetPayloadTimelinessCommittee to return correct PTC size (#14012)

* Change gwei math to primitives package for ePBS state

* use Keymanager() in validator client

* Add PTC assignment support for Duty endpoint (#14032)

* Enable validator client to submit payload attestation message (#14064)

* Remove inclusion list from epbs (#14188)

* Modify `get_ptc` function to follow the Python spec (#14256)

* 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 (#14260)

* Add `remove_flag` and its unit test

* Add a test case trying to remove a flag that is not set

* Ensure epbs state getters & setters check versions (#14276)

* Ensure EPBS state getters and setters check versions

* Rename to LatestExecutionPayloadHeaderEPBS

* Add minimal beacon state

* Use slot for latest message in forkchoice (#14279)

* Add payload attestation helper functions (#14258)

* 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

* Use BeaconCommittees helper to get the ptc (#14286)

* Allow nodes with and without payload in forkchoice (#14288)

* 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 (#14222)

* Read only payload attestation message with verifier

* Payload attestation tests (#14242)

* Payload attestation in verification package

* Feedback #1

---------

Co-authored-by: Md Amaan <114795592+Redidacove@users.noreply.github.com>

* Broadcast signed execution payload header to peer (#14300)

* Add `execution_payload` and `payload_attestation_message` topics (#14304)

* 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

* Indexed paylaod attestation test (#14299)

* test-added

* nil check fix

* randomized inputs

* hardcoded inputs

* suggestions applied

* minor-typo fixed

* deleted

* Process Execution Payload Envelope in Chain Service (#14295)

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 (#13989)

* Payload Attestation Sync package changes

* With verifier

* change idx back to uint64

* subscribe to topic

* add back error

---------

Co-authored-by: terence tsao <terence@prysmaticlabs.com>

* Add getter for payload attestation cache (#14328)

* Add getter for payload attestation cache

* Check against status

* Feedback #1

* Initialize payload att message verfier in sync (#14323)

* Enable validator client to sign execution header (#14333)

* Enable validator client to sign execution header

* Update proto/prysm/v1alpha1/validator-client/keymanager.proto

---------

Co-authored-by: Potuz <potuz@prysmaticlabs.com>

* Process withdrawal (#14297)

* process_withdrawal_fn and isParentfull test

* suggestions applied

* minor change

* removed

* lint

* lint fix

* removed Latestheader

* test added with nil error

* tests passing

* IsParentNode Test added

* lint

* fix test

* updated godoc

* fix in godoc

* comment removed

* fixed braces

* removed var

* removed var

* Update beacon-chain/core/blocks/withdrawals.go

* Update beacon-chain/core/blocks/withdrawals_test.go

* gazelle

* test added and removed previous changes in Testprocesswithdrawal

* added check for nil state

* decrease chromatic complexity

---------

Co-authored-by: Potuz <potuz@potuz.net>
Co-authored-by: Potuz <potuz@prysmaticlabs.com>

* Update tests

* undo changes

* UpdateVote independent of timing; updatePayloadboosts if the block is early

* fix deep source

* remove timinng checks; move to onDemand payloadBoosts; update testCases for the changes

* update errors and returns; update test cases for the changes

* fix deep source errors

* reduce cyclomatic complexity

* gazelle fix

* remove a comment

Co-authored-by: Potuz <potuz@potuz.net>

* fix duplication in beacon-chain config

* fix config tests

* fix number of config params

---------

Co-authored-by: Potuz <potuz@prysmaticlabs.com>
Co-authored-by: terence <terence@prysmaticlabs.com>
Co-authored-by: JihoonSong <jihoonsong@users.noreply.github.com>
Co-authored-by: Md Amaan <114795592+Redidacove@users.noreply.github.com>
Co-authored-by: Potuz <potuz@potuz.net>
potuz pushed a commit that referenced this pull request Sep 13, 2024
* 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
potuz pushed a commit that referenced this pull request Sep 18, 2024
* 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
potuz pushed a commit that referenced this pull request Sep 26, 2024
* 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
potuz pushed a commit that referenced this pull request Oct 7, 2024
* 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
potuz pushed a commit that referenced this pull request Oct 14, 2024
* 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
potuz pushed a commit that referenced this pull request Oct 16, 2024
* 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
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