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

Implement verified claim term extension by client #669

Merged
merged 1 commit into from
Sep 19, 2022

Conversation

anorth
Copy link
Member

@anorth anorth commented Sep 18, 2022

This was fairly straightforward.

One possibly controversial decision was to allow extension of claims that have already expired. I couldn't find a good reason to deny it. I think this will harmonise with my intentions to (in the future) allow re-committing a verified piece if the original sector fails within a claim's lifetime. The "failure" in the case I've implemented is the client forgetting to extend their claim term in time, so the sector was forced to drop it and the provider will need to re-seal.

Closes #550.

@anorth anorth requested a review from ZenGround0 September 18, 2022 23:15
@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 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.

Impacted file tree graph

@@               Coverage Diff                @@
##             decouple-fil+     #669   +/-   ##
================================================
  Coverage                 ?   84.69%           
================================================
  Files                    ?       95           
  Lines                    ?    19057           
  Branches                 ?        0           
================================================
  Hits                     ?    16141           
  Misses                   ?     2916           
  Partials                 ?        0           

Copy link
Contributor

@ZenGround0 ZenGround0 left a comment

Choose a reason for hiding this comment

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

I really want to get aligned on how we do gas optimization with mapmap and one testing concern.

let mut batch_gen = BatchReturnGen::new(params.terms.len());
rt.transaction(|st: &mut State, rt| {
let mut st_claims = st.load_claims(rt.store())?;
// Group consecutive term extensions with the same provider so we can batch update
Copy link
Contributor

Choose a reason for hiding this comment

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

Were you making this decision keeping in mind mapmap caching? I agree this saves checking the mapmap's cache which is something but this points to redundancy. If the mapmap's cache handling was slow enough that you didn't want to rely on it then 1) we should remove that complexity from the data type and accept caller level complexity like this, or 2) we should improve mapmap caching to be useful.

Copy link
Member Author

Choose a reason for hiding this comment

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

I did not have mapmap caching specifically in mind. My motivation was somewhat abstract toward the idea that batch updating a H/AMT should be more efficient due to only calculating intermediate nodes once, even if many values are on the same path. I am aware that the underlying HAMT doesn't actually implement this yet, but felt compelled to do this in the "right" way anyway, so it would immediately benefit if that lower-level improvement is made.

It would be possible to improve either MapMap, or just the Map or HAMT, to cache all updates in memory and only serialize once at the end. That would be more extensive and tricky caching than the present approach, but remove all such considerations and complexity from caller-level code like this. I'm hesitant to push on it due to difficulty of getting it right at that layer.

Copy link
Contributor

Choose a reason for hiding this comment

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

cache all updates in memory and only serialize once at the end

Doesn't internal HAMT node caching solve this problem already? I think it does and I don't think you need the caller complexity added here to achieve that. You already get this with HAMT + MapMap caching.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. If the HAMT does do that, it's not very obvious or at all documented. I tried to quickly benchmark this to see, but discovered much pain trying to replace the mock runtime's blockstore with a TrackingBlockstore (which comes from a different repo (😠 see #678)). I'll revert it on the principle of simplicity first.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not surprised if the rust library has no mention of this but this used to be a consensus thing before fvm so this was documented here: https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0007.md

actors/verifreg/tests/harness/mod.rs Show resolved Hide resolved
@anorth anorth merged commit f8847e0 into decouple-fil+ Sep 19, 2022
@anorth anorth deleted the anorth/extendclaim branch September 19, 2022 03:44
shamb0 pushed a commit to shamb0/builtin-actors that referenced this pull request Jan 31, 2023
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.

3 participants