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

Snapshot files are not valid zstd archives #3006

Closed
lemmih opened this issue Jun 19, 2023 · 2 comments · Fixed by #3015
Closed

Snapshot files are not valid zstd archives #3006

lemmih opened this issue Jun 19, 2023 · 2 comments · Fixed by #3015
Assignees
Labels
Bug Ready Issue is ready for work and anyone can freely assign it to themselves

Comments

@lemmih
Copy link
Contributor

lemmih commented Jun 19, 2023

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. Download a Forest snapshot: forest-cli --chain calibnet snapshot fetch
  2. Verify its integrity: zstd --test forest_snapshot_calibnet_2023-06-19_height_660943.car.zst (this fails)
  3. Forest thinks everything is okay: forest-cli --chain calibnet snapshot validate forest_snapshot_calibnet_2023-06-19_height_660943.car.zst

Log output

Log Output
$ zstd --test forest_snapshot_calibnet_2023-06-19_height_660943.car.zst 
eight_660943.car.zst : 2190 MB...     eight_660943.car.zst : Read error (39) : premature end

$ forest-cli --chain calibnet snapshot validate forest_snapshot_calibnet_2023-06-19_height_660943.car.zst 
✔ This will result in using approximately 1386 MB of data. Proceed? · yes
2023-06-19T06:56:25.927370Z  INFO forest_filecoin::genesis: Initialized genesis: BlockHeader: Cid(bafy2bzacecyaggy24wol5ruvs6qm73gjibs2l2iyhcqmvi7r7a4ph7zx3yqd4)    
2023-06-19T06:56:25.929039Z  INFO forest_filecoin::utils::net::download: Loading forest_snapshot_calibnet_2023-06-19_height_660943.car.zst, is_zstd_compressed: true    
280.72 MB/s 0s 2023-06-19T06:56:34.867571Z  INFO forest_filecoin::utils::db: Buffered write completed: total entries: 2577964, total size: 2.58GB, took: 8s    
Snapshot is valid

Expected behaviour

The zst snapshot files should not prematurely end.

Screenshots

Environment (please complete the following information):

  • OS: Linux
  • Rust version(e.g. rustc --version): default toolchain
  • Branch/commit: latest main

Other information and links

@lemmih lemmih added Bug Ready Issue is ready for work and anyone can freely assign it to themselves labels Jun 19, 2023
@ruseinov ruseinov self-assigned this Jun 19, 2023
@ruseinov
Copy link
Contributor

@lemmih As far as I understand this issue entails:

  1. Making sure that the downloaded snapshots are correct.
  2. Snapshot validation should fail given a corrupt snapshot.

@lemmih
Copy link
Contributor Author

lemmih commented Jun 19, 2023

@lemmih As far as I understand this issue entails:

1. Making sure that the downloaded snapshots are correct.

2. Snapshot validation should fail given a corrupt snapshot.

The snapshots are not corrupted during upload or download. We generate them incorrectly (ie. if you generate a fresh calibnet snapshot, zstd --test will tell you it is invalid). Older snapshots appear to be fine so this might be a bug that was introduced recently. Ideally, a bug fix would include updates to forest-cli snapshot validate to not accept broken files but it isn't strictly necessary.

  • Fix bug in snapshot generation code.
  • Add CI check for broken zst files. That is, add a zstd --test step after we generate a snapshot.
  • (Optional) Update forest-cli snapshot validate to detect incorrectly compressed files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Ready Issue is ready for work and anyone can freely assign it to themselves
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants