Skip to content
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

feat: Verify ClientIVC proofs through Bb binary #7407

Merged
merged 12 commits into from
Jul 11, 2024

Conversation

codygunton
Copy link
Contributor

@codygunton codygunton commented Jul 9, 2024

Exposes a function to verify ClientIVC proofs through the Bb binary

@codygunton codygunton self-assigned this Jul 9, 2024
Base automatically changed from cg-lde-ad/integrate-client-ivc to master July 11, 2024 00:01
@codygunton codygunton force-pushed the cg/verify-client-ivc-flow branch from bf779d3 to f227282 Compare July 11, 2024 00:35
@codygunton codygunton changed the title Cg/verify client ivc flow feat: API to verify ClientIVC proofs Jul 11, 2024
@codygunton codygunton force-pushed the cg/verify-client-ivc-flow branch from 2405071 to 92015eb Compare July 11, 2024 04:13
@codygunton codygunton requested a review from ludamad July 11, 2024 15:50
@codygunton codygunton changed the title feat: API to verify ClientIVC proofs feat: Verify ClientIVC proofs through Bb binary Jul 11, 2024
@codygunton codygunton marked this pull request as ready for review July 11, 2024 16:40
Copy link
Collaborator

@ludamad ludamad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

{
std::vector<Commitment> points;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why underscore? Underscore signifies unused variable elsewhere in codebase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err, here I meant that the variable is 'hidden' / about to be replaces, not sure better notation for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather just use a filter but I'm trying to get this in

@codygunton codygunton merged commit 3760c64 into master Jul 11, 2024
92 checks passed
@codygunton codygunton deleted the cg/verify-client-ivc-flow branch July 11, 2024 18:11
@AztecBot
Copy link
Collaborator

Benchmark results

Metrics with a significant change:

  • avm_simulation_time_ms (Token:mint_public): 335 (+494%)
  • avm_simulation_time_ms (Token:transfer_public): 30.3 (-48%)
  • protocol_circuit_proving_time_in_ms (base-parity): 1,398 (-31%)
Detailed results

All benchmarks are run on txs on the Benchmarking contract on the repository. Each tx consists of a batch call to create_note and increment_balance, which guarantees that each tx has a private call, a nested private call, a public call, and a nested public call, as well as an emitted private note, an unencrypted log, and public storage read and write.

This benchmark source data is available in JSON format on S3 here.

Proof generation

Each column represents the number of threads used in proof generation.

Metric 1 threads 4 threads 16 threads 32 threads 64 threads
proof_construction_time_sha256_ms 5,746 (+1%) 1,546 (+1%) 709 (+1%) 762 (-3%) 770 (+2%)
proof_construction_time_sha256_30_ms 11,823 (-11%) 3,175 (-6%) 1,413 1,459 (+1%) 1,466
proof_construction_time_sha256_100_ms 43,990 11,799 5,648 (-2%) 5,409 (-2%) 5,359
proof_construction_time_poseidon_hash_ms 78.0 34.0 34.0 58.0 88.0 (-1%)
proof_construction_time_poseidon_hash_30_ms 1,523 (+1%) 420 (+1%) 200 224 (-1%) 266 (+1%)
proof_construction_time_poseidon_hash_100_ms 5,654 (+1%) 1,527 (+1%) 686 (+2%) 752 (+4%) 751 (-1%)

L2 block published to L1

Each column represents the number of txs on an L2 block published to L1.

Metric 4 txs 8 txs 16 txs
l1_rollup_calldata_size_in_bytes 708 708 708
l1_rollup_calldata_gas 6,588 6,590 6,600
l1_rollup_execution_gas 583,050 583,203 583,364
l2_block_processing_time_in_ms 766 (+1%) 1,423 2,731
l2_block_building_time_in_ms 13,042 (-1%) 26,033 50,468
l2_block_rollup_simulation_time_in_ms 13,042 (-1%) 26,033 50,467
l2_block_public_tx_process_time_in_ms 10,956 (-1%) 23,673 48,113

L2 chain processing

Each column represents the number of blocks on the L2 chain where each block has 8 txs.

Metric 3 blocks 5 blocks
node_history_sync_time_in_ms 7,121 (-1%) 9,956
node_database_size_in_bytes 12,419,152 16,416,848
pxe_database_size_in_bytes 16,254 26,813

Circuits stats

Stats on running time and I/O sizes collected for every kernel circuit run across all benchmarks.

Circuit simulation_time_in_ms witness_generation_time_in_ms input_size_in_bytes output_size_in_bytes proving_time_in_ms proof_size_in_bytes num_public_inputs size_in_gates
private-kernel-init 117 (+1%) 403 (+1%) 21,732 54,085 N/A N/A N/A N/A
private-kernel-inner 229 721 (-1%) 81,199 54,264 N/A N/A N/A N/A
private-kernel-tail 1,134 2,550 (+1%) 61,808 61,554 N/A N/A N/A N/A
base-parity 6.50 (-1%) 814 (-4%) 160 96.0 ⚠️ 1,398 (-31%) 12,676 3.00 131,072
root-parity 108 (-2%) 118 64,860 96.0 48,918 12,676 3.00 4,194,304
base-rollup 4,259 (+1%) 4,934 180,315 632 48,237 13,476 28.0 4,194,304
root-rollup 152 120 (-1%) 51,261 652 42,358 (+1%) 13,412 26.0 4,194,304
public-kernel-setup 197 (-2%) 2,429 (+1%) 112,536 80,310 22,468 (-1%) 118,916 3,323 2,097,152
public-kernel-app-logic 150 3,284 (-1%) 112,536 80,310 10,099 (-1%) 118,916 3,323 1,048,576
public-kernel-tail 894 26,917 (-2%) 409,413 10,046 70,910 (-4%) 24,868 384 8,388,608
private-kernel-reset-tiny 1,287 1,009 77,007 53,954 N/A N/A N/A N/A
private-kernel-tail-to-public 6,930 2,922 (+2%) 777,415 1,632 N/A N/A N/A N/A
public-kernel-teardown 140 (-1%) 3,265 (-2%) 112,536 80,310 22,533 (-1%) 118,916 3,323 2,097,152
merge-rollup 57.6 N/A 33,566 632 N/A N/A N/A N/A
undefined N/A N/A N/A N/A 164,321 (+1%) N/A N/A N/A

Stats on running time collected for app circuits

Function input_size_in_bytes output_size_in_bytes witness_generation_time_in_ms proof_size_in_bytes proving_time_in_ms
ContractClassRegisterer:register 1,312 9,344 398 (+1%) N/A N/A
ContractInstanceDeployer:deploy 1,376 9,344 25.1 N/A N/A
MultiCallEntrypoint:entrypoint 1,888 9,344 626 (+1%) N/A N/A
GasToken:deploy 1,344 9,344 577 (+1%) N/A N/A
SchnorrAccount:constructor 1,280 9,344 429 N/A N/A
SchnorrAccount:entrypoint 2,272 9,344 762 N/A N/A
Token:privately_mint_private_note 1,248 9,344 501 (-1%) N/A N/A
FPC:fee_entrypoint_public 1,312 9,344 104 (+2%) N/A N/A
Token:transfer 1,280 9,344 1,465 (-1%) N/A N/A
AuthRegistry:set_authorized (avm) 19,222 N/A N/A 95,392 2,096 (-1%)
FPC:prepare_fee (avm) 26,664 N/A N/A 95,456 2,791 (-2%)
Token:transfer_public (avm) 42,914 N/A N/A 95,456 3,169 (-3%)
AuthRegistry:consume (avm) 33,100 N/A N/A 95,424 2,743 (-2%)
FPC:pay_refund (avm) 36,829 N/A N/A 95,424 10,712 (-4%)
Benchmarking:create_note 1,312 9,344 425 N/A N/A
SchnorrAccount:verify_private_authwit 1,248 9,344 41.5 N/A N/A
Token:unshield 1,344 9,344 1,177 (-1%) N/A N/A
FPC:fee_entrypoint_private 1,344 9,344 1,529 (-5%) N/A N/A

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
GasToken:_increase_public_balance 101 (-1%) 13,790
GasToken:set_portal 12.8 (+11%) 3,339
Token:constructor 125 (-4%) 23,692
FPC:constructor 92.3 (-2%) 13,592
GasToken:mint_public 81.7 10,158
Token:mint_public ⚠️ 335 (+494%) 19,034
Token:assert_minter_and_mint 68.1 (-5%) 12,925
AuthRegistry:set_authorized 44.8 (-13%) 7,812
FPC:prepare_fee 100 (-15%) 15,062
Token:transfer_public ⚠️ 30.3 (-48%) 31,218
FPC:pay_refund 133 (-16%) 25,260
Benchmarking:increment_balance 1,346 15,267
Token:_increase_public_balance 15.2 (-27%) 15,006
FPC:pay_refund_with_shielded_rebate 179 (-5%) 26,347

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.154 (-7%)

Tree insertion stats

The duration to insert a fixed batch of leaves into each tree type.

Metric 1 leaves 16 leaves 64 leaves 128 leaves 256 leaves 512 leaves 1024 leaves
batch_insert_into_append_only_tree_16_depth_ms 10.4 16.7 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.8 31.7 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.599 0.512 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 48.0 76.2 132 (+2%) 246 473 (+1%)
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 95.9 159 287 543 1,055
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.490 0.468 0.454 (+1%) 0.445 0.442 (+1%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 59.7 112 (+1%) 185 (+2%) 356 (+1%) 697 (+1%)
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 109 207 355 691 1,363
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.504 0.501 0.489 (+2%) 0.481 (+1%) 0.480 (+1%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 72.9 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A 133 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A 0.518 N/A N/A N/A N/A

Miscellaneous

Transaction sizes based on how many contract classes are registered in the tx.

Metric 0 registered classes 1 registered classes
tx_size_in_bytes 76,837 667,838

Transaction size based on fee payment method

| Metric | |
| - | |

rahul-kothari pushed a commit that referenced this pull request Jul 15, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.46.5</summary>

##
[0.46.5](aztec-package-v0.46.4...aztec-package-v0.46.5)
(2024-07-14)


### Miscellaneous

* **aztec-package:** Synchronize aztec-packages versions
</details>

<details><summary>barretenberg.js: 0.46.5</summary>

##
[0.46.5](barretenberg.js-v0.46.4...barretenberg.js-v0.46.5)
(2024-07-14)


### Miscellaneous

* **barretenberg.js:** Synchronize aztec-packages versions
</details>

<details><summary>aztec-packages: 0.46.5</summary>

##
[0.46.5](aztec-packages-v0.46.4...aztec-packages-v0.46.5)
(2024-07-14)


### Features

* Added barrett_reduction implementation into uintx
([#6768](#6768))
([abced57](abced57))
* Databus allows arbitrarily many reads per index
([#6524](#6524))
([f07200c](f07200c))
* Let LSP always work in a Noir workspace if there's any
(noir-lang/noir#5461)
([8403e84](8403e84))
* Multiple trace structuring configurations
([#7408](#7408))
([e4abe1d](e4abe1d))
* Verify ClientIVC proofs through Bb binary
([#7407](#7407))
([3760c64](3760c64))


### Bug Fixes

* Lagrange interpolation
([#7440](#7440))
([76bcd72](76bcd72))
* Move BigInt modulus checks to runtime in brillig
(noir-lang/noir#5374)
([8403e84](8403e84))
* Run macro processors in the elaborator
(noir-lang/noir#5472)
([8403e84](8403e84))


### Miscellaneous

* Keccak256 in Noir (noir-lang/noir#5316)
([8403e84](8403e84))
* Redo typo PR by omahs (noir-lang/noir#5487)
([8403e84](8403e84))
* Replace relative paths to noir-protocol-circuits
([e89bfd8](e89bfd8))
* Replace relative paths to noir-protocol-circuits
([fae353e](fae353e))


### Documentation

* Minor comments for private refunds/partial notes
([#7447](#7447))
([9bcbb6c](9bcbb6c))
</details>

<details><summary>barretenberg: 0.46.5</summary>

##
[0.46.5](barretenberg-v0.46.4...barretenberg-v0.46.5)
(2024-07-14)


### Features

* Added barrett_reduction implementation into uintx
([#6768](#6768))
([abced57](abced57))
* Databus allows arbitrarily many reads per index
([#6524](#6524))
([f07200c](f07200c))
* Multiple trace structuring configurations
([#7408](#7408))
([e4abe1d](e4abe1d))
* Verify ClientIVC proofs through Bb binary
([#7407](#7407))
([3760c64](3760c64))


### Bug Fixes

* Lagrange interpolation
([#7440](#7440))
([76bcd72](76bcd72))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
AztecBot added a commit to AztecProtocol/barretenberg that referenced this pull request Jul 16, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.46.5</summary>

##
[0.46.5](AztecProtocol/aztec-packages@aztec-package-v0.46.4...aztec-package-v0.46.5)
(2024-07-14)


### Miscellaneous

* **aztec-package:** Synchronize aztec-packages versions
</details>

<details><summary>barretenberg.js: 0.46.5</summary>

##
[0.46.5](AztecProtocol/aztec-packages@barretenberg.js-v0.46.4...barretenberg.js-v0.46.5)
(2024-07-14)


### Miscellaneous

* **barretenberg.js:** Synchronize aztec-packages versions
</details>

<details><summary>aztec-packages: 0.46.5</summary>

##
[0.46.5](AztecProtocol/aztec-packages@aztec-packages-v0.46.4...aztec-packages-v0.46.5)
(2024-07-14)


### Features

* Added barrett_reduction implementation into uintx
([#6768](AztecProtocol/aztec-packages#6768))
([abced57](AztecProtocol/aztec-packages@abced57))
* Databus allows arbitrarily many reads per index
([#6524](AztecProtocol/aztec-packages#6524))
([f07200c](AztecProtocol/aztec-packages@f07200c))
* Let LSP always work in a Noir workspace if there's any
(noir-lang/noir#5461)
([8403e84](AztecProtocol/aztec-packages@8403e84))
* Multiple trace structuring configurations
([#7408](AztecProtocol/aztec-packages#7408))
([e4abe1d](AztecProtocol/aztec-packages@e4abe1d))
* Verify ClientIVC proofs through Bb binary
([#7407](AztecProtocol/aztec-packages#7407))
([3760c64](AztecProtocol/aztec-packages@3760c64))


### Bug Fixes

* Lagrange interpolation
([#7440](AztecProtocol/aztec-packages#7440))
([76bcd72](AztecProtocol/aztec-packages@76bcd72))
* Move BigInt modulus checks to runtime in brillig
(noir-lang/noir#5374)
([8403e84](AztecProtocol/aztec-packages@8403e84))
* Run macro processors in the elaborator
(noir-lang/noir#5472)
([8403e84](AztecProtocol/aztec-packages@8403e84))


### Miscellaneous

* Keccak256 in Noir (noir-lang/noir#5316)
([8403e84](AztecProtocol/aztec-packages@8403e84))
* Redo typo PR by omahs (noir-lang/noir#5487)
([8403e84](AztecProtocol/aztec-packages@8403e84))
* Replace relative paths to noir-protocol-circuits
([e89bfd8](AztecProtocol/aztec-packages@e89bfd8))
* Replace relative paths to noir-protocol-circuits
([fae353e](AztecProtocol/aztec-packages@fae353e))


### Documentation

* Minor comments for private refunds/partial notes
([#7447](AztecProtocol/aztec-packages#7447))
([9bcbb6c](AztecProtocol/aztec-packages@9bcbb6c))
</details>

<details><summary>barretenberg: 0.46.5</summary>

##
[0.46.5](AztecProtocol/aztec-packages@barretenberg-v0.46.4...barretenberg-v0.46.5)
(2024-07-14)


### Features

* Added barrett_reduction implementation into uintx
([#6768](AztecProtocol/aztec-packages#6768))
([abced57](AztecProtocol/aztec-packages@abced57))
* Databus allows arbitrarily many reads per index
([#6524](AztecProtocol/aztec-packages#6524))
([f07200c](AztecProtocol/aztec-packages@f07200c))
* Multiple trace structuring configurations
([#7408](AztecProtocol/aztec-packages#7408))
([e4abe1d](AztecProtocol/aztec-packages@e4abe1d))
* Verify ClientIVC proofs through Bb binary
([#7407](AztecProtocol/aztec-packages#7407))
([3760c64](AztecProtocol/aztec-packages@3760c64))


### Bug Fixes

* Lagrange interpolation
([#7440](AztecProtocol/aztec-packages#7440))
([76bcd72](AztecProtocol/aztec-packages@76bcd72))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants