Merge pull request #7871 from filecoin-project/jen/7869
fix: #7869 sealing: Add more deal expiration checks during PRU pipeline
This commit is contained in:
commit
f955084572
37
extern/storage-sealing/states_replica_update.go
vendored
37
extern/storage-sealing/states_replica_update.go
vendored
@ -13,18 +13,7 @@ import (
|
|||||||
|
|
||||||
func (m *Sealing) handleReplicaUpdate(ctx statemachine.Context, sector SectorInfo) error {
|
func (m *Sealing) handleReplicaUpdate(ctx statemachine.Context, sector SectorInfo) error {
|
||||||
if err := checkPieces(ctx.Context(), m.maddr, sector, m.Api); err != nil { // Sanity check state
|
if err := checkPieces(ctx.Context(), m.maddr, sector, m.Api); err != nil { // Sanity check state
|
||||||
switch err.(type) {
|
return handleErrors(ctx, err, sector)
|
||||||
case *ErrApi:
|
|
||||||
log.Errorf("handleReplicaUpdate: api error, not proceeding: %+v", err)
|
|
||||||
return nil
|
|
||||||
case *ErrInvalidDeals:
|
|
||||||
log.Warnf("invalid deals in sector %d: %v", sector.SectorNumber, err)
|
|
||||||
return ctx.Send(SectorInvalidDealIDs{})
|
|
||||||
case *ErrExpiredDeals: // Probably not much we can do here, maybe re-pack the sector?
|
|
||||||
return ctx.Send(SectorDealsExpired{xerrors.Errorf("expired dealIDs in sector: %w", err)})
|
|
||||||
default:
|
|
||||||
return xerrors.Errorf("checkPieces sanity check error: %w", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
out, err := m.sealer.ReplicaUpdate(sector.sealingCtx(ctx.Context()), m.minerSector(sector.SectorType, sector.SectorNumber), sector.pieceInfos())
|
out, err := m.sealer.ReplicaUpdate(sector.sealingCtx(ctx.Context()), m.minerSector(sector.SectorType, sector.SectorNumber), sector.pieceInfos())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -42,11 +31,16 @@ func (m *Sealing) handleProveReplicaUpdate(ctx statemachine.Context, sector Sect
|
|||||||
if sector.CommR == nil {
|
if sector.CommR == nil {
|
||||||
return xerrors.Errorf("invalid sector %d with nil CommR", sector.SectorNumber)
|
return xerrors.Errorf("invalid sector %d with nil CommR", sector.SectorNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
vanillaProofs, err := m.sealer.ProveReplicaUpdate1(sector.sealingCtx(ctx.Context()), m.minerSector(sector.SectorType, sector.SectorNumber), *sector.CommR, *sector.UpdateSealed, *sector.UpdateUnsealed)
|
vanillaProofs, err := m.sealer.ProveReplicaUpdate1(sector.sealingCtx(ctx.Context()), m.minerSector(sector.SectorType, sector.SectorNumber), *sector.CommR, *sector.UpdateSealed, *sector.UpdateUnsealed)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctx.Send(SectorProveReplicaUpdateFailed{xerrors.Errorf("prove replica update (1) failed: %w", err)})
|
return ctx.Send(SectorProveReplicaUpdateFailed{xerrors.Errorf("prove replica update (1) failed: %w", err)})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := checkPieces(ctx.Context(), m.maddr, sector, m.Api); err != nil { // Sanity check state
|
||||||
|
return handleErrors(ctx, err, sector)
|
||||||
|
}
|
||||||
|
|
||||||
proof, err := m.sealer.ProveReplicaUpdate2(sector.sealingCtx(ctx.Context()), m.minerSector(sector.SectorType, sector.SectorNumber), *sector.CommR, *sector.UpdateSealed, *sector.UpdateUnsealed, vanillaProofs)
|
proof, err := m.sealer.ProveReplicaUpdate2(sector.sealingCtx(ctx.Context()), m.minerSector(sector.SectorType, sector.SectorNumber), *sector.CommR, *sector.UpdateSealed, *sector.UpdateUnsealed, vanillaProofs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctx.Send(SectorProveReplicaUpdateFailed{xerrors.Errorf("prove replica update (2) failed: %w", err)})
|
return ctx.Send(SectorProveReplicaUpdateFailed{xerrors.Errorf("prove replica update (2) failed: %w", err)})
|
||||||
@ -65,6 +59,10 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := checkPieces(ctx.Context(), m.maddr, sector, m.Api); err != nil { // Sanity check state
|
||||||
|
return handleErrors(ctx, err, sector)
|
||||||
|
}
|
||||||
|
|
||||||
if err := checkReplicaUpdate(ctx.Context(), m.maddr, sector, tok, m.Api); err != nil {
|
if err := checkReplicaUpdate(ctx.Context(), m.maddr, sector, tok, m.Api); err != nil {
|
||||||
return ctx.Send(SectorSubmitReplicaUpdateFailed{})
|
return ctx.Send(SectorSubmitReplicaUpdateFailed{})
|
||||||
}
|
}
|
||||||
@ -207,3 +205,18 @@ func (m *Sealing) handleReplicaUpdateWait(ctx statemachine.Context, sector Secto
|
|||||||
func (m *Sealing) handleFinalizeReplicaUpdate(ctx statemachine.Context, sector SectorInfo) error {
|
func (m *Sealing) handleFinalizeReplicaUpdate(ctx statemachine.Context, sector SectorInfo) error {
|
||||||
return ctx.Send(SectorFinalized{})
|
return ctx.Send(SectorFinalized{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func handleErrors(ctx statemachine.Context, err error, sector SectorInfo) error {
|
||||||
|
switch err.(type) {
|
||||||
|
case *ErrApi:
|
||||||
|
log.Errorf("handleReplicaUpdate: api error, not proceeding: %+v", err)
|
||||||
|
return nil
|
||||||
|
case *ErrInvalidDeals:
|
||||||
|
log.Warnf("invalid deals in sector %d: %v", sector.SectorNumber, err)
|
||||||
|
return ctx.Send(SectorInvalidDealIDs{})
|
||||||
|
case *ErrExpiredDeals: // Probably not much we can do here, maybe re-pack the sector?
|
||||||
|
return ctx.Send(SectorDealsExpired{xerrors.Errorf("expired dealIDs in sector: %w", err)})
|
||||||
|
default:
|
||||||
|
return xerrors.Errorf("checkPieces sanity check error: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user