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

Expiration Extension for fip45 #653

Merged
merged 24 commits into from
Sep 21, 2022
Merged

Conversation

ZenGround0
Copy link
Contributor

@ZenGround0 ZenGround0 commented Sep 14, 2022

  • miner logic worked out
  • verifreg claim reading call implemented and called from miner (Verifreg GetClaims method #655)
  • fix old tests broken by change
  • simple unit tests of new expiration
  • actually refactor

@ZenGround0 ZenGround0 changed the base branch from master to decouple-fil+ September 14, 2022 21:00
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.

Looks on track

@ZenGround0 ZenGround0 force-pushed the feat/expiration-fip45 branch from 0f18255 to 89586ce Compare September 16, 2022 19:27
@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2022

Codecov Report

❗ No coverage uploaded for pull request base (decouple-fil+@16b923a). Click here to learn what that means.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##             decouple-fil+     #653   +/-   ##
================================================
  Coverage                 ?   84.74%           
================================================
  Files                    ?       95           
  Lines                    ?    19299           
  Branches                 ?        0           
================================================
  Hits                     ?    16354           
  Misses                   ?     2945           
  Partials                 ?        0           

@ZenGround0 ZenGround0 marked this pull request as ready for review September 19, 2022 23:52
@ZenGround0 ZenGround0 requested a review from anorth September 19, 2022 23:58
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 for this. It basically looks good, but there are enough comments that I'd like to see it again after responses

// ExtendSectorExpiration param
struct ExtendExpirationsInner {
extensions: Vec<ValidatedExpirationExtension>,
claims: Option<BTreeMap<SectorNumber, u64>>,
Copy link
Member

Choose a reason for hiding this comment

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

Aside: You could just use two arguments rather than this struct, since it's not even serializable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood, the idea was to perpetuate the pattern @Kubuxu has been using.

@jennijuju
Copy link
Member

can we have a better PR title please? and this might close #596 , right?

@ZenGround0 ZenGround0 changed the title Feat/expiration fip45 Expiration Extension for fip45 Sep 20, 2022
@jennijuju jennijuju linked an issue Sep 20, 2022 that may be closed by this pull request
@ZenGround0 ZenGround0 requested a review from anorth September 21, 2022 00:27
new_sector.verified_deal_weight =
verified_deal_space * (new_sector.expiration - new_sector.activation);
} else {
new_sector.expiration = new_expiration
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We weren't extending non QAP sectors before, refactoring helped me catch this bug 🙏

Copy link
Member

Choose a reason for hiding this comment

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

Consider pulling this line (and 3761) out after the if block

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 thought about this but then we don't have the nice property that duration is specified in terms of fields on the sector info (new_sector.expiration - new_sector.activation) which you asked for in the past and I agree makes this tricky detail very explicit.


for sc in &decl.sectors_with_claims {
let claims = get_claims(rt, &sc.maintain_claims)
.context(format!("failed to get claims for sector {}", sc.sector_number))?;
Copy link
Member

Choose a reason for hiding this comment

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

Use with_context whenever format!ing a message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this to address @Kubuxu's concern about the expense of format being occurred eagerly in the case where there is no error?

Copy link
Member

Choose a reason for hiding this comment

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

Yes

new_sector.verified_deal_weight =
verified_deal_space * (new_sector.expiration - new_sector.activation);
} else {
new_sector.expiration = new_expiration
Copy link
Member

Choose a reason for hiding this comment

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

Consider pulling this line (and 3761) out after the if block

@@ -145,6 +148,53 @@ pub struct ExpirationExtension {
pub sectors: UnvalidatedBitField,
pub new_expiration: ChainEpoch,
}
#[allow(clippy::too_many_arguments)] // validate mut prevents implementing From
impl Into<ValidatedExpirationExtension> for ExpirationExtension2 {
Copy link
Member

Choose a reason for hiding this comment

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

Not a deal breaker

@ZenGround0 ZenGround0 merged commit 239c197 into decouple-fil+ Sep 21, 2022
@ZenGround0 ZenGround0 deleted the feat/expiration-fip45 branch September 21, 2022 19:12
shamb0 pushed a commit to shamb0/builtin-actors that referenced this pull request Jan 31, 2023
* Expiration Extension 2 handling simple qap extensions
* No legacy extension for new sectors
* mutate_state in test_vm to create legacy sector to maintain deal weight fraction test
* extend_expiration2 miner harness for unit tests
* Refactored expiration extension methods to use shared code

Co-authored-by: zenground0 <[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.

Implement new sector extension method that enforces claim terms
4 participants