-
Notifications
You must be signed in to change notification settings - Fork 220
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
Unusually long padding of vector output of to_le_bytes
.
#916
Comments
to_le_bytes
is unusually long.to_le_bytes
is unusually long.
to_le_bytes
is unusually long.to_le_bytes
.
@Ethan-000 is this still an issue? |
seems so |
@guipublic assigning this issue to you -- can you write a diagnosis and a solution before starting work? |
wait I retried with |
its use dep::std;
fn main(x : Field) -> pub [u8; 32] {
// The result of this byte array will be big-endian
let byte_array = x.to_be_bytes(10);
let mut bytes = [0; 32];
for i in 0..32 {
bytes[i] = byte_array[i];
}
bytes
} will return
|
the output is in the middle I'm not sure if we want to leave it like this or remove the zeros after the answer |
As a side-task in this issue, I think we should document |
@Ethan-000 re what we should do, can I leave that to you to create a rationale as to what you think is the most reasonable and non-suprising output? |
hmm i think This will be similar to the other apis but if a different kind of field element is used it may not be 32 bytes alternatively we can return the exact bytes the field element decompose to |
Following #2479 and #2350 padding has been removed and we simply return the specified byte size. I believe this issue can be closed @Ethan-000 correct? |
Description
Unusually long padding of vector output of
to_le_bytes
.Aim
Expected behavior
I'm not sure if this is intended or a bug. I think the expected length of the
output vector
should be31
or as specified, but its254
at the moment.Bug
To reproduce
see here
Environment
Using
nargo
:Using TypeScript:
Additional context
The text was updated successfully, but these errors were encountered: