We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
1a1286f
If we run this code repro
package blob_test import ( "testing" "github.com/celestiaorg/celestia-app/v2/pkg/proof" "github.com/celestiaorg/celestia-node/blob" ) func TestCommitmentProofRowProofVerify(t *testing.T) { cp := &blob.CommitmentProof{ RowProof: proof.RowProof{ Proofs: []*proof.Proof{{}}, }, } _, _ = cp.Verify(nil, 1) }
An error and not a panic
$ go test -run=TestCommitmentProofRowProofVerify # github.com/celestiaorg/celestia-node/blob.test --- FAIL: TestCommitmentProofRowProofVerify (0.00s) panic: runtime error: index out of range [0] with length 0 [recovered] panic: runtime error: index out of range [0] with length 0 goroutine 9 [running]: testing.tRunner.func1.2({0x1069be820, 0xc000064c78}) /Users/emmanuelodeke/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.0.darwin-amd64/src/testing/testing.go:1632 +0x230 testing.tRunner.func1() /Users/emmanuelodeke/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.0.darwin-amd64/src/testing/testing.go:1635 +0x35e panic({0x1069be820?, 0xc000064c78?}) /Users/emmanuelodeke/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.0.darwin-amd64/src/runtime/panic.go:785 +0x132 github.com/celestiaorg/celestia-app/v2/pkg/proof.RowProof.VerifyProof({{0x0, 0x0, 0x0}, {0xc0010a7f58, 0x1, 0x1}, {0x0, 0x0, 0x0}, 0x0, ...}, ...) /Users/emmanuelodeke/go/pkg/mod/github.com/celestiaorg/celestia-app/v2@v2.1.2/pkg/proof/row_proof.go:32 +0x172 github.com/celestiaorg/celestia-node/blob.(*CommitmentProof).Verify(0xc0010a7eb8, {0x0, 0x0, 0x0}, 0x1) /Users/emmanuelodeke/go/src/github.com/celestiaorg/celestia-node/blob/commitment_proof.go:146 +0x779 github.com/celestiaorg/celestia-node/blob_test.TestCommitmentProofRowProofVerify(0xc000637860?) /Users/emmanuelodeke/go/src/github.com/celestiaorg/celestia-node/blob/repro_test.go:18 +0x94 testing.tRunner(0xc000637860, 0x106b030e0) /Users/emmanuelodeke/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.0.darwin-amd64/src/testing/testing.go:1690 +0xf4 created by testing.(*T).Run in goroutine 1 /Users/emmanuelodeke/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.0.darwin-amd64/src/testing/testing.go:1743 +0x390 exit status 2 FAIL github.com/celestiaorg/celestia-node/blob 1.583s
## Suggested fix diff --git a/blob/commitment_proof.go b/blob/commitment_proof.go index 8fa74671..f6af47a9 100644 --- a/blob/commitment_proof.go +++ b/blob/commitment_proof.go @@ -2,6 +2,7 @@ package blob import ( "bytes" + "errors" "fmt" "github.com/celestiaorg/celestia-app/v2/pkg/appconsts" @@ -85,6 +86,10 @@ func (commitmentProof *CommitmentProof) Validate() error { // Expects the commitment proof to be properly formulated and validated // using the Validate() function. func (commitmentProof *CommitmentProof) Verify(root []byte, subtreeRootThreshold int) (bool, error) { + if len(root) == 0 { + return false, errors.New("root must be non-empty") + } + nmtHasher := nmt.NewNmtHasher(appconsts.NewBaseHashFunc(), share.NamespaceSize, true) // computes the total number of shares proven. @@ -93,6 +98,10 @@ func (commitmentProof *CommitmentProof) Verify(root []byte, subtreeRootThreshold numberOfShares += proof.End() - proof.Start() }
cc @liamsi @musalbas @rootulp
The text was updated successfully, but these errors were encountered:
fix(blob): add fixes along with the fuzzers that discovered them
af22397
This changes adds fuzzers+corpra that found some bugs, along with tests and reproducers to catch future regressions. Fixes celestiaorg#3727 Fixes celestiaorg#3728 Fixes celestiaorg#3729 Fixes celestiaorg#3730 Fixes celestiaorg#3731
9305568
6f6b900
Successfully merging a pull request may close this issue.
Celestia Node version
1a1286f
Steps to reproduce it
If we run this code repro
Expected result
An error and not a panic
Actual result
Relevant log output
cc @liamsi @musalbas @rootulp
The text was updated successfully, but these errors were encountered: