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

Use SetPub instead of creating new public inputs for return values #625

Closed
kevaundray opened this issue Jan 10, 2023 · 4 comments
Closed
Labels
enhancement New feature or request

Comments

@kevaundray
Copy link
Contributor

Problem

When we return values from main, they should all be set to public inputs. Right now we are creating new public inputs and setting the return values to be equal to the newly created public inputs.

Solution

When we return a structure from main, take the witness index and add it to the public inputs index in the ACIR structure

Alternatives considered

(Describe any alternative solutions you have considered.)

Additional context

(If applicable.)

@kevaundray kevaundray added the enhancement New feature or request label Jan 10, 2023
@jfecher
Copy link
Contributor

jfecher commented Jan 10, 2023

Can you elaborate on the advantages of this over our current scheme?

@kevaundray
Copy link
Contributor Author

Can you elaborate on the advantages of this over our current scheme?

This creates less constraints because you no longer need to create two sets of witnesses. You simply just iterate the last structure that is being returned, get their witness indices and put all of those into the public_inputs vector in circuit.

Right now, we are creating two sets of witnesses and making them equal, which is why we need the BinarySolver PR

@kevaundray
Copy link
Contributor Author

kevaundray commented Jan 10, 2023

After a discussion with Jake and Maxim on Slack, Jake realised that we can delay this SetPub to a future PR and possibly not require BinarySolver by optimising out the boolean values that are created when we constrain arrays

@TomAFrench
Copy link
Member

Looks like this is addressed in #731.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants