checkCommit: handle missing precommits
This commit is contained in:
parent
494c3bc487
commit
b2d14380b4
@ -29,6 +29,7 @@ type ErrPrecommitOnChain struct{ error }
|
||||
|
||||
type ErrBadSeed struct{ error }
|
||||
type ErrInvalidProof struct{ error }
|
||||
type ErrNoPrecommit struct{ error }
|
||||
|
||||
func checkPieces(ctx context.Context, si SectorInfo, api SealingAPI) error {
|
||||
tok, height, err := api.ChainHead(ctx)
|
||||
@ -109,6 +110,10 @@ func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte,
|
||||
return xerrors.Errorf("getting precommit info: %w", err)
|
||||
}
|
||||
|
||||
if pci == nil {
|
||||
return &ErrNoPrecommit{xerrors.Errorf("precommit info not found on-chain")}
|
||||
}
|
||||
|
||||
if pci.PreCommitEpoch+miner.PreCommitChallengeDelay != si.SeedEpoch {
|
||||
return &ErrBadSeed{xerrors.Errorf("seed epoch doesn't match on chain info: %d != %d", pci.PreCommitEpoch+miner.PreCommitChallengeDelay, si.SeedEpoch)}
|
||||
}
|
||||
|
1
fsm.go
1
fsm.go
@ -96,6 +96,7 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
|
||||
on(SectorRetryWaitSeed{}, WaitSeed),
|
||||
on(SectorRetryComputeProof{}, Committing),
|
||||
on(SectorRetryInvalidProof{}, Committing),
|
||||
on(SectorRetryPreCommitWait{}, PreCommitWait),
|
||||
),
|
||||
FinalizeFailed: planOne(
|
||||
on(SectorRetryFinalize{}, FinalizeSector),
|
||||
|
@ -201,6 +201,10 @@ type SectorRetryWaitSeed struct{}
|
||||
|
||||
func (evt SectorRetryWaitSeed) apply(state *SectorInfo) {}
|
||||
|
||||
type SectorRetryPreCommitWait struct{}
|
||||
|
||||
func (evt SectorRetryPreCommitWait) apply(state *SectorInfo) {}
|
||||
|
||||
type SectorRetryComputeProof struct{}
|
||||
|
||||
func (evt SectorRetryComputeProof) apply(state *SectorInfo) {
|
||||
|
@ -214,9 +214,9 @@ func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) er
|
||||
}
|
||||
rand, err := m.api.ChainGetRandomness(ectx, tok, crypto.DomainSeparationTag_InteractiveSealChallengeSeed, randHeight, buf.Bytes())
|
||||
if err != nil {
|
||||
err = xerrors.Errorf("failed to get randomness for computing seal proof: %w", err)
|
||||
err = xerrors.Errorf("failed to get randomness for computing seal proof (ch %d; rh %d; tsk %x): %w", curH, randHeight, tok, err)
|
||||
|
||||
_ = ctx.Send(SectorFatalError{error: err})
|
||||
_ = ctx.Send(SectorChainPreCommitFailed{error: err})
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -177,6 +177,9 @@ func (m *Sealing) handleCommitFailed(ctx statemachine.Context, sector SectorInfo
|
||||
}
|
||||
|
||||
return ctx.Send(SectorRetryInvalidProof{})
|
||||
case *ErrPrecommitOnChain:
|
||||
log.Errorf("no precommit on chain, will retry: %+v", err)
|
||||
return ctx.Send(SectorRetryPreCommitWait{})
|
||||
default:
|
||||
return xerrors.Errorf("checkCommit sanity check error: %w", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user