-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
New validator_info and manifest RPC methods #3197
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.
Nice. Thanks for your contribution. There's a few things that I'd like to see addressed before I sign off on this.
ret[jss::master_key] = toBase58(TokenType::NodePublic, pk); | ||
|
||
auto ek = context.app.validatorManifests().getSigningKey(pk); | ||
ret[jss::ephemeral_key] = toBase58(TokenType::NodePublic, ek); |
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.
You should detect and account for the use case where a validator is configured with a fixed key and not a manifest. If that happens, this field and those that follow are not relevant and should not be included.
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.
I believe I addressed this by checking if the ephemeral key does exists, and if not using this to imply the manifest is not present. Please correct if this is the wrong assumption
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.
@nbougalis many thanks for the review. I believe I addressed all feedback save an item above. Let me know it there is anything else!
Edit: meant to leave this as a comment... not a review of my own patches 🤦♂️
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.
I believe you've addressed all my concerns, thanks! We need one more review for this to be considered Passed.
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.
This looks good. There are some formatting nits we should probably resolve. To resolve the formatting, you can try running clang format over Manifest.cpp
and ValidatorIndo.cpp
with the .clang_format
rules checked in with rippled. (I'm also happy to do this and submit a patch if it's a pain for you).
I also noticed there are no unit tests for this. It would be good to have some simple tests for this as well. |
Non-unity build is broken. I think if both ValidatorInfo and Manifest have the following includes it should fix it:
|
@seelabs thanks for the review. Resolved the style issues and added missing includes for the unity build. As far as static_cast, making the change results in the following error:
Could you advice a fix or should this be left as is? Will look into adding some tests in the near future. |
Codecov Report
@@ Coverage Diff @@
## develop #3197 +/- ##
===========================================
- Coverage 70.33% 70.32% -0.01%
===========================================
Files 675 677 +2
Lines 53178 53250 +72
===========================================
+ Hits 37402 37450 +48
- Misses 15776 15800 +24
Continue to review full report at Codecov.
|
Should work as @seelabs mentioned. |
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.
Looked through the tests you added, LGTM.
|
||
Json::Value ret; | ||
|
||
auto pk = context.app.getValidationPublicKey(); |
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.
nit: Would like to see more const
used if possible. i.e. auto const pk = ...
Makes it clear that the variable won't be modified later (which is the case for a lot of these).
@jwbusch pushed a patch constantizing the fields. As far as the scoped ephimeral_key, that method (getSigningKey, already existing before this PR) works a bit different than the new ones in the sense that if the key is not found, the input param (the master key) is simply returned. Since this is not a boost::optional we can't check it's 'truthyness' like the other fields. |
I think this is ready to go, we just need to fix the non-unity build issues. I think we just need to patch two files. I think this patch should fix things: seelabs@b47e374 |
@seelabs cherry picked onto this branch, thanks! |
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.
This looks good. Thanks @movitto. I'm approving this, tho we do need to rebase this onto 1.5.0-b3.
@movitto FYI: Rebasing should be pretty straight-forward. One change to look out for is the parameters for |
@movitto: I can handle the rebase and squashing down if you want, and would be happy to jump on a call with you to walk you through the commands and explain what I'm doing so you know for the next time. |
@nbougalis sure that works. With the XRP meetup tomorrow won't have time to do the call until later on in the week, but perhaps we can schedule it for then (lets coordinate on that one via email) |
Returns local validator details and specified manifest information respectively. Folded and rebased on latest develop
@seelabs @nbougalis rebased and pushed a followup patch w/ the 'Context' -> 'JsonContext' substitution. Using @mellery451's protobuf fix from #3244 (not included in this PR) I was able to build and test locally. |
@movitto Things looks good; I just added a "passed" label. Thanks for (yet another) contribution! |
This pull request addresses issue #3099 by adding two new RPC methods to allow the inspection of validator state.
validator_info will return information pertaining to the current validators keys, manifest sequence, and domain
manifest looks up manifest information for the specified key (either master or ephemeral)
Utility methods have been added to other modules to support this functionality