Merge pull request #6521 from yaohcn/fix-commit-finalize
fix commit finalize failed
This commit is contained in:
commit
715176698f
2
extern/storage-sealing/fsm.go
vendored
2
extern/storage-sealing/fsm.go
vendored
@ -156,7 +156,7 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
|
|||||||
on(SectorSealPreCommit1Failed{}, SealPreCommit1Failed),
|
on(SectorSealPreCommit1Failed{}, SealPreCommit1Failed),
|
||||||
),
|
),
|
||||||
CommitFinalizeFailed: planOne(
|
CommitFinalizeFailed: planOne(
|
||||||
on(SectorRetryFinalize{}, CommitFinalizeFailed),
|
on(SectorRetryFinalize{}, CommitFinalize),
|
||||||
),
|
),
|
||||||
CommitFailed: planOne(
|
CommitFailed: planOne(
|
||||||
on(SectorSealPreCommit1Failed{}, SealPreCommit1Failed),
|
on(SectorSealPreCommit1Failed{}, SealPreCommit1Failed),
|
||||||
|
39
extern/storage-sealing/fsm_test.go
vendored
39
extern/storage-sealing/fsm_test.go
vendored
@ -154,6 +154,45 @@ func TestHappyPathFinalizeEarly(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCommitFinalizeFailed(t *testing.T) {
|
||||||
|
var notif []struct{ before, after SectorInfo }
|
||||||
|
ma, _ := address.NewIDAddress(55151)
|
||||||
|
m := test{
|
||||||
|
s: &Sealing{
|
||||||
|
maddr: ma,
|
||||||
|
stats: SectorStats{
|
||||||
|
bySector: map[abi.SectorID]statSectorState{},
|
||||||
|
},
|
||||||
|
notifee: func(before, after SectorInfo) {
|
||||||
|
notif = append(notif, struct{ before, after SectorInfo }{before, after})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
t: t,
|
||||||
|
state: &SectorInfo{State: Committing},
|
||||||
|
}
|
||||||
|
|
||||||
|
m.planSingle(SectorProofReady{})
|
||||||
|
require.Equal(m.t, m.state.State, CommitFinalize)
|
||||||
|
|
||||||
|
m.planSingle(SectorFinalizeFailed{})
|
||||||
|
require.Equal(m.t, m.state.State, CommitFinalizeFailed)
|
||||||
|
|
||||||
|
m.planSingle(SectorRetryFinalize{})
|
||||||
|
require.Equal(m.t, m.state.State, CommitFinalize)
|
||||||
|
|
||||||
|
m.planSingle(SectorFinalized{})
|
||||||
|
require.Equal(m.t, m.state.State, SubmitCommit)
|
||||||
|
|
||||||
|
expected := []SectorState{Committing, CommitFinalize, CommitFinalizeFailed, CommitFinalize, SubmitCommit}
|
||||||
|
for i, n := range notif {
|
||||||
|
if n.before.State != expected[i] {
|
||||||
|
t.Fatalf("expected before state: %s, got: %s", expected[i], n.before.State)
|
||||||
|
}
|
||||||
|
if n.after.State != expected[i+1] {
|
||||||
|
t.Fatalf("expected after state: %s, got: %s", expected[i+1], n.after.State)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
func TestSeedRevert(t *testing.T) {
|
func TestSeedRevert(t *testing.T) {
|
||||||
ma, _ := address.NewIDAddress(55151)
|
ma, _ := address.NewIDAddress(55151)
|
||||||
m := test{
|
m := test{
|
||||||
|
Loading…
Reference in New Issue
Block a user