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

Feat: Lotus cli: actor: Support move partition command to move partitions' deadline #11301

Merged
merged 7 commits into from
Oct 2, 2023

Conversation

mb1896
Copy link
Contributor

@mb1896 mb1896 commented Sep 26, 2023

Related Issues

#11272

Proposed Changes

Add move-partition subcommand to lotus-miner actor command.

Additional Info

Still waiting for corresponding actor changes to merge https://github.com/filecoin-project/builtin-actors/pull/1326/files

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • If the PR affects users (e.g., new feature, bug fix, system requirements change), update the CHANGELOG.md and add details to the UNRELEASED section.
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

Example usage

Before

$ ./lotus-miner proving deadlines
Miner: t01000
deadline  partitions  sectors (faults)  proven partitions
0         0           0 (0)             0
1         0           0 (0)             0
2         0           0 (0)             0
3         0           0 (0)             0
4         0           0 (0)             0
5         0           0 (0)             0
6         0           0 (0)             0
7         0           0 (0)             0
8         0           0 (0)             0
9         0           0 (0)             0
10        0           0 (0)             0
11        0           0 (0)             0
12        0           0 (0)             0
13        0           0 (0)             0
14        0           0 (0)             0  (current)
15        0           0 (0)             0
16        0           0 (0)             0
17        0           0 (0)             0
18        0           0 (0)             0
19        0           0 (0)             0
20        1           2 (0)             0
21        0           0 (0)             0
22        0           0 (0)             0
23        0           0 (0)             0
24        0           0 (0)             0
25        0           0 (0)             0
26        0           0 (0)             0
27        0           0 (0)             0
28        0           0 (0)             0
29        0           0 (0)             0
30        0           0 (0)             0
31        0           0 (0)             0
32        0           0 (0)             0
33        0           0 (0)             0
34        0           0 (0)             0
35        0           0 (0)             0
36        0           0 (0)             0
37        0           0 (0)             0
38        0           0 (0)             0
39        0           0 (0)             0
40        0           0 (0)             0
41        0           0 (0)             0
42        0           0 (0)             0
43        0           0 (0)             0
44        0           0 (0)             0
45        0           0 (0)             0
46        0           0 (0)             0
47        0           0 (0)             0

Then use

$ ./lotus-miner actor move-partitions --partition-indices 0 --orig-deadline 20 --dest-deadline 17
Miner: t01000
Moving 1 paritions
MovePartitions Message CID: bafy2bzaceaxz7ujzanqq5k5yhvszzgqyydxhylhfy7vrcywv4rbi76j2zicfk
Waiting for block confirmation...
Move partition confirmed

Check deadline has been moved

$ ./lotus-miner proving deadlines                                                                
Miner: t01000
deadline  partitions  sectors (faults)  proven partitions
0         0           0 (0)             0
1         0           0 (0)             0
2         0           0 (0)             0
3         0           0 (0)             0
4         0           0 (0)             0
5         0           0 (0)             0
6         0           0 (0)             0
7         0           0 (0)             0
8         0           0 (0)             0
9         0           0 (0)             0
10        0           0 (0)             0
11        0           0 (0)             0
12        0           0 (0)             0
13        0           0 (0)             0
14        0           0 (0)             0
15        0           0 (0)             0  (current)
16        0           0 (0)             0
17        1           2 (0)             0
18        0           0 (0)             0
19        0           0 (0)             0
20        0           0 (0)             0
21        0           0 (0)             0
22        0           0 (0)             0
23        0           0 (0)             0
24        0           0 (0)             0
25        0           0 (0)             0
26        0           0 (0)             0
27        0           0 (0)             0
28        0           0 (0)             0
29        0           0 (0)             0
30        0           0 (0)             0
31        0           0 (0)             0
32        0           0 (0)             0
33        0           0 (0)             0
34        0           0 (0)             0
35        0           0 (0)             0
36        0           0 (0)             0
37        0           0 (0)             0
38        0           0 (0)             0
39        0           0 (0)             0
40        0           0 (0)             0
41        0           0 (0)             0
42        0           0 (0)             0
43        0           0 (0)             0
44        0           0 (0)             0
45        0           0 (0)             0
46        0           0 (0)             0
47        0           0 (0)             0

