-
Notifications
You must be signed in to change notification settings - Fork 598
test: Add tests for noir<>ivc integration testing #7931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9ebb259
feat: first version of mock protocol circuits
sirasistant 92c32e7
feat: use databus for the mock protocol circuits
sirasistant b2c1bbf
Revert "feat: use databus for the mock protocol circuits"
sirasistant 69b74fc
feat: Add client IVC integration testing
sirasistant 0d34627
ci fix
sirasistant 3600e2d
more ci fixes
sirasistant 855d51a
fix fmt
sirasistant fee7bbb
add package.json
sirasistant 776ee4f
fix ci again
sirasistant ca8fa24
fix vk gen
sirasistant feae637
more ci fixes
sirasistant f44766c
dockerfile update
sirasistant 6269847
fix bootstrap in parallel
sirasistant 68e1a80
fix earthfile
sirasistant df5633d
fix
sirasistant 8cac4e5
chore: cleanup unused dependencies in package json
sirasistant 065457f
Merge branch 'master' into arv/mock_protocol_circuits
sirasistant 876e167
docs: add doc comments to explain some mocks circuits and tests
sirasistant 96416f3
Merge branch 'master' into arv/mock_protocol_circuits
sirasistant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
File renamed without changes.
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Prover.toml | ||
| Verifier.toml | ||
| target |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [workspace] | ||
| members = [ | ||
| "crates/mock-types", | ||
| "crates/app-creator", | ||
| "crates/app-reader", | ||
| "crates/mock-private-kernel-init", | ||
| "crates/mock-private-kernel-inner", | ||
| "crates/mock-private-kernel-reset", | ||
| "crates/mock-private-kernel-tail", | ||
| ] |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Mocked protocol circuits | ||
|
|
||
| These simplified circuits act as a way of testing the IVC integration between noir and barretenberg. They follow the same IVC scheme as the real circuits, but are much simpler and easier to reason about. |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #!/usr/bin/env bash | ||
| set -eu | ||
|
|
||
| cd "$(dirname "$0")" | ||
|
|
||
| CMD=${1:-} | ||
|
|
||
| if [ -n "$CMD" ]; then | ||
| if [ "$CMD" = "clean" ]; then | ||
| git clean -fdx | ||
| exit 0 | ||
| else | ||
| echo "Unknown command: $CMD" | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| NARGO=${NARGO:-../../noir/noir-repo/target/release/nargo} | ||
| $NARGO compile --silence-warnings | ||
|
|
||
| BB_HASH=${BB_HASH:-$(cd ../../ && git ls-tree -r HEAD | grep 'barretenberg/cpp' | awk '{print $3}' | git hash-object --stdin)} | ||
| echo Using BB hash $BB_HASH | ||
| mkdir -p "./target/keys" | ||
|
|
||
| for pathname in "./target"/*.json; do | ||
| BB_HASH=$BB_HASH node ../scripts/generate_vk_json.js "$pathname" "./target/keys" & | ||
| done | ||
|
|
||
| for job in $(jobs -p); do | ||
| wait $job || exit 1 | ||
| done |
8 changes: 8 additions & 0 deletions
8
noir-projects/mock-protocol-circuits/crates/app-creator/Nargo.toml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [package] | ||
| name = "app_creator" | ||
| type = "bin" | ||
| authors = [""] | ||
| compiler_version = ">=0.32.0" | ||
|
|
||
| [dependencies] | ||
| mock_types = { path = "../mock-types" } |
10 changes: 10 additions & 0 deletions
10
noir-projects/mock-protocol-circuits/crates/app-creator/src/main.nr
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| use dep::mock_types::{AppPublicInputs, MAX_COMMITMENTS_PER_CALL}; | ||
|
|
||
| // Mock app for testing that creates the commitments the user commands. | ||
| // Note: A zero is a null commitment. | ||
| fn main(commitments_to_create: [Field; MAX_COMMITMENTS_PER_CALL]) -> pub AppPublicInputs { | ||
| let mut result = AppPublicInputs::default(); | ||
| result.commitments = commitments_to_create; | ||
| result | ||
| } | ||
|
|
||
8 changes: 8 additions & 0 deletions
8
noir-projects/mock-protocol-circuits/crates/app-reader/Nargo.toml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [package] | ||
| name = "app_reader" | ||
| type = "bin" | ||
| authors = [""] | ||
| compiler_version = ">=0.32.0" | ||
|
|
||
| [dependencies] | ||
| mock_types = { path = "../mock-types" } |
10 changes: 10 additions & 0 deletions
10
noir-projects/mock-protocol-circuits/crates/app-reader/src/main.nr
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| use dep::mock_types::{AppPublicInputs, MAX_COMMITMENT_READ_REQUESTS_PER_CALL}; | ||
|
|
||
| // Mock app for testing that reads the commitments (generates read requests) the user commands. | ||
| // Note: A zero read is a null read. | ||
| fn main(commitments_to_read: [Field; MAX_COMMITMENT_READ_REQUESTS_PER_CALL]) -> pub AppPublicInputs { | ||
| let mut result = AppPublicInputs::default(); | ||
| result.read_requests = commitments_to_read; | ||
| result | ||
| } | ||
|
|
8 changes: 8 additions & 0 deletions
8
noir-projects/mock-protocol-circuits/crates/mock-private-kernel-init/Nargo.toml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [package] | ||
| name = "mock_private_kernel_init" | ||
| type = "bin" | ||
| authors = [""] | ||
| compiler_version = ">=0.32.0" | ||
|
|
||
| [dependencies] | ||
| mock_types = { path = "../mock-types" } |
8 changes: 8 additions & 0 deletions
8
noir-projects/mock-protocol-circuits/crates/mock-private-kernel-init/src/main.nr
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| use dep::mock_types::{TxRequest, PrivateKernelPublicInputs, PrivateKernelPublicInputsBuilder, AppPublicInputs}; | ||
|
|
||
| fn main(tx: TxRequest, app_inputs: AppPublicInputs) -> pub PrivateKernelPublicInputs { | ||
| let mut private_kernel_inputs = PrivateKernelPublicInputsBuilder::from_tx(tx); | ||
| private_kernel_inputs.ingest_app_inputs(app_inputs); | ||
| private_kernel_inputs.finish() | ||
| } | ||
|
|
8 changes: 8 additions & 0 deletions
8
noir-projects/mock-protocol-circuits/crates/mock-private-kernel-inner/Nargo.toml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [package] | ||
| name = "mock_private_kernel_inner" | ||
| type = "bin" | ||
| authors = [""] | ||
| compiler_version = ">=0.32.0" | ||
|
|
||
| [dependencies] | ||
| mock_types = { path = "../mock-types" } |
11 changes: 11 additions & 0 deletions
11
noir-projects/mock-protocol-circuits/crates/mock-private-kernel-inner/src/main.nr
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| use dep::mock_types::{PrivateKernelPublicInputs, PrivateKernelPublicInputsBuilder, AppPublicInputs}; | ||
|
|
||
| fn main( | ||
| prev_kernel_public_inputs: PrivateKernelPublicInputs, | ||
| app_inputs: AppPublicInputs | ||
| ) -> pub PrivateKernelPublicInputs { | ||
| let mut private_kernel_inputs = PrivateKernelPublicInputsBuilder::from_previous_kernel(prev_kernel_public_inputs); | ||
| private_kernel_inputs.ingest_app_inputs(app_inputs); | ||
| private_kernel_inputs.finish() | ||
| } | ||
|
|
8 changes: 8 additions & 0 deletions
8
noir-projects/mock-protocol-circuits/crates/mock-private-kernel-reset/Nargo.toml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [package] | ||
| name = "mock_private_kernel_reset" | ||
| type = "bin" | ||
| authors = [""] | ||
| compiler_version = ">=0.32.0" | ||
|
|
||
| [dependencies] | ||
| mock_types = { path = "../mock-types" } |
22 changes: 22 additions & 0 deletions
22
noir-projects/mock-protocol-circuits/crates/mock-private-kernel-reset/src/main.nr
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| use dep::mock_types::{ | ||
| PrivateKernelPublicInputs, PrivateKernelPublicInputsBuilder, MAX_COMMITMENT_READ_REQUESTS_PER_TX, | ||
| MAX_COMMITMENTS_PER_TX | ||
| }; | ||
|
|
||
| // Mock reset kernel that reset read requests. | ||
| // It needs hints to locate the commitment that matches the read requests. | ||
| fn main( | ||
| mut prev_kernel_public_inputs: PrivateKernelPublicInputs, | ||
| commitment_read_hints: [u32; MAX_COMMITMENT_READ_REQUESTS_PER_TX] | ||
| ) -> pub PrivateKernelPublicInputs { | ||
| for i in 0..MAX_COMMITMENT_READ_REQUESTS_PER_TX { | ||
| if commitment_read_hints[i] != MAX_COMMITMENTS_PER_TX { | ||
| assert_eq( | ||
| prev_kernel_public_inputs.commitments[commitment_read_hints[i]], prev_kernel_public_inputs.read_requests[i] | ||
| ); | ||
| prev_kernel_public_inputs.read_requests[i] = 0; | ||
| } | ||
| } | ||
| prev_kernel_public_inputs | ||
| } | ||
|
|
8 changes: 8 additions & 0 deletions
8
noir-projects/mock-protocol-circuits/crates/mock-private-kernel-tail/Nargo.toml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [package] | ||
| name = "mock_private_kernel_tail" | ||
| type = "bin" | ||
| authors = [""] | ||
| compiler_version = ">=0.32.0" | ||
|
|
||
| [dependencies] | ||
| mock_types = { path = "../mock-types" } |
15 changes: 15 additions & 0 deletions
15
noir-projects/mock-protocol-circuits/crates/mock-private-kernel-tail/src/main.nr
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| use dep::mock_types::{ | ||
| PrivateKernelPublicInputs, PrivateKernelPublicInputsBuilder, KernelPublicInputs, | ||
| MAX_COMMITMENT_READ_REQUESTS_PER_TX | ||
| }; | ||
|
|
||
| // The tail kernel finishes the client IVC chain exposing the final public inputs with no remaining calls or unfulfilled read requests. | ||
| fn main(prev_kernel_public_inputs: PrivateKernelPublicInputs) -> pub KernelPublicInputs { | ||
| assert_eq(prev_kernel_public_inputs.remaining_calls, 0); | ||
| for i in 0..MAX_COMMITMENT_READ_REQUESTS_PER_TX { | ||
| assert_eq(prev_kernel_public_inputs.read_requests[i], 0); | ||
| } | ||
|
|
||
| KernelPublicInputs { commitments: prev_kernel_public_inputs.commitments } | ||
| } | ||
|
|
7 changes: 7 additions & 0 deletions
7
noir-projects/mock-protocol-circuits/crates/mock-types/Nargo.toml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [package] | ||
| name = "mock_types" | ||
| type = "lib" | ||
| authors = [""] | ||
| compiler_version = ">=0.32.0" | ||
|
|
||
| [dependencies] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind adding a couple of comments to these mock app methods indicating what is the spirit of the functionality being mocked and what is actually being done?