Skip to content

[IBC] Add nil check on proof for membership and non-membership proof creation#877

Merged
Olshansk merged 1 commit intopokt-network:mainfrom
innocent-saeed36:patch-7
Jul 5, 2023
Merged

[IBC] Add nil check on proof for membership and non-membership proof creation#877
Olshansk merged 1 commit intopokt-network:mainfrom
innocent-saeed36:patch-7

Conversation

@innocent-saeed36
Copy link
Copy Markdown
Contributor

Problem:

In proofs_ics23.go, the createMembershipProof and createNonMembershipProof functions call tree.Prove(key) and then pass the proof to the convertSMPToExistenceProof or convertSMPToExclusionProof functions without checking if proof is nil. This could lead to a panic due to a nil pointer dereference if tree.Prove(key) returns a nil proof.

Solution:

This PR adds a check to verify if proof is nil before passing it to the convertSMPToExistenceProof or convertSMPToExclusionProof functions. If proof is nil, an error is returned.

Changes:

Added nil check on proof in createMembershipProof and createNonMembershipProof functions in proofs_ics23.go.

Copy link
Copy Markdown
Collaborator

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

@innocent-saeed36 Could you please provide the exact ChatGPT prompt you used for this?

@h5law This looks good to me but want a 👍 from you as well

@Olshansk Olshansk requested a review from h5law July 5, 2023 22:28
Copy link
Copy Markdown
Contributor

@h5law h5law left a comment

Choose a reason for hiding this comment

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

Currently the SMT will only return nil for the proof when the err is non-nil. However, if this logic ever changes its good to have this extra check.

LGTM let's merge it in!

@Olshansk Olshansk merged commit b95ade3 into pokt-network:main Jul 5, 2023
bryanchriswhite added a commit that referenced this pull request Jul 7, 2023
* pokt/main:
  [Utility] Update E2E feature path template doc (#870)
  [IBC] Add nil check on proof for membership and non-membership proof creation (#877)
  Added git diff state to devlog10
  Devlog 10 (#872)
  [Documentation] Add IBC Module introduction as an example (#853)
  [Persistence][Bug] Fix Actor Schema Assignment for ValidatorActor in GetActor (#857)
  QOL: add bash completion for p1 to localnet client (#865)
bryanchriswhite added a commit that referenced this pull request Jul 7, 2023
* feat/integrate-bg-router:
  fix: goimports
  fix: unstaked actor bootstrapping FSM transition
  chore: add error log
  test: improve background router validation test
  docs: fix mistake in peer discovery section
  [Utility] Update E2E feature path template doc (#870)
  [IBC] Add nil check on proof for membership and non-membership proof creation (#877)
  Added git diff state to devlog10
  Devlog 10 (#872)
  [Documentation] Add IBC Module introduction as an example (#853)
  [Persistence][Bug] Fix Actor Schema Assignment for ValidatorActor in GetActor (#857)
  QOL: add bash completion for p1 to localnet client (#865)
bryanchriswhite added a commit that referenced this pull request Jul 11, 2023
* pokt/main:
  [P2P] Integrate background router (#732)
  Update main README.md
  [Bug] Fix CI linter errors (#885)
  [Tooling] Block `IN_THIS_*` comments from passing CI (#889)
  [Utility] Update E2E feature path template doc (#870)
  [IBC] Add nil check on proof for membership and non-membership proof creation (#877)
  Added git diff state to devlog10
  Devlog 10 (#872)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

small Pull request is small waiting-for-review

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants