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

Add abstraction to cleanly input arrays and slices to black box funcs #2440

Closed
vezenovm opened this issue Aug 25, 2023 · 0 comments · Fixed by #2562
Closed

Add abstraction to cleanly input arrays and slices to black box funcs #2440

vezenovm opened this issue Aug 25, 2023 · 0 comments · Fixed by #2562
Labels
acir-gen brillig Unconstrained functions / brillig IR enhancement New feature or request

Comments

@vezenovm
Copy link
Contributor

Problem

From PR #2435 description:
The internal structure of slices in SSA was changed in #2347. Slices and arrays are polymorphic over each other, thus slices can be passed to functions that accept arrays with a generic size (ex. fn foo(input: [Field; N]). The slice structure is handled in SSA, but in ACIR gen we setup the inputs to for the black box calls manually. As the slice length always precedes the slice contents, without changes to call_black_box in acir gen, the slice length was being passed to the bb funcs rather than the contents of the slice.

Happy Case

PR #2435 introduced a quick solution to get this fixed, but we should introduce a clean abstraction for differentiating between arrays and slices. Slice inputs to black box function should be handled in a generalizable way that reduces the surface area for bugs.

Alternatives Considered

Keep the manual check for every potential slice input. This can lead to potential bugs if the implementer of a new black box func that accepts arrays generic over their size forgets to handle slices.

Additional Context

N/A

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@vezenovm vezenovm added enhancement New feature or request P-LOW labels Aug 25, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Aug 25, 2023
@vezenovm vezenovm added acir-gen brillig Unconstrained functions / brillig IR labels Aug 25, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acir-gen brillig Unconstrained functions / brillig IR enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant