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

Epic: Expose black box function solvers into TS #2811

Closed
3 of 6 tasks
TomAFrench opened this issue May 19, 2023 · 9 comments
Closed
3 of 6 tasks

Epic: Expose black box function solvers into TS #2811

TomAFrench opened this issue May 19, 2023 · 9 comments
Assignees
Labels
enhancement New feature or request js Noir's JavaScript packages

Comments

@TomAFrench
Copy link
Member

TomAFrench commented May 19, 2023

Problem

Suggested by @Savio-Sou.

Developers who are making use of ACVM.js are often going to want to make use of the blackbox functions inside of their business logic. For instance pedersen commitments are used in applications such as mastermind-noir and must be calculated in TS to feed into the circuit while matching a value calculated inside the circuit.

It's then important to provide an implementation which is guaranteed to be consistent with ACVM.

Proposed solution

The ACVM.js can expose the implementations of black box functions as helper functions to allow developers query the result of these will be. They can then easily calculate any black box function like hashes (e.g. pedersen, keccak256) and verify signatures (schnorr, ecdsa).

This will be guaranteed to match the ACVM and prevent developers from having to hunt down TS implementations.

Tasks

Rust solvers are available for hash_to_field_128_security and fixed_base_scalar_mul atm, so they should require less work than pedersen and schnorr to expose.

@Savio-Sou
Copy link
Collaborator

Savio-Sou commented Jul 18, 2023

Should we also provide helper functions for Noir stdlib functions?

For example: EdDSA where a Noir dev mentioned on Discord the difficulty to compute a Noir-stdlib-compatible version of it in JavaScript.

Not sure if this should spin out into a separate issue / repo. Happy to hear thoughts!

@TomAFrench
Copy link
Member Author

Exposing Noir stdlib functions is outside of the scope of this package as it's purely concerned with ACIR/ACVM. i.e. A change in the Noir stdlib shouldn't require ACVM to change.

That said, a Noir package can compile down its stdlib functions into ACIR snippets and act as a wrapper around acvm_js to execute and decode the return values.

@kobyhallx kobyhallx transferred this issue from noir-lang/acvm-simulator Aug 14, 2023
@TomAFrench TomAFrench linked a pull request Sep 15, 2023 that will close this issue
2 tasks
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Sep 25, 2023
@TomAFrench TomAFrench transferred this issue from noir-lang/acvm Sep 25, 2023
@kobyhallx
Copy link
Contributor

It would be preferable to wait for improved Pedersen implementation to help others being implmented more easily.

@Savio-Sou Savio-Sou added the js Noir's JavaScript packages label Oct 10, 2023
@Savio-Sou
Copy link
Collaborator

It would be preferable to wait for improved Pedersen implementation to help others being implmented more easily.

@kobyhallx for the Pedersen-based ones you meant (e.g. Merkle verification)? Or everything

@Savio-Sou Savio-Sou changed the title Expose black box function solvers into TS Epic: Expose black box function solvers into TS Oct 25, 2023
@Savio-Sou Savio-Sou moved this from 📋 Backlog to 🏗 In progress in Noir Oct 25, 2023
@Savio-Sou Savio-Sou added this to the Pre-Istanbul milestone Oct 25, 2023
@Savio-Sou
Copy link
Collaborator

Savio-Sou commented Oct 25, 2023

Assigning P-HIGH to this Epic, as this helps the Private Kernel Circuit rewrite project plus very useful for Noir app devs in general.

@Savio-Sou Savio-Sou modified the milestones: NoirJS Helpers, 1.0 Nov 22, 2023
@Savio-Sou
Copy link
Collaborator

Savio-Sou commented Dec 4, 2023

@TomAFrench do you foresee #3079 being able to execute the remaining black box functions / fully deprecate how we used to execute black box functions?

If yes, we can close this as superseded.

If not, we might want to prioritize works accordingly.

@Savio-Sou Savio-Sou removed the P-HIGH label Jan 12, 2024
@TomAFrench
Copy link
Member Author

Closing as will be replaced with usage of bb.js in the short term

@TomAFrench TomAFrench closed this as not planned Won't fix, can't repro, duplicate, stale Apr 20, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Noir Apr 20, 2024
@TomAFrench TomAFrench removed this from the 1.0 milestone Apr 20, 2024
@Savio-Sou
Copy link
Collaborator

@TomAFrench is that something bb.js already or should offer?

@TomAFrench
Copy link
Member Author

It does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request js Noir's JavaScript packages
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants