Add "proposed" optional flag to getValidatorsAt
#3531
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.
Why this should be merged
I'm not convinced that it should but opening this up for discussion.
Adding this interface was discussed together with adding
platform.GetProposedHeight
interface in #3530 This is a convenience method to allow for passing "proposed" instead of a numeric height literal toGetValidatorsAt
.The idea is to make it safer to publicly expose
GetValidatorsAt
interface. This by itself doesn't accomplish it but a different proxy service could use this same interface and callGetProposedHeight
and return the cached value if this was called with the same resolved height and subnet.How this works
Makes the GetValidatorsAt accept either numeric height or a "proposed" string literal that first calls
getMinimumHeight
and uses that instead of the numerical value. The service side is backward compatible but the client interface has changed.I'm also not sure if this solution is cleaner than just adding a new boolean flag field to the request. I don't think that the
platformVM
service uses this kind of type overloading anywhere else.How this was tested
Added a unit test.
Need to be documented in RELEASES.md?
Yes - -breaking change to the client.