From 34e8567d62ae7262bba626da13256861640b728d Mon Sep 17 00:00:00 2001 From: zl Date: Tue, 15 Feb 2022 12:40:14 +0800 Subject: [PATCH] fetch changes from v1.4.0-rc7 --- api/storage_struct.go | 14 +++-- api/worker.go | 8 +++ app/venus-sealer/util.go | 3 + extern/filecoin-ffi | 2 +- go.mod | 4 +- go.sum | 6 +- sector-storage/faults.go | 19 ++++++ sector-storage/ffiwrapper/sealer_cgo.go | 50 ++++++++++++++- sector-storage/manager.go | 75 ++++++++++++++++++++++- sector-storage/mock/mock.go | 8 +++ sector-storage/sched_test.go | 7 +++ sector-storage/storiface/worker.go | 2 + sector-storage/worker_local.go | 49 ++++++++++----- sector-storage/worker_tracked.go | 4 ++ storage-sealing/fsm.go | 18 +++++- storage-sealing/fsm_events.go | 16 +++++ storage-sealing/states_failed.go | 23 ++++++- storage-sealing/states_replica_update.go | 78 ++++++++++++++++++++++++ storage-sealing/upgrade_queue.go | 18 ++++++ types/return_type.go | 29 ++++----- types/sector_state.go | 7 ++- types/task.go | 18 +++--- 22 files changed, 408 insertions(+), 50 deletions(-) diff --git a/api/storage_struct.go b/api/storage_struct.go index ede44644..8af20a38 100644 --- a/api/storage_struct.go +++ b/api/storage_struct.go @@ -37,7 +37,6 @@ import ( // * Generate markdown docs // * Generate openrpc blobs - var ErrNotSupported = xerrors.New("method not supported") // StorageMiner is a low-level interface to the Filecoin network storage miner node @@ -245,6 +244,7 @@ type StorageMinerStruct struct { ReturnUnsealPiece func(ctx context.Context, callID types.CallID, err *storiface.CallError) error `perm:"admin" retry:"true"` ReturnReadPiece func(ctx context.Context, callID types.CallID, ok bool, err *storiface.CallError) error `perm:"admin" retry:"true"` ReturnFetch func(ctx context.Context, callID types.CallID, err *storiface.CallError) error `perm:"admin" retry:"true"` + ReturnFinalizeReplicaUpdate func(ctx context.Context, callID types.CallID, err *storiface.CallError) error `perm:"admin" retry:"true"` SealingSchedDiag func(context.Context, bool) (interface{}, error) `perm:"admin"` SealingAbort func(ctx context.Context, call types.CallID) error `perm:"admin"` @@ -292,9 +292,9 @@ type StorageMinerStruct struct { CheckProvable func(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) `perm:"admin"` - MessagerWaitMessage func(ctx context.Context, uuid string, confidence uint64) (*types2.MsgLookup, error) `perm:"read"` + MessagerWaitMessage func(ctx context.Context, uuid string, confidence uint64) (*types2.MsgLookup, error) `perm:"read"` MessagerPushMessage func(ctx context.Context, msg *types2.Message, spec *messager.SendSpec) (string, error) `perm:"sign"` - MessagerGetMessage func(ctx context.Context, uuid string) (*messager.Message, error) `perm:"write"` + MessagerGetMessage func(ctx context.Context, uuid string) (*messager.Message, error) `perm:"write"` IsUnsealed func(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) `perm:"read"` SectorsStatus func(ctx context.Context, sid abi.SectorNumber, showOnChainInfo bool) (SectorInfo, error) `perm:"read"` @@ -473,6 +473,13 @@ func (c *StorageMinerStruct) ReturnSealCommit2(ctx context.Context, callID types return c.Internal.ReturnSealCommit2(ctx, callID, proof, err) } +func (s *StorageMinerStruct) ReturnFinalizeReplicaUpdate(p0 context.Context, callID types.CallID, err *storiface.CallError) error { + if s.Internal.ReturnFinalizeReplicaUpdate == nil { + return ErrNotSupported + } + return s.Internal.ReturnFinalizeReplicaUpdate(p0, callID, err) +} + func (c *StorageMinerStruct) ReturnFinalizeSector(ctx context.Context, callID types.CallID, err *storiface.CallError) error { return c.Internal.ReturnFinalizeSector(ctx, callID, err) } @@ -517,7 +524,6 @@ func (c *StorageMinerStruct) SealingSchedDiag(ctx context.Context, doSched bool) return c.Internal.SealingSchedDiag(ctx, doSched) } - func (s *StorageMinerStruct) SectorAbortUpgrade(p0 context.Context, p1 abi.SectorNumber) error { if s.Internal.SectorAbortUpgrade == nil { return ErrNotSupported diff --git a/api/worker.go b/api/worker.go index 19f6c7b0..e4690e4a 100644 --- a/api/worker.go +++ b/api/worker.go @@ -31,6 +31,7 @@ type WorkerStruct struct { SealPreCommit2 func(ctx context.Context, sector storage.SectorRef, pc1o storage.PreCommit1Out) (types.CallID, error) `perm:"admin"` SealCommit1 func(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (types.CallID, error) `perm:"admin"` SealCommit2 func(ctx context.Context, sector storage.SectorRef, c1o storage.Commit1Out) (types.CallID, error) `perm:"admin"` + FinalizeReplicaUpdate func(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (types.CallID, error) `perm:"admin"` FinalizeSector func(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (types.CallID, error) `perm:"admin"` ReplicaUpdate func(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (types.CallID, error) `perm:"admin"` ProveReplicaUpdate1 func(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (types.CallID, error) `perm:"admin"` @@ -98,6 +99,13 @@ func (w *WorkerStruct) SealCommit2(ctx context.Context, sector storage.SectorRef return w.Internal.SealCommit2(ctx, sector, c1o) } +func (s *WorkerStruct) FinalizeReplicaUpdate(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (types.CallID, error) { + if s.Internal.FinalizeReplicaUpdate == nil { + return *new(types.CallID), ErrNotSupported + } + return s.Internal.FinalizeReplicaUpdate(p0, p1, p2) +} + func (w *WorkerStruct) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (types.CallID, error) { return w.Internal.FinalizeSector(ctx, sector, keepUnsealed) } diff --git a/app/venus-sealer/util.go b/app/venus-sealer/util.go index 2a47f2bd..de7734e7 100644 --- a/app/venus-sealer/util.go +++ b/app/venus-sealer/util.go @@ -85,6 +85,7 @@ var stateOrder = map[types2.SectorState]stateMeta{} var stateList = []stateMeta{ {col: 39, state: "Total"}, {col: color.FgGreen, state: types2.Proving}, + {col: color.FgGreen, state: types2.UpdateActivating}, {col: color.FgBlue, state: types2.Empty}, {col: color.FgBlue, state: types2.WaitDeals}, @@ -115,6 +116,7 @@ var stateList = []stateMeta{ {col: color.FgYellow, state: types2.SubmitReplicaUpdate}, {col: color.FgYellow, state: types2.ReplicaUpdateWait}, {col: color.FgYellow, state: types2.FinalizeReplicaUpdate}, + {col: color.FgYellow, state: types2.ReleaseSectorKey}, {col: color.FgCyan, state: types2.Terminating}, {col: color.FgCyan, state: types2.TerminateWait}, @@ -143,6 +145,7 @@ var stateList = []stateMeta{ {col: color.FgRed, state: types2.SnapDealsAddPieceFailed}, {col: color.FgRed, state: types2.SnapDealsDealsExpired}, {col: color.FgRed, state: types2.ReplicaUpdateFailed}, + {col: color.FgRed, state: types2.ReleaseSectorKeyFailed}, } func getActorAddress(ctx context.Context, nodeAPI api.StorageMiner, overrideMaddr string) (maddr address.Address, err error) { diff --git a/extern/filecoin-ffi b/extern/filecoin-ffi index f66026bd..5ec5d805 160000 --- a/extern/filecoin-ffi +++ b/extern/filecoin-ffi @@ -1 +1 @@ -Subproject commit f66026bd3d165e009b11172c82b44204197a7666 +Subproject commit 5ec5d805c01ea85224f6448dd6c6fa0a2a73c028 diff --git a/go.mod b/go.mod index e1220f10..fbce088e 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/filecoin-project/go-fil-markets v1.14.1 github.com/filecoin-project/go-jsonrpc v0.1.5 github.com/filecoin-project/go-padreader v0.0.1 - github.com/filecoin-project/go-paramfetch v0.0.3-0.20220111000201-e42866db1a53 + github.com/filecoin-project/go-paramfetch v0.0.4 github.com/filecoin-project/go-state-types v0.1.3 github.com/filecoin-project/go-statemachine v1.0.1 github.com/filecoin-project/go-statestore v0.2.0 @@ -35,7 +35,7 @@ require ( github.com/filecoin-project/specs-actors/v5 v5.0.4 github.com/filecoin-project/specs-actors/v6 v6.0.1 github.com/filecoin-project/specs-actors/v7 v7.0.0-rc1 - github.com/filecoin-project/specs-storage v0.1.1-0.20211228030229-6d460d25a0c9 + github.com/filecoin-project/specs-storage v0.2.0 github.com/filecoin-project/venus v1.2.0-rc5.0.20220210073318-71c52bbba9c5 github.com/filecoin-project/venus-market v1.0.2-0.20220210103815-5ea3e7f6c5ac github.com/filecoin-project/venus-messager v1.4.0-rc2 diff --git a/go.sum b/go.sum index 2ed3dbd7..e4530583 100644 --- a/go.sum +++ b/go.sum @@ -381,8 +381,9 @@ github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20/go.m github.com/filecoin-project/go-padreader v0.0.0-20210723183308-812a16dc01b1/go.mod h1:VYVPJqwpsfmtoHnAmPx6MUwmrK6HIcDqZJiuZhtmfLQ= github.com/filecoin-project/go-padreader v0.0.1 h1:8h2tVy5HpoNbr2gBRr+WD6zV6VD6XHig+ynSGJg8ZOs= github.com/filecoin-project/go-padreader v0.0.1/go.mod h1:VYVPJqwpsfmtoHnAmPx6MUwmrK6HIcDqZJiuZhtmfLQ= -github.com/filecoin-project/go-paramfetch v0.0.3-0.20220111000201-e42866db1a53 h1:+nripp+UI/rhl01w9Gs4V0XDGaVPYPMGU/D/gNVLue0= github.com/filecoin-project/go-paramfetch v0.0.3-0.20220111000201-e42866db1a53/go.mod h1:1FH85P8U+DUEmWk1Jkw3Bw7FrwTVUNHk/95PSPG+dts= +github.com/filecoin-project/go-paramfetch v0.0.4 h1:H+Me8EL8T5+79z/KHYQQcT8NVOzYVqXIi7nhb48tdm8= +github.com/filecoin-project/go-paramfetch v0.0.4/go.mod h1:1FH85P8U+DUEmWk1Jkw3Bw7FrwTVUNHk/95PSPG+dts= github.com/filecoin-project/go-state-types v0.0.0-20200903145444-247639ffa6ad/go.mod h1:IQ0MBPnonv35CJHtWSN3YY1Hz2gkPru1Q9qoaYLxx9I= github.com/filecoin-project/go-state-types v0.0.0-20200928172055-2df22083d8ab/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= @@ -415,8 +416,9 @@ github.com/filecoin-project/specs-actors/v7 v7.0.0-20211117170924-fd07a4c7dff9/g github.com/filecoin-project/specs-actors/v7 v7.0.0-20211222192039-c83bea50c402/go.mod h1:p6LIOFezA1rgRLMewbvdi3Pp6SAu+q9FtJ9CAleSjrE= github.com/filecoin-project/specs-actors/v7 v7.0.0-rc1 h1:FuDaXIbcw2hRsFI8SDTmsGGCE+NumpF6aiBoU/2X5W4= github.com/filecoin-project/specs-actors/v7 v7.0.0-rc1/go.mod h1:TA5FwCna+Yi36POaT7SLKXsgEDvJwc0V/L6ZsO19B9M= -github.com/filecoin-project/specs-storage v0.1.1-0.20211228030229-6d460d25a0c9 h1:oUYOvF7EvdXS0Zmk9mNkaB6Bu0l+WXBYPzVodKMiLug= github.com/filecoin-project/specs-storage v0.1.1-0.20211228030229-6d460d25a0c9/go.mod h1:Tb88Zq+IBJbvAn3mS89GYj3jdRThBTE/771HCVZdRJU= +github.com/filecoin-project/specs-storage v0.2.0 h1:Y4UDv0apRQ3zI2GiPPubi8JblpUZZphEdaJUxCutfyg= +github.com/filecoin-project/specs-storage v0.2.0/go.mod h1:Tb88Zq+IBJbvAn3mS89GYj3jdRThBTE/771HCVZdRJU= github.com/filecoin-project/test-vectors/schema v0.0.5/go.mod h1:iQ9QXLpYWL3m7warwvK1JC/pTri8mnfEmKygNDqqY6E= github.com/filecoin-project/venus v1.2.0-rc5/go.mod h1:P2i2m4nheAeVXXWjkVLDyezY7l2Bi1sNBt5gno0/Sn0= github.com/filecoin-project/venus v1.2.0-rc5.0.20220210073318-71c52bbba9c5 h1:RnwvdAb3HTktA57dX8UCY45qcPiFY/2J+aXhqOJ42wY= diff --git a/sector-storage/faults.go b/sector-storage/faults.go index 7f0362f4..71c40534 100644 --- a/sector-storage/faults.go +++ b/sector-storage/faults.go @@ -55,6 +55,25 @@ func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, return nil } + // temporary hack to make the check work with snapdeals + // will go away in https://github.com/filecoin-project/lotus/pull/7971 + if lp.Sealed == "" || lp.Cache == "" { + // maybe it's update + lockedUpdate, err := m.index.StorageTryLock(ctx, sector.ID, storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTNone) + if err != nil { + return xerrors.Errorf("acquiring sector lock: %w", err) + } + if lockedUpdate { + lp, _, err = m.localStore.AcquireSector(ctx, sector, storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove) + if err != nil { + log.Warnw("CheckProvable Sector FAULT: acquire sector in checkProvable", "sector", sector, "error", err) + bad[sector.ID] = fmt.Sprintf("acquire sector failed: %s", err) + return nil + } + lp.Sealed, lp.Cache = lp.Update, lp.UpdateCache + } + } + if lp.Sealed == "" || lp.Cache == "" { log.Warnw("CheckProvable Sector FAULT: cache and/or sealed paths not found", "sector", sector, "sealed", lp.Sealed, "cache", lp.Cache) bad[sector.ID] = fmt.Sprintf("cache and/or sealed paths not found, cache %q, sealed %q", lp.Cache, lp.Sealed) diff --git a/sector-storage/ffiwrapper/sealer_cgo.go b/sector-storage/ffiwrapper/sealer_cgo.go index 0e7fa76f..30d39b47 100644 --- a/sector-storage/ffiwrapper/sealer_cgo.go +++ b/sector-storage/ffiwrapper/sealer_cgo.go @@ -811,7 +811,7 @@ func (sb *Sealer) ReleaseSealed(ctx context.Context, sector storage.SectorRef) e return xerrors.Errorf("not supported at this layer") } -func (sb *Sealer) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { +func (sb *Sealer) freeUnsealed(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { ssize, err := sector.ProofType.SectorSize() if err != nil { return err @@ -875,7 +875,18 @@ func (sb *Sealer) FinalizeSector(ctx context.Context, sector storage.SectorRef, } } + return nil +} + +func (sb *Sealer) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { + ssize, err := sector.ProofType.SectorSize() + if err != nil { + return err + } + if err := sb.freeUnsealed(ctx, sector, keepUnsealed); err != nil { + return err + } paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTCache, 0, storiface.PathStorage) if err != nil { return xerrors.Errorf("acquiring sector cache path: %w", err) @@ -886,6 +897,43 @@ func (sb *Sealer) FinalizeSector(ctx context.Context, sector storage.SectorRef, return ffi.ClearCache(uint64(ssize), paths.Cache) } +func (sb *Sealer) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { + ssize, err := sector.ProofType.SectorSize() + if err != nil { + return err + } + + if err := sb.freeUnsealed(ctx, sector, keepUnsealed); err != nil { + return err + } + + { + paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTCache, 0, storiface.PathStorage) + if err != nil { + return xerrors.Errorf("acquiring sector cache path: %w", err) + } + defer done() + + if err := ffi.ClearCache(uint64(ssize), paths.Cache); err != nil { + return xerrors.Errorf("clear cache: %w", err) + } + } + + { + paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUpdateCache, 0, storiface.PathStorage) + if err != nil { + return xerrors.Errorf("acquiring sector cache path: %w", err) + } + defer done() + + if err := ffi.ClearCache(uint64(ssize), paths.UpdateCache); err != nil { + return xerrors.Errorf("clear cache: %w", err) + } + } + + return nil +} + func (sb *Sealer) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) error { // This call is meant to mark storage as 'freeable'. Given that unsealing is // very expensive, we don't remove data as soon as we can - instead we only diff --git a/sector-storage/manager.go b/sector-storage/manager.go index 10f9db9b..84c63ec7 100644 --- a/sector-storage/manager.go +++ b/sector-storage/manager.go @@ -150,8 +150,9 @@ func New(ctx context.Context, lstor *stores.Local, stor *stores.Remote, ls store go m.sched.runSched() localTasks := []types.TaskType{ - types.TTCommit1, types.TTProveReplicaUpdate1, types.TTFinalize, types.TTFetch, + types.TTCommit1, types.TTProveReplicaUpdate1, types.TTFinalize, types.TTFetch, types.TTFinalizeReplicaUpdate, } + if sc.AllowAddPiece { localTasks = append(localTasks, types.TTAddPiece) } @@ -591,6 +592,74 @@ func (m *Manager) FinalizeSector(ctx context.Context, sector storage.SectorRef, return nil } +func (m *Manager) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + if err := m.index.StorageLock(ctx, sector.ID, storiface.FTNone, storiface.FTSealed|storiface.FTUnsealed|storiface.FTCache|storiface.FTUpdate|storiface.FTUpdateCache); err != nil { + return xerrors.Errorf("acquiring sector lock: %w", err) + } + + fts := storiface.FTUnsealed + { + unsealedStores, err := m.index.StorageFindSector(ctx, sector.ID, storiface.FTUnsealed, 0, false) + if err != nil { + return xerrors.Errorf("finding unsealed sector: %w", err) + } + + if len(unsealedStores) == 0 { // Is some edge-cases unsealed sector may not exist already, that's fine + fts = storiface.FTNone + } + } + + pathType := storiface.PathStorage + { + sealedStores, err := m.index.StorageFindSector(ctx, sector.ID, storiface.FTUpdate, 0, false) + if err != nil { + return xerrors.Errorf("finding sealed sector: %w", err) + } + + for _, store := range sealedStores { + if store.CanSeal { + pathType = storiface.PathSealing + break + } + } + } + + selector := newExistingSelector(m.index, sector.ID, storiface.FTCache|storiface.FTSealed|storiface.FTUpdate|storiface.FTUpdateCache, false) + + err := m.sched.Schedule(ctx, sector, types.TTFinalizeReplicaUpdate, selector, + m.schedFetch(sector, storiface.FTCache|storiface.FTSealed|storiface.FTUpdate|storiface.FTUpdateCache|fts, pathType, storiface.AcquireMove), + func(ctx context.Context, w Worker) error { + _, err := m.waitSimpleCall(ctx)(w.FinalizeReplicaUpdate(ctx, sector, keepUnsealed)) + return err + }) + if err != nil { + return err + } + + fetchSel := newAllocSelector(m.index, storiface.FTCache|storiface.FTSealed|storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathStorage) + moveUnsealed := fts + { + if len(keepUnsealed) == 0 { + moveUnsealed = storiface.FTNone + } + } + + err = m.sched.Schedule(ctx, sector, types.TTFetch, fetchSel, + m.schedFetch(sector, storiface.FTCache|storiface.FTSealed|storiface.FTUpdate|storiface.FTUpdateCache|moveUnsealed, storiface.PathStorage, storiface.AcquireMove), + func(ctx context.Context, w Worker) error { + _, err := m.waitSimpleCall(ctx)(w.MoveStorage(ctx, sector, storiface.FTCache|storiface.FTSealed|storiface.FTUpdate|storiface.FTUpdateCache|moveUnsealed)) + return err + }) + if err != nil { + return xerrors.Errorf("moving sector to storage: %w", err) + } + + return nil +} + func (m *Manager) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) error { return nil } @@ -890,6 +959,10 @@ func (m *Manager) ReturnProveReplicaUpdate2(ctx context.Context, callID types.Ca return m.returnResult(ctx, callID, proof, err) } +func (m *Manager) ReturnFinalizeReplicaUpdate(ctx context.Context, callID types.CallID, err *storiface.CallError) error { + return m.returnResult(ctx, callID, nil, err) +} + func (m *Manager) ReturnGenerateSectorKeyFromData(ctx context.Context, callID types.CallID, err *storiface.CallError) error { return m.returnResult(ctx, callID, nil, err) } diff --git a/sector-storage/mock/mock.go b/sector-storage/mock/mock.go index b882e1f9..67e9330b 100644 --- a/sector-storage/mock/mock.go +++ b/sector-storage/mock/mock.go @@ -479,6 +479,10 @@ func (mgr *SectorMgr) FinalizeSector(context.Context, storage.SectorRef, []stora return nil } +func (mgr *SectorMgr) FinalizeReplicaUpdate(context.Context, storage.SectorRef, []storage.Range) error { + return nil +} + func (mgr *SectorMgr) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) error { return nil } @@ -579,6 +583,10 @@ func (mgr *SectorMgr) ReturnGenerateSectorKeyFromData(ctx context.Context, callI panic("not supported") } +func (mgr *SectorMgr) ReturnFinalizeReplicaUpdate(ctx context.Context, callID types.CallID, err *storiface.CallError) error { + panic("not supported") +} + func (m mockVerifProver) VerifySeal(svi proof.SealVerifyInfo) (bool, error) { plen, err := svi.SealProof.ProofSize() if err != nil { diff --git a/sector-storage/sched_test.go b/sector-storage/sched_test.go index d5198f19..37857d11 100644 --- a/sector-storage/sched_test.go +++ b/sector-storage/sched_test.go @@ -94,6 +94,9 @@ func (s *schedTestWorker) Remove(ctx context.Context, sector storage.SectorRef) panic("implement me") } +func (t *testExec) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { + panic("implement me") +} func (s *schedTestWorker) NewSector(ctx context.Context, sector storage.SectorRef) (types.CallID, error) { panic("implement me") } @@ -118,6 +121,10 @@ func (s *schedTestWorker) GenerateSectorKeyFromData(ctx context.Context, sector panic("implement me") } +func (s *schedTestWorker) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (types.CallID, error) { + panic("implement me") +} + func (s *schedTestWorker) MoveStorage(ctx context.Context, sector storage.SectorRef, types storiface.SectorFileType) (types.CallID, error) { panic("implement me") } diff --git a/sector-storage/storiface/worker.go b/sector-storage/storiface/worker.go index 4b828200..6944ced6 100644 --- a/sector-storage/storiface/worker.go +++ b/sector-storage/storiface/worker.go @@ -107,6 +107,7 @@ type WorkerCalls interface { SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (types.CallID, error) SealCommit2(ctx context.Context, sector storage.SectorRef, c1o storage.Commit1Out) (types.CallID, error) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (types.CallID, error) + FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (types.CallID, error) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (types.CallID, error) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (types.CallID, error) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (types.CallID, error) @@ -169,6 +170,7 @@ type WorkerReturn interface { ReturnProveReplicaUpdate1(ctx context.Context, callID types.CallID, proofs storage.ReplicaVanillaProofs, err *CallError) error ReturnProveReplicaUpdate2(ctx context.Context, callID types.CallID, proof storage.ReplicaUpdateProof, err *CallError) error ReturnGenerateSectorKeyFromData(ctx context.Context, callID types.CallID, err *CallError) error + ReturnFinalizeReplicaUpdate(ctx context.Context, callID types.CallID, err *CallError) error ReturnMoveStorage(ctx context.Context, callID types.CallID, err *CallError) error ReturnUnsealPiece(ctx context.Context, callID types.CallID, err *CallError) error ReturnReadPiece(ctx context.Context, callID types.CallID, ok bool, err *CallError) error diff --git a/sector-storage/worker_local.go b/sector-storage/worker_local.go index fd60e788..8c403d93 100644 --- a/sector-storage/worker_local.go +++ b/sector-storage/worker_local.go @@ -200,20 +200,21 @@ func rfunc(in interface{}) func(context.Context, types.CallID, storiface.WorkerR } var returnFunc = map[types.ReturnType]func(context.Context, types.CallID, storiface.WorkerReturn, interface{}, *storiface.CallError) error{ - types.ReturnAddPiece: rfunc(storiface.WorkerReturn.ReturnAddPiece), - types.ReturnSealPreCommit1: rfunc(storiface.WorkerReturn.ReturnSealPreCommit1), - types.ReturnSealPreCommit2: rfunc(storiface.WorkerReturn.ReturnSealPreCommit2), - types.ReturnSealCommit1: rfunc(storiface.WorkerReturn.ReturnSealCommit1), - types.ReturnSealCommit2: rfunc(storiface.WorkerReturn.ReturnSealCommit2), - types.ReturnFinalizeSector: rfunc(storiface.WorkerReturn.ReturnFinalizeSector), - types.ReturnReleaseUnsealed: rfunc(storiface.WorkerReturn.ReturnReleaseUnsealed), - types.ReturnReplicaUpdate: rfunc(storiface.WorkerReturn.ReturnReplicaUpdate), - types.ReturnProveReplicaUpdate1: rfunc(storiface.WorkerReturn.ReturnProveReplicaUpdate1), - types.ReturnProveReplicaUpdate2: rfunc(storiface.WorkerReturn.ReturnProveReplicaUpdate2), - types.ReturnGenerateSectorKey: rfunc(storiface.WorkerReturn.ReturnGenerateSectorKeyFromData), - types.ReturnMoveStorage: rfunc(storiface.WorkerReturn.ReturnMoveStorage), - types.ReturnUnsealPiece: rfunc(storiface.WorkerReturn.ReturnUnsealPiece), - types.ReturnFetch: rfunc(storiface.WorkerReturn.ReturnFetch), + types.ReturnAddPiece: rfunc(storiface.WorkerReturn.ReturnAddPiece), + types.ReturnSealPreCommit1: rfunc(storiface.WorkerReturn.ReturnSealPreCommit1), + types.ReturnSealPreCommit2: rfunc(storiface.WorkerReturn.ReturnSealPreCommit2), + types.ReturnSealCommit1: rfunc(storiface.WorkerReturn.ReturnSealCommit1), + types.ReturnSealCommit2: rfunc(storiface.WorkerReturn.ReturnSealCommit2), + types.ReturnFinalizeSector: rfunc(storiface.WorkerReturn.ReturnFinalizeSector), + types.ReturnReleaseUnsealed: rfunc(storiface.WorkerReturn.ReturnReleaseUnsealed), + types.ReturnReplicaUpdate: rfunc(storiface.WorkerReturn.ReturnReplicaUpdate), + types.ReturnProveReplicaUpdate1: rfunc(storiface.WorkerReturn.ReturnProveReplicaUpdate1), + types.ReturnProveReplicaUpdate2: rfunc(storiface.WorkerReturn.ReturnProveReplicaUpdate2), + types.ReturnGenerateSectorKey: rfunc(storiface.WorkerReturn.ReturnGenerateSectorKeyFromData), + types.ReturnFinalizeReplicaUpdate: rfunc(storiface.WorkerReturn.ReturnFinalizeReplicaUpdate), + types.ReturnMoveStorage: rfunc(storiface.WorkerReturn.ReturnMoveStorage), + types.ReturnUnsealPiece: rfunc(storiface.WorkerReturn.ReturnUnsealPiece), + types.ReturnFetch: rfunc(storiface.WorkerReturn.ReturnFetch), } func (l *LocalWorker) asyncCall(ctx context.Context, sector storage.SectorRef, rt types.ReturnType, work func(ctx context.Context, ci types.CallID) (interface{}, error)) (types.CallID, error) { @@ -454,6 +455,26 @@ func (l *LocalWorker) FinalizeSector(ctx context.Context, sector storage.SectorR }) } +func (l *LocalWorker) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (types.CallID, error) { + sb, err := l.executor() + if err != nil { + return types.UndefCall, err + } + + return l.asyncCall(ctx, sector, types.ReturnFinalizeReplicaUpdate, func(ctx context.Context, ci types.CallID) (interface{}, error) { + if err := sb.FinalizeReplicaUpdate(ctx, sector, keepUnsealed); err != nil { + return nil, xerrors.Errorf("finalizing sector: %w", err) + } + + if len(keepUnsealed) == 0 { + if err := l.storage.Remove(ctx, sector.ID, storiface.FTUnsealed, true, nil); err != nil { + return nil, xerrors.Errorf("removing unsealed data: %w", err) + } + } + + return nil, err + }) +} func (l *LocalWorker) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (types.CallID, error) { return types.UndefCall, xerrors.Errorf("implement me") } diff --git a/sector-storage/worker_tracked.go b/sector-storage/worker_tracked.go index d0d440a7..361a4e79 100644 --- a/sector-storage/worker_tracked.go +++ b/sector-storage/worker_tracked.go @@ -195,4 +195,8 @@ func (t *trackedWorker) ProveReplicaUpdate2(ctx context.Context, sector storage. }) } +func (t *trackedWorker) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (types.CallID, error) { + return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, sector, types.TTFinalizeReplicaUpdate, func() (types.CallID, error) { return t.Worker.FinalizeReplicaUpdate(ctx, sector, keepUnsealed) }) +} + var _ Worker = &trackedWorker{} diff --git a/storage-sealing/fsm.go b/storage-sealing/fsm.go index cc013d9a..c4eae8c2 100644 --- a/storage-sealing/fsm.go +++ b/storage-sealing/fsm.go @@ -179,8 +179,15 @@ var fsmPlanners = map[types.SectorState]func(events []statemachine.Event, state types.FinalizeReplicaUpdate: planOne( on(SectorFinalized{}, types.Proving), ), - // Sealing errors + types.UpdateActivating: planOne( + on(SectorUpdateActive{}, types.ReleaseSectorKey), + ), + types.ReleaseSectorKey: planOne( + on(SectorKeyReleased{}, types.Proving), + on(SectorReleaseKeyFailed{}, types.ReleaseSectorKeyFailed), + ), + // Sealing errors types.AddPieceFailed: planOne( on(SectorRetryWaitDeals{}, types.WaitDeals), apply(SectorStartPacking{}), @@ -260,6 +267,9 @@ var fsmPlanners = map[types.SectorState]func(events []statemachine.Event, state on(SectorDealsExpired{}, types.SnapDealsDealsExpired), on(SectorAbortUpgrade{}, types.AbortUpgrade), ), + types.ReleaseSectorKeyFailed: planOne( + on(SectorUpdateActive{}, types.ReleaseSectorKey), + ), // Post-seal @@ -502,6 +512,10 @@ func (m *Sealing) plan(events []statemachine.Event, state *types.SectorInfo) (fu return m.handleReplicaUpdateWait, processed, nil case types.FinalizeReplicaUpdate: return m.handleFinalizeReplicaUpdate, processed, nil + case types.UpdateActivating: + return m.handleUpdateActivating, processed, nil + case types.ReleaseSectorKey: + return m.handleReleaseSectorKey, processed, nil // Handled failure modes case types.AddPieceFailed: @@ -538,6 +552,8 @@ func (m *Sealing) plan(events []statemachine.Event, state *types.SectorInfo) (fu return m.handleSnapDealsRecoverDealIDs, processed, nil case types.ReplicaUpdateFailed: return m.handleSubmitReplicaUpdateFailed, processed, nil + case types.ReleaseSectorKeyFailed: + return m.handleReleaseSectorKeyFailed, 0, err case types.AbortUpgrade: return m.handleAbortUpgrade, processed, nil diff --git a/storage-sealing/fsm_events.go b/storage-sealing/fsm_events.go index 7521b641..a5040796 100644 --- a/storage-sealing/fsm_events.go +++ b/storage-sealing/fsm_events.go @@ -337,6 +337,14 @@ type SectorReplicaUpdateLanded struct{} func (evt SectorReplicaUpdateLanded) apply(state *types.SectorInfo) {} +type SectorUpdateActive struct{} + +func (evt SectorUpdateActive) apply(state *types.SectorInfo) {} + +type SectorKeyReleased struct{} + +func (evt SectorKeyReleased) apply(state *types.SectorInfo) {} + // Failed state recovery type SectorRetrySealPreCommit1 struct{} @@ -447,6 +455,14 @@ type SectorSubmitReplicaUpdateFailed struct{} func (evt SectorSubmitReplicaUpdateFailed) apply(state *types.SectorInfo) {} +type SectorReleaseKeyFailed struct{ error } + +func (evt SectorReleaseKeyFailed) FormatError(xerrors.Printer) (next error) { + return evt.error +} + +func (evt SectorReleaseKeyFailed) apply(state *types.SectorInfo) {} + // Faults type SectorFaulty struct{} diff --git a/storage-sealing/states_failed.go b/storage-sealing/states_failed.go index db7ebbe6..e69ec6b9 100644 --- a/storage-sealing/states_failed.go +++ b/storage-sealing/states_failed.go @@ -217,7 +217,7 @@ func (m *Sealing) handleSubmitReplicaUpdateFailed(ctx statemachine.Context, sect tok, _, err := m.api.ChainHead(ctx.Context()) if err != nil { - log.Errorf("handleCommitting: api error, not proceeding: %+v", err) + log.Errorf("handleSubmitReplicaUpdateFailed: api error, not proceeding: %+v", err) return nil } @@ -243,6 +243,17 @@ func (m *Sealing) handleSubmitReplicaUpdateFailed(ctx statemachine.Context, sect } } + // Abort upgrade for sectors that went faulty since being marked for upgrade + active, err := sectorActive(ctx.Context(), m.api, m.maddr, tok, sector.SectorNumber) + if err != nil { + log.Errorf("sector active check: api error, not proceeding: %+v", err) + return nil + } + if !active { + log.Errorf("sector marked for upgrade %d no longer active, aborting upgrade", sector.SectorNumber) + return ctx.Send(SectorAbortUpgrade{}) + } + if err := m.failedCooldown(ctx, sector); err != nil { return err } @@ -250,6 +261,16 @@ func (m *Sealing) handleSubmitReplicaUpdateFailed(ctx statemachine.Context, sect return ctx.Send(SectorRetrySubmitReplicaUpdate{}) } +func (m *Sealing) handleReleaseSectorKeyFailed(ctx statemachine.Context, sector types.SectorInfo) error { + // not much we can do, wait for a bit and try again + + if err := m.failedCooldown(ctx, sector); err != nil { + return err + } + + return ctx.Send(SectorUpdateActive{}) +} + func (m *Sealing) handleCommitFailed(ctx statemachine.Context, sector types.SectorInfo) error { tok, _, err := m.api.ChainHead(ctx.Context()) if err != nil { diff --git a/storage-sealing/states_replica_update.go b/storage-sealing/states_replica_update.go index d8f1b576..7eee4a9b 100644 --- a/storage-sealing/states_replica_update.go +++ b/storage-sealing/states_replica_update.go @@ -2,6 +2,10 @@ package sealing import ( "bytes" + "context" + "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/venus/venus-shared/actors/policy" + "time" "golang.org/x/xerrors" @@ -36,6 +40,21 @@ func (m *Sealing) handleProveReplicaUpdate(ctx statemachine.Context, sector type if sector.CommR == nil { return xerrors.Errorf("invalid sector %d with nil CommR", sector.SectorNumber) } + // Abort upgrade for sectors that went faulty since being marked for upgrade + tok, _, err := m.api.ChainHead(ctx.Context()) + if err != nil { + log.Errorf("handleProveReplicaUpdate: api error, not proceeding: %+v", err) + return nil + } + active, err := sectorActive(ctx.Context(), m.api, m.maddr, tok, sector.SectorNumber) + if err != nil { + log.Errorf("sector active check: api error, not proceeding: %+v", err) + return nil + } + if !active { + log.Errorf("sector marked for upgrade %d no longer active, aborting upgrade", sector.SectorNumber) + return ctx.Send(SectorAbortUpgrade{}) + } vanillaProofs, err := m.sealer.ProveReplicaUpdate1(sector.SealingCtx(ctx.Context()), m.minerSector(sector.SectorType, sector.SectorNumber), *sector.CommR, *sector.UpdateSealed, *sector.UpdateUnsealed) if err != nil { @@ -204,9 +223,68 @@ func (m *Sealing) handleReplicaUpdateWait(ctx statemachine.Context, sector types } func (m *Sealing) handleFinalizeReplicaUpdate(ctx statemachine.Context, sector types.SectorInfo) error { + cfg, err := m.getConfig() + if err != nil { + return xerrors.Errorf("getting sealing config: %w", err) + } + + if err := m.sealer.FinalizeReplicaUpdate(sector.SealingCtx(ctx.Context()), m.minerSector(sector.SectorType, sector.SectorNumber), sector.KeepUnsealedRanges(false, cfg.AlwaysKeepUnsealedCopy)); err != nil { + return ctx.Send(SectorFinalizeFailed{xerrors.Errorf("finalize sector: %w", err)}) + } return ctx.Send(SectorFinalized{}) } +func (m *Sealing) handleUpdateActivating(ctx statemachine.Context, sector types.SectorInfo) error { + try := func() error { + mw, err := m.api.MessagerWaitMsg(ctx.Context(), sector.ReplicaUpdateMessage) + if err != nil { + return err + } + + tok, _, err := m.api.ChainHead(ctx.Context()) + if err != nil { + return err + } + + nv, err := m.api.StateNetworkVersion(ctx.Context(), tok) + if err != nil { + return err + } + + lb := policy.GetWinningPoStSectorSetLookback(nv) + targetHeight := mw.Height + lb + InteractivePoRepConfidence + + return m.events.ChainAt(ctx.Context(), func(context.Context, types.TipSetToken, abi.ChainEpoch) error { + return ctx.Send(SectorUpdateActive{}) + }, func(ctx context.Context, ts types.TipSetToken) error { + log.Warn("revert in handleUpdateActivating") + return nil + }, InteractivePoRepConfidence, targetHeight) + } + + for { + err := try() + if err == nil { + break + } + + log.Errorw("error in handleUpdateActivating", "error", err) + + // likely an API issue, sleep for a bit and retry + time.Sleep(time.Minute) + } + + return nil +} + +func (m *Sealing) handleReleaseSectorKey(ctx statemachine.Context, sector types.SectorInfo) error { + if err := m.sealer.ReleaseSectorKey(sector.SealingCtx(ctx.Context()), m.minerSector(sector.SectorType, sector.SectorNumber)); err != nil { + return ctx.Send(SectorReleaseKeyFailed{err}) + } + + return ctx.Send(SectorKeyReleased{}) +} + func handleErrors(ctx statemachine.Context, err error, sector types.SectorInfo) error { switch err.(type) { case *ErrApi: diff --git a/storage-sealing/upgrade_queue.go b/storage-sealing/upgrade_queue.go index ae99fbf5..9ae3afa0 100644 --- a/storage-sealing/upgrade_queue.go +++ b/storage-sealing/upgrade_queue.go @@ -2,6 +2,7 @@ package sealing import ( "context" + "github.com/filecoin-project/go-address" market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market" "github.com/filecoin-project/venus/venus-shared/actors/builtin/miner" @@ -112,6 +113,23 @@ func (m *Sealing) MarkForSnapUpgrade(ctx context.Context, id abi.SectorNumber) e return m.sectors.Send(uint64(id), SectorStartCCUpdate{}) } +func sectorActive(ctx context.Context, api SealingAPI, maddr address.Address, tok types.TipSetToken, sector abi.SectorNumber) (bool, error) { + active, err := api.StateMinerActiveSectors(ctx, maddr, tok) + if err != nil { + return false, xerrors.Errorf("failed to check active sectors: %w", err) + } + + // Ensure the upgraded sector is active + var found bool + for _, si := range active { + if si.SectorNumber == sector { + found = true + break + } + } + return found, nil +} + func (m *Sealing) tryUpgradeSector(ctx context.Context, params *miner.SectorPreCommitInfo) big.Int { if len(params.DealIDs) == 0 { return big.Zero() diff --git a/types/return_type.go b/types/return_type.go index db05970a..9d141db3 100644 --- a/types/return_type.go +++ b/types/return_type.go @@ -3,18 +3,19 @@ package types type ReturnType string const ( - ReturnAddPiece ReturnType = "ReturnAddPiece" - ReturnSealPreCommit1 ReturnType = "ReturnSealPreCommit1" - ReturnSealPreCommit2 ReturnType = "ReturnSealPreCommit2" - ReturnSealCommit1 ReturnType = "ReturnSealCommit1" - ReturnSealCommit2 ReturnType = "ReturnSealCommit2" - ReturnFinalizeSector ReturnType = "ReturnFinalizeSector" - ReturnReplicaUpdate ReturnType = "ReturnReplicaUpdate" - ReturnProveReplicaUpdate1 ReturnType = "ReturnProveReplicaUpdate1" - ReturnProveReplicaUpdate2 ReturnType = "ReturnProveReplicaUpdate2" - ReturnGenerateSectorKey ReturnType = "ReturnGenerateSectorKey" - ReturnReleaseUnsealed ReturnType = "ReturnReleaseUnsealed" - ReturnMoveStorage ReturnType = "ReturnMoveStorage" - ReturnUnsealPiece ReturnType = "ReturnUnsealPiece" - ReturnFetch ReturnType = "ReturnFetch" + ReturnAddPiece ReturnType = "ReturnAddPiece" + ReturnSealPreCommit1 ReturnType = "ReturnSealPreCommit1" + ReturnSealPreCommit2 ReturnType = "ReturnSealPreCommit2" + ReturnSealCommit1 ReturnType = "ReturnSealCommit1" + ReturnSealCommit2 ReturnType = "ReturnSealCommit2" + ReturnFinalizeSector ReturnType = "ReturnFinalizeSector" + ReturnFinalizeReplicaUpdate ReturnType = "ReturnFinalizeReplicaUpdate" + ReturnReplicaUpdate ReturnType = "ReturnReplicaUpdate" + ReturnProveReplicaUpdate1 ReturnType = "ReturnProveReplicaUpdate1" + ReturnProveReplicaUpdate2 ReturnType = "ReturnProveReplicaUpdate2" + ReturnGenerateSectorKey ReturnType = "ReturnGenerateSectorKey" + ReturnReleaseUnsealed ReturnType = "ReturnReleaseUnsealed" + ReturnMoveStorage ReturnType = "ReturnMoveStorage" + ReturnUnsealPiece ReturnType = "ReturnUnsealPiece" + ReturnFetch ReturnType = "ReturnFetch" ) diff --git a/types/sector_state.go b/types/sector_state.go index 8391f5cd..e694025b 100644 --- a/types/sector_state.go +++ b/types/sector_state.go @@ -52,6 +52,8 @@ var ExistSectorStateList = map[SectorState]struct{}{ ProveReplicaUpdate: {}, SubmitReplicaUpdate: {}, ReplicaUpdateWait: {}, + UpdateActivating: {}, + ReleaseSectorKey: {}, FinalizeReplicaUpdate: {}, SnapDealsAddPieceFailed: {}, SnapDealsDealsExpired: {}, @@ -104,6 +106,8 @@ const ( SubmitReplicaUpdate SectorState = "SubmitReplicaUpdate" ReplicaUpdateWait SectorState = "ReplicaUpdateWait" FinalizeReplicaUpdate SectorState = "FinalizeReplicaUpdate" + UpdateActivating SectorState = "UpdateActivating" + ReleaseSectorKey SectorState = "ReleaseSectorKey" // error modes FailedUnrecoverable SectorState = "FailedUnrecoverable" @@ -124,6 +128,7 @@ const ( SnapDealsRecoverDealIDs SectorState = "SnapDealsRecoverDealIDs" AbortUpgrade SectorState = "AbortUpgrade" ReplicaUpdateFailed SectorState = "ReplicaUpdateFailed" + ReleaseSectorKeyFailed SectorState = "ReleaseSectorKeyFailed" Faulty SectorState = "Faulty" // sector is corrupted or gone for some reason FaultReported SectorState = "FaultReported" // sector has been declared as a fault on chain @@ -153,7 +158,7 @@ func toStatState(st SectorState, finEarly bool) StatSectorState { return SstProving } return SstSealing - case Proving, Removed, Removing, Terminating, TerminateWait, TerminateFinality, TerminateFailed: + case Proving, UpdateActivating, ReleaseSectorKey, Removed, Removing, Terminating, TerminateWait, TerminateFinality, TerminateFailed: return SstProving } diff --git a/types/task.go b/types/task.go index 03bffa2f..04a6b4bd 100644 --- a/types/task.go +++ b/types/task.go @@ -14,10 +14,11 @@ const ( TTFetch TaskType = "seal/v0/fetch" TTUnseal TaskType = "seal/v0/unseal" - TTReplicaUpdate TaskType = "seal/v0/replicaupdate" - TTProveReplicaUpdate1 TaskType = "seal/v0/provereplicaupdate/1" - TTProveReplicaUpdate2 TaskType = "seal/v0/provereplicaupdate/2" - TTRegenSectorKey TaskType = "seal/v0/regensectorkey" + TTReplicaUpdate TaskType = "seal/v0/replicaupdate" + TTProveReplicaUpdate1 TaskType = "seal/v0/provereplicaupdate/1" + TTProveReplicaUpdate2 TaskType = "seal/v0/provereplicaupdate/2" + TTRegenSectorKey TaskType = "seal/v0/regensectorkey" + TTFinalizeReplicaUpdate TaskType = "seal/v0/finalize/replicaupdate" ) var order = map[TaskType]int{ @@ -48,10 +49,11 @@ var shortNames = map[TaskType]string{ TTFetch: "GET", TTUnseal: "UNS", - TTReplicaUpdate: "RU", - TTProveReplicaUpdate1: "PR1", - TTProveReplicaUpdate2: "PR2", - TTRegenSectorKey: "GSK", + TTReplicaUpdate: "RU", + TTProveReplicaUpdate1: "PR1", + TTProveReplicaUpdate2: "PR2", + TTRegenSectorKey: "GSK", + TTFinalizeReplicaUpdate: "FRU", } func (a TaskType) MuchLess(b TaskType) (bool, bool) {