Try to re-precommit on consecutive failed commit proof compute
This commit is contained in:
parent
cdada6e889
commit
9b92e145e7
76
cbor_gen.go
76
cbor_gen.go
@ -425,22 +425,6 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// t.Nonce (uint64) (uint64)
|
||||
if len("Nonce") > cbg.MaxLength {
|
||||
return xerrors.Errorf("Value in field \"Nonce\" was too long")
|
||||
}
|
||||
|
||||
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Nonce")))); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := w.Write([]byte("Nonce")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Nonce))); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// t.SectorType (abi.RegisteredProof) (int64)
|
||||
if len("SectorType") > cbg.MaxLength {
|
||||
return xerrors.Errorf("Value in field \"SectorType\" was too long")
|
||||
@ -645,6 +629,29 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
|
||||
}
|
||||
}
|
||||
|
||||
// t.PreCommitTipSet (sealing.TipSetToken) (slice)
|
||||
if len("PreCommitTipSet") > cbg.MaxLength {
|
||||
return xerrors.Errorf("Value in field \"PreCommitTipSet\" was too long")
|
||||
}
|
||||
|
||||
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("PreCommitTipSet")))); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := w.Write([]byte("PreCommitTipSet")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(t.PreCommitTipSet) > cbg.ByteArrayMaxLen {
|
||||
return xerrors.Errorf("Byte array in field t.PreCommitTipSet was too long")
|
||||
}
|
||||
|
||||
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.PreCommitTipSet)))); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := w.Write(t.PreCommitTipSet); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// t.SeedValue (abi.InteractiveSealRandomness) (slice)
|
||||
if len("SeedValue") > cbg.MaxLength {
|
||||
return xerrors.Errorf("Value in field \"SeedValue\" was too long")
|
||||
@ -855,21 +862,6 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
|
||||
}
|
||||
t.SectorNumber = abi.SectorNumber(extra)
|
||||
|
||||
}
|
||||
// t.Nonce (uint64) (uint64)
|
||||
case "Nonce":
|
||||
|
||||
{
|
||||
|
||||
maj, extra, err = cbg.CborReadHeader(br)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if maj != cbg.MajUnsignedInt {
|
||||
return fmt.Errorf("wrong type for uint64 field")
|
||||
}
|
||||
t.Nonce = uint64(extra)
|
||||
|
||||
}
|
||||
// t.SectorType (abi.RegisteredProof) (int64)
|
||||
case "SectorType":
|
||||
@ -912,9 +904,11 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
|
||||
if maj != cbg.MajArray {
|
||||
return fmt.Errorf("expected cbor array")
|
||||
}
|
||||
|
||||
if extra > 0 {
|
||||
t.Pieces = make([]Piece, extra)
|
||||
}
|
||||
|
||||
for i := 0; i < int(extra); i++ {
|
||||
|
||||
var v Piece
|
||||
@ -1080,6 +1074,24 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
|
||||
}
|
||||
|
||||
}
|
||||
// t.PreCommitTipSet (sealing.TipSetToken) (slice)
|
||||
case "PreCommitTipSet":
|
||||
|
||||
maj, extra, err = cbg.CborReadHeader(br)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if extra > cbg.ByteArrayMaxLen {
|
||||
return fmt.Errorf("t.PreCommitTipSet: byte array too large (%d)", extra)
|
||||
}
|
||||
if maj != cbg.MajByteString {
|
||||
return fmt.Errorf("expected byte array")
|
||||
}
|
||||
t.PreCommitTipSet = make([]byte, extra)
|
||||
if _, err := io.ReadFull(br, t.PreCommitTipSet); err != nil {
|
||||
return err
|
||||
}
|
||||
// t.SeedValue (abi.InteractiveSealRandomness) (slice)
|
||||
case "SeedValue":
|
||||
|
||||
@ -1215,9 +1227,11 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
|
||||
if maj != cbg.MajArray {
|
||||
return fmt.Errorf("expected cbor array")
|
||||
}
|
||||
|
||||
if extra > 0 {
|
||||
t.Log = make([]Log, extra)
|
||||
}
|
||||
|
||||
for i := 0; i < int(extra); i++ {
|
||||
|
||||
var v Log
|
||||
|
||||
1
fsm.go
1
fsm.go
@ -82,6 +82,7 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
|
||||
),
|
||||
ComputeProofFailed: planOne(
|
||||
on(SectorRetryComputeProof{}, Committing),
|
||||
on(SectorSealPreCommitFailed{}, SealFailed),
|
||||
),
|
||||
CommitFailed: planOne(
|
||||
on(SectorSealPreCommitFailed{}, SealFailed),
|
||||
|
||||
@ -185,7 +185,9 @@ func (evt SectorRetryWaitSeed) apply(state *SectorInfo) {}
|
||||
|
||||
type SectorRetryComputeProof struct{}
|
||||
|
||||
func (evt SectorRetryComputeProof) apply(state *SectorInfo) {}
|
||||
func (evt SectorRetryComputeProof) apply(state *SectorInfo) {
|
||||
state.InvalidProofs++
|
||||
}
|
||||
|
||||
type SectorRetryInvalidProof struct{}
|
||||
|
||||
|
||||
@ -224,12 +224,12 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo)
|
||||
}
|
||||
c2in, err := m.sealer.SealCommit1(ctx.Context(), m.minerSector(sector.SectorNumber), sector.TicketValue, sector.SeedValue, sector.pieceInfos(), cids)
|
||||
if err != nil {
|
||||
return ctx.Send(SectorComputeProofFailed{xerrors.Errorf("computing seal proof failed: %w", err)})
|
||||
return ctx.Send(SectorComputeProofFailed{xerrors.Errorf("computing seal proof failed(1): %w", err)})
|
||||
}
|
||||
|
||||
proof, err := m.sealer.SealCommit2(ctx.Context(), m.minerSector(sector.SectorNumber), c2in)
|
||||
if err != nil {
|
||||
return ctx.Send(SectorComputeProofFailed{xerrors.Errorf("computing seal proof failed: %w", err)})
|
||||
return ctx.Send(SectorComputeProofFailed{xerrors.Errorf("computing seal proof failed(2): %w", err)})
|
||||
}
|
||||
|
||||
tok, _, err := m.api.ChainHead(ctx.Context())
|
||||
|
||||
@ -116,6 +116,10 @@ func (m *Sealing) handleComputeProofFailed(ctx statemachine.Context, sector Sect
|
||||
return err
|
||||
}
|
||||
|
||||
if sector.InvalidProofs > 1 {
|
||||
return ctx.Send(SectorSealPreCommitFailed{xerrors.Errorf("consecutive compute fails")})
|
||||
}
|
||||
|
||||
return ctx.Send(SectorRetryComputeProof{})
|
||||
}
|
||||
|
||||
|
||||
5
types.go
5
types.go
@ -48,8 +48,7 @@ type Log struct {
|
||||
|
||||
type SectorInfo struct {
|
||||
State SectorState
|
||||
SectorNumber abi.SectorNumber // TODO: this field's name should be changed to SectorNumber
|
||||
Nonce uint64 // TODO: remove
|
||||
SectorNumber abi.SectorNumber
|
||||
|
||||
SectorType abi.RegisteredProof
|
||||
|
||||
@ -75,7 +74,7 @@ type SectorInfo struct {
|
||||
|
||||
// Committing
|
||||
CommitMessage *cid.Cid
|
||||
InvalidProofs uint64 // failed proof computations (doesn't validate with proof inputs)
|
||||
InvalidProofs uint64 // failed proof computations (doesn't validate with proof inputs; can't compute)
|
||||
|
||||
// Faults
|
||||
FaultReportMsg *cid.Cid
|
||||
|
||||
Loading…
Reference in New Issue
Block a user