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

fix: miner: move partitions with expired/terminated sectors #1455

Merged
merged 2 commits into from
Oct 24, 2023

Conversation

arajasek
Copy link
Contributor

@arajasek arajasek commented Oct 19, 2023

I think the comment sector_count is both total sector count and total live sector count, since no sector is faulty here. was wrong. You can have "dead" sectors (terminated or expired) ones. @TippyFlitsUK hit this case when testing moving partitions.

The question is what's the right thing to do. I think it's fine to just move partitions with terminated / expired sectors, and the text of the FIP doesn't disallow this. If so, I think this PR fixes this, and we can land it with a test.

Otherwise, we need to explicitly disallow moving partitions with expired sectors, which the code doesn't currently do.

@arajasek
Copy link
Contributor Author

I think we want to know for sure that in a Partition, we always have "live sectors" + uproven.count() + faults.count() + terminated.count() = sectors.count().

@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2023

Codecov Report

Merging #1455 (27d8d70) into master (c4cdd4a) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1455      +/-   ##
==========================================
- Coverage   91.13%   91.08%   -0.05%     
==========================================
  Files         146      146              
  Lines       27951    27951              
==========================================
- Hits        25473    25460      -13     
- Misses       2478     2491      +13     
Files Coverage Δ
actors/miner/src/deadline_state.rs 84.79% <100.00%> (ø)

... and 5 files with indirect coverage changes

@zhiqiangxu
Copy link
Contributor

zhiqiangxu commented Oct 19, 2023

I think we want to know for sure that in a Partition, we always have "live sectors" + uproven.count() + faults.count() + terminated.count() = sectors.count().

It seems not, since there's a comment for live_sectors: non-terminated sectors in this deadline (incl faulty)

So it seems to me that "live sectors" + terminated.count() = sectors.count().

The implicit relation seems to be that "live sectors" == unproven + proven + faults, and recoveries is a subset of faults.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

An additional assertion in some of the tests would also be nice.


// start updating orig/dest `Deadline` here

orig_deadline.total_sectors -= sector_count;
orig_deadline.live_sectors -= sector_count;
orig_deadline.live_sectors -= live_sector_count;

dest_deadline.total_sectors += sector_count;
dest_deadline.live_sectors += sector_count;
Copy link
Member

Choose a reason for hiding this comment

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

This would need to be `+= live_sector_count

@zhiqiangxu
Copy link
Contributor

I added a testcase for this bug here: #1448

It's currently failing with the error: panicked at 'attempt to subtract with overflow'.

After merging this fix, it should pass.

* add dispute_remaining_partition_after_move

* add move_partition_with_terminated_sector
@Stebalien Stebalien added this pull request to the merge queue Oct 24, 2023
Merged via the queue into master with commit 09d50ad Oct 24, 2023
15 checks passed
@Stebalien Stebalien deleted the asr/fix-move-partitions branch October 24, 2023 17:40
Stebalien pushed a commit that referenced this pull request Oct 24, 2023
Stebalien added a commit that referenced this pull request Oct 24, 2023
…1458)

(removed the tests due to conflicts)

Co-authored-by: Aayush Rajasekaran <[email protected]>
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.

5 participants