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: snapshot fetch without aria2 #2814

Merged
merged 3 commits into from
May 2, 2023
Merged

Conversation

hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented May 2, 2023

Summary of changes

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes #2786

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@hanabi1224 hanabi1224 marked this pull request as ready for review May 2, 2023 05:25
echo "Cleaning up snapshots"
$FOREST_CLI_PATH --chain calibnet snapshot clean -s "$SNAPSHOT_DIRECTORY" --force
echo "Cleaning up snapshots again"
$FOREST_CLI_PATH --chain calibnet snapshot clean -s "$SNAPSHOT_DIRECTORY" --force
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to repeat snapshot clean again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To cover #2811

Copy link
Member

Choose a reason for hiding this comment

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

It's a good question. It might be worth adding this issue in the code to make it clear from the start.

@@ -375,13 +378,20 @@ where
let mut downloaded: u64 = 0;
let mut stream = snapshot_response.into_body();

let mut snapshot_hasher = Sha256::new();
let mut snapshot_hasher = if use_compressed {
None
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason behind not checking against checksum in case of compressed snapshot and without aria2? Don't we have a digest in both case? (with and without aria2)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checksum is not provided for a compressed snapshot. Also zstd has checksum mechanism internally

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm if I look into the digest file I have:

cat 468720_2023_04_13T12_13_00Z.sha256sum
ae6d21b3bd88fa0d21528343b05e6f323a7131fad5d3e1148a5ed7c603d915a5 *468720_2023_04_13T12_13_00Z.car
180819491d0dfd37cc09ebc5ceded668c09fa6ec3f1fefe54ad20ca0fa71805a *468720_2023_04_13T12_13_00Z.car.zst

But if zstd does it internally, then we can skip it. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did not realize checksum is there. I can investigate adding back checksum check then. Thx for the info

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just checked the zstd spec again, its checksum mechanism is optional, we should indeed verify checksum if it's available

@lemmih lemmih enabled auto-merge (squash) May 2, 2023 15:40
@lemmih lemmih merged commit a8c9c9f into main May 2, 2023
@lemmih lemmih deleted the hm/fix-snapshot-fetch-without-aria2 branch May 2, 2023 16:00
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.

compressed snapshot fetch without aria2 and filecoin provider fails
5 participants