-
Notifications
You must be signed in to change notification settings - Fork 610
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
chore: update 07-tendermint GetConsensusState to return bool over error #1180
chore: update 07-tendermint GetConsensusState to return bool over error #1180
Conversation
Happy to leave this on the back burner until the higher priority PRs are merged. Should minimise disruptions with merge conflicts..etc |
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.
LGTM once @colin-axner suggestion is applied.
modules/light-clients/07-tendermint/types/misbehaviour_handle.go
Outdated
Show resolved
Hide resolved
modules/light-clients/07-tendermint/types/misbehaviour_handle.go
Outdated
Show resolved
Hide resolved
modules/light-clients/07-tendermint/types/misbehaviour_handle.go
Outdated
Show resolved
Hide resolved
@@ -59,29 +58,14 @@ func SetConsensusState(clientStore sdk.KVStore, cdc codec.BinaryCodec, consensus | |||
|
|||
// GetConsensusState retrieves the consensus state from the client prefixed | |||
// store. An error is returned if the consensus state does not exist. |
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.
godoc needs to be updated. Should we make this function private?
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.
Good spot
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.
Making private makes a bit more awkward for testing. We would actually need to remove the test function for this.
getConsensusState
will still get coverage from a number of other tests but testing the panic scenarios then isn't really possible.
What do you think? I don't really have any strong feelings about making it public/private
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.
lets leave for now
Co-authored-by: colin axnér <[email protected]>
Co-authored-by: colin axnér <[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.
Wahoo, nice!
…or (cosmos#1180) * updating 07-tendermint GetConsensusState to return bool over error * panic on unmarshal and type assertion failure, update tests * updating to use MustUnmarshalConsensusState directly * Update modules/light-clients/07-tendermint/types/misbehaviour_handle.go Co-authored-by: colin axnér <[email protected]> * Update modules/light-clients/07-tendermint/types/misbehaviour_handle.go Co-authored-by: colin axnér <[email protected]> * removing comments and updating godoc Co-authored-by: colin axnér <[email protected]>
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. --> ## Overview Closes: cosmos#1180 <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. --> ## Checklist <!-- Please complete the checklist to ensure that the PR is ready to be reviewed. IMPORTANT: PRs should be left in Draft until the below checklist is completed. --> - [x] New and updated code has appropriate documentation - [x] New and updated code has new and/or updated testing - [x] Required CI checks are passing - [ ] Visual proof for any user facing features like CLI or documentation updates - [x] Linked issues closed with keywords
Description
07-tendermint
helperGetConsensusState
to return(*ConsensusState, bool)
in favour of(*ConsensusState, error)
closes: #1140
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes