Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
hi! I am trying to read witness files in another project of mine (circomkit-ffi) and I came across your witness reader function. I have made the following changes:
impl Fn(&[u8]) -> T
parse_witness_to_bigints
by simply calling the generic function with chunk-mapper asBigInt::from_le_bytes
match
instead ofif-else
; maybe opinionated but I think it looks more clear here and especially fixes the hidden case of "section 1pos
mutations happen within theelse
branch ofsection_id == 2
check" casewith this generic function we are able to read raw witness files into other backends like:
parse_witness_to_elems(&wtns_data, F::from_le_bytes_mod_order)
parse_witness_to_elems(&wtns_data, |bytes| FrElement::from_bytes_le(bytes).unwrap())