From 7cdc96b4232803ae72f29e37d9e37f2f142e967e Mon Sep 17 00:00:00 2001 From: paulallensuxs <114240091+paulallensuxs@users.noreply.github.com> Date: Fri, 16 Feb 2024 18:02:55 +0000 Subject: [PATCH 1/3] add #[recursive] explainer to docs --- docs/docs/noir/standard_library/recursion.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/docs/noir/standard_library/recursion.md b/docs/docs/noir/standard_library/recursion.md index f252150c8b5..1b93c4df5d0 100644 --- a/docs/docs/noir/standard_library/recursion.md +++ b/docs/docs/noir/standard_library/recursion.md @@ -8,6 +8,26 @@ Noir supports recursively verifying proofs, meaning you verify the proof of a No Read [the explainer on recursion](../../explainers/explainer-recursion.md) to know more about this function and the [guide on how to use it.](../../how_to/how-to-recursion.md) +## The `#[recursive]` Attribute + +In Noir, the `#[recursive]` attribute is used to indicate that a circuit is designed for recursive proof generation. When applied, it informs the compiler and the tooling that the circuit should be compiled in a way that makes its proofs suitable for recursive verification. This attribute eliminates the need for manual flagging of recursion at the tooling level, streamlining the proof generation process for recursive circuits. + +### Example usage with `#[recursive]` + +```rust +#[recursive] +fn main(x: Field, y: pub Field) { + assert(x == y, "x and y are not equal"); +} + +// This marks the circuit as recursion-friendly and indicates that proofs generated from this circuit +// are intended for recursive verification. +``` + +By incorporating this attribute directly in the circuit's definition, tooling like Nargo and NoirJS can automatically handle the proving of recursive Noir programs without requiring additional flags or configurations. + +## Verifying Recursive Proofs + ```rust #[foreign(verify_proof)] fn verify_proof(_verification_key : [Field], _proof : [Field], _public_input : Field, _key_hash : Field) {} From ced5fc0463a481a6ce7738d632b8199b2bc3a1d8 Mon Sep 17 00:00:00 2001 From: paulallensuxs <114240091+paulallensuxs@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:00:04 +0000 Subject: [PATCH 2/3] add #[recursive] attribute to versioned_docs under v0.24.0 --- .../noir/standard_library/recursion.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/versioned_docs/version-v0.24.0/noir/standard_library/recursion.md b/docs/versioned_docs/version-v0.24.0/noir/standard_library/recursion.md index f252150c8b5..1b93c4df5d0 100644 --- a/docs/versioned_docs/version-v0.24.0/noir/standard_library/recursion.md +++ b/docs/versioned_docs/version-v0.24.0/noir/standard_library/recursion.md @@ -8,6 +8,26 @@ Noir supports recursively verifying proofs, meaning you verify the proof of a No Read [the explainer on recursion](../../explainers/explainer-recursion.md) to know more about this function and the [guide on how to use it.](../../how_to/how-to-recursion.md) +## The `#[recursive]` Attribute + +In Noir, the `#[recursive]` attribute is used to indicate that a circuit is designed for recursive proof generation. When applied, it informs the compiler and the tooling that the circuit should be compiled in a way that makes its proofs suitable for recursive verification. This attribute eliminates the need for manual flagging of recursion at the tooling level, streamlining the proof generation process for recursive circuits. + +### Example usage with `#[recursive]` + +```rust +#[recursive] +fn main(x: Field, y: pub Field) { + assert(x == y, "x and y are not equal"); +} + +// This marks the circuit as recursion-friendly and indicates that proofs generated from this circuit +// are intended for recursive verification. +``` + +By incorporating this attribute directly in the circuit's definition, tooling like Nargo and NoirJS can automatically handle the proving of recursive Noir programs without requiring additional flags or configurations. + +## Verifying Recursive Proofs + ```rust #[foreign(verify_proof)] fn verify_proof(_verification_key : [Field], _proof : [Field], _public_input : Field, _key_hash : Field) {} From 3e0b757526f76b1b5cb857f99d13c6692d36ae49 Mon Sep 17 00:00:00 2001 From: Savio <72797635+Savio-Sou@users.noreply.github.com> Date: Thu, 22 Feb 2024 20:34:37 +0800 Subject: [PATCH 3/3] Update attribute intention --- docs/docs/noir/standard_library/recursion.md | 2 +- .../version-v0.24.0/noir/standard_library/recursion.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/noir/standard_library/recursion.md b/docs/docs/noir/standard_library/recursion.md index 1b93c4df5d0..9337499dac8 100644 --- a/docs/docs/noir/standard_library/recursion.md +++ b/docs/docs/noir/standard_library/recursion.md @@ -24,7 +24,7 @@ fn main(x: Field, y: pub Field) { // are intended for recursive verification. ``` -By incorporating this attribute directly in the circuit's definition, tooling like Nargo and NoirJS can automatically handle the proving of recursive Noir programs without requiring additional flags or configurations. +By incorporating this attribute directly in the circuit's definition, tooling like Nargo and NoirJS can automatically execute recursive-specific duties for Noir programs (e.g. recursive-friendly proof artifact generation) without additional flags or configurations. ## Verifying Recursive Proofs diff --git a/docs/versioned_docs/version-v0.24.0/noir/standard_library/recursion.md b/docs/versioned_docs/version-v0.24.0/noir/standard_library/recursion.md index 1b93c4df5d0..9337499dac8 100644 --- a/docs/versioned_docs/version-v0.24.0/noir/standard_library/recursion.md +++ b/docs/versioned_docs/version-v0.24.0/noir/standard_library/recursion.md @@ -24,7 +24,7 @@ fn main(x: Field, y: pub Field) { // are intended for recursive verification. ``` -By incorporating this attribute directly in the circuit's definition, tooling like Nargo and NoirJS can automatically handle the proving of recursive Noir programs without requiring additional flags or configurations. +By incorporating this attribute directly in the circuit's definition, tooling like Nargo and NoirJS can automatically execute recursive-specific duties for Noir programs (e.g. recursive-friendly proof artifact generation) without additional flags or configurations. ## Verifying Recursive Proofs