-
Notifications
You must be signed in to change notification settings - Fork 200
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
Noir program attempts to read uninitialised memory #2133
Comments
Ah, I hoped this would be fixed by #2106. I can confirm this is still an issue after that has been merged. |
@jfecher can you check if this has been solved? |
@kevaundray a Nargo bug with nested crates is making it more difficult for me to test it. When trying to run the integration test, Nargo complains the parent directory is a lib instead of a bin target even though I'm trying to run the test in a subdirectory which is a bin target. After moving the subdirectory somewhere else, the bug is still present. |
cc'ing @phated as I am not sure if this is the desired functionality or a bug. If it is a bug we can make a separate issue. I also had to move the subdirectory outside of the main |
It's both. lol. Please open an issue so it can be prioritized. |
The panic is a bug, but there may also be an error in the program linked. We are not checking for index out of bounds on dynamic arrays. I'm working on a fix. I was able to reproduce this on our
This errors out with:
When working with the project linked in the issue, I was get a panic with an index one greater than the specified array being accessed. Due to this I think the project linked most likely has an index out of bounds bug, just that the compiler needs to have a clear error and not a panic. |
After some more investigation this looks like it may be a deeper error. I made a fix that checks for loop out of bounds and on the simple case in |
PR #2389 has included actual location data to ACIR memory operations. The missing location data is a bug in its own right, but has also exposed another issue with how we are handling call stacks. From the PR description: The new location data has also exposed the actual bug that occurs in #2133. It looks like we are not handling locations correctly during flattening. A smaller reproduced snippet of the storage proof example is provided in the if z == 20 {
x[0] = x[4];
} else {
x[idx] = 10;
for i in 0..5 {
x[idx] = x[i];
}
}
// TODO(#2133): This line should be where we show the error
// but instead it will show x[0] == x[4] as the line where there is an index out of bounds
assert(x[idx] != 0) This bug is also seen in the storage proof example, which will return the below output when calling However, based on the smaller snippet above, it looks to be using the incorrect location, as the array access being reported is within the then case of an if statement: if ((i + n) as u32) < (N as u32)
{
out[i] = input[i+n];
} |
#2389 was a step towards a fix, but not the full fix. |
Thanks, I had not realized this got closed by that PR. |
I'm not sure this has been resolved. I'm still getting an index out of bounds error on commit c344d86. |
Ah this should not have been closed, as the change was only incldued in ACVM. More context on the fix can be found here (#2493) |
Is it just a wait for ACVM v0.24.0 that contains the fix to go into Noir? |
Is this an open issue still? |
Nope. I can confirm that proofs can now be generated for the linked program. |
Closed, potentially with #2504. |
Reopening @ax0's issue #2099 based on the new error.
Aim
Generate a proof for this program.
Expected Behavior
A proof is successfully generated.
Bug
We get the following error:
To Reproduce
git clone https://github.com/aragonzkresearch/noir-trie-proofs
cd noir-trie-proofs/tests/depth_8_storage_proof
nargo execute
Installation Method
Compiled from source
Nargo Version
nargo 0.9.0 (git version hash: a07b8a4, is dirty: false)
Additional Context
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: