Skip to content

Commit

Permalink
(squash this) add an extra test
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed Aug 6, 2024
1 parent 69aeca1 commit c9a710d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion commd.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func PieceAggregateCommP(proofType abi.RegisteredSealProof, pieceInfos []abi.Pie

fincid, err := commcid.PieceCommitmentV1ToCID(stack[0].commP)

return fincid, abi.PaddedPieceSize(stack[0].size / 2), err
return fincid, abi.PaddedPieceSize(stack[0].size), err
}

var s256pool = sync.Pool{New: func() any { return sha256simd.New() }}
Expand Down
6 changes: 5 additions & 1 deletion commd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestGenerateUnsealedCID(t *testing.T) {

expCommD := cidMustParse("baga6ea4seaqiw3gbmstmexb7sqwkc5r23o3i7zcyx5kr76pfobpykes3af62kca")

commD, _, _ := commp.PieceAggregateCommP(
commD, sizeD, _ := commp.PieceAggregateCommP(
abi.RegisteredSealProof_StackedDrg32GiBV1_1, // 32G sector SP
[]abi.PieceInfo{
{PieceCID: cidMustParse("baga6ea4seaqknzm22isnhsxt2s4dnw45kfywmhenngqq3nc7jvecakoca6ksyhy"), Size: 256 << 20}, // https://filfox.info/en/deal/3755444
Expand All @@ -49,6 +49,10 @@ func TestGenerateUnsealedCID(t *testing.T) {
if commD != expCommD {
t.Fatalf("calculated commd for sector f01392893:139074 as %s, expected %s", commD, expCommD)
}

if sizeD != 32<<30 {
t.Fatalf("calculated size for sector f01392893:139074 as %d, expected 32GiB", sizeD)
}
}

// Delete below when this ships in a stable release https://github.com/ipfs/go-cid/pull/139
Expand Down

0 comments on commit c9a710d

Please sign in to comment.