@mb1896 mb1896 requested a review from a team as a code owner September 26, 2023 18:18
@mb1896 mb1896 changed the title Move partition Feat: Lotus cli: actor: Support move partition command to move partitions' deadline Sep 26, 2023
@rjan90
Copy link
Contributor

rjan90 commented Sep 28, 2023

Testing plan:

General:

  • Run the disputer when completing these tasks
  • Submit a bad proof, move the partition and make sure the disputer catches it?
    Unable to move partition after submitting invalid PoSt with ./lotus-shed miner send-invalid-windowed-post --partitions 108 --actor t01000 --really-do-it 47:
lotus-miner actor move-partitions --orig-deadline 47 --dest-deadline 2 --partition-indices 108 --really-do-it
Miner: t01000
Moving 1 paritions
ERROR: mpool push: GasEstimateMessageGas error: message execution failed: exit 20, reason: message failed with backtrace:
00: f01000 (method 33) -- while removing partitions: ActorError(exit_code: ExitCode { value: 16 }, msg: invalid post was submitted) (20)
--> caused by: crypto::verify_post -- not on curve (1: illegal argument)
 (RetCode=20)

FIP specific:

  • Check that CLI-command for moving partition / partitions works as expected:

Successes:

  • Check that moving a single partition (1) from a deadline to another which proving period is in 24 hours after the partitions last proving deadline works
    This worked:
lotus-miner actor move-partitions --orig-deadline 0 --dest-deadline 47 --partition-indices 0 --really-do-it
Miner: t01000
Moving 1 paritions
MovePartitions Message CID: bafy2bzacecey6z4chgmlvuvdfqnfsbzhcufw64jzfcczktkfj6o33zn3qirzk
Waiting for block confirmation...
Move partition confirmed

lotus-miner proving deadlines
Miner: t01000
deadline  partitions  sectors (faults)  proven partitions
deadline  partitions  sectors (faults)  proven partitions
0         0           0 (0)             0
-------
46        0           0 (0)             0
47        1           2 (0)             0
  • WindowPoSt functions for partition moved from original deadline to new deadline
  • Check that moving multiple partitions from a deadline to another which proving period is in 24 hours after the partitions last proving deadline works
    This worked:
lotus-miner actor move-partitions --orig-deadline=0 --dest-deadline=46 --partition-indices=0,1 --really-do-it
Miner: t01000
Moving 2 paritions
MovePartitions Message CID: bafy2bzacecxzuguqcdnedkqpfeeggxdbcxtdxnheocd4ks4adu7imuspc53g2
Waiting for block confirmation...
Move partition confirmed
  • Check that compact partitions works for a moved partition
    This worked
lotus-miner sectors compact-partitions --deadline=47 --partitions=0 --really-do-it
compacting 1 paritions
Requested compact partitions in message bafy2bzaceanjygoerwf436u6jlz2c2ipxwwx6mcl7cxrfabasmi4p63i4mc3y

Before compaction:
        All Sectors:               2
        All Sector Numbers:         [0 1]
        Live Sectors:              1
        Live Sector Numbers:        [0]
        Active Sectors:            1
        Active Sector Numbers:      [0]
        Faulty Sectors:            0
        Faulty Sector Numbers:      []
        Recovering Sectors:        0
        Recovering Sector Numbers:  []
        
 After compaction:
        All Sectors:               1
        All Sector Numbers:         [0]
        Live Sectors:              1
        Live Sector Numbers:        [0]
        Active Sectors:            1
        Active Sector Numbers:      [0]
        Faulty Sectors:            0
        Faulty Sector Numbers:      []
        Recovering Sectors:        0
        Recovering Sector Numbers:  []
  • Check that failing and recovering the partition in the new deadline works after it has been proven after the move
    This worked
  • Check that moving a single partition (1) from a deadline to another which proving period is beyond 24 hours after the partitions last proving deadline fails.
    This correctly fails with:
