Skip to content

Commit

Permalink
Merge pull request #11 from filecoin-project/chore/fix-lint
Browse files Browse the repository at this point in the history
chore: resolve lint errors
  • Loading branch information
Jakub Sztandera authored Jun 5, 2023
2 parents f293b5c + 7c63083 commit c8dec97
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions datasegment/commp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)

Expand Down
11 changes: 7 additions & 4 deletions datasegment/creation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions datasegment/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit c8dec97

Please sign in to comment.