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

Add piece expects piece to be truncated to padded size #1611

Open
pyropy opened this issue Jun 9, 2022 · 2 comments
Open

Add piece expects piece to be truncated to padded size #1611

pyropy opened this issue Jun 9, 2022 · 2 comments

Comments

@pyropy
Copy link

pyropy commented Jun 9, 2022

Description

I'm unsure if current rust implementation of add_piece is intended to be compatible with lotus or lotus ways of adding new piece but it seems to be vastly different from lotus implementation.

When calling add_piece, it seems like the data needs to be fr32 padded and truncated to padded size (zeroes appended to the right side of the piece.

When calling add_piece where payload size is 1166 B, unpadded piece size is 2032 B and padded piece size is 2048 B I get following error

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: add_piece: invalid bytes amount written'

.. with only 1174 B of unpadded data written to the output car file during `add_piece.

Acceptance criteria

  • Being able to add piece without needing to previously pad and or truncate file to padded size

Risks + pitfalls

  • Possibly breaking current implementations using this add_piece implementation

Where to begin

This is where the error happens

@vmx
Copy link
Contributor

vmx commented Jun 10, 2022

IIRC there was a discussion about the API back in the days. It was decided that Lotus hands a piece in the correct shape to the proofs system. I don't see a need that the APIs need to match, as Lotus operates on a higher level than the proofs system.

@pyropy
Copy link
Author

pyropy commented Jun 14, 2022

@vmx Thanks for reply, that makes sense. So lotus will assemble a sector and hand it off to the rust add_piece implementation?

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

No branches or pull requests

2 participants