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

Document the #[oracle] attribute #3971

Closed
Savio-Sou opened this issue Jan 5, 2024 · 9 comments · Fixed by #4002
Closed

Document the #[oracle] attribute #3971

Savio-Sou opened this issue Jan 5, 2024 · 9 comments · Fixed by #4002
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Milestone

Comments

@Savio-Sou
Copy link
Collaborator

Savio-Sou commented Jan 5, 2024

Problem

The #[foreign_call] attribute has been surfaced in multiple discussions as a feature for fetching information outside of the Noir program, but we don't currently have written explanations of how it is used.

Happy Case

Document how is #[foreign_call] used in the Noir docs with examples.

Alternatives Considered

No response

Additional Context

Non-exhausive / potentially inaccurate list of reference PRs I came across:

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@Savio-Sou Savio-Sou added enhancement New feature or request documentation Improvements or additions to documentation labels Jan 5, 2024
@Savio-Sou Savio-Sou added this to the 0.21.0 milestone Jan 5, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jan 5, 2024
@Savio-Sou
Copy link
Collaborator Author

@signorecello would you like to pair with @TomAFrench and @sirasistant to work on this?

@Savio-Sou
Copy link
Collaborator Author

Relatedly is #[oracle] the same as #[foreign_call]? (example)
If not we should create a separate issue to also document it.

@kevaundray
Copy link
Contributor

#[foreign] is a compiler attribute for specifying blackbox functions whereas #[oracle] tells the compiler to delegate execution of a function to something outside of Noir

@Savio-Sou
Copy link
Collaborator Author

Does that mean Noir devs are intended to use #[oracle] but not necessarily #[foreign_call]?
(And is #[foreign_call] and #[foreign] the same?)

@kevaundray
Copy link
Contributor

Noir devs should not use any of those I think in most cases -- oracles are for people who want to have their own runtimes like aztec, ie I can't depend on a library that has an oracle in it unless it is an oracle from the Noir runtime, like println

@Savio-Sou
Copy link
Collaborator Author

Savio-Sou commented Jan 5, 2024

Right, perhaps an advanced rather than general use case but would for example #3767 be where Noir devs could find#[oracle] useful?

@TomAFrench TomAFrench changed the title Document the #[foreign_call] attribute Document the #[oracle] attribute Jan 5, 2024
@TomAFrench
Copy link
Member

#[foreign_call] doesn't exist. I got those mixed up in an example a while back.

@TomAFrench
Copy link
Member

Noir devs should not use any of those I think in most cases -- oracles are for people who want to have their own runtimes like aztec, ie I can't depend on a library that has an oracle in it unless it is an oracle from the Noir runtime, like println

Generally agree although I can see an argument for allowing them in bin packages, i.e. as it lives in the package you running then you aren't pulling in this new oracle call unawares so you're more likely to run the package in an environment which supplies a handler for it.

@signorecello
Copy link
Contributor

This is where diátaxis framework shines: we don't have to not document something, as it is delegated to reference material. It is still there, but not surfaced as something that works out-of-the-box.

To work, I'll be doing a how-to guide which will come with its own section on the runtime part.

This should be documented in reference, though. I'll try to find a nice place for it, and we can follow the same pattern for future situations like this.

github-merge-queue bot pushed a commit that referenced this issue Jan 16, 2024
… of oracles (#4002)

# Description

This PR adds some more in-depth documentation on oracles, what they are
and how to use them.

## Problem\*

Closes #3971

Oracles can now be resolved with JSON RPC calls, which is a powerful
feature for developers. This PR attempts to provide some information on
how they can be part of a development flow

## Summary\*

- [ ] Adds the nargo commands for oracles
- [ ] Adds an explainer on what are oracles and what can you do with
them
- [ ] Adds a how-to guide on using oracles
- [ ] Adds a tutorial on a small project using oracles

---------

Co-authored-by: Savio <[email protected]>
Co-authored-by: josh crites <[email protected]>
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jan 16, 2024
@Savio-Sou Savio-Sou modified the milestones: 0.21.0, 0.23.0 Jan 19, 2024
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 enhancement New feature or request
Projects
Archived in project
4 participants