Skip to content

Commit ba4d476

Browse files
authored
chore: add debug info to ErrPartSetInvalidProof (#1875)
Part of celestiaorg/celestia-app#4859 ## Motivation Currently the two instances where `ErrPartSetInvalidProof` is returned look identical. This PR modifies the errors so to include additional information that will help with debugging.
1 parent 4b045d9 commit ba4d476

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

types/part_set.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,12 @@ func (ps *PartSet) AddPart(part *Part) (bool, error) {
301301

302302
// The proof should be compatible with the number of parts.
303303
if part.Proof.Total != int64(ps.total) {
304-
return false, ErrPartSetInvalidProof
304+
return false, fmt.Errorf("%w: part.Proof.Total: %d != ps.total: %d", ErrPartSetInvalidProof, part.Proof.Total, ps.total)
305305
}
306306

307307
// Check hash proof
308-
if part.Proof.Verify(ps.Hash(), part.Bytes) != nil {
309-
return false, ErrPartSetInvalidProof
308+
if err := part.Proof.Verify(ps.Hash(), part.Bytes); err != nil {
309+
return false, fmt.Errorf("%w: part.Proof.Verify(ps.Hash(), part.Bytes) = %v", ErrPartSetInvalidProof, err)
310310
}
311311

312312
return ps.AddPartWithoutProof(part)

0 commit comments

Comments
 (0)