-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 bugs in sectors extend --v1-sectors #6066
Merged
arajasek
merged 2 commits into
filecoin-project:master
from
chadwick2143:extend-v1-sectors
Jul 11, 2021
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -435,6 +435,12 @@ var sectorsExtendCmd = &cli.Command{ | |
Usage: "when extending v1 sectors, don't try to extend sectors by fewer than this number of epochs", | ||
Required: false, | ||
}, | ||
&cli.Int64Flag{ | ||
Name: "expiration-ignore", | ||
Value: 120, | ||
Usage: "when extending v1 sectors, skip sectors whose current expiration is less than <ignore> epochs from now", | ||
Required: false, | ||
}, | ||
&cli.Int64Flag{ | ||
Name: "expiration-cutoff", | ||
Usage: "when extending v1 sectors, skip sectors whose current expiration is more than <cutoff> epochs from now (infinity if unspecified)", | ||
|
@@ -493,6 +499,10 @@ var sectorsExtendCmd = &cli.Command{ | |
continue | ||
} | ||
|
||
if si.Expiration < (head.Height() + abi.ChainEpoch(cctx.Int64("expiration-ignore"))) { | ||
continue | ||
} | ||
|
||
if cctx.IsSet("expiration-cutoff") { | ||
if si.Expiration > (head.Height() + abi.ChainEpoch(cctx.Int64("expiration-cutoff"))) { | ||
continue | ||
|
@@ -507,6 +517,10 @@ var sectorsExtendCmd = &cli.Command{ | |
|
||
// Set the new expiration to 48 hours less than the theoretical maximum lifetime | ||
newExp := ml - (miner3.WPoStProvingPeriod * 2) + si.Activation | ||
if withinTolerance(si.Expiration, newExp) || si.Expiration >= newExp { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both of these should be redundant thanks to the check in line 514, but no reason to omit. |
||
continue | ||
} | ||
|
||
p, err := api.StateSectorPartition(ctx, maddr, si.SectorNumber, types.EmptyTSK) | ||
if err != nil { | ||
return xerrors.Errorf("getting sector location for sector %d: %w", si.SectorNumber, err) | ||
|
@@ -524,7 +538,7 @@ var sectorsExtendCmd = &cli.Command{ | |
} else { | ||
added := false | ||
for exp := range es { | ||
if withinTolerance(exp, newExp) { | ||
if withinTolerance(exp, newExp) && newExp > exp && exp > si.Expiration { | ||
arajasek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
es[exp] = append(es[exp], uint64(si.SectorNumber)) | ||
added = true | ||
break | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest a larger default than 2 hours, but users need to be specifying this.