-
Notifications
You must be signed in to change notification settings - Fork 664
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
Expose BLS public keys from platform.getValidatorsAt #1740
Conversation
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.
should we add a test that un-marshaling the marshaled json returns the original object?
(Also it seems the weight is returned as a string in the new format vs a number in the old format, not sure if this change is intentional)
We typically return weights as strings because javascript represents all numbers as floats. Which can cause precision errors with the sizes of the numbers we are returning. So we explicitly return strings so that javascript can parse them into big nums correctly. The prior implementation was an oversight. |
Added |
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.
One sanity check question, but LGTM
// GetValidatorsAtReply is the response from GetValidatorsAt | ||
type GetValidatorsAtReply struct { | ||
// TODO should we change this to map[ids.NodeID]*validators.Validator? | ||
// We'd have to add a MarshalJSON method to validators.Validator. |
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.
Do we need to add MarshalJSON
to validators.Validator
like the comment describes?
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.
We do not. I decided to do it this way because it felt weird not to include the NodeID in the struct json definition... But it was duplicate information in the map (which I didn't want to expose over the json rpc)
Why this should be merged
This is the last piece to be able to implement an adapter for the
validators.State
interface from theplatformvm.Client
interface.Resolves #1634
Split out of #1611
How this works
Changes the
platform.getValidatorsAt
API return type to include BLS public keys. Note - this is a breaking change.validators.State
interface can be implemented by:GetMinimumHeight
->GetHeight
GetCurrentHeight
->GetHeight
GetSubnetID
->ValidatedBy
GetValidatorSet
->GetValidatorsAt
How this was tested
Calling:
against a synced Fuji node.
Previous result
New result