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

fix: initialise arrays returned by brillig #2048

Merged
merged 11 commits into from
Sep 11, 2023
Merged

Conversation

guipublic
Copy link
Contributor

Description

Problem*

We generate an init opcode for arrays in acir, in order to handle dynamic arrays.
However arrays returned from brillig were not initialised.

Resolves

Summary*

Documentation

  • This PR requires documentation updates when merged.

    • I will submit a noir-lang/docs PR.
    • I will request for and support Dev Rel's help in documenting this PR.

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

Copy link
Contributor

@kevaundray kevaundray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes:

  • Lets not change the visibility of AcirVarData and vars, we can create methods on the context which expose the public functionality needed instead of just exposing the public type.

  • Either way I think we want to avoid pub here in favour of a more restrictive pub(crate)

  • On mobile, so perhaps I'm wrong -- it sems like we don't need to change the visibility

@guipublic
Copy link
Contributor Author

guipublic commented Jul 26, 2023

Notes:

I was debugging the nested arrays, it should not have been commit, I just reverted it.

@kevaundray
Copy link
Contributor

Can you include a test case?

@sirasistant
Copy link
Contributor

Would this handle returned nested arrays created by #2047 ?

@guipublic
Copy link
Contributor Author

Can you include a test case?

I added one

@guipublic
Copy link
Contributor Author

guipublic commented Jul 26, 2023

Would this handle returned nested arrays created by #2047 ?

No, the nested arrays test is failing after updating from master.

@guipublic
Copy link
Contributor Author

Would this handle returned nested arrays created by #2047 ?

No, the nested arrays test is failing after updating from master.

We still do not handle nested arrays, but the test is now passing, we simply don't add the init opcode for nested arrays, since they are not supported anyways.

@sirasistant
Copy link
Contributor

We still do not handle nested arrays, but the test is now passing, we simply don't add the init opcode for nested arrays, since they are not supported anyways.

We don't support multidimensional arrays but we do support nested arrays, for example, if you have an array of structs that contain arrays. This might break the initialization?

@kevaundray
Copy link
Contributor

@sirasistant what were your thoughts on this PR?

@sirasistant
Copy link
Contributor

This is needed for dynamic accesses to arrays returned from brillig, but if it's not too complicated we should also init nested returned arrays, if it's complicated we should create an issue and merge this as is since it's already is solving a problem :D

sirasistant
sirasistant previously approved these changes Aug 17, 2023
Copy link
Contributor

@sirasistant sirasistant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh I see that what's not supported is nested dynamic arrays, got it. Let's merge this!

@kevaundray kevaundray added this pull request to the merge queue Sep 11, 2023
Merged via the queue into master with commit 788dfb4 Sep 11, 2023
14 checks passed
@kevaundray kevaundray deleted the gd/brillig_uninitialised branch September 11, 2023 18:08
TomAFrench added a commit that referenced this pull request Sep 11, 2023
* master:
  chore: Move tooling related items into their own directory (#2644)
  chore: add `CompilationResult` helper type (#2639)
  fix: initialise arrays returned by brillig (#2048)
  chore: clippy fix (#2631)
  fix(wasm): Remove stacker from dependencies (#2637)
TomAFrench added a commit that referenced this pull request Sep 11, 2023
* master:
  chore: Move tooling related items into their own directory (#2644)
  chore: add `CompilationResult` helper type (#2639)
  fix: initialise arrays returned by brillig (#2048)
  chore: clippy fix (#2631)
  fix(wasm): Remove stacker from dependencies (#2637)
  chore(ci): reenable CI for `noir_wasm` (#2636)
  fix: avoid overflows in integer division (#2180)
  chore(ci): Nightly Integration testing  (#2596)
  feat(parser): allow multiple attributes (#2537)
  feat(nargo): Allow installing custom backends from the CLI (#2632)
  chore(ci): enforce clippy and `cargo fmt` in CI (#2628)
TomAFrench added a commit that referenced this pull request Sep 11, 2023
* master:
  chore: Move tooling related items into their own directory (#2644)
  chore: add `CompilationResult` helper type (#2639)
  fix: initialise arrays returned by brillig (#2048)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants