-
Notifications
You must be signed in to change notification settings - Fork 969
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
Address Review of v0.12 #6179
Merged
Merged
Address Review of v0.12 #6179
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9f54e91
rem outdated tests
rauljordan 404c18b
remove redundant
rauljordan f6d51d3
refactor and cleanup
nisdas ac48a1a
comment
nisdas 51a2a90
Merge refs/heads/v0.12 into tidy-up-comments
prylabs-bulldozer[bot] 431f1ec
terence's review
nisdas 7ce9b8c
Update beacon-chain/rpc/validator/attester.go
terencechain 975508b
Update beacon-chain/rpc/validator/attester.go
terencechain 76424e5
Update beacon-chain/rpc/validator/attester.go
terencechain 01e2e79
Update beacon-chain/rpc/validator/attester.go
terencechain e11c6ba
Merge refs/heads/v0.12 into tidy-up-comments
prylabs-bulldozer[bot] 8e2e042
benches passing
rauljordan ef7fb2d
Merge branch 'tidy-up-comments' of github.com:prysmaticlabs/prysm int…
rauljordan 7d8e41e
Merge branch 'v0.12' of https://github.com/prysmaticlabs/geth-shardin…
nisdas 859f474
Merge branch 'v0.12Review' of github.com:prysmaticlabs/prysm into v0.…
rauljordan 0c551d6
Merge branch 'v0.12' into v0.12Review
rauljordan 8a4ee41
Merge branch 'v0.12' into v0.12Review
rauljordan e4449bc
fix up attester test
rauljordan 70e398f
Merge branch 'v0.12' into v0.12Review
rauljordan 5ecd345
Merge branch 'v0.12' into v0.12Review
rauljordan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,9 @@ func (vs *Server) GetAttestationData(ctx context.Context, req *ethpb.Attestation | |
// ProposeAttestation is a function called by an attester to vote | ||
// on a block via an attestation object as defined in the Ethereum Serenity specification. | ||
func (vs *Server) ProposeAttestation(ctx context.Context, att *ethpb.Attestation) (*ethpb.AttestResponse, error) { | ||
ctx, span := trace.StartSpan(ctx, "AttesterServer.ProposeAttestation") | ||
defer span.End() | ||
|
||
if _, err := bls.SignatureFromBytes(att.Signature); err != nil { | ||
return nil, status.Error(codes.InvalidArgument, "Incorrect attestation signature") | ||
} | ||
|
@@ -195,11 +198,14 @@ func (vs *Server) ProposeAttestation(ctx context.Context, att *ethpb.Attestation | |
|
||
// SubscribeCommitteeSubnets subscribes to the committee ID subnet given subscribe request. | ||
func (vs *Server) SubscribeCommitteeSubnets(ctx context.Context, req *ethpb.CommitteeSubnetsSubscribeRequest) (*ptypes.Empty, error) { | ||
ctx, span := trace.StartSpan(ctx, "AttesterServer.SubscribeCommitteeSubnets") | ||
defer span.End() | ||
|
||
if len(req.Slots) != len(req.CommitteeIds) && len(req.CommitteeIds) != len(req.IsAggregator) { | ||
return nil, status.Error(codes.InvalidArgument, "request fields are not the same length") | ||
} | ||
if len(req.Slots) == 0 { | ||
return &ptypes.Empty{}, nil | ||
return nil, status.Error(codes.InvalidArgument, "no attester slots provided") | ||
} | ||
|
||
fetchValsLen := func(slot uint64) (uint64, error) { | ||
|
@@ -211,19 +217,22 @@ func (vs *Server) SubscribeCommitteeSubnets(ctx context.Context, req *ethpb.Comm | |
return uint64(len(vals)), nil | ||
} | ||
|
||
// run first request | ||
// request the head validator indices of | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are the comments formatted like this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok changed |
||
// epoch represented by the first requested | ||
// slot | ||
currValsLen, err := fetchValsLen(req.Slots[0]) | ||
if err != nil { | ||
return nil, err | ||
return nil, status.Errorf(codes.Internal, "Could not retrieve head validator indices: %v", err) | ||
terencechain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
currEpoch := helpers.SlotToEpoch(req.Slots[0]) | ||
|
||
for i := 0; i < len(req.Slots); i++ { | ||
// if epoch has changed, re-request active validators | ||
// indices. | ||
terencechain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if currEpoch != helpers.SlotToEpoch(req.Slots[i]) { | ||
currValsLen, err = fetchValsLen(req.Slots[i]) | ||
if err != nil { | ||
return nil, err | ||
return nil, status.Errorf(codes.Internal, "Could not retrieve head validator indices: %v", err) | ||
terencechain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
currEpoch = helpers.SlotToEpoch(req.Slots[i]) | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
what happen during genesis when attesters request for slot 0?
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.
req.Slots will still have len 1 in this case
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.
ah yes, i was thinking the actual slot number. my b!