From 7f93cdc81d1c8d6679db50f1f4bab01608f67936 Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Tue, 21 Dec 2021 16:31:02 +0100 Subject: [PATCH] refactor: isolate commp in its own package to avoid exposing pulling filecoin-ffi --- {shared => commp}/commp.go | 2 +- storagemarket/impl/provider_environments.go | 4 ++-- storagemarket/testnodes/testnodes.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) rename {shared => commp}/commp.go (98%) diff --git a/shared/commp.go b/commp/commp.go similarity index 98% rename from shared/commp.go rename to commp/commp.go index 4815c446..fd230562 100644 --- a/shared/commp.go +++ b/commp/commp.go @@ -1,4 +1,4 @@ -package shared +package commp import ( "io" diff --git a/storagemarket/impl/provider_environments.go b/storagemarket/impl/provider_environments.go index 210c46d0..b17521e4 100644 --- a/storagemarket/impl/provider_environments.go +++ b/storagemarket/impl/provider_environments.go @@ -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" @@ -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 } diff --git a/storagemarket/testnodes/testnodes.go b/storagemarket/testnodes/testnodes.go index 814eb241..14c53ac4 100644 --- a/storagemarket/testnodes/testnodes.go +++ b/storagemarket/testnodes/testnodes.go @@ -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" @@ -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) }