-
Notifications
You must be signed in to change notification settings - Fork 8
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(rln): review and refine utility functions in rln #287
Conversation
Benchmark for 3f2009cClick to view benchmark
|
Benchmark for 1bd7e8dClick to view benchmark
|
Benchmark for 3f2009cClick to view benchmark
|
Benchmark for 3f2009cClick to view benchmark
|
Benchmark for 1bd7e8dClick to view benchmark
|
Benchmark for 1bd7e8dClick to view benchmark
|
…or handling big-endian
Benchmark for 1cd0004Click to view benchmark
|
Benchmark for 1cd0004Click to view benchmark
|
Benchmark for 1cd0004Click to view benchmark
|
Benchmark for 1820eadClick to view benchmark
|
Benchmark for 1820eadClick to view benchmark
|
Benchmark for 1820eadClick to view benchmark
|
Benchmark for c388464Click to view benchmark
|
Benchmark for c388464Click to view benchmark
|
Benchmark for c388464Click to view benchmark
|
…r and optimize functions in utils.rs
Benchmark for 1b8f7e6Click to view benchmark
|
Benchmark for 1b8f7e6Click to view benchmark
|
Benchmark for 1b8f7e6Click to view benchmark
|
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.
LGTM, just add a comments near Vec::with_capacity(...)
on how the length was calculated if there are any numbers in there
|
||
// We store each element | ||
input.iter().for_each(|el| bytes.extend(fr_to_bytes_le(el))); | ||
let mut bytes = Vec::with_capacity(8 + input.len() * fr_byte_size()); |
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.
could you please add comment why such size. Just for code readability in the future
|
||
Ok(bytes) | ||
} | ||
let mut bytes = Vec::with_capacity(8 + input.len()); |
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.
Same as above
pub fn serialize_witness(rln_witness: &RLNWitnessInput) -> Result<Vec<u8>> { | ||
message_id_range_check(&rln_witness.message_id, &rln_witness.user_message_limit)?; | ||
|
||
let mut serialized: Vec<u8> = Vec::new(); | ||
let mut serialized: Vec<u8> = Vec::with_capacity( | ||
fr_byte_size() * (5 + rln_witness.path_elements.len()) |
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.
Also good idea to describe how we calculate length
Benchmark for a6114eeClick to view benchmark
|
Benchmark for a6114eeClick to view benchmark
|
Benchmark for a6114eeClick to view benchmark
|
Review and refine utility functions to resolve #279: