-
Notifications
You must be signed in to change notification settings - Fork 72
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
Remove carv1/carv2 specific semantics from commP calculations #1651
Conversation
The commp should be directly over the bytes of the deal, it shouldn't care about car format.
We should also fix Lotus to calculate
which refers to:
|
I don't see anything in the commp utility / ffi calculations of commp that do more than a direct hash summing over the bytes of the piece/deal/file. Are you pointing to somewhere else where a carv2 would get unwrapped to only commp over the wrapped carv1? |
I just reviewed CI, and if you search for |
I believe the remaining rough edge here is in |
* SkipNext's metadata calculation wasn't working properly in the case of a CARv2 as it didn't take into account the V1 header in the original offset calculation. * Add a SourceOffset and some docs to be absolutely clear what offsets we're returning in the metadata. Ref: filecoin-project/boost#1651
* fix: use fixed car BlockReader#SkipNext SourceOffset Ref: ipld/go-car#491 * chore: regenerate cbor-gen types w/ cbor-gen update
* SkipNext's metadata calculation wasn't working properly in the case of a CARv2 as it didn't take into account the V1 header in the original offset calculation. * Add a SourceOffset and some docs to be absolutely clear what offsets we're returning in the metadata. Ref: filecoin-project/boost#1651
flagged by @rvagg that we should make sure there's a test over a carv2 deal to exercise that branch of graphsync |
* fix: offsets to CAR section starts these are required for carv2 indexes when we pass them back to a Blockstore * fix: use ReadNode and compare CID we find
Yep, it was broken. Tested and fixed here: #1662 |
@willscott @rvagg nice work! Thanks for diving deep into the code to figure this one out 🙌 Once we merge this PR, our restore functionality will also need to change, because at the moment it assumes CAR files. So we're going to hold off on merging until we've figured out how to modify the restore function. |
if err != nil { | ||
return &dealMakingError{ | ||
retry: types.DealRetryFatal, | ||
error: fmt.Errorf("failed to open CARv2 file: %w", err), | ||
error: fmt.Errorf("failed to stat CARv1 file: %w", err), |
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.
error: fmt.Errorf("failed to stat CARv1 file: %w", err), | |
error: fmt.Errorf("failed to stat file: %w", err), |
"sort" | ||
) | ||
|
||
func NewMultiReaderAt(parts ...ReaderAtSize) io.ReaderAt { |
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.
Let's add a unit test for this functionalty.
Let's also add an itest with a file that is not a car file to make sure that flow works as expected |
We need to account for this change in our LID recovery tool. We should hold off on merging this PR till we complete the following tasks.
|
is the podsi itest sufficient for the itest ask? e.g. we'll merge this first into #1495 |
also needs to be updated to go-car/v2@v2.13.1 which will break the calculations here due to the "fix" |
@willscott I think we can marge this in data-segment indexing once unti test to NewMultiReaderAt() is done. I am moving the other 2 tasks to respective PRs. |
@LexLuthr yes, please consider it a blocker. I fixed a bug and released 2.12 for this branch but then we realised later we changed the behaviour in a braking way so fixed that in 2.13.1, now the values returned from |
@LexLuthr go-car/v2 update done |
and a test for NewMultiReaderAt while I'm at it |
I think we are good to merge now. We just need to ensure that we are merging |
@willscott Are we good to close this? I already see a commit with merge from this branch on #1495 |
yes. i think we can consider this 'merged' - there are failing tests in #1495 that i was going to take a look at addressing / identifying as fall-out from this merge or unrelated |
The commp should be directly over the bytes of the deal, it shouldn't care about car format.