You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes adding some if statements leads to more checks needed on notes or it fails compiling with:
'internal error: entered unreachable code: Cannot flatten a dynamic array'.
This is fixed by utilizing the Aztec note ONLY inside an if statement that checks that the note exists:
Works:
let options=NoteGetterOptions::new().select(1,from.address).set_limit(1);letnote=stored_set.get_notes(options)[0];if(note.is_some()){stored_set.remove(note.unwrap_unchecked());}
Doesn't work:
let options=NoteGetterOptions::new().select(1,from.address).set_limit(1);letnote=stored_set.get_notes(options)[0];assert(note.is_some());stored_set.remove(note.unwrap_unchecked());
Expected Behavior
Asserting that the note exists should be the same as using it inside an if statement.
Even if the note is not asserted, the error should be more expressive into what the actual issue is.
Would you be able to provide a smaller more up-to-date example? We recently had a fix that I think is related to this issue but the project is using compiler version 0.18.0 and old versions of aztec-nr so it is difficult to reproduce.
Also if you could post a more full stack trace that would be very helpful.
@drgorillamd Thank you for the update! I'm assuming you are using 0.24.0 of aztec-packages. The recent fix has not yet been released but it is on master. I can successfully compile the supplied contract with the fix on master. Going to close this issue as it has been fixed but please do re-open it if after the release you are still running into issues.
Aim
Sometimes adding some if statements leads to more checks needed on notes or it fails compiling with:
'internal error: entered unreachable code: Cannot flatten a dynamic array'.
This is fixed by utilizing the Aztec note ONLY inside an if statement that checks that the note exists:
Works:
Doesn't work:
Expected Behavior
Asserting that the note exists should be the same as using it inside an if statement.
Even if the note is not asserted, the error should be more expressive into what the actual issue is.
Bug
Code:
https://github.com/drgorillamd/aztec-big-gist/tree/feat/array-in-struct/src
Error:
'internal error: entered unreachable code: Cannot flatten a dynamic array'
This bug only happens when adding if statements. In the code sent, removing the if from the start of the function makes the contract compile:
To Reproduce
Repo with the reproduction: https://github.com/drgorillamd/aztec-big-gist/tree/feat/array-in-struct/src
Installation Method
None
Nargo Version
No response
Additional Context
No response
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: