From 0f122df6e26527a2bca57652220a8adb60ae1bd1 Mon Sep 17 00:00:00 2001 From: Jennifer Wang Date: Mon, 3 Jan 2022 21:29:48 -0500 Subject: [PATCH] Check piece before PRU2 instead of PRU1 as PRU2 is the heavy computation part --- extern/storage-sealing/states_replica_update.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extern/storage-sealing/states_replica_update.go b/extern/storage-sealing/states_replica_update.go index b2121ef72..caf50fb7e 100644 --- a/extern/storage-sealing/states_replica_update.go +++ b/extern/storage-sealing/states_replica_update.go @@ -31,15 +31,15 @@ func (m *Sealing) handleProveReplicaUpdate(ctx statemachine.Context, sector Sect return xerrors.Errorf("invalid sector %d with nil CommR", sector.SectorNumber) } - if err := checkPieces(ctx.Context(), m.maddr, sector, m.Api); err != nil { // Sanity check state - return handleErrors(ctx, err, sector) - } - vanillaProofs, err := m.sealer.ProveReplicaUpdate1(sector.sealingCtx(ctx.Context()), m.minerSector(sector.SectorType, sector.SectorNumber), *sector.CommR, *sector.UpdateSealed, *sector.UpdateUnsealed) if err != nil { 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) if err != nil { return ctx.Send(SectorProveReplicaUpdateFailed{xerrors.Errorf("prove replica update (2) failed: %w", err)})