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: add support for nested arrays returned by oracles #5132

Merged
merged 21 commits into from
Jun 13, 2024
Merged

Conversation

guipublic
Copy link
Contributor

Description

Problem*

Resolves #4561

Summary*

Generates brillig arrays of arrays during brillig-gen for types having nested arrays.
Populate these nested brillig arrays in the brillig VM when data returned from oracles does not match the size of the outer array

Additional Context

For this to work, it is required that the oracle returns flatten values, although its Noir signature is a nested type.
It's certainly possible to deserialise nested json arrays but I could not get it done easily so it'll be better handled in a separate PR.

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist*

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

@guipublic guipublic requested a review from sirasistant May 29, 2024 15:37
@github-actions github-actions bot added the documentation Improvements or additions to documentation label May 29, 2024
@guipublic guipublic changed the title Fix: Add support for nested arrays returned by oracles fix: add support for nested arrays returned by oracles May 30, 2024
Copy link
Contributor

github-actions bot commented May 30, 2024

@TomAFrench
Copy link
Member

Can you add a test case for this?

@guipublic
Copy link
Contributor Author

guipublic commented May 30, 2024

Can you add a test case for this?

I wonder how to unit test Oracles?

@vezenovm
Copy link
Contributor

I wonder how to unit test Oracles?

You should be able to use the mock oracle

@guipublic
Copy link
Contributor Author

I wonder how to unit test Oracles?

You should be able to use the mock oracle

Thank you, I added a test using a mock oracle

@TomAFrench
Copy link
Member

We should be able to refactor this so that we remove some duplication on how we're writing arrays into memory. I'm ok taking in some tech debt here however. If we're not handling this in this PR then can you add make an issue to handle this in future?

We should add some extra test cases involving nested types including struts however.

@TomAFrench TomAFrench requested a review from vezenovm June 11, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please implement deflating heap arrays from foregin calls
4 participants