From 354de2d8da092064f728c54ffd51fe2059c6634f Mon Sep 17 00:00:00 2001 From: Vlad <13818348+walldiss@users.noreply.github.com> Date: Wed, 5 Jun 2024 20:50:40 +0500 Subject: [PATCH] Err > Error --- share/shwap/row.go | 2 +- share/shwap/row_namespace_data.go | 2 +- share/shwap/sample.go | 6 +++--- share/shwap/sample_test.go | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/share/shwap/row.go b/share/shwap/row.go index f1e3b8b019..f03c7366f5 100644 --- a/share/shwap/row.go +++ b/share/shwap/row.go @@ -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 } diff --git a/share/shwap/row_namespace_data.go b/share/shwap/row_namespace_data.go index 685005f0c5..2bbf4c06fa 100644 --- a/share/shwap/row_namespace_data.go +++ b/share/shwap/row_namespace_data.go @@ -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 } diff --git a/share/shwap/sample.go b/share/shwap/sample.go index c1de9d66f3..c521410e35 100644 --- a/share/shwap/sample.go +++ b/share/shwap/sample.go @@ -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. @@ -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 } diff --git a/share/shwap/sample_test.go b/share/shwap/sample_test.go index 04189951cd..34fb4bfa9b 100644 --- a/share/shwap/sample_test.go +++ b/share/shwap/sample_test.go @@ -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) {