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 index to activationStatus and MultipleValidatorStatus response #6026
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6026 +/- ##
==========================================
- Coverage 59.57% 59.54% -0.03%
==========================================
Files 320 320
Lines 26970 27112 +142
==========================================
+ Hits 16067 16145 +78
- Misses 8713 8775 +62
- Partials 2190 2192 +2 |
beacon-chain/rpc/validator/status.go
Outdated
ctx, span := trace.StartSpan(ctx, "validatorServer.validatorStatus") | ||
defer span.End() | ||
|
||
// Using farFutureEpoch as the default value for index, in case the validators index cannot be determined. |
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.
It's confusing to use farFutureEpoch
as default value for index. One's unit is Epoch
and one's unit is ValidatorIndex
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.
Agreed, is there a better way we could do this, maybe through a boolean ?
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.
Hmm, That would require changing the protobufs as well no? Not sure how to go about 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.
Don't name it farFutureEpoch
, name it like:
https://github.com/prysmaticlabs/prysm/blob/master/beacon-chain/forkchoice/protoarray/types.go#L45
headState, err := vs.HeadFetcher.HeadState(ctx) | ||
if err != nil { | ||
return nil, status.Error(codes.Internal, "Could not get head state") | ||
} | ||
return vs.validatorStatus(ctx, req.PublicKey, headState), nil | ||
vStatus, _ := vs.validatorStatus(ctx, headState, req.PublicKey) |
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.
Unhandled error
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.
That is the return indice, the function doesn't return an error.
beacon-chain/rpc/validator/status.go
Outdated
ctx, span := trace.StartSpan(ctx, "validatorServer.validatorStatus") | ||
defer span.End() | ||
|
||
// Using farFutureEpoch as the default value for index, in case the validators index cannot be determined. |
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.
Agreed, is there a better way we could do this, maybe through a boolean ?
…o add-indices-resp
What type of PR is this?
API Improvement
What does this PR do? Why is it needed?
This PR modifies the
activationStatus
andmultipleValidatorStatus
to also return the indice, for the validator to log out the indices where there is room for them.status.go
was also a bit messy, so I've reordered some parameters and removed some unneeded parameters.