Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storagefsm: Add missing planners #5016

Merged
merged 4 commits into from
Nov 26, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/lotus-storage-miner/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ var stateList = []stateMeta{

{col: color.FgRed, state: sealing.UndefinedSectorState},
{col: color.FgYellow, state: sealing.Packing},
{col: color.FgYellow, state: sealing.GetTicket},
{col: color.FgYellow, state: sealing.PreCommit1},
{col: color.FgYellow, state: sealing.PreCommit2},
{col: color.FgYellow, state: sealing.PreCommitting},
Expand Down
4 changes: 4 additions & 0 deletions extern/storage-sealing/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,12 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
on(SectorFaultReported{}, FaultReported),
),

FaultReported: final, // not really supported right now

FaultedFinal: final,
Removed: final,

FailedUnrecoverable: final,
}

func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(statemachine.Context, SectorInfo) error, uint64, error) {
Expand Down
15 changes: 15 additions & 0 deletions extern/storage-sealing/fsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,18 @@ func TestPlanCommittingHandlesSectorCommitFailed(t *testing.T) {

require.Equal(t, CommitFailed, m.state.State)
}

func TestPlannerList(t *testing.T) {
for state := range ExistSectorStateList {
_, ok := fsmPlanners[state]
require.True(t, ok, "state %s", state)
}

for state := range fsmPlanners {
if state == UndefinedSectorState {
continue
}
_, ok := ExistSectorStateList[state]
require.True(t, ok, "state %s", state)
}
}
3 changes: 2 additions & 1 deletion extern/storage-sealing/sector_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var ExistSectorStateList = map[SectorState]struct{}{
Empty: {},
WaitDeals: {},
Packing: {},
GetTicket: {},
PreCommit1: {},
PreCommit2: {},
PreCommitting: {},
Expand Down Expand Up @@ -75,7 +76,7 @@ const (

func toStatState(st SectorState) statSectorState {
switch st {
case Empty, WaitDeals, Packing, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, WaitSeed, Committing, CommitWait, FinalizeSector:
case Empty, WaitDeals, Packing, GetTicket, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, WaitSeed, Committing, CommitWait, FinalizeSector:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also include SubmitCommit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lotus-miner sectors status --on-chain-info 373
SectorID: 373
Status: FailedUnrecoverable
CIDcommD: baga6ea4seaqao7s73y24kcutaosvacpdjgfe5pw76ooefnyqw4ynr3d2y6x2mpq
CIDcommR: bagboea4b5abca5ehdl4tioxfrnfzbtuiu2s7rf7suda65p3542llbbh4yrb2nlst
Ticket: d06fb5b99669a2cb8ec38dccdab373bc888e8fb65a9e7a3003a5e2d51419deb7
TicketH: 177438
Seed: 561a606d2186a491fe2b0785fc9f4a6862609161a92e4106754445ffa75f6d13
SeedH: 180373
Precommit: bafy2bzacebujc2uoj6h6ldc4izxc5ndskly7e3zvflgprwbtzl4zd75zimewa
Commit: bafy2bzacecmfzz4imws3chq5a4ivnov2prq3uxbmk267vywqakudo465ew4do
Proof: 8c47fe9ef34abebbd55eedf6b9a4ca814df60d4abdafe7f7a19c50374982dbbd740ad930a99e76a5ba45fe0717f3fbda97560c2d278aef795d1406686bb0cfa763f97a178be3f7598d6226c7915872f669c46052d58058b96c2115767a37e3970f83c453235b120c77c1378fd806fb311354ef85b4a3d226ddb0a7e9992245c106808252cf99609965c0136258ac41ddb412d79183ba743d03528f30985c970d0deb09d9db3b05dd94bfe77a8e261c22f1c694eade77dde5cdfce06ec762e0378109271a1f1b0071df4b17c28349d5b2c8c4c36ddc67d120499028284d491af9b1252a2733ad1e5a139d7ad8cc08b787adfb61d336ebd42e668ceff0da3821e9bc56589949dd67a9cd832f80cc1afab5c007684d1dc26d08df75843e2b6e7aba117627f409b36d099c434bff490b14d9b781c01cb76c9b3c54c7afbc1d679037b75456d2f97422312a2250361f71c8e694bca7265b00eb6a6bda8f386af4a2afaf157fa956f4619803f9ee799ace36f20dee04b265e23ba948401ba926f3c06a91ccf1b9827a926a0d314d8f54100cb232b8c3b034d8bfb9247610b1f3ace2297908802e6d5dbad09928ba8b384f03bc9533ddce0942a5b86908a247c8ff8ff2ccf10905a733b1f977ba562319830b628de34a02e9f8e928b45625bb785781ed069a54ef5fd4d4644f47ac7c574ad0c3b17ac41ace7033ccbbb9b01c9c6baa60a6ba22faf90ebff3406bd9d45d88d8408c0f1706b7695bf932c114616d97b7f2c4c7c66af514f037dcb734d68f23287153ee6b0c8807a08dcfaf306c9525df34a211a185c3ad50fade9889ccf964c021eecf135c4851c110becf636a780acb4ff38e9f4eb99bd3904a35c2e8823f4e6d9237d79c7fb6861d2a8de1e47fc6855fad869c30b3a4c713c49f8dd1a1ae4c6de6f7553f4f4b76452a64e5144476cd00100a289ba2db542ce1f17a9ba05f0822ba59ba99c22c6d28b575537629744262ed644ae069ae689adafd06dd18793494977a080829962524ae9e40b9fad8044f45cb0ab07911aa429b6ef9439c0dd820e8ededd1dbb3c12f9148719f4cee685b834aab023e550388b84d017d5a82a6c20be7c7b88c052d1fd385c7fc308f131a16d64350a9c0235d5a39f68d79932f80a8cf852977afb9a722a29bdd71708473552b1c25f18bef8aa764acc4cd0f69df7ac87d3478a30bbc2e1956d8318be0f7120044b17ec63e132c5e61522cf8b354e5e3647775888e208dbdab1cb382f73c0018ac95423550472bdd3aaef9d7a75b9874f57d627b3a86a7f0cf307e1a7b6f1705639c6077fb714ed4a77c0bc1620882adebf4ccad3514b22a539817d7bf8c903a2c4535b7c46e4661629be6e4f01f6921d30dcf474d20fd2c1b00a28040710d4e2bcbba88f2be21866f231a978a4cb51d6918d6e716504593e74f5039c35b04be3d378a1491429a07ccce876a4b4b5f9c36cf125bfeeb7cf48a5af146e3120e68206b23d65a0715a624afa9af0a98335aa37375daabdc10d60d5291c63c92d7a5e6085672d7001c3f75cb536e5846a084188bf9928fb111d92d2c815ce26ae36c8d4c7d2796a54f59803babac76cc1d5eff076766fbb2ca9b2b3cb592864caf3691106d9b885981ae8eccd36e4ec1084c0d5fc39cc885784fdc38e4c95592fb0f0000ffa8d57df5da7df5e2236e829573c0dcf2acb87db9b3446cb6523b56a99912f0a1d464d642cbe695874211ad8ab8bb639ec0a674d223fe4534c1297b0d68e94b4efd36e8813907ab0d71f86c6f632c1a3b1fe82320534ae164c06f962d2363a7dfb73c0db33ef8e7cb155335b6ae84b0fe5db030ebcd71197efaea734696b818df5c1f06101644ff491b665d42709e739e655a2456bb33501b8a94409974546ee8585542ffa6404629c7ee7777c073605902e1a3d9f8b063499d419f2cb80ed50397ecca5d87e3a98a8c1e688452dc1e7a415ca179b83cc31eadf5e15bb80968bbbb2e8abceedc96be4c1ec669408fd7b9853d12ed6480c2896d11931383f61437130d8533b19f909a4dcb5576268cf4c24bec85d115c9938b24dc9d1b35b62fa59f2bb04d625af9688cfe0a83628da3e0145610ff220723c6b9af95698d0f80de788b3d6a025d70e0b6135983469a80b6f25a9c30087314f344aa45ad6f921dab7310d10d470743367e4b819cfa57271cb91d8d23f620b3229dcf66bcfd1f70385b38648c5a2fbff40969ceb12d183b10539e6772cc4c0e1fe58f5a8721d90c4c355c4d9ac82c998496d1600d8771a8bd19a45d7aca0c9eee27e6951271bcd566685406f5249143cf39eb9f567595b53eaa81a21bd8d0866ac80eb709af1f882a37bbf0afb660bfbb7c3b08a2c68c9055db5fec41ddc688c81717c1346bf83ce92f901683250a3755fe29e426f96c19fbebf5a4cb66b177fb9ae614947e74c0fd5d9960c488412a95b4b4139c8c8a7dd2e438cec59637dbc2a22be6d5a8a7d8e565e77ed111274ef65b71b7b4ede03e4448f099f6de0fd48cabb54fa716ba442c8f48edf5637f55375ee92a1e0d432f033c56d846d7cd6b4e94533f0ebe64ec46441fdc7f8f45f3d5f20f392ebef06440f58b40804c96419cd94d09ad3889ea57f289a907ce7b369ead99e6939b9366333061fb5e53faa56836358a5d170c37760388336f9817ba9090b54a849bda544eeb12cd5b16a114384c4e37
Deals: [0]
Retries: 0

Sector On Chain Info
SealProof: 3
Activation: 181204
Expiration: 1733207
DealWeight: 0
VerifiedDealWeight: 0
InitialPledge: 193795484914212757

Expiration Info
OnTime: 0
Early: 0

until it is on chain

return sstSealing
case Proving, Removed, Removing:
return sstProving
Expand Down