Merge pull request #8339 from filecoin-project/backport/v1.15.1/smallfixes

backport: #8338, #8337
This commit is contained in:
Łukasz Magiera 2022-03-17 19:50:21 +01:00 committed by GitHub
commit d4cbb0803b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 3 deletions

View File

@ -549,10 +549,10 @@ func (m *Manager) FinalizeSector(ctx context.Context, sector storage.SectorRef,
} }
} }
selector := newExistingSelector(m.index, sector.ID, storiface.FTCache|storiface.FTSealed, false) selector := newExistingSelector(m.index, sector.ID, storiface.FTCache, false)
err := m.sched.Schedule(ctx, sector, sealtasks.TTFinalize, selector, err := m.sched.Schedule(ctx, sector, sealtasks.TTFinalize, selector,
m.schedFetch(sector, storiface.FTCache|storiface.FTSealed|unsealed, pathType, storiface.AcquireMove), m.schedFetch(sector, storiface.FTCache|unsealed, pathType, storiface.AcquireMove),
func(ctx context.Context, w Worker) error { func(ctx context.Context, w Worker) error {
_, err := m.waitSimpleCall(ctx)(w.FinalizeSector(ctx, sector, keepUnsealed)) _, err := m.waitSimpleCall(ctx)(w.FinalizeSector(ctx, sector, keepUnsealed))
return err return err

View File

@ -399,7 +399,7 @@ func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(sta
processed, err := p(events, state) processed, err := p(events, state)
if err != nil { if err != nil {
return nil, 0, xerrors.Errorf("running planner for state %s failed: %w", state.State, err) return nil, processed, xerrors.Errorf("running planner for state %s failed: %w", state.State, err)
} }
///// /////

View File

@ -323,6 +323,33 @@ func TestBrokenState(t *testing.T) {
} }
} }
func TestBadEvent(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]SectorState{},
byState: map[SectorState]int64{},
},
notifee: func(before, after SectorInfo) {
notif = append(notif, struct{ before, after SectorInfo }{before, after})
},
},
t: t,
state: &SectorInfo{State: Proving},
}
_, processed, err := m.s.Plan([]statemachine.Event{{User: SectorPacked{}}}, m.state)
require.NoError(t, err)
require.Equal(t, uint64(1), processed)
require.Equal(m.t, m.state.State, Proving)
require.Len(t, m.state.Log, 2)
require.Contains(t, m.state.Log[1].Message, "received unexpected event")
}
func TestTicketExpired(t *testing.T) { func TestTicketExpired(t *testing.T) {
var notif []struct{ before, after SectorInfo } var notif []struct{ before, after SectorInfo }
ma, _ := address.NewIDAddress(55151) ma, _ := address.NewIDAddress(55151)