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

PreCommitPolicy: Fix edge-case when deal duration is close to the MaxSectorExpirationExtension #6729

Closed
wants to merge 1 commit into from

Conversation

arajasek
Copy link
Contributor

@arajasek arajasek commented Jul 11, 2021

Fixes #6065

TODO: Add tests to precommit_policy_test

@arajasek arajasek force-pushed the asr/deal-edge-case branch 2 times, most recently from 36f4994 to 56283c4 Compare July 11, 2021 22:10
extern/storage-sealing/precommit_policy.go Outdated Show resolved Hide resolved
exp = *hardLimit
}

exp += miner.WPoStProvingPeriod - (exp % miner.WPoStProvingPeriod) + p.provingBoundary - 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this is even needed anymore in v5 actors. At least could add a comment on what this is doing

Suggested change
exp += miner.WPoStProvingPeriod - (exp % miner.WPoStProvingPeriod) + p.provingBoundary - 1
// align on proving period boundary
exp += miner.WPoStProvingPeriod - (exp % miner.WPoStProvingPeriod) + p.provingBoundary - 1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it's not needed I'd love to take it out, I just don't know. Adding comment for now, with a TODO saying it could be taken out.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it has been needed for a while. But @ZenGround0 would know fo rsure.


if exp < minEnd {
// we need to add* ceil(end - maxEnd) days
daysToAdd := (minEnd-exp)/miner.WPoStProvingPeriod + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this doing floor()+1? Ceil would be ((minEnd-exp) + miner.WPoStProvingPeriod - 1)/miner.WPoStProvingPeriod

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, in this case with 2779/2880 probability, ceil = floor + 1 :P

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(and in the 1/2880 case, we're off by 1 day, so no biggie)

@jennijuju jennijuju added the need/author-input Hint: Needs Author Input label Jul 27, 2021
@jennijuju jennijuju added this to the v1.11.2 milestone Jul 27, 2021
@arajasek arajasek force-pushed the asr/deal-edge-case branch from 56283c4 to ef67e38 Compare July 28, 2021 20:59
@arajasek arajasek requested a review from a team as a code owner July 28, 2021 20:59
@Stebalien
Copy link
Member

@arajasek this needs a rebase. I've tried, but it looks like the code currently in master is slightly different and takes some form of "proving buffer" into account.

@Stebalien Stebalien marked this pull request as draft July 30, 2021 04:40
@github-actions
Copy link

github-actions bot commented Aug 4, 2021

Thank you for submitting the PR and contributing to lotus! Lotus maintainers need more of your input before merging it, please address the suggested changes or reply to the comments or this PR will be closed in 48 hours. You are always more than welcome to reopen the PR later as well!

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.

[BUG] Sector duration calculation causes Precommit rejection
4 participants