-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document recursive verification example
- Loading branch information
Showing
3 changed files
with
44 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
# Noir recursion | ||
# A minimal example of nested recursion | ||
|
||
## Install dependencies | ||
## About | ||
|
||
`yarn` | ||
The code in this project shows recursive verification of Noir functions. | ||
|
||
## Compile all the things | ||
The primary function is simply addition, and verifies the re-calculation of one path up a binary tree from two leaf nodes. | ||
A more useful application of this design would be proving the hash of data in a merkle tree (leaf nodes), up to the merkle root. Amortizing the cost of proving each hash per nested call. | ||
|
||
`yarn compile:all` | ||
## The circuits | ||
The function doing the calculation, in this case addition, is in the sumLib. It is used in both recursive circuits: `sum` and `recursiveLeaf`. | ||
|
||
## Run main typescript | ||
## Verification | ||
Results of a call to `sum` are verified in `recursiveLeaf`, which itself also calls `sum` again. The results of the `recursiveLeaf` call are then verified in `recursiveNode`. | ||
|
||
`yarn start` | ||
That is: | ||
- `recursiveNode` verifies `recursiveLeaf` artifacts | ||
- `recursiveLeaf` verifies `sum` artifacts | ||
|
||
## Using this project | ||
- Install dependencies: `yarn` | ||
- Compile all the things: `yarn compile:all` | ||
- Run main typescript: `yarn start` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters