Skip to content

Commit

Permalink
Merge pull request #3873 from filecoin-project/unify-wdpost-log
Browse files Browse the repository at this point in the history
Use `window post` for window PoSt related log messages.
  • Loading branch information
magik6k authored Sep 16, 2020
2 parents 2db7b8c + 5c69249 commit 0c41522
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion chain/stmgr/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ func MinerGetBaseInfo(ctx context.Context, sm *StateManager, bcs beacon.Schedule

sectors, err := GetSectorsForWinningPoSt(ctx, pv, sm, lbst, maddr, prand)
if err != nil {
return nil, xerrors.Errorf("getting wpost proving set: %w", err)
return nil, xerrors.Errorf("getting winning post proving set: %w", err)
}

if len(sectors) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion chain/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ func (syncer *Syncer) VerifyWinningPoStProof(ctx context.Context, h *types.Block

rand, err := store.DrawRandomness(rbase.Data, crypto.DomainSeparationTag_WinningPoStChallengeSeed, h.Height, buf.Bytes())
if err != nil {
return xerrors.Errorf("failed to get randomness for verifying winningPost proof: %w", err)
return xerrors.Errorf("failed to get randomness for verifying winning post proof: %w", err)
}

mid, err := address.IDFromAddress(h.Miner)
Expand Down
4 changes: 2 additions & 2 deletions cmd/lotus-bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ var sealBenchCmd = &cli.Command{
return err
}
if !ok {
log.Error("post verification failed")
log.Error("window post verification failed")
}

verifyWindowpost1 := time.Now()
Expand All @@ -403,7 +403,7 @@ var sealBenchCmd = &cli.Command{
return err
}
if !ok {
log.Error("post verification failed")
log.Error("window post verification failed")
}

verifyWindowpost2 := time.Now()
Expand Down
2 changes: 1 addition & 1 deletion storage/addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func AddressFor(ctx context.Context, a addrSelectApi, mi api.MinerInfo, use Addr
return addr, nil
}

log.Warnw("control address didn't have enough funds for PoSt message", "address", addr, "required", types.FIL(minFunds), "balance", types.FIL(b))
log.Warnw("control address didn't have enough funds for window post message", "address", addr, "required", types.FIL(minFunds), "balance", types.FIL(b))
}

// Try to use the owner account if we can, fallback to worker if we can't
Expand Down
20 changes: 10 additions & 10 deletions storage/wdpost_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (s *WindowPoStScheduler) doPost(ctx context.Context, deadline *dline.Info,

posts, err := s.runPost(ctx, *deadline, ts)
if err != nil {
log.Errorf("runPost failed: %+v", err)
log.Errorf("run window post failed: %+v", err)
s.failPost(err, deadline)
return
}
Expand All @@ -92,7 +92,7 @@ func (s *WindowPoStScheduler) doPost(ctx context.Context, deadline *dline.Info,
post := &posts[i]
sm, err := s.submitPost(ctx, post)
if err != nil {
log.Errorf("submitPost failed: %+v", err)
log.Errorf("submit window post failed: %+v", err)
s.failPost(err, deadline)
} else {
recordProofsEvent(post.Partitions, sm.Cid())
Expand Down Expand Up @@ -397,7 +397,7 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty

rand, err := s.api.ChainGetRandomnessFromBeacon(ctx, ts.Key(), crypto.DomainSeparationTag_WindowedPoStChallengeSeed, di.Challenge, buf.Bytes())
if err != nil {
return nil, xerrors.Errorf("failed to get chain randomness for windowPost (ts=%d; deadline=%d): %w", ts.Height(), di, err)
return nil, xerrors.Errorf("failed to get chain randomness for window post (ts=%d; deadline=%d): %w", ts.Height(), di, err)
}

// Get the partitions for the given deadline
Expand Down Expand Up @@ -490,7 +490,7 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
}

// Generate proof
log.Infow("running windowPost",
log.Infow("running window post",
"chain-random", rand,
"deadline", di,
"height", ts.Height(),
Expand All @@ -507,7 +507,7 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
postOut, ps, err = s.prover.GenerateWindowPoSt(ctx, abi.ActorID(mid), sinfos, abi.PoStRandomness(rand))
elapsed := time.Since(tsStart)

log.Infow("computing window PoSt", "batch", batchIdx, "elapsed", elapsed)
log.Infow("computing window post", "batch", batchIdx, "elapsed", elapsed)

if err == nil {
// Proof generation successful, stop retrying
Expand All @@ -517,10 +517,10 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
// Proof generation failed, so retry

if len(ps) == 0 {
return nil, xerrors.Errorf("running post failed: %w", err)
return nil, xerrors.Errorf("running window post failed: %w", err)
}

log.Warnw("generate window PoSt skipped sectors", "sectors", ps, "error", err, "try", retries)
log.Warnw("generate window post skipped sectors", "sectors", ps, "error", err, "try", retries)

skipCount += uint64(len(ps))
for _, sector := range ps {
Expand All @@ -547,7 +547,7 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
commEpoch := di.Open
commRand, err := s.api.ChainGetRandomnessFromTickets(ctx, ts.Key(), crypto.DomainSeparationTag_PoStChainCommit, commEpoch, nil)
if err != nil {
return nil, xerrors.Errorf("failed to get chain randomness for windowPost (ts=%d; deadline=%d): %w", ts.Height(), commEpoch, err)
return nil, xerrors.Errorf("failed to get chain randomness for window post (ts=%d; deadline=%d): %w", ts.Height(), commEpoch, err)
}

for i := range posts {
Expand Down Expand Up @@ -644,7 +644,7 @@ func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.Submi

enc, aerr := actors.SerializeParams(proof)
if aerr != nil {
return nil, xerrors.Errorf("could not serialize submit post parameters: %w", aerr)
return nil, xerrors.Errorf("could not serialize submit window post parameters: %w", aerr)
}

msg := &types.Message{
Expand Down Expand Up @@ -705,7 +705,7 @@ func (s *WindowPoStScheduler) setSender(ctx context.Context, msg *types.Message,

pa, err := AddressFor(ctx, s.api, mi, PoStAddr, minFunds)
if err != nil {
log.Errorw("error selecting address for post", "error", err)
log.Errorw("error selecting address for window post", "error", err)
msg.From = s.worker
return
}
Expand Down
14 changes: 7 additions & 7 deletions storage/wdpost_sched.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (s *WindowPoStScheduler) Run(ctx context.Context) {
select {
case changes, ok := <-notifs:
if !ok {
log.Warn("WindowPoStScheduler notifs channel closed")
log.Warn("window post scheduler notifs channel closed")
notifs = nil
continue
}
Expand Down Expand Up @@ -151,10 +151,10 @@ func (s *WindowPoStScheduler) Run(ctx context.Context) {
}

if err := s.revert(ctx, lowest); err != nil {
log.Error("handling head reverts in windowPost sched: %+v", err)
log.Error("handling head reverts in window post sched: %+v", err)
}
if err := s.update(ctx, highest); err != nil {
log.Error("handling head updates in windowPost sched: %+v", err)
log.Error("handling head updates in window post sched: %+v", err)
}

span.End()
Expand Down Expand Up @@ -184,7 +184,7 @@ func (s *WindowPoStScheduler) revert(ctx context.Context, newLowest *types.TipSe

func (s *WindowPoStScheduler) update(ctx context.Context, new *types.TipSet) error {
if new == nil {
return xerrors.Errorf("no new tipset in WindowPoStScheduler.update")
return xerrors.Errorf("no new tipset in window post sched update")
}

di, err := s.api.StateMinerProvingDeadline(ctx, s.actor, new.Key())
Expand All @@ -206,7 +206,7 @@ func (s *WindowPoStScheduler) update(ctx context.Context, new *types.TipSet) err
// (Need to get correct deadline above, which is tricky)

if di.Open+StartConfidence >= new.Height() {
log.Info("not starting windowPost yet, waiting for startconfidence", di.Open, di.Open+StartConfidence, new.Height())
log.Info("not starting window post yet, waiting for startconfidence", di.Open, di.Open+StartConfidence, new.Height())
return nil
}

Expand All @@ -216,7 +216,7 @@ func (s *WindowPoStScheduler) update(ctx context.Context, new *types.TipSet) err
s.activeEPS = 0
}
s.failLk.Unlock()*/
log.Infof("at %d, doPost for P %d, dd %d", new.Height(), di.PeriodStart, di.Index)
log.Infof("at %d, do window post for P %d, dd %d", new.Height(), di.PeriodStart, di.Index)

s.doPost(ctx, di, new)

Expand All @@ -238,7 +238,7 @@ func (s *WindowPoStScheduler) abortActivePoSt() {
}
})

log.Warnf("Aborting Window PoSt (Deadline: %+v)", s.activeDeadline)
log.Warnf("Aborting window post (Deadline: %+v)", s.activeDeadline)
}

s.activeDeadline = nil
Expand Down

0 comments on commit 0c41522

Please sign in to comment.