lotus-miner actor move-partitions --orig-deadline 0 --dest-deadline 10 --partition-indices 0 --really-do-it
Miner: t01000
Moving 1 paritions
ERROR: mpool push: GasEstimateMessageGas error: message execution failed: exit 18, reason: message failed with backtrace:
00: f01000 (method 33) -- conditions not satisfied for deadline_available_for_move: can only move to a deadline which is nearer from current deadline 40, dest_deadline 10 is not nearer than orig_deadline 0 (18)
 (RetCode=18)
  • Check that moving unproven paritions are not allowed
    This correctly fails with:
lotus-miner actor move-partitions --orig-deadline 0 --dest-deadline 46 --partition-indices 0,1 -
-really-do-it
Miner: t01000
Moving 2 paritions
ERROR: mpool push: GasEstimateMessageGas error: message execution failed: exit 20, reason: message failed with backtrace:
00: f01000 (method 33) -- failed to move partitions: ActorError(exit_code: ExitCode { value: 18 }, msg: partition with faults or unproven sectors are not allowed to move, partition_idx 1) (20)
 (RetCode=20)
  • Check that moving multiple partitions in a deadline to another which proving period is in 24 hours after the partitions last proving period fails.
    This correctly fails with:
lotus-miner actor move-partitions --orig-deadline 3 --dest-deadline 11 --partition-indices 0,1 --really-do-it
Miner: t01000
Moving 2 paritions
ERROR: mpool push: GasEstimateMessageGas error: message execution failed: exit 18, reason: message failed with backtrace:
00: f01000 (method 33) -- conditions not satisfied for deadline_available_for_move: can only move to a deadline which is nearer from current deadline 21, dest_deadline 11 is not nearer than orig_deadline 3 (18)
 (RetCode=18)
  • Try to move more partitions then are available in a deadline.
    This correctly fails with:
lotus-miner actor move-partitions --orig-deadline 20 --dest-deadline 0 --partition-indices 0,
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49
,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65 --really-do-it
Miner: t01000
ERROR: partition size(66) cannot be bigger than current partition size(65) for deadline 20
  • Check that a WindowPoSt-partition with failed sectors is unable to be moved.
    This correctly fails with:
lotus-miner proving deadlines
Miner: t01000
deadline  partitions  sectors (faults)  proven partitions
-----
28        1           2 (2)             0

The trying to move the partition:
lotus-miner actor move-partitions --orig-deadline 28 --dest-deadline 1 --partition-indices 109 --really-do-it
Miner: t01000
Moving 1 paritions
ERROR: mpool push: GasEstimateMessageGas error: message execution failed: exit 20, reason: message failed with backtrace:
00: f01000 (method 33) -- failed to move partitions: ActorError(exit_code: ExitCode { value: 18 }, msg: partition with faults or unproven sectors are not allowed to move, partition_idx 109) (20)
 (RetCode=20)
  • Merge partitions until max_partitions_per_deadline (3000) is hit, and confirm that it fails.
    This correctly fails with:
lotus-miner proving deadlines
Miner: t01000
deadline  partitions  sectors (faults)  proven partitions
-----
25        2929        5858 (0)          0

Then trying to move more partitions to exceed it:
lotus-miner actor move-partitions --orig-deadline 6 --dest-deadline 25 --partition-indices 0,1,2,3,4,5,6,7,8,9,10,11,12,13
,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,
67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108 --really-do-it
Miner: t01000
Moving 109 paritions
ERROR: mpool push: GasEstimateMessageGas error: message execution failed: exit 20, reason: message failed with backtrace:
00: f01000 (method 33) -- failed to move partitions: ActorError(exit_code: ExitCode { value: 18 }, msg: partitions in dest_deadline will exceed max_partitions_per_deadline) (20)
 (RetCode=20)

Some edge-cases we want to test:

Move a partition from a deadline to another then:

  • Fault & recover sectors in that partition.
    This worked as expected
  • Fault & terminate sectors in that partition.
    This worked as expected:
