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

fix: store identity CIDs in CARs for online deals #749

Merged
merged 2 commits into from
Oct 14, 2022

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Sep 2, 2022

Builds on #747 and relies on ipld/go-car#332

This matches historical precedent, without doing this we get CommP failures where
deals are made with intermediate inline CIDs and the client stores them in
the CAR used to make CommP. car.SelectiveCar is the historical way of doing
this.

e.g. https://github.com/filecoin-project/lotus/blob/a843c52e38da13da489cbe6b290ea49b2660b3fb/node/impl/client/client.go#L1405-L1412

More discussion in ipld/go-car#332, and I'll also open a Lotus PR to bring this in and test it there and will link back here from that.

@rvagg
Copy link
Member Author

rvagg commented Sep 9, 2022

updated this to use the newly released go-car/v2@2.5.0 which has the necessary changes to handle identity CIDs like we want for this

Copy link
Contributor

@dirkmc dirkmc left a comment

Choose a reason for hiding this comment

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

Just one question, but otherwise LGTM 👍

There is quite a lot of code for handling pieces in provider.go
I wonder if we should move some of it into a separate file?

// for each link, query the dagstore for pieces that contain it
for i, link := range links {
piecesWithThisCid, err := p.dagStore.GetPiecesContainingBlock(link)
if len(piecesWithThisCid) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible for GetPiecesContainingBlock to return a zero-length piecesWithThisCid, and for err to also be nil?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, I think it's probably unsafe to not explicitly deal with err even though I believe zero-length should also ways be coupled with an error (comes out of GetShardsForMultihash in the inverted index which requires an entry for that CID and an ErrNotFound otherwise). Addressed in #750

@rvagg
Copy link
Member Author

rvagg commented Sep 13, 2022

This becomes considerably simpler with #747 merged, the big changes were in there. Rebased now so there's only two commits left.

@rvagg
Copy link
Member Author

rvagg commented Sep 13, 2022

There is quite a lot of code for handling pieces in provider.go
I wonder if we should move some of it into a separate file?

Done in #750 since those changes related to the now-merged #747

@rvagg rvagg force-pushed the rvagg/store-identity-cids branch 2 times, most recently from 49ff77d to f559821 Compare October 14, 2022 03:26
matches historical precedent, without doing this we get CommP failures where
deals are made with intermediate inline CIDs and the client stores them in
the CAR used to make CommP. car.SelectiveCar is the historical way of doing
this.

e.g. https://github.com/filecoin-project/lotus/blob/a843c52e38da13da489cbe6b290ea49b2660b3fb/node/impl/client/client.go#L1405-L1412

Ref: ipld/go-car#332
@dirkmc dirkmc merged commit db1f092 into master Oct 14, 2022
@dirkmc dirkmc deleted the rvagg/store-identity-cids branch October 14, 2022 12:29
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.

2 participants