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 non membership #5152

Merged
merged 10 commits into from
Mar 12, 2024
Merged

feat: Nullifier non membership #5152

merged 10 commits into from
Mar 12, 2024

Conversation

LeilaWang
Copy link
Collaborator

@LeilaWang LeilaWang commented Mar 12, 2024

Allow public functions to push non-existent read requests for nullifiers. The kernel will check that the values being read are not in the tree and not in the pending set.
Note that the read requests are only propagated to non-revertible data. We will move all types of requests to validation_requests in function circuit's public inputs. And they should always be verified whether the tx reverts or not.

Copy link
Contributor

github-actions bot commented Mar 12, 2024

Changes to circuit sizes

Generated at commit: 0ac6867876c1d7de38ee3522a76de17b27cae4be, compared to commit: 5457edb3ddd29df96906f98fb05469a26a644654

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
public_kernel_tail +66,758 ❌ +112.14% +180,325 ❌ +97.99%
public_kernel_app_logic_simulated +24 ❌ +2.64% +48 ❌ +2.64%
public_kernel_setup_simulated +24 ❌ +2.64% +48 ❌ +2.64%
public_kernel_teardown_simulated +24 ❌ +2.64% +48 ❌ +2.64%
public_kernel_tail_simulated +24 ❌ +2.64% +48 ❌ +2.64%
public_kernel_teardown +553 ❌ +1.93% +2,186 ❌ +1.22%
public_kernel_setup +481 ❌ +1.79% +2,114 ❌ +1.19%
public_kernel_app_logic +615 ❌ +1.13% +3,377 ❌ +1.09%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
public_kernel_tail 126,287 (+66,758) +112.14% 364,346 (+180,325) +97.99%
public_kernel_app_logic_simulated 932 (+24) +2.64% 1,867 (+48) +2.64%
public_kernel_setup_simulated 932 (+24) +2.64% 1,867 (+48) +2.64%
public_kernel_teardown_simulated 932 (+24) +2.64% 1,867 (+48) +2.64%
public_kernel_tail_simulated 932 (+24) +2.64% 1,867 (+48) +2.64%
public_kernel_teardown 29,162 (+553) +1.93% 181,232 (+2,186) +1.22%
public_kernel_setup 27,416 (+481) +1.79% 179,485 (+2,114) +1.19%
public_kernel_app_logic 54,928 (+615) +1.13% 312,722 (+3,377) +1.09%

@AztecBot
Copy link
Collaborator

AztecBot commented Mar 12, 2024

Benchmark results

