Skip to content

Commit

Permalink
storagefsm: Record publish deals message CID
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Aug 27, 2020
1 parent 29078aa commit 7806a98
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 5 deletions.
49 changes: 47 additions & 2 deletions extern/storage-sealing/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion extern/storage-sealing/sealing.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (m *Sealing) Stop(ctx context.Context) error {
return m.sectors.Stop(ctx)
}
func (m *Sealing) AddPieceToAnySector(ctx context.Context, size abi.UnpaddedPieceSize, r io.Reader, d DealInfo) (abi.SectorNumber, abi.PaddedPieceSize, error) {
log.Infof("Adding piece for deal %d", d.DealID)
log.Infof("Adding piece for deal %d (publish msg: %s)", d.DealID, d.PublishCid)
if (padreader.PaddedSize(uint64(size))) != size {
return 0, 0, xerrors.Errorf("cannot allocate unpadded piece")
}
Expand Down
1 change: 1 addition & 0 deletions extern/storage-sealing/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Piece struct {

// DealInfo is a tuple of deal identity and its schedule
type DealInfo struct {
PublishCid *cid.Cid
DealID abi.DealID
DealSchedule DealSchedule
KeepUnsealed bool
Expand Down
9 changes: 7 additions & 2 deletions markets/storageadapter/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,13 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark
}

func (n *ProviderNodeAdapter) OnDealComplete(ctx context.Context, deal storagemarket.MinerDeal, pieceSize abi.UnpaddedPieceSize, pieceData io.Reader) (*storagemarket.PackingResult, error) {
if deal.PublishCid == nil {
return nil, xerrors.Errorf("deal.PublishCid can't be nil")
}

p, offset, err := n.secb.AddPiece(ctx, pieceSize, pieceData, sealing.DealInfo{
DealID: deal.DealID,
DealID: deal.DealID,
PublishCid: deal.PublishCid,
DealSchedule: sealing.DealSchedule{
StartEpoch: deal.ClientDealProposal.Proposal.StartEpoch,
EndEpoch: deal.ClientDealProposal.Proposal.EndEpoch,
Expand Down Expand Up @@ -351,7 +356,7 @@ func (n *ProviderNodeAdapter) GetChainHead(ctx context.Context) (shared.TipSetTo
}

func (n *ProviderNodeAdapter) WaitForMessage(ctx context.Context, mcid cid.Cid, cb func(code exitcode.ExitCode, bytes []byte, err error) error) error {
receipt, err := n.StateWaitMsg(ctx, mcid, build.MessageConfidence)
receipt, err := n.StateWaitMsg(ctx, mcid, 2*build.MessageConfidence)
if err != nil {
return cb(0, nil, err)
}
Expand Down
1 change: 1 addition & 0 deletions storage/sectorblocks/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (st *SectorBlocks) AddPiece(ctx context.Context, size abi.UnpaddedPieceSize
return 0, 0, err
}

// TODO: DealID has very low finality here
err = st.writeRef(d.DealID, sn, offset, size)
if err != nil {
return 0, 0, xerrors.Errorf("writeRef: %w", err)
Expand Down

0 comments on commit 7806a98

Please sign in to comment.