v1.27.0-a #10

Closed
jonathanface wants to merge 473 commits from v1.27.0-a into master
Showing only changes of commit 68f1a44469 - Show all commits

View File

@ -178,7 +178,7 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
}) })
// MAKE A MINING ATTEMPT!! // MAKE A MINING ATTEMPT!!
log.Debugw("attempting to mine a block", "tipset", types.LogCids(base.TipSet.Cids())) log.Debugw("attempting to mine a block", "tipset", types.LogCids(base.TipSet.Cids()), "null-rounds", base.AddRounds)
mbi, err := t.api.MinerGetBaseInfo(ctx, maddr, round, base.TipSet.Key()) mbi, err := t.api.MinerGetBaseInfo(ctx, maddr, round, base.TipSet.Key())
if err != nil { if err != nil {
@ -226,6 +226,8 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
} }
} }
log.Infow("WinPostTask won election", "tipset", types.LogCids(base.TipSet.Cids()), "miner", maddr, "round", round, "eproof", eproof)
// winning PoSt // winning PoSt
var wpostProof []prooftypes.PoStProof var wpostProof []prooftypes.PoStProof
{ {
@ -277,6 +279,8 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
} }
} }
log.Infow("WinPostTask winning PoSt computed", "tipset", types.LogCids(base.TipSet.Cids()), "miner", maddr, "round", round, "proofs", wpostProof)
ticket, err := t.computeTicket(ctx, maddr, &rbase, round, base.TipSet.MinTicket(), mbi) ticket, err := t.computeTicket(ctx, maddr, &rbase, round, base.TipSet.MinTicket(), mbi)
if err != nil { if err != nil {
return false, xerrors.Errorf("scratching ticket failed: %w", err) return false, xerrors.Errorf("scratching ticket failed: %w", err)
@ -288,6 +292,8 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
return false, xerrors.Errorf("failed to select messages for block: %w", err) return false, xerrors.Errorf("failed to select messages for block: %w", err)
} }
log.Infow("WinPostTask selected messages", "tipset", types.LogCids(base.TipSet.Cids()), "miner", maddr, "round", round, "messages", len(msgs))
// equivocation handling // equivocation handling
{ {
// This next block exists to "catch" equivocating miners, // This next block exists to "catch" equivocating miners,
@ -358,6 +364,8 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
} }
} }
log.Infow("WinPostTask base ready", "tipset", types.LogCids(base.TipSet.Cids()), "miner", maddr, "round", round, "ticket", ticket)
// block construction // block construction
var blockMsg *types.BlockMsg var blockMsg *types.BlockMsg
{ {
@ -379,6 +387,8 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
} }
} }
log.Infow("WinPostTask block ready", "tipset", types.LogCids(base.TipSet.Cids()), "miner", maddr, "round", round, "block", blockMsg.Header.Cid(), "timestamp", blockMsg.Header.Timestamp)
// persist in db // persist in db
{ {
bhjson, err := json.Marshal(blockMsg.Header) bhjson, err := json.Marshal(blockMsg.Header)
@ -396,11 +406,13 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
// wait until block timestamp // wait until block timestamp
{ {
log.Infow("WinPostTask waiting for block timestamp", "tipset", types.LogCids(base.TipSet.Cids()), "miner", maddr, "round", round, "block", blockMsg.Header.Cid(), "until", time.Unix(int64(blockMsg.Header.Timestamp), 0))
time.Sleep(time.Until(time.Unix(int64(blockMsg.Header.Timestamp), 0))) time.Sleep(time.Until(time.Unix(int64(blockMsg.Header.Timestamp), 0)))
} }
// submit block!! // submit block!!
{ {
log.Infow("WinPostTask submitting block", "tipset", types.LogCids(base.TipSet.Cids()), "miner", maddr, "round", round, "block", blockMsg.Header.Cid())
if err := t.api.SyncSubmitBlock(ctx, blockMsg); err != nil { if err := t.api.SyncSubmitBlock(ctx, blockMsg); err != nil {
return false, xerrors.Errorf("failed to submit block: %w", err) return false, xerrors.Errorf("failed to submit block: %w", err)
} }
@ -489,7 +501,7 @@ func (mb MiningBase) baseTime() time.Time {
} }
func (mb MiningBase) afterPropDelay() time.Time { func (mb MiningBase) afterPropDelay() time.Time {
return mb.baseTime().Add(randTimeOffset(time.Second)) return mb.baseTime().Add(time.Duration(build.PropagationDelaySecs) * time.Second).Add(randTimeOffset(time.Second))
} }
func (t *WinPostTask) mineBasic(ctx context.Context) { func (t *WinPostTask) mineBasic(ctx context.Context) {