fpost -> windowPost renaming
This commit is contained in:
parent
7e96b15091
commit
5524241645
@ -141,7 +141,7 @@ func StorageMiner(mctx helpers.MetricsCtx, lc fx.Lifecycle, api lapi.FullNode, h
|
|||||||
return nil, xerrors.Errorf("bad sector size: %w", err)
|
return nil, xerrors.Errorf("bad sector size: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fps := storage.NewFPoStScheduler(api, sealer, maddr, worker, ppt)
|
fps := storage.NewWindowedPoStScheduler(api, sealer, maddr, worker, ppt)
|
||||||
|
|
||||||
sm, err := storage.NewMiner(api, maddr, worker, h, ds, sealer, sc, verif, tktFn)
|
sm, err := storage.NewMiner(api, maddr, worker, h, ds, sealer, sc, verif, tktFn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -18,7 +18,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *FPoStScheduler) failPost(eps abi.ChainEpoch) {
|
func (s *WindowPoStScheduler) failPost(eps abi.ChainEpoch) {
|
||||||
s.failLk.Lock()
|
s.failLk.Lock()
|
||||||
if eps > s.failed {
|
if eps > s.failed {
|
||||||
s.failed = eps
|
s.failed = eps
|
||||||
@ -26,7 +26,7 @@ func (s *FPoStScheduler) failPost(eps abi.ChainEpoch) {
|
|||||||
s.failLk.Unlock()
|
s.failLk.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) doPost(ctx context.Context, eps abi.ChainEpoch, ts *types.TipSet) {
|
func (s *WindowPoStScheduler) doPost(ctx context.Context, eps abi.ChainEpoch, ts *types.TipSet) {
|
||||||
ctx, abort := context.WithCancel(ctx)
|
ctx, abort := context.WithCancel(ctx)
|
||||||
|
|
||||||
s.abort = abort
|
s.abort = abort
|
||||||
@ -35,7 +35,7 @@ func (s *FPoStScheduler) doPost(ctx context.Context, eps abi.ChainEpoch, ts *typ
|
|||||||
go func() {
|
go func() {
|
||||||
defer abort()
|
defer abort()
|
||||||
|
|
||||||
ctx, span := trace.StartSpan(ctx, "FPoStScheduler.doPost")
|
ctx, span := trace.StartSpan(ctx, "WindowPoStScheduler.doPost")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
proof, err := s.runPost(ctx, eps, ts)
|
proof, err := s.runPost(ctx, eps, ts)
|
||||||
@ -54,7 +54,7 @@ func (s *FPoStScheduler) doPost(ctx context.Context, eps abi.ChainEpoch, ts *typ
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) declareFaults(ctx context.Context, fc uint64, params *miner.DeclareTemporaryFaultsParams) error {
|
func (s *WindowPoStScheduler) declareFaults(ctx context.Context, fc uint64, params *miner.DeclareTemporaryFaultsParams) error {
|
||||||
log.Warnf("DECLARING %d FAULTS", fc)
|
log.Warnf("DECLARING %d FAULTS", fc)
|
||||||
|
|
||||||
enc, aerr := actors.SerializeParams(params)
|
enc, aerr := actors.SerializeParams(params)
|
||||||
@ -90,7 +90,7 @@ func (s *FPoStScheduler) declareFaults(ctx context.Context, fc uint64, params *m
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) checkFaults(ctx context.Context, ssi []abi.SectorNumber) ([]abi.SectorNumber, error) {
|
func (s *WindowPoStScheduler) checkFaults(ctx context.Context, ssi []abi.SectorNumber) ([]abi.SectorNumber, error) {
|
||||||
//faults := s.sb.Scrub(ssi)
|
//faults := s.sb.Scrub(ssi)
|
||||||
log.Warnf("Stub checkFaults")
|
log.Warnf("Stub checkFaults")
|
||||||
var faults []struct {
|
var faults []struct {
|
||||||
@ -143,7 +143,7 @@ func (s *FPoStScheduler) checkFaults(ctx context.Context, ssi []abi.SectorNumber
|
|||||||
return faultIDs, nil
|
return faultIDs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *types.TipSet) (*abi.OnChainPoStVerifyInfo, error) {
|
func (s *WindowPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *types.TipSet) (*abi.OnChainPoStVerifyInfo, error) {
|
||||||
ctx, span := trace.StartSpan(ctx, "storage.runPost")
|
ctx, span := trace.StartSpan(ctx, "storage.runPost")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *ty
|
|||||||
}
|
}
|
||||||
rand, err := s.api.ChainGetRandomness(ctx, ts.Key(), crypto.DomainSeparationTag_WindowedPoStChallengeSeed, challengeRound, buf.Bytes())
|
rand, err := s.api.ChainGetRandomness(ctx, ts.Key(), crypto.DomainSeparationTag_WindowedPoStChallengeSeed, challengeRound, buf.Bytes())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to get chain randomness for fpost (ts=%d; eps=%d): %w", ts.Height(), eps, err)
|
return nil, xerrors.Errorf("failed to get chain randomness for windowPost (ts=%d; eps=%d): %w", ts.Height(), eps, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ssi, err := s.sortedSectorInfo(ctx, ts)
|
ssi, err := s.sortedSectorInfo(ctx, ts)
|
||||||
@ -163,11 +163,11 @@ func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *ty
|
|||||||
return nil, xerrors.Errorf("getting sorted sector info: %w", err)
|
return nil, xerrors.Errorf("getting sorted sector info: %w", err)
|
||||||
}
|
}
|
||||||
if len(ssi) == 0 {
|
if len(ssi) == 0 {
|
||||||
log.Warn("attempted to run fpost without any sectors...")
|
log.Warn("attempted to run windowPost without any sectors...")
|
||||||
return nil, xerrors.Errorf("no sectors to run fpost on")
|
return nil, xerrors.Errorf("no sectors to run windowPost on")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infow("running fPoSt",
|
log.Infow("running windowPost",
|
||||||
"chain-random", rand,
|
"chain-random", rand,
|
||||||
"eps", eps,
|
"eps", eps,
|
||||||
"height", ts.Height())
|
"height", ts.Height())
|
||||||
@ -184,7 +184,7 @@ func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *ty
|
|||||||
|
|
||||||
tsStart := time.Now()
|
tsStart := time.Now()
|
||||||
|
|
||||||
log.Infow("generating fPoSt",
|
log.Infow("generating windowPost",
|
||||||
"sectors", len(ssi),
|
"sectors", len(ssi),
|
||||||
"faults", len(faults))
|
"faults", len(faults))
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ func (s *FPoStScheduler) runPost(ctx context.Context, eps abi.ChainEpoch, ts *ty
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) sortedSectorInfo(ctx context.Context, ts *types.TipSet) ([]abi.SectorInfo, error) {
|
func (s *WindowPoStScheduler) sortedSectorInfo(ctx context.Context, ts *types.TipSet) ([]abi.SectorInfo, error) {
|
||||||
sset, err := s.api.StateMinerProvingSet(ctx, s.actor, ts.Key())
|
sset, err := s.api.StateMinerProvingSet(ctx, s.actor, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to get proving set for miner (tsH: %d): %w", ts.Height(), err)
|
return nil, xerrors.Errorf("failed to get proving set for miner (tsH: %d): %w", ts.Height(), err)
|
||||||
@ -250,7 +250,7 @@ func (s *FPoStScheduler) sortedSectorInfo(ctx context.Context, ts *types.TipSet)
|
|||||||
return sbsi, nil
|
return sbsi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) submitPost(ctx context.Context, proof *abi.OnChainPoStVerifyInfo) error {
|
func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *abi.OnChainPoStVerifyInfo) error {
|
||||||
ctx, span := trace.StartSpan(ctx, "storage.commitPost")
|
ctx, span := trace.StartSpan(ctx, "storage.commitPost")
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
@ -20,7 +20,7 @@ const Inactive = 0
|
|||||||
|
|
||||||
const StartConfidence = 4 // TODO: config
|
const StartConfidence = 4 // TODO: config
|
||||||
|
|
||||||
type FPoStScheduler struct {
|
type WindowPoStScheduler struct {
|
||||||
api storageMinerApi
|
api storageMinerApi
|
||||||
sb storage.Prover
|
sb storage.Prover
|
||||||
proofType abi.RegisteredProof
|
proofType abi.RegisteredProof
|
||||||
@ -38,11 +38,11 @@ type FPoStScheduler struct {
|
|||||||
failLk sync.Mutex
|
failLk sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFPoStScheduler(api storageMinerApi, sb storage.Prover, actor address.Address, worker address.Address, rt abi.RegisteredProof) *FPoStScheduler {
|
func NewWindowedPoStScheduler(api storageMinerApi, sb storage.Prover, actor address.Address, worker address.Address, rt abi.RegisteredProof) *WindowPoStScheduler {
|
||||||
return &FPoStScheduler{api: api, sb: sb, actor: actor, worker: worker, proofType: rt}
|
return &WindowPoStScheduler{api: api, sb: sb, actor: actor, worker: worker, proofType: rt}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) Run(ctx context.Context) {
|
func (s *WindowPoStScheduler) Run(ctx context.Context) {
|
||||||
notifs, err := s.api.ChainNotify(ctx)
|
notifs, err := s.api.ChainNotify(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -67,11 +67,11 @@ func (s *FPoStScheduler) Run(ctx context.Context) {
|
|||||||
select {
|
select {
|
||||||
case changes, ok := <-notifs:
|
case changes, ok := <-notifs:
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Warn("FPoStScheduler notifs channel closed")
|
log.Warn("WindowPoStScheduler notifs channel closed")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, span := trace.StartSpan(ctx, "FPoStScheduler.headChange")
|
ctx, span := trace.StartSpan(ctx, "WindowPoStScheduler.headChange")
|
||||||
|
|
||||||
var lowest, highest *types.TipSet = s.cur, nil
|
var lowest, highest *types.TipSet = s.cur, nil
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ func (s *FPoStScheduler) Run(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) revert(ctx context.Context, newLowest *types.TipSet) error {
|
func (s *WindowPoStScheduler) revert(ctx context.Context, newLowest *types.TipSet) error {
|
||||||
if s.cur == newLowest {
|
if s.cur == newLowest {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -119,9 +119,9 @@ func (s *FPoStScheduler) revert(ctx context.Context, newLowest *types.TipSet) er
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) update(ctx context.Context, new *types.TipSet) error {
|
func (s *WindowPoStScheduler) update(ctx context.Context, new *types.TipSet) error {
|
||||||
if new == nil {
|
if new == nil {
|
||||||
return xerrors.Errorf("no new tipset in FPoStScheduler.update")
|
return xerrors.Errorf("no new tipset in WindowPoStScheduler.update")
|
||||||
}
|
}
|
||||||
newEPS, start, err := s.shouldFallbackPost(ctx, new)
|
newEPS, start, err := s.shouldFallbackPost(ctx, new)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -148,7 +148,7 @@ func (s *FPoStScheduler) update(ctx context.Context, new *types.TipSet) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) abortActivePoSt() {
|
func (s *WindowPoStScheduler) abortActivePoSt() {
|
||||||
if s.activeEPS == Inactive {
|
if s.activeEPS == Inactive {
|
||||||
return // noop
|
return // noop
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ func (s *FPoStScheduler) abortActivePoSt() {
|
|||||||
s.abort = nil
|
s.abort = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) shouldFallbackPost(ctx context.Context, ts *types.TipSet) (abi.ChainEpoch, bool, error) {
|
func (s *WindowPoStScheduler) shouldFallbackPost(ctx context.Context, ts *types.TipSet) (abi.ChainEpoch, bool, error) {
|
||||||
ps, err := s.api.StateMinerPostState(ctx, s.actor, ts.Key())
|
ps, err := s.api.StateMinerPostState(ctx, s.actor, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, false, xerrors.Errorf("getting ElectionPeriodStart: %w", err)
|
return 0, false, xerrors.Errorf("getting ElectionPeriodStart: %w", err)
|
Loading…
Reference in New Issue
Block a user