Skip to content
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

Define uninitialised array element access #1458

Closed
Tracked by #1376
joss-aztec opened this issue May 31, 2023 · 4 comments
Closed
Tracked by #1376

Define uninitialised array element access #1458

joss-aztec opened this issue May 31, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request refactor ssa

Comments

@joss-aztec
Copy link
Contributor

Problem

During ACIR gen the current implementation of memory (once merged) will throw an error when encountering a load instruction for an array element that hasn't been initialised.

Happy Case

The current behaviour is probably the safest approach, but its nonetheless worth revisiting further down the road once we better understand the requirements of dynamic arrays.

Alternatives Considered

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@joss-aztec joss-aztec added the enhancement New feature or request label May 31, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir May 31, 2023
@joss-aztec
Copy link
Contributor Author

@kevaundray
Copy link
Contributor

@guipublic since dynamic arrays have been implemented, can you revisit this?

@guipublic
Copy link
Contributor

All arrays are initialised in noir, when they are declared. So loading an initialised part of an array is only possible for out-of-bounds indices, which cannot be avoided when we have witness indices.
However, in that case the prover will not be able to generate the proof and we will report an error.
We could add a range-check before any array access to prevent out-of-bound errors on the prover and then report better errors to the user.

@jfecher
Copy link
Contributor

jfecher commented Jul 28, 2023

Closing this issue since I think we have a good answer for it. Arrays themselves can never be uninitialized but out of bounds accesses are still possible. For these cases we issue a compiler error.

@jfecher jfecher closed this as completed Jul 28, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor ssa
Projects
Archived in project
Development

No branches or pull requests

4 participants