From cb665caf9ed0120064229a9680e48244e344d9bd Mon Sep 17 00:00:00 2001 From: laser Date: Tue, 28 Jan 2020 11:46:26 -0800 Subject: [PATCH 1/2] planCommitting must handle SectorCommitFailed The SectorCommitFailed struct can be created from within Sealing#handleCommitting, and is created if actors.SerializeParams(params) produces an error or if m.api.MpoolPushMessage(ctx.Context(), msg) produces an error. --- storage/sealing/fsm.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/sealing/fsm.go b/storage/sealing/fsm.go index ad0803488..4fdd81d35 100644 --- a/storage/sealing/fsm.go +++ b/storage/sealing/fsm.go @@ -205,6 +205,8 @@ func planCommitting(events []statemachine.Event, state *SectorInfo) error { state.State = api.SealCommitFailed case SectorSealFailed: state.State = api.CommitFailed + case SectorCommitFailed: + state.State = api.CommitFailed default: return xerrors.Errorf("planCommitting got event of unknown type %T, events: %+v", event.User, events) } From 1cdf29244c8f92d8ed21e52a70b9284476823289 Mon Sep 17 00:00:00 2001 From: laser Date: Tue, 28 Jan 2020 12:39:07 -0800 Subject: [PATCH 2/2] write basic test affirming state change --- storage/sealing/fsm_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/storage/sealing/fsm_test.go b/storage/sealing/fsm_test.go index 2dada5470..7430bb634 100644 --- a/storage/sealing/fsm_test.go +++ b/storage/sealing/fsm_test.go @@ -83,3 +83,17 @@ func TestSeedRevert(t *testing.T) { m.planSingle(SectorProving{}) require.Equal(m.t, m.state.State, api.Proving) } + +func TestPlanCommittingHandlesSectorCommitFailed(t *testing.T) { + m := test{ + s: &Sealing{}, + t: t, + state: &SectorInfo{State: api.Committing}, + } + + events := []statemachine.Event{{SectorCommitFailed{}}} + + require.NoError(t, planCommitting(events, m.state)) + + require.Equal(t, api.SectorStates[api.CommitFailed], api.SectorStates[m.state.State]) +}