Metrics with a significant change:

  • circuit_simulation_time_in_ms (public-kernel-tail): 178 (+92%)
  • circuit_input_size_in_bytes (public-kernel-tail): 40,926 (+20%)
  • tx_sequencer_processing_time_ms (1): 727 (+18%)
  • l2_block_public_tx_process_time_in_ms (8): 5,877 (+16%)
  • l2_block_public_tx_process_time_in_ms (32): 23,231 (+16%)
  • l2_block_public_tx_process_time_in_ms (64): 46,432 (+17%)
  • note_successful_decrypting_time_in_ms (8): 231 (+52%)
  • note_trial_decrypting_time_in_ms (32): 91.0 (+149%)
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 a74dccbd 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,668 18,820 36,356
l1_rollup_calldata_gas 65,944 238,804 469,520
l1_rollup_execution_gas 666,576 953,665 1,336,828
l2_block_processing_time_in_ms 1,323 4,693 (-3%) 9,222
note_successful_decrypting_time_in_ms ⚠️ 231 (+52%) 573 (+11%) 1,002
note_trial_decrypting_time_in_ms 36.5 (-33%) ⚠️ 91.0 (+149%) 132 (-3%)
l2_block_building_time_in_ms 12,935 (+4%) 51,179 (+4%) 103,180 (+6%)
l2_block_rollup_simulation_time_in_ms 7,032 (-5%) 27,891 (-4%) 56,649 (-2%)
l2_block_public_tx_process_time_in_ms ⚠️ 5,877 (+16%) ⚠️ 23,231 (+16%) ⚠️ 46,432 (+17%)

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 13,826 (-5%) 27,021 (-4%)
note_history_successful_decrypting_time_in_ms 1,316 (+3%) 2,451 (+1%)
note_history_trial_decrypting_time_in_ms 108 (-8%) 154 (+10%)
node_database_size_in_bytes 18,653,264 35,233,872
pxe_database_size_in_bytes 29,859 59,414

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 273 44,338 27,700
private-kernel-ordering 208 (+1%) 52,324 14,326
base-rollup 634 (-4%) 177,083 925
root-rollup 68.5 (-3%) 4,176 789
private-kernel-inner 363 (+1%) 73,197 27,700
public-kernel-app-logic 187 (+4%) 35,198 (+2%) 28,215 (+2%)
public-kernel-tail ⚠️ 178 (+92%) ⚠️ 40,926 (+20%) 28,215 (+2%)
merge-rollup 8.33 (-3%) 2,696 925

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 512 leaves 1024 leaves 2048 leaves 4096 leaves 32 leaves
batch_insert_into_append_only_tree_16_depth_ms 10.1 (-2%) 16.0 (-1%) N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.8 31.6 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.586 (-2%) 0.496 (-1%) N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 46.9 (+2%) 71.7 (-2%) 230 (-1%) 448 (+1%) 863 (-1%) 1,717 (-1%) N/A
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 96.0 159 543 1,055 2,079 4,127 N/A
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.481 (+2%) 0.443 (-2%) 0.419 (-1%) 0.420 (+1%) 0.411 (-1%) 0.412 (-1%) N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 55.0 (+2%) 106 (-1%) 338 672 (+2%) 1,308 (-1%) 2,614 N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 104 207 691 1,363 2,707 5,395 N/A
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.490 (+2%) 0.479 (-1%) 0.458 0.462 (+2%) 0.454 0.455 N/A
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A N/A N/A N/A N/A N/A 61.6 (+1%)
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A N/A N/A N/A N/A N/A N/A 109
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A N/A N/A N/A N/A N/A N/A 0.540 (+1%)

Miscellaneous

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

Metric 0 registered classes
tx_size_in_bytes 19,191

Transaction processing duration by data writes.

Metric 0 new note hashes 1 new note hashes
tx_pxe_processing_time_ms 2,812 1,443
Metric 0 public data writes 1 public data writes
tx_sequencer_processing_time_ms 8.70 (+2%) ⚠️ 727 (+18%)

@LeilaWang LeilaWang marked this pull request as ready for review March 12, 2024 14:50
@LeilaWang LeilaWang requested a review from sirasistant March 12, 2024 14:50
Copy link
Collaborator

@sirasistant sirasistant left a comment

Choose a reason for hiding this comment

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

Looks great! :D

