Skip to content

Commit

Permalink
refactor: isolate commp in its own package to avoid exposing pulling …
Browse files Browse the repository at this point in the history
…filecoin-ffi (#659)
  • Loading branch information
dirkmc committed Dec 21, 2021
1 parent a7fc856 commit b6454d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion shared/commp.go → commp/commp.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package shared
package commp

import (
"io"
Expand Down
4 changes: 2 additions & 2 deletions storagemarket/impl/provider_environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"

"github.com/filecoin-project/go-fil-markets/commp"
"github.com/filecoin-project/go-fil-markets/filestore"
"github.com/filecoin-project/go-fil-markets/piecestore"
"github.com/filecoin-project/go-fil-markets/shared"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-fil-markets/storagemarket/impl/providerstates"
"github.com/filecoin-project/go-fil-markets/storagemarket/network"
Expand Down Expand Up @@ -109,7 +109,7 @@ func (p *providerDealEnvironment) GeneratePieceCommitment(proposalCid cid.Cid, c
}
}()

pieceCID, err := shared.GenerateCommp(rd.DataReader(), rd.Header.DataSize, uint64(dealSize))
pieceCID, err := commp.GenerateCommp(rd.DataReader(), rd.Header.DataSize, uint64(dealSize))
return pieceCID, "", err
}

Expand Down
3 changes: 2 additions & 1 deletion storagemarket/testnodes/testnodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/filecoin-project/specs-actors/actors/builtin/verifreg"

"github.com/filecoin-project/go-fil-markets/commp"
"github.com/filecoin-project/go-fil-markets/shared"
"github.com/filecoin-project/go-fil-markets/shared_testutil"
"github.com/filecoin-project/go-fil-markets/storagemarket"
Expand Down Expand Up @@ -394,7 +395,7 @@ func (n *FakeProviderNode) OnDealComplete(ctx context.Context, deal storagemarke
}

// Generate commP
pieceCID, err := shared.GenerateCommp(pieceReader, uint64(pieceSize), uint64(pieceSize))
pieceCID, err := commp.GenerateCommp(pieceReader, uint64(pieceSize), uint64(pieceSize))
if err != nil {
return nil, fmt.Errorf("on deal complete: generating commp: %w", err)
}
Expand Down

0 comments on commit b6454d9

Please sign in to comment.