-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding autogenerated variants for the reset circuit (#6508)
This PR adds: - Autogeneration of kernel reset variants by declaring them in a json file - Updating of the nargo workspace so the new variants get compiled - Autogeneration from the same JSON of the circuits.js typings for the variants, and validation of the sizes - Updates across code to support multiple variants for the reset. However, if you add variants in the json descriptor, you'll still have to manually update `noir-protocol-circuits-types/index.ts` to add imports for the jsons of the variants (however typescript will cry in the places that you need to modify, thanks to the circuits.js autogeneration) - Updates the kernel prover to choose the appropiate variant for the hints size and trims the hints
- Loading branch information
1 parent
21dc72a
commit 8e8d2dd
Showing
50 changed files
with
918 additions
and
271 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
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,3 +1,5 @@ | ||
Prover.toml | ||
Verifier.toml | ||
target | ||
crates/autogenerated | ||
Nargo.toml |
File renamed without changes.
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
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
16 changes: 14 additions & 2 deletions
16
noir-projects/noir-protocol-circuits/crates/private-kernel-reset-simulated/src/main.nr
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,6 +1,18 @@ | ||
use dep::private_kernel_lib::PrivateKernelResetCircuitPrivateInputs; | ||
use dep::types::PrivateKernelCircuitPublicInputs; | ||
use dep::types::{ | ||
PrivateKernelCircuitPublicInputs, | ||
constants::{ | ||
MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, | ||
MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX | ||
} | ||
}; | ||
|
||
global NOTE_HASH_PENDING_AMOUNT = MAX_NOTE_HASH_READ_REQUESTS_PER_TX; // 128 | ||
global NOTE_HASH_SETTLED_AMOUNT = MAX_NOTE_HASH_READ_REQUESTS_PER_TX; | ||
global NULLIFIER_PENDING_AMOUNT = MAX_NULLIFIER_READ_REQUESTS_PER_TX; // 8 | ||
global NULLIFIER_SETTLED_AMOUNT = MAX_NULLIFIER_READ_REQUESTS_PER_TX; | ||
global NULLIFIER_KEYS = MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX; // 4 | ||
|
||
unconstrained fn main(input: PrivateKernelResetCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs { | ||
unconstrained fn main(input: PrivateKernelResetCircuitPrivateInputs<NOTE_HASH_PENDING_AMOUNT, NOTE_HASH_SETTLED_AMOUNT, NULLIFIER_PENDING_AMOUNT, NULLIFIER_SETTLED_AMOUNT, NULLIFIER_KEYS>) -> pub PrivateKernelCircuitPublicInputs { | ||
input.execute() | ||
} |
16 changes: 14 additions & 2 deletions
16
noir-projects/noir-protocol-circuits/crates/private-kernel-reset/src/main.nr
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,7 +1,19 @@ | ||
use dep::private_kernel_lib::PrivateKernelResetCircuitPrivateInputs; | ||
use dep::types::PrivateKernelCircuitPublicInputs; | ||
use dep::types::{ | ||
PrivateKernelCircuitPublicInputs, | ||
constants::{ | ||
MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX, | ||
MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX | ||
} | ||
}; | ||
|
||
global NOTE_HASH_PENDING_AMOUNT = MAX_NOTE_HASH_READ_REQUESTS_PER_TX; // 128 | ||
global NOTE_HASH_SETTLED_AMOUNT = MAX_NOTE_HASH_READ_REQUESTS_PER_TX; | ||
global NULLIFIER_PENDING_AMOUNT = MAX_NULLIFIER_READ_REQUESTS_PER_TX; // 8 | ||
global NULLIFIER_SETTLED_AMOUNT = MAX_NULLIFIER_READ_REQUESTS_PER_TX; | ||
global NULLIFIER_KEYS = MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX; // 4 | ||
|
||
#[recursive] | ||
fn main(input: PrivateKernelResetCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs { | ||
fn main(input: PrivateKernelResetCircuitPrivateInputs<NOTE_HASH_PENDING_AMOUNT, NOTE_HASH_SETTLED_AMOUNT, NULLIFIER_PENDING_AMOUNT, NULLIFIER_SETTLED_AMOUNT, NULLIFIER_KEYS>) -> pub PrivateKernelCircuitPublicInputs { | ||
input.execute() | ||
} |
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
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
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
Oops, something went wrong.