-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix Signing Infos Endpoint #4292
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4292 +/- ##
==========================================
+ Coverage 59.1% 59.35% +0.24%
==========================================
Files 217 214 -3
Lines 14595 14526 -69
==========================================
- Hits 8627 8622 -5
+ Misses 5330 5266 -64
Partials 638 638 |
Co-Authored-By: alexanderbez <[email protected]>
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.
ACK
|
||
signingInfo, found := k.getValidatorSigningInfo(ctx, params.ConsAddress) | ||
if !found { | ||
return nil, ErrNoSigningInfoFound(DefaultCodespace, params.ConsAddress) |
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.
so there's a good practice in returning OK 200
even if the response is empty, because the request was processed successfully. See https://stackoverflow.com/a/13367198
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.
Hmmm, ok so for collections, this makes sense. But this is a single resource you're looking for, not a collection. If I go with this approach and just return a 200 OK
with an empty ValidatorSigningInfo{}
object, you'll get the following as a response:
{
"address": "",
"index_offset": "0",
"jailed_until": "0001-01-01T00:00:00Z",
"missed_blocks_counter": "0",
"start_height": "0",
"tombstoned": false
}
This isn't what I'd want to see as an API consumer. Or am I wrong? I suppose I can add omitempty
to all the JSON tags so you'll get {}
as a response. Is that better?
@@ -42,3 +45,7 @@ func ErrMissingSelfDelegation(codespace sdk.CodespaceType) sdk.Error { | |||
func ErrSelfDelegationTooLowToUnjail(codespace sdk.CodespaceType) sdk.Error { | |||
return sdk.NewError(codespace, CodeValidatorNotJailed, "validator's self delegation less than MinSelfDelegation, cannot be unjailed") | |||
} | |||
|
|||
func ErrNoSigningInfoFound(codespace sdk.CodespaceType, consAddr sdk.ConsAddress) sdk.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.
ditto, no need for this error if the request is successful
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.
Responded; see above.
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.
looks good - only one restructure per comment
/slashing/signing_infos
/slashing/validators/{validatorPubKey}/signing_info
closes: #4194
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added a relevant changelog entry:
clog add [section] [stanza] [message]
rereviewed
Files changed
in the github PR explorerFor Admin Use: