Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Delay power until first window PoSt #883

Merged
merged 3 commits into from
Aug 20, 2020
Merged

Delay power until first window PoSt #883

merged 3 commits into from
Aug 20, 2020

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Aug 4, 2020

This will need a lot of tests, and the existing tests are now all broken.

Design

Every partition gets a new Unproven bitfield for sectors that have yet to be proven and an UnprovenPower field store power to be proven and activated when the partition is next proven.

Crucially, new faulty power from unproven sectors is never removed from the miner, because it was never activated. Furthermore, unproven power is added to the miner when it's proved the first time. To achieve this, many methods have gained poweDelta return values.

Faults

When marked faulty, unproven sectors are removed from the unproven bitfield and added to the faulty bitfield. They now join the normal fault flow.

Termination

Unproven sectors may be terminated (early) like any other sector.

WindowPoSt

On WindowPoSt, skipped unproven sectors are added to the faulty sectors bitfield/power normally. Then, UnprovenPower and the Unproven bitfield are zeroed.

End of deadline

At the end of the deadline, unproven sectors in unposted partitions are marked faulty along with their power.

Handling sector expiration before handling unproven sectors is explicitly forbidden.

@Stebalien Stebalien marked this pull request as draft August 4, 2020 03:34
Base automatically changed from steb/quantize-deadline to master August 5, 2020 17:44
@Stebalien Stebalien force-pushed the steb/delay-power branch 2 times, most recently from fe1b1c9 to 257188e Compare August 5, 2020 17:46
Copy link
Member

@anorth anorth left a comment

Choose a reason for hiding this comment

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

Epic, looking good. FYI @nicola

actors/builtin/miner/deadline_state.go Outdated Show resolved Hide resolved
@Stebalien Stebalien force-pushed the steb/delay-power branch 3 times, most recently from cb7c30b to 5f0049c Compare August 13, 2020 04:29
@Stebalien Stebalien changed the title [WIP] Delay power until first window PoSt Delay power until first window PoSt Aug 13, 2020
@Stebalien Stebalien marked this pull request as ready for review August 13, 2020 04:30
@Stebalien
Copy link
Member Author

This still needs more tests, but it's now passing the existing tests and is ready to review.

@Stebalien Stebalien force-pushed the steb/delay-power branch 2 times, most recently from 45a9550 to 10a1e29 Compare August 13, 2020 04:37
@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2020

Codecov Report

Merging #883 into master will decrease coverage by 0.0%.
The diff coverage is 62.0%.

@@           Coverage Diff            @@
##           master    #883     +/-   ##
========================================
- Coverage    74.0%   74.0%   -0.1%     
========================================
  Files          57      57             
  Lines        6483    6550     +67     
========================================
+ Hits         4803    4847     +44     
- Misses       1083    1092      +9     
- Partials      597     611     +14     

@anorth anorth requested a review from nicola August 17, 2020 03:59
actors/builtin/miner/deadline_state.go Outdated Show resolved Hide resolved
actors/builtin/miner/deadline_state_test.go Outdated Show resolved Hide resolved
actors/builtin/miner/miner_state_test.go Outdated Show resolved Hide resolved
actors/builtin/miner/miner_test.go Outdated Show resolved Hide resolved
actors/builtin/miner/partition_state_test.go Outdated Show resolved Hide resolved
@Stebalien Stebalien force-pushed the steb/delay-power branch 5 times, most recently from a35cfdb to f8f822c Compare August 18, 2020 05:14
@Stebalien
Copy link
Member Author

Ok, I've found a bug. I'm not correctly handling power when handling missing posts at the end of the proving deadline. I'll upload a fix with tests tomorrow.

@Stebalien Stebalien force-pushed the steb/delay-power branch 2 times, most recently from b4d387e to 5075507 Compare August 18, 2020 19:36
@Stebalien Stebalien force-pushed the steb/delay-power branch 2 times, most recently from b042b80 to 1c8dec8 Compare August 18, 2020 20:04
@@ -328,10 +331,23 @@ func (rt *Runtime) Send(toAddr addr.Address, methodNum abi.MethodNum, params run
exp := rt.expectSends[0]

if !exp.Equal(toAddr, methodNum, params, value) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Unrelated change to the testing framework to make reading errors easier.

@Stebalien
Copy link
Member Author

@anorth the second commit fixes the bug (and adds/fixes more tests). I'm now explicitly returning:

  • PowerDelta (not all newely faulty power is part of this delta, as some of it may not have been "active").
  • PenaltyPower (retracted power + newly faulty power)
  • NewFaultyPower

Copy link
Member

@anorth anorth left a comment

Choose a reason for hiding this comment

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

Thanks.

It's slightly unfortunate that the "policy" logic of which power to penalize is now in the state, but not a huge problem. We could probably resolve this and make things a bit more concise with a "power deltas" struct for use as return value from the methods that return more than one power thingy.

@Stebalien
Copy link
Member Author

Stebalien commented Aug 19, 2020

Hm. Yeah, adding a power delta object would clean things up a bit (#1011).

@Stebalien Stebalien merged commit e5708f4 into master Aug 20, 2020
@Stebalien Stebalien deleted the steb/delay-power branch August 20, 2020 00:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants