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: Nullifier read requests in public kernel #4910

Merged
merged 16 commits into from
Mar 7, 2024

Conversation

LeilaWang
Copy link
Collaborator

@LeilaWang LeilaWang commented Mar 4, 2024

Verifying nullifier read requests in tail public kernel circuit.

Copy link
Contributor

github-actions bot commented Mar 4, 2024

Changes to circuit sizes

Generated at commit: 715332ff33ed1d1af3340e15aa9c2a337b22ffc7, compared to commit: fed729daaa667b78e9291a9eae5ab8225f82d572

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
public_kernel_app_logic_simulated +24 ❌ +2.68% +48 ❌ +2.67%
public_kernel_setup_simulated +24 ❌ +2.68% +48 ❌ +2.67%
public_kernel_teardown_simulated +24 ❌ +2.68% +48 ❌ +2.67%
public_kernel_app_logic +408 ❌ +0.76% +3,125 ❌ +1.01%
public_kernel_setup +253 ❌ +0.95% +1,602 ❌ +0.91%
public_kernel_teardown +262 ❌ +0.92% +1,611 ❌ +0.90%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
public_kernel_app_logic_simulated 920 (+24) +2.68% 1,843 (+48) +2.67%
public_kernel_setup_simulated 920 (+24) +2.68% 1,843 (+48) +2.67%
public_kernel_teardown_simulated 920 (+24) +2.68% 1,843 (+48) +2.67%
public_kernel_app_logic 54,395 (+408) +0.76% 311,218 (+3,125) +1.01%
public_kernel_setup 26,969 (+253) +0.95% 178,346 (+1,602) +0.91%
public_kernel_teardown 28,679 (+262) +0.92% 180,057 (+1,611) +0.90%

@AztecBot
Copy link
Collaborator

AztecBot commented Mar 7, 2024

Benchmark results

Metrics with a significant change:

  • tx_sequencer_processing_time_ms (1): 580 (+25%)
  • node_history_sync_time_in_ms (5): 17,218 (+21%)
  • note_history_successful_decrypting_time_in_ms (5): 1,483 (+21%)
  • note_history_trial_decrypting_time_in_ms (5): 130 (+81%)
  • l2_block_public_tx_process_time_in_ms (8): 4,676 (+23%)
  • l2_block_public_tx_process_time_in_ms (32): 18,305 (+22%)
  • l2_block_public_tx_process_time_in_ms (64): 36,742 (+23%)
  • note_trial_decrypting_time_in_ms (8): 8.98 (-92%)
  • note_trial_decrypting_time_in_ms (64): 126 (+134%)
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.

Values are compared against data from master at commit 5cccc78e and shown if the difference exceeds 1%.

L2 block published to L1

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

Metric 8 txs 32 txs 64 txs
l1_rollup_calldata_size_in_bytes 5,700 18,884 36,452
l1_rollup_calldata_gas 66,588 239,300 470,156
l1_rollup_execution_gas 194,536 500,606 909,414
l2_block_processing_time_in_ms 1,189 (-1%) 4,505 (-1%) 8,948 (-1%)
note_successful_decrypting_time_in_ms 203 (+3%) 542 (-1%) 994 (-3%)
note_trial_decrypting_time_in_ms ⚠️ 8.98 (-92%) 63.4 (-3%) ⚠️ 126 (+134%)
l2_block_building_time_in_ms 12,032 (+8%) 47,607 (+7%) 95,357 (+7%)
l2_block_rollup_simulation_time_in_ms 7,327 29,236 58,485 (-1%)
l2_block_public_tx_process_time_in_ms ⚠️ 4,676 (+23%) ⚠️ 18,305 (+22%) ⚠️ 36,742 (+23%)

L2 chain processing

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

Metric 5 blocks 10 blocks
node_history_sync_time_in_ms ⚠️ 17,218 (+21%) 27,941 (+1%)
note_history_successful_decrypting_time_in_ms ⚠️ 1,483 (+21%) 2,431 (+2%)
note_history_trial_decrypting_time_in_ms ⚠️ 130 (+81%) 142 (+46%)
node_database_size_in_bytes 18,788,432 35,500,112
pxe_database_size_in_bytes 29,923 59,478

