rename to simplify merge

This commit is contained in:
Steven Allen 2020-09-14 14:40:52 -07:00
parent fb3f710523
commit 2088335b9d

View File

@ -17,14 +17,14 @@ import (
"go.opencensus.io/trace" "go.opencensus.io/trace"
"golang.org/x/xerrors" "golang.org/x/xerrors"
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner" "github.com/filecoin-project/specs-actors/actors/builtin/miner"
v0proof "github.com/filecoin-project/specs-actors/actors/runtime/proof" "github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/api/apibstore" "github.com/filecoin-project/lotus/api/apibstore"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" iminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
) )
@ -115,12 +115,12 @@ func (s *WindowPoStScheduler) checkSectors(ctx context.Context, check bitfield.B
return sbf, nil return sbf, nil
} }
func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, dlIdx uint64, partitions []miner.Partition) error { func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, dlIdx uint64, partitions []iminer.Partition) error {
ctx, span := trace.StartSpan(ctx, "storage.checkNextRecoveries") ctx, span := trace.StartSpan(ctx, "storage.checkNextRecoveries")
defer span.End() defer span.End()
params := &v0miner.DeclareFaultsRecoveredParams{ params := &miner.DeclareFaultsRecoveredParams{
Recoveries: []v0miner.RecoveryDeclaration{}, Recoveries: []miner.RecoveryDeclaration{},
} }
faulty := uint64(0) faulty := uint64(0)
@ -165,7 +165,7 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, dlIdx uin
continue continue
} }
params.Recoveries = append(params.Recoveries, v0miner.RecoveryDeclaration{ params.Recoveries = append(params.Recoveries, miner.RecoveryDeclaration{
Deadline: dlIdx, Deadline: dlIdx,
Partition: uint64(partIdx), Partition: uint64(partIdx),
Sectors: recovered, Sectors: recovered,
@ -214,12 +214,12 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, dlIdx uin
return nil return nil
} }
func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64, partitions []miner.Partition) error { func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64, partitions []iminer.Partition) error {
ctx, span := trace.StartSpan(ctx, "storage.checkNextFaults") ctx, span := trace.StartSpan(ctx, "storage.checkNextFaults")
defer span.End() defer span.End()
params := &v0miner.DeclareFaultsParams{ params := &miner.DeclareFaultsParams{
Faults: []v0miner.FaultDeclaration{}, Faults: []miner.FaultDeclaration{},
} }
bad := uint64(0) bad := uint64(0)
@ -251,7 +251,7 @@ func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64,
bad += c bad += c
params.Faults = append(params.Faults, v0miner.FaultDeclaration{ params.Faults = append(params.Faults, miner.FaultDeclaration{
Deadline: dlIdx, Deadline: dlIdx,
Partition: uint64(partIdx), Partition: uint64(partIdx),
Sectors: faulty, Sectors: faulty,
@ -298,7 +298,7 @@ func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64,
return nil return nil
} }
func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *types.TipSet) (*v0miner.SubmitWindowedPoStParams, error) { func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *types.TipSet) (*miner.SubmitWindowedPoStParams, error) {
ctx, span := trace.StartSpan(ctx, "storage.runPost") ctx, span := trace.StartSpan(ctx, "storage.runPost")
defer span.End() defer span.End()
@ -308,7 +308,7 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
return nil, xerrors.Errorf("resolving actor: %w", err) return nil, xerrors.Errorf("resolving actor: %w", err)
} }
mas, err := miner.Load(stor, act) mas, err := iminer.Load(stor, act)
if err != nil { if err != nil {
return nil, xerrors.Errorf("getting miner state: %w", err) return nil, xerrors.Errorf("getting miner state: %w", err)
} }
@ -325,8 +325,8 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
log.Errorf("loading deadline: %v", err) log.Errorf("loading deadline: %v", err)
return return
} }
var partitions []miner.Partition var partitions []iminer.Partition
err = dl.ForEachPartition(func(_ uint64, part miner.Partition) error { err = dl.ForEachPartition(func(_ uint64, part iminer.Partition) error {
partitions = append(partitions, part) partitions = append(partitions, part)
return nil return nil
}) })
@ -361,8 +361,8 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
return nil, xerrors.Errorf("loading deadline: %w", err) return nil, xerrors.Errorf("loading deadline: %w", err)
} }
var partitions []miner.Partitions var partitions []iminer.Partitions
err = dl.ForEachPartition(func(_ uint64, part miner.Partition) error { err = dl.ForEachPartition(func(_ uint64, part iminer.Partition) error {
partitions = apppend(partitions, part) partitions = apppend(partitions, part)
return nil return nil
}) })
@ -370,9 +370,9 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
return nil, xerrors.Errorf("loading partitions: %w", err) return nil, xerrors.Errorf("loading partitions: %w", err)
} }
params := &v0miner.SubmitWindowedPoStParams{ params := &miner.SubmitWindowedPoStParams{
Deadline: di.Index, Deadline: di.Index,
Partitions: make([]v0miner.PoStPartition, 0, len(partitions)), Partitions: make([]miner.PoStPartition, 0, len(partitions)),
Proofs: nil, Proofs: nil,
} }
@ -432,7 +432,7 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
sidToPart[si.SectorNumber] = partIdx sidToPart[si.SectorNumber] = partIdx
} }
params.Partitions = append(params.Partitions, v0miner.PoStPartition{ params.Partitions = append(params.Partitions, miner.PoStPartition{
Index: uint64(partIdx), Index: uint64(partIdx),
Skipped: skipped, Skipped: skipped,
}) })
@ -497,7 +497,7 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
return params, nil return params, nil
} }
func (s *WindowPoStScheduler) sectorsForProof(ctx context.Context, goodSectors, allSectors bitfield.BitField, ts *types.TipSet) ([]v0proof.SectorInfo, error) { func (s *WindowPoStScheduler) sectorsForProof(ctx context.Context, goodSectors, allSectors bitfield.BitField, ts *types.TipSet) ([]proof.SectorInfo, error) {
sset, err := s.api.StateMinerSectors(ctx, s.actor, &goodSectors, false, ts.Key()) sset, err := s.api.StateMinerSectors(ctx, s.actor, &goodSectors, false, ts.Key())
if err != nil { if err != nil {
return nil, err return nil, err
@ -507,22 +507,22 @@ func (s *WindowPoStScheduler) sectorsForProof(ctx context.Context, goodSectors,
return nil, nil return nil, nil
} }
substitute := v0proof.SectorInfo{ substitute := proof.SectorInfo{
SectorNumber: sset[0].ID, SectorNumber: sset[0].ID,
SealedCID: sset[0].Info.SealedCID, SealedCID: sset[0].Info.SealedCID,
SealProof: sset[0].Info.SealProof, SealProof: sset[0].Info.SealProof,
} }
sectorByID := make(map[uint64]v0proof.SectorInfo, len(sset)) sectorByID := make(map[uint64]proof.SectorInfo, len(sset))
for _, sector := range sset { for _, sector := range sset {
sectorByID[uint64(sector.ID)] = v0proof.SectorInfo{ sectorByID[uint64(sector.ID)] = proof.SectorInfo{
SectorNumber: sector.ID, SectorNumber: sector.ID,
SealedCID: sector.Info.SealedCID, SealedCID: sector.Info.SealedCID,
SealProof: sector.Info.SealProof, SealProof: sector.Info.SealProof,
} }
} }
proofSectors := make([]v0proof.SectorInfo, 0, len(sset)) proofSectors := make([]proof.SectorInfo, 0, len(sset))
if err := allSectors.ForEach(func(sectorNo uint64) error { if err := allSectors.ForEach(func(sectorNo uint64) error {
if info, found := sectorByID[sectorNo]; found { if info, found := sectorByID[sectorNo]; found {
proofSectors = append(proofSectors, info) proofSectors = append(proofSectors, info)
@ -537,7 +537,7 @@ func (s *WindowPoStScheduler) sectorsForProof(ctx context.Context, goodSectors,
return proofSectors, nil return proofSectors, nil
} }
func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *v0miner.SubmitWindowedPoStParams) error { func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.SubmitWindowedPoStParams) error {
ctx, span := trace.StartSpan(ctx, "storage.commitPost") ctx, span := trace.StartSpan(ctx, "storage.commitPost")
defer span.End() defer span.End()