This partition was moved, and then faulted:
Partition Index:          109
        All Sectors:               2
        All Sector Numbers:         [36 37]
        Live Sectors:              1
        Live Sector Numbers:        [37]
        Active Sectors:            0
        Active Sector Numbers:      []
        Faulty Sectors:            1
        Faulty Sector Numbers:      [37]
        Recovering Sectors:        0
        Recovering Sector Numbers:  []
        
After faulting, sector number 37 was terminated:

lotus-miner sectors terminate --really-do-it 37
Partition Index:          109
        All Sectors:               2
        All Sector Numbers:         [36 37]
        Live Sectors:              0
        Live Sector Numbers:        []
        Active Sectors:            0
        Active Sector Numbers:      []
        Faulty Sectors:            0
        Faulty Sector Numbers:      []
        Recovering Sectors:        0
        Recovering Sector Numbers:  []
  • Directly terminate non-faulty sectors in that partition.
    This works as expected:
lotus-miner proving deadline --sector-nums 9
Deadline Index:           9
Partitions:               2
Proven Partitions:        0
Current:                  false

Partition Index:          0
        All Sectors:               2
        All Sector Numbers:         [21 22]
        Live Sectors:              2
        Live Sector Numbers:        [21 22]
        Active Sectors:            2
        Active Sector Numbers:      [21 22]
        Faulty Sectors:            0
        Faulty Sector Numbers:      []
        Recovering Sectors:        0
        Recovering Sector Numbers:  []
Partition Index:          1
        All Sectors:               2
        All Sector Numbers:         [116 117]
        Live Sectors:              2
        Live Sector Numbers:        [116 117]
        Active Sectors:            2
        Active Sector Numbers:      [116 117]
        Faulty Sectors:            0
        Faulty Sector Numbers:      []
        Recovering Sectors:        0
        Recovering Sector Numbers:  []
 
 Move partitions:       
 lotus-miner actor move-partitions --orig-deadline 9 --dest-deadline 0 --partition-indices 0,1 --really-do-it
 
 Then terminate sector:
 lotus-miner sectors terminate 116 --really-do-it
 
See that its terminated:
lotus-miner proving deadline --sector-nums 0
Deadline Index:           0
Partitions:               4
Proven Partitions:        0
Current:                  false
----
----
Partition Index:          3
        All Sectors:               2
        All Sector Numbers:         [116 117]
        Live Sectors:              1
        Live Sector Numbers:        [117]
        Active Sectors:            1
        Active Sector Numbers:      [117]
        Faulty Sectors:            0
        Faulty Sector Numbers:      []
        Recovering Sectors:        0
        Recovering Sector Numbers:  []   
  • Terminate a sector after the partition has been proven once after moving
  • Fault and let sectors expire as faulty in that partition.

@jennijuju
Copy link
Member

jennijuju commented Sep 28, 2023

@rjan90 thank you for the test plan - can we also add

  • try to merge partitions to a single deadline till a deadline hits max_partitions_per_deadline and it should fail?
  • try to submit a bad proof and move the partition and the disputer can catch it.

@mb1896 mb1896 merged commit e81e5a7 into feat/nv21 Oct 2, 2023
87 checks passed
@mb1896 mb1896 deleted the move-partition branch October 2, 2023 16:27
@rjan90 rjan90 mentioned this pull request Oct 2, 2023
@BaiYuTest
Copy link

The following test case scenario passed using venus:

  • Check that moving a single partition from a deadline to another which proving period is in 24 hours after the partitions last proving deadline works, and WindowPoSt works.
  • Check that moving a single partition from a deadline to another which proving period is beyond 24 hours after the partitions last proving deadline fails.
  • Check that moving multiple partitions from a deadline to another which proving period is in 24 hours after the partitions last proving deadline works, and WindowPoSt works.
  • Check that moving faulty paritions are not allowed.
  • Check that moving unproven paritions are not allowed.
  • Check that faulty sectors in a partition in the new deadline works after it has been proven after the move.
  • Check that moving a single partition from A deadline to B deadline, then compact the blank partition in A deadline works.
  • Check that moving a single partition from A deadline to B deadline, then moving that partition from B deadline to C deadline, and WindowPoSt works.
  • Check that moving an unexisted partition fails.

We also want to test:

  • Terminate
  • Expired sectors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants