feat!: Fixing the bytesize for be, le byte serialization, adding new functionality and tests#157
Conversation
| } | ||
|
|
||
| // TODO: add the benchmarks for serialization to the macro (currently dealing with trait visibility issues) | ||
| #[export] |
There was a problem hiding this comment.
I tried adding these to the macro, but I was getting complaints that the trait that implements the function is out of bounds.
|
@TomAFrench, there's a compiler panic that has been resolved in the nightly version. |
MirandaWood
left a comment
There was a problem hiding this comment.
Not familiar with Noir benchmarks but logic etc. LGTM, thanks for adding! 🚀
|
I'd like to avoid having two completely separate codepaths for serde logic just depending on the endianness. We should be able to avoid this and share logic between then (in the ultra-simple case just reverse the input/output array as appropriate). |
|
@TomAFrench I'll just revert the arrays then. wondering how this will affect the number of constraints though. Given that these are runtime arrays, this will introduce additional |
|
I would expect this to be free in ACIR and negligible overhead in brillig. We shouldn't be using RAM gates at all in this situation. |
|
Did a bit of experimenting. The circuit size goes from |
|
Looks like these new tests are really heavy @kashbrti. |

Description
Our current
to_le_bytesandfrom_be_bytesimplementations required the bytesize to be passed as a generic.This was offering a nonideal interface as when the bytesize was not large enough, it would cause a non-comprehensive
error.
After discussions with Zac, I decided to fix the size of the byte representations.
Also, to facilitate the blob work, I've added a
to_be_bytesfunctionality, which is needed forBLSpoint compression.This PR adds two new methods:
to_be_bytes()from_le_bytes()These two functions have also allowed us to write fuzz tests for the byte serialization functions.
On another note, I fixed a small bug I found, a line that was commented out for testing reasons during the switch to
u128limbs, which I just uncommented. This resolves last limb ofderive_from_seedis always 1 #156 as well.I have also included the changes in #155 in this PR to avoid merging issues.
Problem*
Resolves
Summary*
Additional Context
PR Checklist*
cargo fmton default settings.