-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Integrate databus in the private kernels (#9028)
Integrates the databus in the private kernels. We do this by annotating with call_data(0) for previous kernel public inputs and call_data(1) for app public inputs. Kernels and apps expose their own public inputs as return_data except the tail kernel who does it via the traditional public inputs mechanism for the tube.
- Loading branch information
1 parent
308c03b
commit 1798b1c
Showing
37 changed files
with
383 additions
and
164 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
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
2 changes: 1 addition & 1 deletion
2
noir-projects/mock-protocol-circuits/crates/mock-private-kernel-tail/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
13 changes: 11 additions & 2 deletions
13
noir-projects/noir-protocol-circuits/crates/private-kernel-init-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,15 @@ | ||
use dep::private_kernel_lib::PrivateKernelInitCircuitPrivateInputs; | ||
use dep::types::PrivateKernelCircuitPublicInputs; | ||
use types::transaction::tx_request::TxRequest; | ||
use types::abis::private_kernel::private_call_data::PrivateCallDataWithoutPublicInputs; | ||
use types::abis::private_circuit_public_inputs::PrivateCircuitPublicInputs; | ||
|
||
unconstrained fn main(input: PrivateKernelInitCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs { | ||
input.execute() | ||
unconstrained fn main( | ||
tx_request: TxRequest, | ||
vk_tree_root: Field, | ||
private_call: PrivateCallDataWithoutPublicInputs, | ||
app_public_inputs: PrivateCircuitPublicInputs | ||
) -> pub PrivateKernelCircuitPublicInputs { | ||
let private_inputs = PrivateKernelInitCircuitPrivateInputs::new(tx_request, vk_tree_root, private_call, app_public_inputs); | ||
private_inputs.execute() | ||
} |
14 changes: 11 additions & 3 deletions
14
noir-projects/noir-protocol-circuits/crates/private-kernel-init/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,15 @@ | ||
use dep::private_kernel_lib::PrivateKernelInitCircuitPrivateInputs; | ||
use dep::types::PrivateKernelCircuitPublicInputs; | ||
use types::transaction::tx_request::TxRequest; | ||
use types::abis::private_kernel::private_call_data::PrivateCallDataWithoutPublicInputs; | ||
use types::abis::private_circuit_public_inputs::PrivateCircuitPublicInputs; | ||
|
||
#[recursive] | ||
fn main(input: PrivateKernelInitCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs { | ||
input.execute() | ||
fn main( | ||
tx_request: TxRequest, | ||
vk_tree_root: Field, | ||
private_call: PrivateCallDataWithoutPublicInputs, | ||
app_public_inputs: call_data(1) PrivateCircuitPublicInputs | ||
) -> return_data PrivateKernelCircuitPublicInputs { | ||
let private_inputs = PrivateKernelInitCircuitPrivateInputs::new(tx_request, vk_tree_root, private_call, app_public_inputs); | ||
private_inputs.execute() | ||
} |
18 changes: 16 additions & 2 deletions
18
noir-projects/noir-protocol-circuits/crates/private-kernel-inner-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,20 @@ | ||
use dep::private_kernel_lib::PrivateKernelInnerCircuitPrivateInputs; | ||
use dep::types::PrivateKernelCircuitPublicInputs; | ||
use types::abis::private_kernel_data::PrivateKernelDataWithoutPublicInputs; | ||
use types::abis::private_kernel::private_call_data::PrivateCallDataWithoutPublicInputs; | ||
use types::abis::private_circuit_public_inputs::PrivateCircuitPublicInputs; | ||
|
||
unconstrained fn main(input: PrivateKernelInnerCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs { | ||
input.execute() | ||
unconstrained fn main( | ||
previous_kernel: PrivateKernelDataWithoutPublicInputs, | ||
previous_kernel_public_inputs: PrivateKernelCircuitPublicInputs, | ||
private_call: PrivateCallDataWithoutPublicInputs, | ||
app_public_inputs: PrivateCircuitPublicInputs | ||
) -> pub PrivateKernelCircuitPublicInputs { | ||
let private_inputs = PrivateKernelInnerCircuitPrivateInputs::new( | ||
previous_kernel, | ||
previous_kernel_public_inputs, | ||
private_call, | ||
app_public_inputs | ||
); | ||
private_inputs.execute() | ||
} |
19 changes: 16 additions & 3 deletions
19
noir-projects/noir-protocol-circuits/crates/private-kernel-inner/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,20 @@ | ||
use dep::private_kernel_lib::PrivateKernelInnerCircuitPrivateInputs; | ||
use dep::types::PrivateKernelCircuitPublicInputs; | ||
use types::abis::private_kernel_data::PrivateKernelDataWithoutPublicInputs; | ||
use types::abis::private_kernel::private_call_data::PrivateCallDataWithoutPublicInputs; | ||
use types::abis::private_circuit_public_inputs::PrivateCircuitPublicInputs; | ||
|
||
#[recursive] | ||
fn main(input: PrivateKernelInnerCircuitPrivateInputs) -> pub PrivateKernelCircuitPublicInputs { | ||
input.execute() | ||
fn main( | ||
previous_kernel: PrivateKernelDataWithoutPublicInputs, | ||
previous_kernel_public_inputs: call_data(0) PrivateKernelCircuitPublicInputs, | ||
private_call: PrivateCallDataWithoutPublicInputs, | ||
app_public_inputs: call_data(1) PrivateCircuitPublicInputs | ||
) -> return_data PrivateKernelCircuitPublicInputs { | ||
let private_inputs = PrivateKernelInnerCircuitPrivateInputs::new( | ||
previous_kernel, | ||
previous_kernel_public_inputs, | ||
private_call, | ||
app_public_inputs | ||
); | ||
private_inputs.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
17 changes: 12 additions & 5 deletions
17
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,26 +1,33 @@ | ||
use dep::private_kernel_lib::PrivateKernelResetCircuitPrivateInputs; | ||
use dep::private_kernel_lib::private_kernel_reset::{PrivateKernelResetHints, PrivateKernelResetCircuitPrivateInputs}; | ||
use dep::types::{ | ||
PrivateKernelCircuitPublicInputs, | ||
constants::{ | ||
MAX_ENCRYPTED_LOGS_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NOTE_HASHES_PER_TX, | ||
MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_KEY_VALIDATION_REQUESTS_PER_TX | ||
} | ||
}; | ||
use types::abis::private_kernel_data::PrivateKernelDataWithoutPublicInputs; | ||
|
||
global NOTE_HASH_PENDING_AMOUNT = MAX_NOTE_HASH_READ_REQUESTS_PER_TX; // 128 | ||
global NOTE_HASH_PENDING_AMOUNT = MAX_NOTE_HASH_READ_REQUESTS_PER_TX; // 64 | ||
global NOTE_HASH_SETTLED_AMOUNT = MAX_NOTE_HASH_READ_REQUESTS_PER_TX; | ||
global NULLIFIER_PENDING_AMOUNT = MAX_NULLIFIER_READ_REQUESTS_PER_TX; // 128 | ||
global NULLIFIER_PENDING_AMOUNT = MAX_NULLIFIER_READ_REQUESTS_PER_TX; // 64 | ||
global NULLIFIER_SETTLED_AMOUNT = MAX_NULLIFIER_READ_REQUESTS_PER_TX; | ||
global NULLIFIER_KEYS = MAX_KEY_VALIDATION_REQUESTS_PER_TX; // 64 | ||
global TRANSIENT_DATA_AMOUNT = MAX_NULLIFIERS_PER_TX; // 64 | ||
global NOTE_HASH_SILOING_AMOUNT = MAX_NOTE_HASHES_PER_TX; // 64 | ||
global NULLIFIER_SILOING_AMOUNT = MAX_NULLIFIERS_PER_TX; // 64 | ||
global ENCRYPTED_LOG_SILOING_AMOUNT = MAX_ENCRYPTED_LOGS_PER_TX; // 8 | ||
|
||
unconstrained fn main(input: PrivateKernelResetCircuitPrivateInputs<NOTE_HASH_PENDING_AMOUNT, NOTE_HASH_SETTLED_AMOUNT, NULLIFIER_PENDING_AMOUNT, NULLIFIER_SETTLED_AMOUNT, NULLIFIER_KEYS, TRANSIENT_DATA_AMOUNT>) -> pub PrivateKernelCircuitPublicInputs { | ||
input.execute( | ||
unconstrained fn main( | ||
previous_kernel: PrivateKernelDataWithoutPublicInputs, | ||
previous_kernel_public_inputs: PrivateKernelCircuitPublicInputs, | ||
hints: PrivateKernelResetHints<NOTE_HASH_PENDING_AMOUNT, NOTE_HASH_SETTLED_AMOUNT, NULLIFIER_PENDING_AMOUNT, NULLIFIER_SETTLED_AMOUNT, NULLIFIER_KEYS, TRANSIENT_DATA_AMOUNT> | ||
) -> pub PrivateKernelCircuitPublicInputs { | ||
let private_inputs = PrivateKernelResetCircuitPrivateInputs::new(previous_kernel, previous_kernel_public_inputs, hints); | ||
private_inputs.execute( | ||
NOTE_HASH_SILOING_AMOUNT, | ||
NULLIFIER_SILOING_AMOUNT, | ||
ENCRYPTED_LOG_SILOING_AMOUNT | ||
) | ||
} | ||
|
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
10 changes: 8 additions & 2 deletions
10
noir-projects/noir-protocol-circuits/crates/private-kernel-tail-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,12 @@ | ||
use dep::private_kernel_lib::PrivateKernelTailCircuitPrivateInputs; | ||
use dep::types::KernelCircuitPublicInputs; | ||
use types::abis::private_kernel_data::PrivateKernelDataWithoutPublicInputs; | ||
use types::abis::kernel_circuit_public_inputs::PrivateKernelCircuitPublicInputs; | ||
|
||
unconstrained fn main(input: PrivateKernelTailCircuitPrivateInputs) -> pub KernelCircuitPublicInputs { | ||
input.execute() | ||
unconstrained fn main( | ||
previous_kernel: PrivateKernelDataWithoutPublicInputs, | ||
previous_kernel_public_inputs: PrivateKernelCircuitPublicInputs | ||
) -> pub KernelCircuitPublicInputs { | ||
let private_inputs = PrivateKernelTailCircuitPrivateInputs::new(previous_kernel, previous_kernel_public_inputs); | ||
private_inputs.execute() | ||
} |
10 changes: 8 additions & 2 deletions
10
...rojects/noir-protocol-circuits/crates/private-kernel-tail-to-public-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,12 @@ | ||
use dep::private_kernel_lib::PrivateKernelTailToPublicCircuitPrivateInputs; | ||
use dep::types::PublicKernelCircuitPublicInputs; | ||
use types::abis::private_kernel_data::PrivateKernelDataWithoutPublicInputs; | ||
use types::abis::kernel_circuit_public_inputs::PrivateKernelCircuitPublicInputs; | ||
|
||
unconstrained fn main(input: PrivateKernelTailToPublicCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs { | ||
input.execute() | ||
unconstrained fn main( | ||
previous_kernel: PrivateKernelDataWithoutPublicInputs, | ||
previous_kernel_public_inputs: PrivateKernelCircuitPublicInputs | ||
) -> pub PublicKernelCircuitPublicInputs { | ||
let private_inputs = PrivateKernelTailToPublicCircuitPrivateInputs::new(previous_kernel, previous_kernel_public_inputs); | ||
private_inputs.execute() | ||
} |
11 changes: 8 additions & 3 deletions
11
noir-projects/noir-protocol-circuits/crates/private-kernel-tail-to-public/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,12 @@ | ||
use dep::private_kernel_lib::PrivateKernelTailToPublicCircuitPrivateInputs; | ||
use dep::types::PublicKernelCircuitPublicInputs; | ||
use types::abis::private_kernel_data::PrivateKernelDataWithoutPublicInputs; | ||
use types::abis::kernel_circuit_public_inputs::PrivateKernelCircuitPublicInputs; | ||
|
||
#[recursive] | ||
fn main(input: PrivateKernelTailToPublicCircuitPrivateInputs) -> pub PublicKernelCircuitPublicInputs { | ||
input.execute() | ||
fn main( | ||
previous_kernel: PrivateKernelDataWithoutPublicInputs, | ||
previous_kernel_public_inputs: call_data(0) PrivateKernelCircuitPublicInputs | ||
) -> pub PublicKernelCircuitPublicInputs { | ||
let private_inputs = PrivateKernelTailToPublicCircuitPrivateInputs::new(previous_kernel, previous_kernel_public_inputs); | ||
private_inputs.execute() | ||
} |
Oops, something went wrong.