Comment on lines 91 to 94
assert(
error != NonMembershipCheckErrorCode.NOT_LESS_THAN_NEXT, "Key is not less than the next leaf"
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could add an exhaustive check here in case we add more items to the emulated enum and we forgot to add the corresponding assertion here. We could just add at the end an assert(false, "Unknown...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Great idea!

@LeilaWang LeilaWang merged commit 426bd6d into master Mar 12, 2024
97 checks passed
@LeilaWang LeilaWang deleted the lw/nullifier_non_membership branch March 12, 2024 16:19
TomAFrench added a commit that referenced this pull request Mar 12, 2024
* master:
  feat: Nullifier non membership (#5152)
  refactor: share code between provers (#4655)
  fix: Increase the json limit for RPC requests (#5161)
  fix: Move timers for ClientIVC breakdown (#5145)
  chore(master): Release 0.27.0 (#5100)
critesjosh pushed a commit that referenced this pull request Mar 12, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[0.27.1](aztec-package-v0.27.0...aztec-package-v0.27.1)
(2024-03-12)


### Miscellaneous

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

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

##
[0.27.1](barretenberg.js-v0.27.0...barretenberg.js-v0.27.1)
(2024-03-12)


### Miscellaneous

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

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

##
[0.27.1](aztec-cli-v0.27.0...aztec-cli-v0.27.1)
(2024-03-12)


### Miscellaneous

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

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

##
[0.27.1](aztec-packages-v0.27.0...aztec-packages-v0.27.1)
(2024-03-12)


### Features

* Further ClientIVC breakdown
([#5146](#5146))
([c8e1cb8](c8e1cb8))
* Nullifier non membership
([#5152](#5152))
([426bd6d](426bd6d))


### Bug Fixes

* Increase the json limit for RPC requests
([#5161](#5161))
([419958c](419958c))
* Move timers for ClientIVC breakdown
([#5145](#5145))
([5457edb](5457edb))


### Miscellaneous

* **boxes:** Adding clone contract option
([#4980](#4980))
([a427aa5](a427aa5))
* Share code between provers
([#4655](#4655))
([ef10d65](ef10d65))
</details>

<details><summary>barretenberg: 0.27.1</summary>

##
[0.27.1](barretenberg-v0.27.0...barretenberg-v0.27.1)
(2024-03-12)


### Features

* Further ClientIVC breakdown
([#5146](#5146))
([c8e1cb8](c8e1cb8))


### Bug Fixes

* Move timers for ClientIVC breakdown
([#5145](#5145))
([5457edb](5457edb))


### Miscellaneous

* Share code between provers
([#4655](#4655))
([ef10d65](ef10d65))
</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 13, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[0.27.1](AztecProtocol/aztec-packages@aztec-package-v0.27.0...aztec-package-v0.27.1)
(2024-03-12)


### Miscellaneous

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

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

##
[0.27.1](AztecProtocol/aztec-packages@barretenberg.js-v0.27.0...barretenberg.js-v0.27.1)
(2024-03-12)


### Miscellaneous

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

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

##
[0.27.1](AztecProtocol/aztec-packages@aztec-cli-v0.27.0...aztec-cli-v0.27.1)
(2024-03-12)


### Miscellaneous

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

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

##
[0.27.1](AztecProtocol/aztec-packages@aztec-packages-v0.27.0...aztec-packages-v0.27.1)
(2024-03-12)


### Features

* Further ClientIVC breakdown
([#5146](AztecProtocol/aztec-packages#5146))
([c8e1cb8](AztecProtocol/aztec-packages@c8e1cb8))
* Nullifier non membership
([#5152](AztecProtocol/aztec-packages#5152))
([426bd6d](AztecProtocol/aztec-packages@426bd6d))


### Bug Fixes

* Increase the json limit for RPC requests
([#5161](AztecProtocol/aztec-packages#5161))
([419958c](AztecProtocol/aztec-packages@419958c))
* Move timers for ClientIVC breakdown
([#5145](AztecProtocol/aztec-packages#5145))
([5457edb](AztecProtocol/aztec-packages@5457edb))


### Miscellaneous

* **boxes:** Adding clone contract option
([#4980](AztecProtocol/aztec-packages#4980))
([a427aa5](AztecProtocol/aztec-packages@a427aa5))
* Share code between provers
([#4655](AztecProtocol/aztec-packages#4655))
([ef10d65](AztecProtocol/aztec-packages@ef10d65))
</details>

<details><summary>barretenberg: 0.27.1</summary>

##
[0.27.1](AztecProtocol/aztec-packages@barretenberg-v0.27.0...barretenberg-v0.27.1)
(2024-03-12)


### Features

* Further ClientIVC breakdown
([#5146](AztecProtocol/aztec-packages#5146))
([c8e1cb8](AztecProtocol/aztec-packages@c8e1cb8))


### Bug Fixes

* Move timers for ClientIVC breakdown
([#5145](AztecProtocol/aztec-packages#5145))
([5457edb](AztecProtocol/aztec-packages@5457edb))


### Miscellaneous

* Share code between provers
([#4655](AztecProtocol/aztec-packages#4655))
([ef10d65](AztecProtocol/aztec-packages@ef10d65))
</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