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

mater: CARv2 archive not padded to the power of 2? #418

Closed
Tracked by #347
th7nder opened this issue Sep 30, 2024 · 1 comment
Closed
Tracked by #347

mater: CARv2 archive not padded to the power of 2? #418

th7nder opened this issue Sep 30, 2024 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@th7nder
Copy link
Contributor

th7nder commented Sep 30, 2024

➜  polka-storage git:(feat/410/generate-porep) ✗ cat test-data.txt
12345678
➜  polka-storage git:(feat/410/generate-porep) ✗ ./target/debug/mater-cli convert test-data.txt
Converted test-data.txt and saved the CARv2 file at test-data.car with a CID of bafkreibggtbqs74y4nugl4gfoiajyt75omywxsfyrth6rumwv427i3rdsq
➜  polka-storage git:(feat/410/generate-porep) ✗ ./target/debug/polka-storage-provider utils commp test-data.car
Piece commitment CID: baga6ea4seaqbnqij5xlom6q37ebwxnc3com4dr3e36wc6ch2ld7pbhfog3lvwky
➜  polka-storage git:(feat/410/generate-porep) ✗ ./target/debug/polka-storage-provider utils po-rep test-data.car baga6ea4seaqbnqij5xlom6q37ebwxnc3com4dr3e36wc6ch2ld7pbhfog3lvwky
thread 'main' panicked at /home/th7nder/workspace/eiger/polka-storage/lib/polka-storage-proofs/src/porep/mod.rs:49:81:
called `Result::unwrap()` on an `Err` value: Bit-padded piece size must be a power of 2 (PaddedBytesAmount(228))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
➜  polka-storage git:(feat/410/generate-porep) ✗ xxd test-data.txt
00000000: 3132 3334 3536 3738 0a                   12345678.
➜  polka-storage git:(feat/410/generate-porep) ✗ ls -lh test-data.car 
-rw-r--r-- 1 th7nder th7nder 226 Sep 30 19:21 test-data.car
➜  polka-storage git:(feat/410/generate-porep) ✗ ls -lh test-data.txt
-rw-r--r-- 1 th7nder th7nder 9 Sep 30 19:14 test-data.txt

Mater creates a 226 bytes long CARv2 archive, out of 9 bytes file.
Moreover, rust reads it as 228 bytes.

It should be a power of two, because: https://github.com/filecoin-project/rust-fil-proofs/blob/5a0523ae1ddb73b415ce2fa819367c7989aaf73f/filecoin-proofs/src/api/mod.rs#L471

Reproducible on feat/410/generate-porep branch.

@th7nder th7nder added the bug Something isn't working label Sep 30, 2024
@th7nder th7nder added this to the Phase 2 milestone Sep 30, 2024
@jmg-duarte
Copy link
Contributor

We figured out the padding isn't mater's issue and it's added outside of the file by commp and friends

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants