@@ -803,7 +803,7 @@ func (tm *TestUnmanagedMiner) submitProveCommit(
803
803
804
804
// Step 6: Submit the ProveCommit to the network
805
805
if proofType .IsNonInteractive () {
806
- if tm .IsImmutableDeadline (provingDeadline ) {
806
+ if tm .MaybeImmutableDeadline (provingDeadline ) {
807
807
// avoid immutable deadlines
808
808
provingDeadline = 5
809
809
}
@@ -1701,12 +1701,17 @@ func (tm *TestUnmanagedMiner) AssertDisputeFails(sector abi.SectorNumber) {
1701
1701
req .Contains (err .Error (), "(RetCode=16)" )
1702
1702
}
1703
1703
1704
- func (tm * TestUnmanagedMiner ) IsImmutableDeadline (deadlineIndex uint64 ) bool {
1704
+ // MaybeImmutableDeadline checks if the deadline index is immutable. Immutable deadlines are defined
1705
+ // as being the current deadline for the miner or their next deadline. But we also include the
1706
+ // deadline after the next deadline in our check here to be conservative to avoid race conditions of
1707
+ // the chain progressing before messages land.
1708
+ func (tm * TestUnmanagedMiner ) MaybeImmutableDeadline (deadlineIndex uint64 ) bool {
1705
1709
req := require .New (tm .t )
1706
1710
di , err := tm .FullNode .StateMinerProvingDeadline (tm .ctx , tm .ActorAddr , types .EmptyTSK )
1707
1711
req .NoError (err )
1708
1712
currentDeadlineIdx := CurrentDeadlineIndex (di )
1709
- return currentDeadlineIdx == deadlineIndex || currentDeadlineIdx == deadlineIndex - 1
1713
+ // Check if deadlineIndex is the current, next, or the one after next.
1714
+ return deadlineIndex >= currentDeadlineIdx && deadlineIndex <= currentDeadlineIdx + 2
1710
1715
}
1711
1716
1712
1717
// CurrentDeadlineIndex manually calculates the current deadline index. This may be useful in
0 commit comments