-
Notifications
You must be signed in to change notification settings - Fork 25
Encode fragment size with u32 #622
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
Conversation
danielSanchezQ
left a comment
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.
Great, thanks!
|
I'm not actually too happy with |
| let mut inner = Vec::new(); | ||
| let mut rng = ChaChaRng::seed_from_u64(u64::arbitrary(g)); | ||
| let crs_seed = String::arbitrary(g).into_bytes(); | ||
| let committee_size = 1; // very time consuming |
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.
Maybe try 1..=2 just to exercise the multi-member case?
IIRC there was an idea to be able to iterate through raw fragments in a block without copying their bodies out of a raw block, and the read implementation for |
| inner.push(DecryptedPrivateTallyProposal { | ||
| tally_result: (0..n_options.get()) | ||
| .map(|_| u64::arbitrary(g)) | ||
| .collect::<Box<[_]>>(), |
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.
Wow, didn't know that .collect<Box<[_]>> is a thing, cool.
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.
Everything that implements FromIterator is fair game for the collect combinator, so yeah.
This was related to a temporary implementation that I coded before changing it in 03e27ba. I'm reasonably happy with the current one |
eea8acf to
1033ef4
Compare
|
I've moved the |
Some large fragments (private
VoteTallywith lots of proposals/shares) can overflow the current fragment size (u16) when serializing. This PR encodes the size of aFragmentas au32to overcome such limitations.In addition, add some tests that could help detect such issues in the future:
Arbitraryfor privateVoteTally, so that we can test its ser/de implementations and stress the behavior of other parts with very large payloads.Fragment