Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Write a separate section on how return values are computed automatically #42

Closed
kevaundray opened this issue Dec 5, 2022 · 4 comments
Closed

Comments

@kevaundray
Copy link

No description provided.

@Savio-Sou
Copy link
Contributor

Savio-Sou commented Jan 31, 2023

There are two ways to "supply" public inputs.

fn main(x : Field, y : pub Field) {
  constrain x == y
}

In the above program, you are directly supplying the public input because it cannot be computed for some reason from the initial input.

fn main(x: Field, y : Field) -> pub Field {
 constrain x == y;
 return y
}

In the above program, you are return a value from the main function which we have defined to always be public, in this case, the output would get automatically computed for you from the initial inputs.
We floated the idea around of introducing the concept of a public input and a public output. This is a bit confusing depending on your background however because on the proving system layer, there are only public inputs

@critesjosh
Copy link
Collaborator

@Globallager what exactly needs to be documented for this to be considered complete?

@Savio-Sou
Copy link
Contributor

@Globallager what exactly needs to be documented for this to be considered complete?

Mainly how public inputs & return values are automatically computed and stored in Verifier.toml when running nargo prove.

It was already documented here, but we still got a few queries from the community on it back in Jan. Hence we've created the issue for ways to further increase awareness (e.g. separating that into a new section).

If we weren't getting queries recently however we can close this without doc changes.

@signorecello signorecello transferred this issue from noir-lang/book Mar 30, 2023
@signorecello
Copy link
Collaborator

to my knowledge this didn't prompt any more questions, so I'm closing for the time being

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants