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(acir_gen): Pass accurate contents to slice inputs for bb func calls #2435

Merged
merged 8 commits into from
Aug 25, 2023

Conversation

vezenovm
Copy link
Contributor

Description

Problem*

Resolves #2421

Summary*

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.

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.

@vezenovm
Copy link
Contributor Author

@sirasistant I added the test from the issue, but it would be great if you could test this fix against the sha256 + ecdsa as well

@sirasistant
Copy link
Contributor

Will test it! I think this might also be an issue in brillig? 🤔

@vezenovm
Copy link
Contributor Author

Will test it! I think this might also be an issue in brillig?

Yeah it is, I am fixing

@vezenovm
Copy link
Contributor Author

@sirasistant I have updated for brillig as well now. This should be ready for review

@sirasistant
Copy link
Contributor

It's fixed on aztec packages! 🥳 reviewing now :)

sirasistant
sirasistant previously approved these changes Aug 25, 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.

Thanks for the fix! We might want in the future to abstract this a bit, especially if we end up having a blackbox function that accepts more than one slice, It'd be complex to handle this way

@vezenovm
Copy link
Contributor Author

We might want in the future to abstract this a bit, especially if we end up having a blackbox function that accepts more than one slice, It'd be complex to handle this way

I agree. I more meant for this to be a quick solution as I work towards other priorities. I will make an issue to improve the handling of black box inputs

@vezenovm
Copy link
Contributor Author

@sirasistant I just pushed an update which dismissed your review, could you take another look?

@vezenovm vezenovm requested a review from sirasistant August 25, 2023 15:33
@vezenovm vezenovm added this pull request to the merge queue Aug 25, 2023
Merged via the queue into master with commit 054642b Aug 25, 2023
@vezenovm vezenovm deleted the mv/bb-func-slice-inputs branch August 25, 2023 16:35
TomAFrench added a commit that referenced this pull request Aug 25, 2023
* master:
  fix: Implement new mem2reg pass (#2420)
  feat(nargo): Support optional directory in git dependencies (#2436)
  fix(acir_gen): Pass accurate contents to slice inputs for bb func calls (#2435)
  fix(ssa): codegen missing check for unary minus (#2413)
  fix(lsp): Remove duplicated creation of lenses (#2433)
  feat: Add `test(should_fail)` attribute for tests that are meant to fail (#2418)
  chore: improve error message for InternalError (#2429)
  chore: Add stdlib to every crate as it is added to graph (#2392)
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.

Using the resulting slice from to_radix in signature verification fails the verification
2 participants