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

imp: use error returns in VerifyMembership fns #7492

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

colin-axner
Copy link
Contributor

@colin-axner colin-axner commented Oct 21, 2024

Description

made this change in relation to cosmos/ics23#391

Example error message now:

failed to verify membership proof at index 0: provided value doesn't match proof: invalid proof

Previous error message:

chained membership proof failed to verify membership of value: 696E76616C69642076616C7565 in subroot FED126FA5980E8E5261C96B693BB0DB1999AA07C23CD5A53F23D59340A3F4A1C at index 0. Please ensure the path and value are both correct.: invalid proof

closes: #XXXX


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 the 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 and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

Comment on lines -129 to -130
switch proof.Proofs[0].Proof.(type) {
case *ics23.CommitmentProof_Nonexist:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

decided to take the liberty to do some code cleanup. Since proof.Proofs.GetNonexist only returns a non exist proof, the switch statement is unnecessary since we check the return value is non nil

Comment on lines -186 to -187
switch proofs[i].Proof.(type) {
case *ics23.CommitmentProof_Exist:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

@colin-axner colin-axner changed the title imp: use error returns in VerifyMembership fn imp: use error returns in VerifyMembership fns Oct 21, 2024
@colin-axner colin-axner marked this pull request as ready for review October 21, 2024 16:20
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.

1 participant