Skip to content

Commit

Permalink
Err > Error
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss committed Jun 5, 2024
1 parent d6612ba commit 354de2d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion share/shwap/row.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (r Row) Validate(dah *share.Root, idx int) error {
}

if err := r.verifyInclusion(dah, idx); err != nil {
return fmt.Errorf("%w: %w", ErrorFailedVerification, err)
return fmt.Errorf("%w: %w", ErrFailedVerification, err)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion share/shwap/row_namespace_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (rnd RowNamespaceData) Validate(dah *share.Root, namespace share.Namespace,
}

if !rnd.verifyInclusion(rowRoot, namespace) {
return fmt.Errorf("%w for row: %d", ErrorFailedVerification, rowIdx)
return fmt.Errorf("%w for row: %d", ErrFailedVerification, rowIdx)
}
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions share/shwap/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/celestiaorg/celestia-node/share/shwap/pb"
)

// ErrorFailedVerification is returned when inclusion proof verification fails. It is returned
// ErrFailedVerification is returned when inclusion proof verification fails. It is returned
// when the data and the proof do not match trusted data root.
var ErrorFailedVerification = errors.New("failed to verify inclusion")
var ErrFailedVerification = errors.New("failed to verify inclusion")

// Sample represents a data share along with its Merkle proof, used to validate the share's
// inclusion in a data square.
Expand Down Expand Up @@ -67,7 +67,7 @@ func (s Sample) Validate(dah *share.Root, rowIdx, colIdx int) error {
return fmt.Errorf("invalid SampleProofType: %d", s.ProofType)
}
if !s.verifyInclusion(dah, rowIdx, colIdx) {
return ErrorFailedVerification
return ErrFailedVerification
}
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions share/shwap/sample_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,26 @@ func TestSampleNegativeVerifyInclusion(t *testing.T) {

// incorrect row index
err = sample.Validate(root, 1, 0)
require.ErrorIs(t, err, shwap.ErrorFailedVerification)
require.ErrorIs(t, err, shwap.ErrFailedVerification)

// Corrupt the share
sample.Share[0] ^= 0xFF
err = sample.Validate(root, 0, 0)
require.ErrorIs(t, err, shwap.ErrorFailedVerification)
require.ErrorIs(t, err, shwap.ErrFailedVerification)

// incorrect proofType
sample, err = inMem.Sample(context.Background(), 0, 0)
require.NoError(t, err)
sample.ProofType = rsmt2d.Col
err = sample.Validate(root, 0, 0)
require.ErrorIs(t, err, shwap.ErrorFailedVerification)
require.ErrorIs(t, err, shwap.ErrFailedVerification)

// Corrupt the last root hash byte
sample, err = inMem.Sample(context.Background(), 0, 0)
require.NoError(t, err)
root.RowRoots[0][len(root.RowRoots[0])-1] ^= 0xFF
err = sample.Validate(root, 0, 0)
require.ErrorIs(t, err, shwap.ErrorFailedVerification)
require.ErrorIs(t, err, shwap.ErrFailedVerification)
}

func TestSampleProtoEncoding(t *testing.T) {
Expand Down

0 comments on commit 354de2d

Please sign in to comment.