Circuits stats

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

Circuit circuit_simulation_time_in_ms circuit_input_size_in_bytes circuit_output_size_in_bytes
private-kernel-init 254 44,736 28,001
private-kernel-ordering 197 (+2%) 52,625 14,627
base-rollup 669 (+2%) 177,932 997
root-rollup 69.0 4,320 825
private-kernel-inner 322 73,715 28,001
public-kernel-app-logic 165 34,920 (+8%) 27,972 (+10%)
public-kernel-tail 82.8 34,507 27,972
merge-rollup 8.53 2,840 997

Tree insertion stats

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

Metric 1 leaves 2 leaves 8 leaves 16 leaves 32 leaves 64 leaves 128 leaves 512 leaves 1024 leaves 2048 leaves 4096 leaves
batch_insert_into_append_only_tree_16_depth_ms 9.81 (+1%) 10.4 (-5%) 16.6 (-2%) 16.6 (+2%) 22.0 (-1%) 35.4 (-1%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.9 17.5 23.0 31.6 47.0 79.0 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.569 0.579 (-5%) 0.706 (-2%) 0.513 (+2%) 0.461 (-1%) 0.441 (-1%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A N/A N/A N/A 45.9 72.9 229 (-3%) 463 (+4%) 867 (-1%) 1,718 (-1%)
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A N/A N/A N/A 96.0 159 543 1,055 2,079 4,127
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A N/A N/A N/A 0.470 0.450 0.419 (-2%) 0.434 (+4%) 0.413 (-1%) 0.412 (-1%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A N/A N/A N/A 53.8 107 340 (+1%) 682 (+3%) 1,312 (-2%) 2,607 (-1%)
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A N/A N/A N/A 104 207 691 1,363 2,707 5,395
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A N/A N/A N/A 0.478 0.483 0.463 (+1%) 0.467 (+3%) 0.456 (-1%) 0.454
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A N/A 61.8 (+1%) N/A N/A N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A N/A N/A 109 N/A N/A N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A N/A N/A 0.540 (+1%) N/A N/A N/A N/A N/A N/A

Miscellaneous

Transaction sizes based on how many contracts are deployed in the tx.

Metric 0 deployed contracts
tx_size_in_bytes 19,179

Transaction processing duration by data writes.

Metric 0 new note hashes 1 new note hashes
tx_pxe_processing_time_ms 2,712 1,391 (+1%)
Metric 0 public data writes 1 public data writes
tx_sequencer_processing_time_ms 5.71 (+3%) ⚠️ 580 (+25%)

@@ -83,6 +84,24 @@ pub fn array_concat<T, N, S, M>(array1: [T; N], array2: [T; S]) -> [T; M] where
result
}

pub fn array_merge<T, N>(array1: [T; N], array2: [T; N]) -> [T; N] where T: Empty + Eq {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need to assert that the non-empty length of array1 plus the non-empty length of array2 is less than or equal to N?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It will fail to run when trying to insert to index N. A clearer error message would be nice, but checking it is a bit too expensive for my liking 😅

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see we're checking in TS anyway so we should get the clear message.

for i in 0..MAX_NON_REVERTIBLE_NULLIFIERS_PER_TX {
if i < num_extra_nullifier {
let mock_value = self.get_mock_nullifier_value(index_offset + i);
self.end.new_nullifiers.push(
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this be appending to end_non_revertible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ooops. Good catch!

@@ -0,0 +1,62 @@
import { Tuple } from '@aztec/foundation/serialize';

export interface IsEmpty {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not in this PR, but thoughts on moving this to a more universal place?

const numNonEmptyItems1 = countAccumulatedItems(arr1);
const arr = [...arr0, ...arr1] as Tuple<T, NM>;
if (numNonEmptyItems0 < arr0.length) {
const emptyItem = arr0[numNonEmptyItems0];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Clever!

Copy link
Collaborator

@just-mitch just-mitch left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@LeilaWang LeilaWang marked this pull request as ready for review March 7, 2024 17:26
@LeilaWang LeilaWang merged commit 0e44247 into master Mar 7, 2024
96 checks passed
@LeilaWang LeilaWang deleted the lw/nullifier_read_requests_in_public branch March 7, 2024 20:18
PhilWindle pushed a commit that referenced this pull request Mar 8, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[0.26.6](aztec-package-v0.26.5...aztec-package-v0.26.6)
(2024-03-08)


### Miscellaneous

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

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

##
[0.26.6](barretenberg.js-v0.26.5...barretenberg.js-v0.26.6)
(2024-03-08)


### Miscellaneous

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

<details><summary>aztec-cli: 0.26.6</summary>

##
[0.26.6](aztec-cli-v0.26.5...aztec-cli-v0.26.6)
(2024-03-08)


### Features

* Show bytecode size per function in CLI inspect-contract
([#5059](#5059))
([cb9fdc6](cb9fdc6))
</details>

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

##
[0.26.6](aztec-packages-v0.26.5...aztec-packages-v0.26.6)
(2024-03-08)


### Features

* Basic public reverts
([#4870](#4870))
([5cccc78](5cccc78))
* Deploying new inbox
([#5036](#5036))
([fed729d](fed729d))
* Detect unknown note type ids in compute_note_hash
([#5086](#5086))
([6206bec](6206bec))
* Easy deployment of protocol contracts in e2e
([#4983](#4983))
([480161f](480161f))
* IPA documentation
([#4924](#4924))
([48bd22e](48bd22e))
* Nullifier read requests in public kernel
([#4910](#4910))
([0e44247](0e44247))
* Show bytecode size per function in CLI inspect-contract
([#5059](#5059))
([cb9fdc6](cb9fdc6))
* Updating an SMT solver class
([#4981](#4981))
([4b94d58](4b94d58))


### Bug Fixes

* Canonical contract address
([#5030](#5030))
([b2af880](b2af880))
* Flaky deployment test
([#5035](#5035))
([039eafc](039eafc))
* Pull the correct platform image for noir
([#5097](#5097))
([3342371](3342371))
* Sleep function memory leak
([#5023](#5023))
([a72cfea](a72cfea)),
closes
[#4817](#4817)
* Storage v2
([#5027](#5027))
([fe3190e](fe3190e))
* Update protogalaxy cmake dependencies
([#5066](#5066))
([507c374](507c374))


### Miscellaneous

* Address warnings in noir test suite
([#4966](#4966))
([7ef4ef5](7ef4ef5))
* Bootstrap noir natively if nargo is invalid
([#5034](#5034))
([df089de](df089de))
* Build avm transpiler if we are on mac
([#5039](#5039))
([c2966b9](c2966b9))
* **ci:** Re-enable certain bb solidity ACIR tests
([#5065](#5065))
([58e1ff4](58e1ff4))
* Cleanup of prover and verifier instances
([#4959](#4959))
([f2fdefd](f2fdefd))
* Delete bootstrap scripts from `noir/noir-repo`
([#5044](#5044))
([add91ca](add91ca))
* Disable `hello_world_example` noir test in aztec-packages CI
([#5061](#5061))
([1be9243](1be9243))
* Join-split example Part 1
([#4965](#4965))
([b9de0f5](b9de0f5))
* Moving RootRollupInputs impl
([#5087](#5087))
([f3d9f9b](f3d9f9b))
* Remove eccvm functionality to update the op queue and ensure ultra ops
are populated through function
([#5084](#5084))
([77954ab](77954ab))


### Documentation

* Parity circuit naming fixes
([#5076](#5076))
([c255255](c255255))
</details>

<details><summary>barretenberg: 0.26.6</summary>

##
[0.26.6](barretenberg-v0.26.5...barretenberg-v0.26.6)
(2024-03-08)


### Features

* IPA documentation
([#4924](#4924))
([48bd22e](48bd22e))
* Updating an SMT solver class
([#4981](#4981))
([4b94d58](4b94d58))


### Bug Fixes

* Storage v2
([#5027](#5027))
([fe3190e](fe3190e))
* Update protogalaxy cmake dependencies
([#5066](#5066))
([507c374](507c374))


### Miscellaneous

* **ci:** Re-enable certain bb solidity ACIR tests
([#5065](#5065))
([58e1ff4](58e1ff4))
* Cleanup of prover and verifier instances
([#4959](#4959))
([f2fdefd](f2fdefd))
* Join-split example Part 1
([#4965](#4965))
([b9de0f5](b9de0f5))
* Remove eccvm functionality to update the op queue and ensure ultra ops
are populated through function
([#5084](#5084))
([77954ab](77954ab))
</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 Mar 9, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[0.26.6](AztecProtocol/aztec-packages@aztec-package-v0.26.5...aztec-package-v0.26.6)
(2024-03-08)


### Miscellaneous

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

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

##
[0.26.6](AztecProtocol/aztec-packages@barretenberg.js-v0.26.5...barretenberg.js-v0.26.6)
(2024-03-08)


### Miscellaneous

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

<details><summary>aztec-cli: 0.26.6</summary>

##
[0.26.6](AztecProtocol/aztec-packages@aztec-cli-v0.26.5...aztec-cli-v0.26.6)
(2024-03-08)


### Features

* Show bytecode size per function in CLI inspect-contract
([#5059](AztecProtocol/aztec-packages#5059))
([cb9fdc6](AztecProtocol/aztec-packages@cb9fdc6))
</details>

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

##
[0.26.6](AztecProtocol/aztec-packages@aztec-packages-v0.26.5...aztec-packages-v0.26.6)
(2024-03-08)


### Features

* Basic public reverts
([#4870](AztecProtocol/aztec-packages#4870))
([5cccc78](AztecProtocol/aztec-packages@5cccc78))
* Deploying new inbox
([#5036](AztecProtocol/aztec-packages#5036))
([fed729d](AztecProtocol/aztec-packages@fed729d))
* Detect unknown note type ids in compute_note_hash
([#5086](AztecProtocol/aztec-packages#5086))
([6206bec](AztecProtocol/aztec-packages@6206bec))
* Easy deployment of protocol contracts in e2e
([#4983](AztecProtocol/aztec-packages#4983))
([480161f](AztecProtocol/aztec-packages@480161f))
* IPA documentation
([#4924](AztecProtocol/aztec-packages#4924))
([48bd22e](AztecProtocol/aztec-packages@48bd22e))
* Nullifier read requests in public kernel
([#4910](AztecProtocol/aztec-packages#4910))
([0e44247](AztecProtocol/aztec-packages@0e44247))
* Show bytecode size per function in CLI inspect-contract
([#5059](AztecProtocol/aztec-packages#5059))
([cb9fdc6](AztecProtocol/aztec-packages@cb9fdc6))
* Updating an SMT solver class
([#4981](AztecProtocol/aztec-packages#4981))
([4b94d58](AztecProtocol/aztec-packages@4b94d58))


### Bug Fixes

* Canonical contract address
([#5030](AztecProtocol/aztec-packages#5030))
([b2af880](AztecProtocol/aztec-packages@b2af880))
* Flaky deployment test
([#5035](AztecProtocol/aztec-packages#5035))
([039eafc](AztecProtocol/aztec-packages@039eafc))
* Pull the correct platform image for noir
([#5097](AztecProtocol/aztec-packages#5097))
([3342371](AztecProtocol/aztec-packages@3342371))
* Sleep function memory leak
([#5023](AztecProtocol/aztec-packages#5023))
([a72cfea](AztecProtocol/aztec-packages@a72cfea)),
closes
[#4817](AztecProtocol/aztec-packages#4817)
* Storage v2
([#5027](AztecProtocol/aztec-packages#5027))
([fe3190e](AztecProtocol/aztec-packages@fe3190e))
* Update protogalaxy cmake dependencies
([#5066](AztecProtocol/aztec-packages#5066))
([507c374](AztecProtocol/aztec-packages@507c374))


### Miscellaneous

* Address warnings in noir test suite
([#4966](AztecProtocol/aztec-packages#4966))
([7ef4ef5](AztecProtocol/aztec-packages@7ef4ef5))
* Bootstrap noir natively if nargo is invalid
([#5034](AztecProtocol/aztec-packages#5034))
([df089de](AztecProtocol/aztec-packages@df089de))
* Build avm transpiler if we are on mac
([#5039](AztecProtocol/aztec-packages#5039))
([c2966b9](AztecProtocol/aztec-packages@c2966b9))
* **ci:** Re-enable certain bb solidity ACIR tests
([#5065](AztecProtocol/aztec-packages#5065))
([58e1ff4](AztecProtocol/aztec-packages@58e1ff4))
* Cleanup of prover and verifier instances
([#4959](AztecProtocol/aztec-packages#4959))
([f2fdefd](AztecProtocol/aztec-packages@f2fdefd))
* Delete bootstrap scripts from `noir/noir-repo`
([#5044](AztecProtocol/aztec-packages#5044))
([add91ca](AztecProtocol/aztec-packages@add91ca))
* Disable `hello_world_example` noir test in aztec-packages CI
([#5061](AztecProtocol/aztec-packages#5061))
([1be9243](AztecProtocol/aztec-packages@1be9243))
* Join-split example Part 1
([#4965](AztecProtocol/aztec-packages#4965))
([b9de0f5](AztecProtocol/aztec-packages@b9de0f5))
* Moving RootRollupInputs impl
([#5087](AztecProtocol/aztec-packages#5087))
([f3d9f9b](AztecProtocol/aztec-packages@f3d9f9b))
* Remove eccvm functionality to update the op queue and ensure ultra ops
are populated through function
([#5084](AztecProtocol/aztec-packages#5084))
([77954ab](AztecProtocol/aztec-packages@77954ab))


### Documentation

* Parity circuit naming fixes
([#5076](AztecProtocol/aztec-packages#5076))
([c255255](AztecProtocol/aztec-packages@c255255))
</details>

<details><summary>barretenberg: 0.26.6</summary>

##
[0.26.6](AztecProtocol/aztec-packages@barretenberg-v0.26.5...barretenberg-v0.26.6)
(2024-03-08)


### Features

* IPA documentation
([#4924](AztecProtocol/aztec-packages#4924))
([48bd22e](AztecProtocol/aztec-packages@48bd22e))
* Updating an SMT solver class
([#4981](AztecProtocol/aztec-packages#4981))
([4b94d58](AztecProtocol/aztec-packages@4b94d58))


### Bug Fixes

* Storage v2
([#5027](AztecProtocol/aztec-packages#5027))
([fe3190e](AztecProtocol/aztec-packages@fe3190e))
* Update protogalaxy cmake dependencies
([#5066](AztecProtocol/aztec-packages#5066))
([507c374](AztecProtocol/aztec-packages@507c374))


### Miscellaneous

* **ci:** Re-enable certain bb solidity ACIR tests
([#5065](AztecProtocol/aztec-packages#5065))
([58e1ff4](AztecProtocol/aztec-packages@58e1ff4))
* Cleanup of prover and verifier instances
([#4959](AztecProtocol/aztec-packages#4959))
([f2fdefd](AztecProtocol/aztec-packages@f2fdefd))
* Join-split example Part 1
([#4965](AztecProtocol/aztec-packages#4965))
([b9de0f5](AztecProtocol/aztec-packages@b9de0f5))
* Remove eccvm functionality to update the op queue and ensure ultra ops
are populated through function
([#5084](AztecProtocol/aztec-packages#5084))
([77954ab](AztecProtocol/aztec-packages@77954ab))
</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