-
Notifications
You must be signed in to change notification settings - Fork 931
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
Command to fetch validator statuses + MultipleValidatorStatus #5784
Merged
prylabs-bulldozer
merged 97 commits into
prysmaticlabs:master
from
michaelhly:validator-client-account-statuses
May 19, 2020
Merged
Changes from 91 commits
Commits
Show all changes
97 commits
Select commit
Hold shift + click to select a range
a7a3ae0
Add method to fetch account statuses
michaelhly 673c839
Add status command
michaelhly 4e97a2a
gofmt
michaelhly 3c357a1
Add comment about sorting
michaelhly 1294fdf
Close conneciton when finished
michaelhly 462f35f
Fix error
michaelhly d355b13
Refactor FetchAccountStatuses
michaelhly a2c2f45
Add status_test.go
michaelhly 237620d
Move sorting out of FetchAccountStatuses
michaelhly 15132b7
Remove unnecessary casting
michaelhly e8123b4
Expect ValidatorStatus to be called
michaelhly c0d837e
Wrap long comment
michaelhly 7b7efef
Comment out sorting
michaelhly 9635895
Add all necessary dial options
michaelhly 348b799
Close connection before evaluating error from fetch
michaelhly c39e231
Small changes
michaelhly 74c315b
Fix lint issues
michaelhly dbf8bee
Merge branch 'master' into validator-client-account-statuses
michaelhly c2558ec
Update dependencies for docker images
michaelhly 3b0557e
Rename multipleValidatorStatus to activationStatus
michaelhly 63694ef
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
michaelhly 3ee1734
Update commit hash for ethereumapis
michaelhly 1e1ade8
Implement MultipleValidatorStatus
michaelhly 470edfe
Tests for MultipleValidatorStatus
michaelhly 1c1abb0
Fix bugs
michaelhly 8676c90
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
michaelhly 4231332
Add export comment for MultipleValidatorStatus
michaelhly 1bd716c
Run `go fmt` in prysm (#5815)
terencechain a67d182
Add fix for nil state in InitializeFromProto (#5817)
0xKiwi 8b4bbba
Add export comment for MultipleValidatorStatus
michaelhly 05e015c
Clean up comments
michaelhly d1a0e34
Update mock files for beacon_node_validator_service
michaelhly 2dc898e
Merge branch 'validator-client-account-statuses' of https://github.co…
michaelhly 6f65dfd
Run gazelle
michaelhly d7a6b2e
Fix mock issues
michaelhly 3fc3f84
Fetch statuses in batches
michaelhly 5a65093
Simplify public key generation for status_test
michaelhly 81e0edc
Sort validator statuses by status type
michaelhly ea2e0ba
Format validator statuses and print to console
michaelhly 4df5845
Fix lint issues
michaelhly a5f30db
Delimit with commas
michaelhly 31c0dc0
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
michaelhly 4b40102
Rename otheropts to extraopts
michaelhly e0b9705
Merge branch 'master' into validator-client-account-statuses
rauljordan e478ba9
Merge branch 'validator-client-account-statuses' of https://github.co…
michaelhly 9b47c26
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
michaelhly 550aca1
Clean up MultipleValidatorStatus tests
michaelhly 5a3ae0d
Add sync checker to MultipleValidatorStatus
michaelhly 87ecfa5
Update formatting
michaelhly b068f9e
Prepend 0x to validator keys
michaelhly d454abc
Check number of status blocks recieved in status_test
michaelhly 1c6ceb3
Move sorting to goroutine
michaelhly 9564ad4
Capitalize constants
michaelhly 03d0905
Fix typo
michaelhly b55c67f
Use mock reponses in sort test
michaelhly c3d1f5d
Remove byteutils
michaelhly abb2a02
Fix ugly format
michaelhly 42c3e9d
Add comment on MultipleValidatorStatus test
michaelhly b59c94e
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
michaelhly 96593f1
Create entrypoint to run status command, and make unexported function…
michaelhly 5bd7da8
Move merge step into FetchAccountStatuses
michaelhly 33be715
Revert service.go
michaelhly a2422db
Remove responseToSortedMetadata
michaelhly 93793be
Simplify mergeTwo
michaelhly de2f7a8
Replace fmt output with logrus
michaelhly 5020326
Fix typo
michaelhly 7591973
Merge branch 'master' into validator-client-account-statuses
michaelhly 79ddcf1
Update comment
michaelhly 6287a41
Merge branch 'validator-client-account-statuses' of https://github.co…
michaelhly decf519
Return error on bad credentials
michaelhly 47bdf93
Merge branch 'master' into validator-client-account-statuses
rauljordan 4a1142b
Merge branch 'master' into validator-client-account-statuses
rauljordan e4fa645
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
michaelhly d51659b
Skip merge step on error
michaelhly 0286f5a
Fix conflicts
michaelhly fc78940
Fix mock paths
michaelhly 2a7f94c
Add comments
michaelhly d3435bd
Convert some sprintfs to wrapfs
michaelhly c201cd6
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
michaelhly 1e1fcbf
Rename ExtractPublicKeys to ExtractPublicKeysFromKeyStore and move to…
michaelhly bcdd032
Add support for keymanager
michaelhly 8a82426
Add supported flags to flags list
michaelhly 7dda2b0
Log warning on intermediary errors
michaelhly 4952966
Update output
michaelhly a1463a1
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
michaelhly f77e5e6
Merge branch 'master' into validator-client-account-statuses
rauljordan 1eea671
Fix conflicts
michaelhly c086663
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
michaelhly 3b1be09
Merge branch 'validator-client-account-statuses' of https://github.co…
michaelhly a786cb0
Set context timeout for FetchAccountStatuses
michaelhly 1d78e7a
Remove deprecated grpc.WithTimeout
michaelhly 9744278
gofmt
michaelhly 9100ecb
Remove getters
michaelhly a15de80
Remove parallel stuff
michaelhly 5472aac
Move grpc dialing out of status.go
michaelhly 2f8ce09
Update logging based on feedback
michaelhly 7861331
Update validator/accounts/status.go
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
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 |
---|---|---|
|
@@ -38,9 +38,53 @@ func (vs *Server) ValidatorStatus( | |
return vs.validatorStatus(ctx, req.PublicKey, headState), nil | ||
} | ||
|
||
// multipleValidatorStatus returns the validator status response for the set of validators | ||
// MultipleValidatorStatus is the same as ValidatorStatus. Supports retrieval of multiple | ||
// validator statuses. Takes a list of public keys or a list of validator indices. | ||
func (vs *Server) MultipleValidatorStatus( | ||
ctx context.Context, | ||
req *ethpb.MultipleValidatorStatusRequest) (*ethpb.MultipleValidatorStatusResponse, error) { | ||
if vs.SyncChecker.Syncing() { | ||
return nil, status.Errorf(codes.Unavailable, "Syncing to latest head, not ready to respond") | ||
} | ||
headState, err := vs.HeadFetcher.HeadState(ctx) | ||
if err != nil { | ||
return nil, status.Error(codes.Internal, "Could not get head state") | ||
} | ||
responseCap := len(req.GetPublicKeys()) + len(req.GetIndices()) | ||
pubkeys := make([][]byte, 0, responseCap) | ||
filtered := make(map[[48]byte]bool) | ||
filtered[[48]byte{}] = true // Filter out keys with all zeros. | ||
// Filter out duplicate public keys. | ||
for _, pubKey := range req.GetPublicKeys() { | ||
pubkeyBytes := bytesutil.ToBytes48(pubKey) | ||
if !filtered[pubkeyBytes] { | ||
pubkeys = append(pubkeys, pubKey) | ||
filtered[pubkeyBytes] = true | ||
} | ||
} | ||
// Convert indices to public keys. | ||
for _, idx := range req.GetIndices() { | ||
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. same over here |
||
pubkeyBytes := headState.PubkeyAtIndex(uint64(idx)) | ||
if !filtered[pubkeyBytes] { | ||
pubkeys = append(pubkeys, pubkeyBytes[:]) | ||
filtered[pubkeyBytes] = true | ||
} | ||
} | ||
// Fetch statuses from beacon state. | ||
statuses := make([]*ethpb.ValidatorStatusResponse, len(pubkeys)) | ||
for i, pubKey := range pubkeys { | ||
statuses[i] = vs.validatorStatus(ctx, pubKey, headState) | ||
} | ||
|
||
return ðpb.MultipleValidatorStatusResponse{ | ||
PublicKeys: pubkeys, | ||
Statuses: statuses, | ||
}, nil | ||
} | ||
|
||
// activationStatus returns the validator status response for the set of validators | ||
// requested by their pub keys. | ||
func (vs *Server) multipleValidatorStatus( | ||
func (vs *Server) activationStatus( | ||
ctx context.Context, | ||
pubkeys [][]byte, | ||
) (bool, []*ethpb.ValidatorActivationResponse_Status, error) { | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
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.
no need to copy here, you can access the field directly