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

feat: Recursive verification #1246

Closed
wants to merge 11 commits into from
Closed

feat: Recursive verification #1246

wants to merge 11 commits into from

Conversation

vezenovm
Copy link
Contributor

Related issue(s)

Resolves #1154

Description

This adds a foreign function to enable recursive verification of proofs.

Summary of changes

A new std lib method was added:

#[foreign(verify_proof)]
fn verify_proof(_verification_key : [Field], _proof : [Field], _public_input : Field, _key_hash : Field, _input_aggregation_object : [Field]) -> [Field] {}

Although this function signature is not final as I would like to remove the key hash field and have it be handled by the compiler. The key hash will have to be specific to a backend and we cannot rely on the compiler to generate the key hash without backend interop.

TODO: include a clean way to generate inner recursive proofs with nargo. The barretenberg backend requries a different hash type for recursive proofs (it using pedersen-blake3 for efficiency), however, the Noir requries a keccak based prover in order to be compatible with the Solidity verifier. This is why a new RecursiveProver type was added to the DSL package.

Dependency additions / changes

Currently referencing these drafts PRs:
aztec_backend: noir-lang/acvm-backend-barretenberg#146
acvm: noir-lang/acvm#234
barretenberg-sys: noir-lang/barretenberg-sys#26
barretenberg: AztecProtocol/barretenberg#383

Test additions / changes

There is a new recursion test that calls the new verify_proof foreign function. It currently fetches its proof data from this backend recursion test, as I still have to add a clean way to generate recursive proofs using nargo.

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.

Additional context

TomAFrench and others added 10 commits April 25, 2023 23:44
* master:
  chore: address clippy warnings (#1239)
  chore(ssa refactor): Implement function calls (#1235)
  chore(ssa refactor): Implement mutable and immutable variables (#1234)
  chore(ssa refactor): Fix recursive printing of blocks (#1230)
  feat(noir): added assert keyword (#1227)
  chore(ssa refactor): Implement ssa-gen for indexing, cast, constrain, if, unary (#1225)
  feat(noir): added `distinct` keyword (#1219)
@vezenovm vezenovm changed the base branch from master to bump-backend April 28, 2023 15:20
@@ -235,6 +235,25 @@ fn prepare_outputs(
outputs
}

fn prepare_outputs_no_count(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new method prepare_outputs_no_count was created with the addition of variable output sizes. It feels a bit hacky, but all integration tests do pass. Do we think this is fine for now or should I add logic to expose backend specific information on variable output sizes of blackbox funcs?

Base automatically changed from bump-backend to master May 1, 2023 15:25
@vezenovm
Copy link
Contributor Author

Closing in favor of #1379

@vezenovm vezenovm closed this May 19, 2023
@TomAFrench TomAFrench deleted the mv/verify_proof branch November 20, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add foreign function for recursion
2 participants