diff --git a/datasegment/commp_test.go b/datasegment/commp_test.go index e9bc101..bfb9467 100644 --- a/datasegment/commp_test.go +++ b/datasegment/commp_test.go @@ -16,6 +16,7 @@ func TestLightCommP2Cid(t *testing.T) { c1, err := commcid.PieceCommitmentV1ToCID(node[:]) assert.NoError(t, err) c2, err := lightCommP2Cid(node) + assert.NoError(t, err) assert.Equal(t, c1, c2) } @@ -28,6 +29,7 @@ func TestLightCid2CommP(t *testing.T) { c, err := commcid.PieceCommitmentV1ToCID(node[:]) assert.NoError(t, err) n1, err := lightCid2CommP(c) + assert.NoError(t, err) assert.Equal(t, node, n1) diff --git a/datasegment/creation_test.go b/datasegment/creation_test.go index 2832384..2ef7a71 100644 --- a/datasegment/creation_test.go +++ b/datasegment/creation_test.go @@ -55,6 +55,7 @@ func TestAggregateCreation(t *testing.T) { for _, pi := range subPieceInfos { ip, err := a.ProofForPieceInfo(pi) + assert.NoError(t, err) aux, err := ip.ComputeExpectedAuxData(VerifierDataForPieceInfo(pi)) assert.NoError(t, err) assert.Equal(t, InclusionAuxData{CommPa: pcid, SizePa: a.DealSize}, *aux) @@ -238,7 +239,8 @@ func TestAggregateSample(t *testing.T) { require.NoError(t, err) { - _, err = f.Seek(int64(a.Index.Entries[0].UnpaddedOffest()), os.SEEK_SET) + _, err = f.Seek(int64(a.Index.Entries[0].UnpaddedOffest()), io.SeekStart) + require.NoError(t, err) p0, err := os.Open("testdata/sample_aggregate/cat.png.car") require.NoError(t, err) _, err = io.Copy(f, p0) @@ -247,7 +249,7 @@ func TestAggregateSample(t *testing.T) { { p1, err := os.Open("testdata/sample_aggregate/Verifiable Data Aggregation.png.car") require.NoError(t, err) - _, err = f.Seek(int64(a.Index.Entries[1].UnpaddedOffest()), os.SEEK_SET) + _, err = f.Seek(int64(a.Index.Entries[1].UnpaddedOffest()), io.SeekStart) require.NoError(t, err) _, err = io.Copy(f, p1) require.NoError(t, err) @@ -257,7 +259,7 @@ func TestAggregateSample(t *testing.T) { { index_start, err := a.IndexStartPosition() require.NoError(t, err) - _, err = f.Seek(int64(index_start), os.SEEK_SET) + _, err = f.Seek(int64(index_start), io.SeekStart) require.NoError(t, err) r, err := a.IndexReader() require.NoError(t, err) @@ -271,7 +273,7 @@ func TestAggregateSample(t *testing.T) { { indexStart := DataSegmentIndexStartOffset(dealSize) - f.Seek(int64(indexStart), os.SEEK_SET) + f.Seek(int64(indexStart), io.SeekStart) indexData, err := ParseDataSegmentIndex(f) require.NoError(t, err) @@ -296,6 +298,7 @@ func TestAggregateSample(t *testing.T) { assert.NoError(t, err) commp, paddedSize, err := commpHasher.Digest() + assert.NoError(t, err) pieceCid := Must(commcid.PieceCommitmentV1ToCID(commp)) assert.Equal(t, uint64(dealSize), uint64(paddedSize)) assert.Equal(t, cid.MustParse("baga6ea4seaqnqkeoqevjjjfe46wo2lpfclcbmkyms4wkz5srou3vzmr3w3c72bq"), diff --git a/datasegment/index.go b/datasegment/index.go index 8a9dbbe..cdc4f36 100644 --- a/datasegment/index.go +++ b/datasegment/index.go @@ -260,10 +260,10 @@ func (sd SegmentDesc) Validate() error { return validationError("computed checksum does not match embedded checksum") } if sd.Offset%128 != 0 { - return validationError("offset is not aligned in unpadded data") + return validationError("offset is not aligned in padded data") } if sd.Size%128 != 0 { - return validationError("size is not aligned in unpadded data") + return validationError("size is not aligned in padded data") } return nil }