Skip to content
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

Merged

Conversation

damiannolan
Copy link
Member

Description

  • Updates the 07-tendermint helper GetConsensusState 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.

  • 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.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@damiannolan
Copy link
Member Author

Happy to leave this on the back burner until the higher priority PRs are merged. Should minimise disruptions with merge conflicts..etc

Copy link
Contributor

@seantking seantking left a 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.

@@ -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.
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot

Copy link
Member Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets leave for now

damiannolan and others added 3 commits March 29, 2022 14:25
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wahoo, nice!

@damiannolan damiannolan enabled auto-merge (squash) March 30, 2022 13:50
@damiannolan damiannolan merged commit 18f1382 into 02-client-refactor Mar 30, 2022
@damiannolan damiannolan deleted the damian/1140-update-get-consensus-state branch March 30, 2022 13:58
seunlanlege pushed a commit to ComposableFi/ibc-go that referenced this pull request Aug 9, 2022
…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 <25233464+colin-axner@users.noreply.github.com>

* Update modules/light-clients/07-tendermint/types/misbehaviour_handle.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* removing comments and updating godoc

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
CosmosCar pushed a commit to caelus-labs/ibc-go that referenced this pull request Nov 6, 2023
<!--
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants