Skip to content

Commit

Permalink
renames IsOfEmptyProof to IsEmptyProof
Browse files Browse the repository at this point in the history
  • Loading branch information
staheri14 committed Apr 25, 2023
1 parent 8a27636 commit 9e3d8de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ func NewAbsenceProof(proofStart, proofEnd int, proofNodes [][]byte, leafHash []b
return Proof{proofStart, proofEnd, proofNodes, leafHash, ignoreMaxNamespace}
}

// IsOfEmptyProof checks whether the proof corresponds to an empty proof as defined in NMT specifications https://github.com/celestiaorg/nmt/blob/master/docs/spec/nmt.md.
func (proof Proof) IsOfEmptyProof() bool {
// IsEmptyProof checks whether the proof corresponds to an empty proof as defined in NMT specifications https://github.com/celestiaorg/nmt/blob/master/docs/spec/nmt.md.
func (proof Proof) IsEmptyProof() bool {
return proof.start == proof.end && len(proof.nodes) == 0
}

Expand Down Expand Up @@ -156,7 +156,7 @@ func (proof Proof) VerifyNamespace(h hash.Hash, nID namespace.ID, leaves [][]byt

isEmptyRange := proof.start == proof.end
if isEmptyRange {
if proof.IsOfEmptyProof() && len(leaves) == 0 {
if proof.IsEmptyProof() && len(leaves) == 0 {
rootMin := namespace.ID(MinNamespace(root, nIDLen))
rootMax := namespace.ID(MaxNamespace(root, nIDLen))
// empty proofs are always rejected unless 1) nID is outside the range of
Expand Down
2 changes: 1 addition & 1 deletion proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestVerifyNamespace_EmptyProof(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require.True(t, tt.args.proof.IsOfEmptyProof() == tt.isValidEmptyProof)
require.True(t, tt.args.proof.IsEmptyProof() == tt.isValidEmptyProof)
if got := tt.args.proof.VerifyNamespace(tt.args.hasher, tt.args.nID, tt.args.leaves, tt.args.root); got != tt.want {
t.Errorf("VerifyNamespace() = %v, want %v", got, tt.want)
}
Expand Down

0 comments on commit 9e3d8de

Please sign in to comment.