-
Notifications
You must be signed in to change notification settings - Fork 204
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
Compilation panic while trying to convert Field to fixed length byte array #1023
Comments
Thank you for the report. Looks like this is a result of the monomorphization pass in the compiler failing to deduce the size of the Originally, I was going to suggest getting around this problem by changing your program to include a type annotation:
Or return the le_bytes directly: fn field_to_fixed_byte_array(f : Field) -> [u8; 16] {
f.to_le_bytes(8)
} But this seems to produce an unintended program to me as you can now change the result type of the function to any array size and have it still prove. It'll likely be a while before this is fixed completely, unfortunately. These API of these methods on field may have to be changed. |
I got around this issue by iterating with a fixed count of the array, and pulling values into a new, sized array. I don't love it, but it works for now |
@jfecher what is the status of this issue? |
@kevaundray still open. Looks like the
|
The new error would be coming from
Most likely |
Aim
I wrote a small snippet of code to try to turn a field into a fixed length byte array, but the compiler panics
Expected behavior
Compilation
Bug
➜ aes-noir nargo compile main
The application panicked (crashed).
Message: called
Option::unwrap()
on aNone
valueLocation: crates/noirc_frontend/src/monomorphization/mod.rs:619
To reproduce
main.nr code:
Installation method
Binary
Nargo version
nargo 0.3.2 (git version hash: 4f3208d, is dirty: false)
@noir-lang/noir_wasm version
No response
@noir-lang/barretenberg version
No response
@noir-lang/aztec_backend version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: