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

SingleAttestation implementation #6488

Open
wants to merge 101 commits into
base: unstable
Choose a base branch
from

Conversation

eserilev
Copy link
Collaborator

@eserilev eserilev commented Oct 15, 2024

Issue Addressed

Closes #6380

Proposed Changes

Spec: ethereum/consensus-specs#3900

Convert single attestation as early as possible to reduce code diff

Conga-lined off:

@eserilev eserilev changed the title Single attestation SingleAttestation implementation Oct 15, 2024
@eserilev eserilev added the work-in-progress PR is a work-in-progress label Oct 15, 2024
@eserilev
Copy link
Collaborator Author

bell curve
@dapplion

@eserilev eserilev added the electra Required for the Electra/Prague fork label Oct 15, 2024
@eserilev eserilev added ready-for-review The code is ready for review and removed work-in-progress PR is a work-in-progress labels Oct 24, 2024
@eserilev
Copy link
Collaborator Author

eserilev commented Nov 28, 2024

I've ran some kurtosis tests interoping against prysm and we are attesting correctly

EDIT: we are NOT interoping correctly at the moment. I am working on debugging the issue

@eserilev eserilev added blocked and removed ready-for-review The code is ready for review labels Dec 2, 2024
@michaelsproul michaelsproul added the v6.1.0 New release c. Q1 2025 label Dec 3, 2024
@michaelsproul michaelsproul self-requested a review December 19, 2024 06:23
@michaelsproul michaelsproul added the electra-alpha10 Electra release for devnet 5 label Dec 19, 2024
@michaelsproul michaelsproul changed the base branch from electra-alpha10 to unstable January 14, 2025 01:13
Copy link
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

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

Did a quick re-review of about half of this. Will come back to it ASAP tomorrow

beacon_node/beacon_chain/src/test_utils.rs Outdated Show resolved Hide resolved
beacon_node/http_api/src/publish_attestations.rs Outdated Show resolved Hide resolved
consensus/types/src/attestation.rs Outdated Show resolved Hide resolved
};

if committee.index != self.committee_index as u64 {
return Err(Error::InvalidCommittee);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return Err(Error::InvalidCommittee);
return Err(Error::UnexpectedCommittee(committee.index, self.committee_index));

Copy link
Collaborator Author

@eserilev eserilev Jan 15, 2025

Choose a reason for hiding this comment

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

I've updated the args for this method. Instead of passing in the full BeaconCommittee obj, I'm passing in the committee slice. Upstream from this method call I make a check for the existence of the specific committee for the slot and committee_index and return either a Error::NoCommitteeForSlotAndIndex or log a warn message if the committee isn't found

consensus/types/src/attestation.rs Outdated Show resolved Hide resolved
consensus/types/src/attestation.rs Outdated Show resolved Hide resolved
Copy link
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

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

Approved modulo Lion's small tweaks

@@ -90,6 +90,10 @@ impl<E: EthSpec> ServerSentEventHandler<E> {
.attestation_tx
.send(kind)
.map(|count| log_count("attestation", count)),
EventKind::SingleAttestation(_) => self
.attestation_tx
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not correct I believe. There's a new event name single_attestation, so you should have a new (tx,rx) and broadcast there. https://github.com/ethereum/beacon-APIs/blob/aa1be259e2d8a64f451dd304913e0310779f6f80/apis/eventstream/index.yaml#L70

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah otherwise calls into the event stream with error with unknown topic

Copy link
Collaborator Author

@eserilev eserilev Jan 15, 2025

Choose a reason for hiding this comment

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

I believe the attestation_tx is just for SSE which is for our own internal infra? We still emit a SingleAttestation event with the new single_attestation topic name, which I think is spec compliant. I could be wrong though

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok maybe I am wrong, ill double check, thanks

Copy link
Collaborator

Choose a reason for hiding this comment

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

pub enum EventTopic {
this enum must include a SingleAttestation variant

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep you were right, heres the fix
54844b3

@michaelsproul
Copy link
Member

Looks like one of the SSE tests is failing (get_events)

@eserilev
Copy link
Collaborator Author

I believe i've fixed the test failure but I think I need to add some test coverage for the new single_attestation event topic

@eserilev
Copy link
Collaborator Author

i've added test coverage for the new single_attestation event topic. This PR should hopefully be good to go

let current_fork = self
.spec
.fork_name_at_slot::<T::EthSpec>(v.attestation().data().slot);
if current_fork.electra_enabled() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it necessary to check the fork now? Can we have single attestations before electra?

Copy link
Collaborator

@dapplion dapplion left a comment

Choose a reason for hiding this comment

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

PR is good to go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electra Required for the Electra/Prague fork electra-alpha10 Electra release for devnet 5 ready-for-review The code is ready for review v6.1.0 New release c. Q1 2025
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants