-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Update Beacon API events to Electra #14855
Conversation
@@ -170,24 +167,23 @@ func (vs *Server) proposeAtt( | |||
return nil, status.Errorf(codes.Internal, "Could not get attestation root: %v", err) | |||
} | |||
|
|||
var singleAtt *ethpb.SingleAttestation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for this variable anymore. It was used so that we can broadcast a single attestation but send an Electra attestation through the feed. But we can safely send a single attestation because the only consumers are the monitor tool and API which know how to handle single attestations.
@@ -320,6 +320,13 @@ func (s *Server) handleAttestationsElectra( | |||
} | |||
|
|||
for i, singleAtt := range validAttestations { | |||
s.OperationNotifier.OperationFeed().Send(&feed.Event{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did we need to move this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that we send a single attestation and not an Electra one. Previously we were sending att
where att := singleAtt.ToAttestationElectra(committee)
@@ -139,8 +139,9 @@ func (s *Service) validateCommitteeIndexBeaconAttestation(ctx context.Context, p | |||
return validationRes, err | |||
} | |||
|
|||
var singleAtt *eth.SingleAttestation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In contrast to the code in beacon-chain/rpc/prysm/v1alpha1/validator/attester.go
, here we need the variable because att
becomes the Electra attestation (see line 148). It is necessary to convert before calling validateUnaggregatedAttWithState
case operation.SingleAttReceived: | ||
data, ok := e.Data.(*operation.SingleAttReceivedData) | ||
if !ok { | ||
log.Error("Event feed data is not of type *operation.SingleAttReceivedData") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wonder why we don't print the Type of the data here for old ones, maybe that would be useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it because we already do that once in the marshal reader?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you are looking at the correct file? I don't see any marshal reader in the monitor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops then maybe we should print the type somewhere.
att := structs.AttFromConsensus(att) | ||
return jsonMarshalReader(eventName, att) | ||
}, nil | ||
case *eth.AttestationElectra: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shoot this must have been missed...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change in beacon-chain/sync/validate_aggregate_proof.go
had to be introduced for this to have any effect anyway
@@ -433,6 +433,15 @@ func (a *AttestationElectra) ToConsensus() (*eth.AttestationElectra, error) { | |||
}, nil | |||
} | |||
|
|||
func SingleAttFromConsensus(a *eth.SingleAttestation) *SingleAttestation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a comment here but something i forgot why we did it, why do we not check if a.Data is not nil? do we do that somewhere else? i forgot.
att := structs.AttFromConsensus(v.Attestation.Aggregate) | ||
return jsonMarshalReader(eventName, att) | ||
}, nil | ||
switch att := v.Attestation.AggregateVal().(type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would this ever panic? v.Attestation being nil?
8d9c78b
to
1006d25
Compare
What type of PR is this?
Feature
What does this PR do? Why is it needed?
Beacon API event support for
SingleAttestation
andSignedAggregateAttestationAndProofElectra
Acknowledgements