From 96bdf47c11e749377b83d9632d2ddc71e370be36 Mon Sep 17 00:00:00 2001 From: Mike <41407352+hunjixin@users.noreply.github.com> Date: Wed, 22 Dec 2021 09:34:58 +0800 Subject: [PATCH] padreader for payload data (#157) --- app/venus-sealer/init.go | 5 ++--- go.mod | 2 +- go.sum | 4 ++-- storage-sealing/deals.go | 10 ++++++++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/venus-sealer/init.go b/app/venus-sealer/init.go index e0ee17dd..8ce7de23 100644 --- a/app/venus-sealer/init.go +++ b/app/venus-sealer/init.go @@ -137,9 +137,8 @@ var initCmd = &cli.Command{ Usage: "indicate the deployment method of the venus-market, one of `solo`, `pool`, Default: `solo`", }, &cli.StringFlag{ - Name: "market-url", - Usage: "market url", - Required: true, + Name: "market-url", + Usage: "market url", }, &cli.StringFlag{ Name: "market-token", diff --git a/go.mod b/go.mod index a30282de..32d44e29 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/filecoin-project/specs-actors/v6 v6.0.1 github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 github.com/filecoin-project/venus v1.1.3-rc1 - github.com/filecoin-project/venus-market v1.0.2-0.20211206084715-070874dc17eb + github.com/filecoin-project/venus-market v1.0.2-0.20211217074314-b0f03a224ab5 github.com/filecoin-project/venus-messager v1.2.2-rc1.0.20211201075617-c9dd295b905c github.com/gbrlsnchs/jwt/v3 v3.0.0 github.com/golang/mock v1.6.0 diff --git a/go.sum b/go.sum index dab5194f..c8fdef70 100644 --- a/go.sum +++ b/go.sum @@ -389,8 +389,8 @@ github.com/filecoin-project/venus-auth v1.2.2-0.20210721103851-593a379c4916/go.m github.com/filecoin-project/venus-auth v1.3.1-0.20210809053831-012d55d5f578/go.mod h1:/cbLZYvQhinVFUG4TP2Uy1o7LtF+guT21qZIMTmKk0g= github.com/filecoin-project/venus-auth v1.3.1 h1:3FGPK6zCxZIpQA+VTY01wNaCvcgyLWPa61zuFY+br9c= github.com/filecoin-project/venus-auth v1.3.1/go.mod h1:DZwxRN2SVvRjw4UOMw2PBO1+hwAusksaWJe6BoGkjec= -github.com/filecoin-project/venus-market v1.0.2-0.20211206084715-070874dc17eb h1:MNupB2v1fBye/Niq2dpN24UN+tztP6FJwpffq/6xFa8= -github.com/filecoin-project/venus-market v1.0.2-0.20211206084715-070874dc17eb/go.mod h1:yDx6bwthenirxF9TIWUAZ20cpySvw45ktBqY2yAmGYQ= +github.com/filecoin-project/venus-market v1.0.2-0.20211217074314-b0f03a224ab5 h1:8tS6dzNZgYjgzERHXgEtMcwcm+jrmriHZG0VBKG8Q7A= +github.com/filecoin-project/venus-market v1.0.2-0.20211217074314-b0f03a224ab5/go.mod h1:yDx6bwthenirxF9TIWUAZ20cpySvw45ktBqY2yAmGYQ= github.com/filecoin-project/venus-messager v1.2.2-rc1.0.20211201075617-c9dd295b905c h1:eLyzMO+gCk/zmiajbk7BQTCD8lm85NpNPAHdWH3jtYM= github.com/filecoin-project/venus-messager v1.2.2-rc1.0.20211201075617-c9dd295b905c/go.mod h1:6bIzQHF9SMavQWRwxntjAocxz95LUBuT2Q52Q8TkQ3c= github.com/filecoin-project/venus-wallet v1.2.0/go.mod h1:RsBPnMOv0qqL1bwB4SdstSecIRF9WY1OZFE/0BshyrM= diff --git a/storage-sealing/deals.go b/storage-sealing/deals.go index 190b47ce..0a786c98 100644 --- a/storage-sealing/deals.go +++ b/storage-sealing/deals.go @@ -2,6 +2,7 @@ package sealing import ( "context" + "github.com/filecoin-project/go-padreader" types2 "github.com/filecoin-project/venus-market/types" "github.com/filecoin-project/venus-sealer/types" @@ -19,13 +20,18 @@ func (m *Sealing) DealSector(ctx context.Context) ([]types.DealAssign, error) { var assigned []types.DealAssign for _, deal := range deals { - r, err := m.pieceStorage.Read(ctx, deal.PieceStorage) + r, err := m.pieceStorage.Read(ctx, deal.PieceCID.String()) if err != nil { log.Errorf("read piece from piece storage %v", err) continue } - so, err := m.SectorAddPieceToAny(ctx, deal.Length.Unpadded(), r, types.PieceDealInfo{ + padR, err := padreader.NewInflator(r, uint64(deal.PayloadSize), deal.PieceSize.Unpadded()) + if err != nil { + return nil, err + } + + so, err := m.SectorAddPieceToAny(ctx, deal.Length.Unpadded(), padR, types.PieceDealInfo{ PublishCid: &deal.PublishCid, DealID: deal.DealID, DealProposal: &deal.DealProposal,