Skip to content

Commit

Permalink
fix: itest: fix wdpost proving epoch calculation
Browse files Browse the repository at this point in the history
Fixes: #12091
  • Loading branch information
rvagg committed Jun 19, 2024
1 parent 4fb5fb0 commit 394345f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions itests/kit/node_unmanaged.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,9 @@ func (tm *TestUnmanagedMiner) wdPostLoop(ctx context.Context, sectorNumber abi.S

err = tm.submitWindowPost(ctx, sectorNumber, sealedCid, sealedPath, cacheDir)
writeRespF(err) // send an error, or first post, or nothing if no error and this isn't the first post
if err != nil {
return
}
postCount++
tm.t.Logf("Sector %d: WindowPoSt #%d submitted", sectorNumber, postCount)
}
Expand Down Expand Up @@ -846,15 +849,18 @@ func (tm *TestUnmanagedMiner) calculateNextPostEpoch(

// Calculate the start of the period, adjusting if the current deadline has passed
periodStart := di.PeriodStart
if di.PeriodStart < di.CurrentEpoch && sp.Deadline <= di.Index && di.Open <= di.CurrentEpoch {
if di.Open > di.CurrentEpoch {
// special case, first sector onboarded, cron hasn't run deadline tick yet
periodStart = di.PeriodStart + di.WPoStProvingPeriod
} else if di.PeriodStart < di.CurrentEpoch && sp.Deadline <= di.Index {
// If the deadline has passed in the current proving period, calculate for the next period
// Note that di.Open may be > di.CurrentEpoch if the miner has just been enrolled in cron so
// their deadlines haven't started rolling yet
periodStart += di.WPoStProvingPeriod
}

// Calculate the exact epoch when proving should occur
provingEpoch := periodStart + (di.WPoStProvingPeriod/abi.ChainEpoch(di.WPoStPeriodDeadlines))*abi.ChainEpoch(sp.Deadline)
provingEpoch := periodStart + di.WPoStChallengeWindow*abi.ChainEpoch(sp.Deadline)

tm.t.Logf("Miner %s: WindowPoST(%d): next ProvingEpoch: %d", tm.ActorAddr, sectorNumber, provingEpoch)

Expand Down

0 comments on commit 394345f

Please sign in to comment.