diff --git a/build/params_debug.go b/build/params_debug.go index 2b0c8e22b..ac9efbbe6 100644 --- a/build/params_debug.go +++ b/build/params_debug.go @@ -2,11 +2,15 @@ package build +import ( + "github.com/filecoin-project/specs-actors/actors/abi" +) + func init() { InsecurePoStValidation = true } -var SectorSizes = []uint64{1024} +var SectorSizes = []abi.SectorSize{1024} // Seconds const BlockDelay = 6 diff --git a/build/params_shared.go b/build/params_shared.go index 6617d6e6c..a18a9431b 100644 --- a/build/params_shared.go +++ b/build/params_shared.go @@ -2,6 +2,8 @@ package build import ( "math/big" + + "github.com/filecoin-project/specs-actors/actors/abi" ) // Core network constants @@ -12,7 +14,7 @@ import ( const UnixfsChunkSize uint64 = 1 << 20 const UnixfsLinksPerLevel = 1024 -func SupportedSectorSize(ssize uint64) bool { +func SupportedSectorSize(ssize abi.SectorSize) bool { for _, ss := range SectorSizes { if ssize == ss { return true diff --git a/build/params_testnet.go b/build/params_testnet.go index 016109770..7a5dda668 100644 --- a/build/params_testnet.go +++ b/build/params_testnet.go @@ -2,7 +2,11 @@ package build -var SectorSizes = []uint64{ +import ( + "github.com/filecoin-project/specs-actors/actors/abi" +) + +var SectorSizes = []abi.SectorSize{ 32 << 30, } diff --git a/chain/actors/actor_storagepower.go b/chain/actors/actor_storagepower.go index 33bfde49e..76a69dcd1 100644 --- a/chain/actors/actor_storagepower.go +++ b/chain/actors/actor_storagepower.go @@ -69,7 +69,7 @@ type CreateStorageMinerParams struct { } func (spa StoragePowerActor) CreateStorageMiner(act *types.Actor, vmctx types.VMContext, params *CreateStorageMinerParams) ([]byte, ActorError) { - if !build.SupportedSectorSize(uint64(params.SectorSize)) { + if !build.SupportedSectorSize(params.SectorSize) { return nil, aerrors.Newf(1, "Unsupported sector size: %d", params.SectorSize) } diff --git a/cmd/lotus-seal-worker/main.go b/cmd/lotus-seal-worker/main.go index 208d64eb5..1551bb07f 100644 --- a/cmd/lotus-seal-worker/main.go +++ b/cmd/lotus-seal-worker/main.go @@ -134,7 +134,7 @@ var runCmd = &cli.Command{ return err } - if err := paramfetch.GetParams(build.ParametersJson(), ssize); err != nil { + if err := paramfetch.GetParams(build.ParametersJson(), uint64(ssize)); err != nil { return xerrors.Errorf("get params: %w", err) } diff --git a/cmd/lotus-seal-worker/transfer.go b/cmd/lotus-seal-worker/transfer.go index 6091a628f..683071b5f 100644 --- a/cmd/lotus-seal-worker/transfer.go +++ b/cmd/lotus-seal-worker/transfer.go @@ -9,6 +9,7 @@ import ( sectorbuilder "github.com/filecoin-project/go-sectorbuilder" "github.com/filecoin-project/go-sectorbuilder/fs" + "github.com/filecoin-project/specs-actors/actors/abi" files "github.com/ipfs/go-ipfs-files" "golang.org/x/xerrors" "gopkg.in/cheggaaa/pb.v1" @@ -25,7 +26,7 @@ func (w *worker) sizeForType(typ string) int64 { return size } -func (w *worker) fetch(typ string, sectorID uint64) error { +func (w *worker) fetch(typ string, sectorID abi.SectorNumber) error { outname := filepath.Join(w.repo, typ, w.sb.SectorName(sectorID)) url := w.minerEndpoint + "/remote/" + typ + "/" + fmt.Sprint(sectorID) @@ -77,7 +78,7 @@ func (w *worker) fetch(typ string, sectorID uint64) error { } -func (w *worker) push(typ string, sectorID uint64) error { +func (w *worker) push(typ string, sectorID abi.SectorNumber) error { w.limiter.transferLimit <- struct{}{} defer func() { <-w.limiter.transferLimit @@ -146,12 +147,12 @@ func (w *worker) push(typ string, sectorID uint64) error { return w.remove(typ, sectorID) } -func (w *worker) remove(typ string, sectorID uint64) error { +func (w *worker) remove(typ string, sectorID abi.SectorNumber) error { filename := filepath.Join(w.repo, typ, w.sb.SectorName(sectorID)) return os.RemoveAll(filename) } -func (w *worker) fetchSector(sectorID uint64, typ sectorbuilder.WorkerTaskType) error { +func (w *worker) fetchSector(sectorID abi.SectorNumber, typ sectorbuilder.WorkerTaskType) error { w.limiter.transferLimit <- struct{}{} defer func() { <-w.limiter.transferLimit diff --git a/cmd/lotus-storage-miner/init.go b/cmd/lotus-storage-miner/init.go index 833d2d1f3..c694e552e 100644 --- a/cmd/lotus-storage-miner/init.go +++ b/cmd/lotus-storage-miner/init.go @@ -1,7 +1,6 @@ package main import ( - "bytes" "context" "crypto/rand" "encoding/json" @@ -72,7 +71,7 @@ var initCmd = &cli.Command{ &cli.Uint64Flag{ Name: "sector-size", Usage: "specify sector size to use", - Value: build.SectorSizes[0], + Value: uint64(build.SectorSizes[0]), }, &cli.StringFlag{ Name: "pre-sealed-sectors", @@ -279,12 +278,12 @@ func migratePreSealMeta(ctx context.Context, api lapi.FullNode, presealDir strin return err } - proposalCid, err := sector.Deal.Cid() + pnd, err := cborutil.AsIpld(sector.Deal) if err != nil { return err } - dealKey := datastore.NewKey(deals.ProviderDsPrefix).ChildString(proposalCid.String()) + dealKey := datastore.NewKey(deals.ProviderDsPrefix).ChildString(pnd.Cid().String()) proposal, err := utils.ToSharedStorageDealProposal(§or.Deal) if err != nil { @@ -293,9 +292,9 @@ func migratePreSealMeta(ctx context.Context, api lapi.FullNode, presealDir strin deal := &deals.MinerDeal{ MinerDeal: storagemarket.MinerDeal{ Proposal: *proposal, - ProposalCid: proposalCid, + ProposalCid: pnd.Cid(), State: storagemarket.StorageDealActive, - Ref: proposalCid, // TODO: This is super wrong, but there + Ref: pnd.Cid(), // TODO: This is super wrong, but there // are no params for CommP CIDs, we can't recover unixfs cid easily, // and this isn't even used after the deal enters Complete state DealID: dealID, @@ -325,8 +324,9 @@ func findMarketDealID(ctx context.Context, api lapi.FullNode, deal actors.Storag } for k, v := range deals { - if bytes.Equal(v.PieceRef, deal.PieceRef) { - return strconv.ParseUint(k, 10, 64) + if v.Proposal.PieceCID.Equals(deal.PieceCID) { + id, err := strconv.ParseUint(k, 10, 64) + return abi.DealID(id), err } } diff --git a/lotuspond/spawn.go b/lotuspond/spawn.go index bc0602fa6..fd211b3da 100644 --- a/lotuspond/spawn.go +++ b/lotuspond/spawn.go @@ -10,6 +10,7 @@ import ( "sync/atomic" "time" + "github.com/filecoin-project/specs-actors/actors/abi" "golang.org/x/xerrors" "github.com/filecoin-project/go-address" @@ -18,7 +19,7 @@ import ( ) func init() { - build.SectorSizes = []uint64{1024} + build.SectorSizes = []abi.SectorSize{1024} } func (api *api) Spawn() (nodeInfo, error) {