Skip to content

Commit

Permalink
add #[recursive] explainer to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
paulallensuxs committed Feb 16, 2024
1 parent b283637 commit 7cdc96b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/docs/noir/standard_library/recursion.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down

0 comments on commit 7cdc96b

Please sign in to comment.