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: compute out hash in circuits #4561 #4873

Merged
merged 22 commits into from
Mar 6, 2024

Conversation

sklppy88
Copy link
Contributor

Resolves #4561.

@sklppy88 sklppy88 marked this pull request as ready for review February 29, 2024 22:23
@sklppy88 sklppy88 requested a review from LHerskind February 29, 2024 22:23
@sklppy88 sklppy88 marked this pull request as draft February 29, 2024 22:28
Copy link
Contributor

github-actions bot commented Feb 29, 2024

Changes to circuit sizes

Generated at commit: 0a4b3c5f3b74e2211c9c380c41d2931ced8c389d, compared to commit: fb6552c945bc25e4599a0500167a04a5e0177708

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_merge +239 ❌ +83.86% +4,987 ❌ +12.17%
rollup_base_simulated 0 ➖ 0.00% +2 ❌ +5.41%
rollup_root +239 ❌ +12.21% +4,987 ❌ +5.03%
rollup_base +187 ❌ +0.12% +7,044 ❌ +0.41%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_merge 524 (+239) +83.86% 45,970 (+4,987) +12.17%
rollup_base_simulated 1 (0) 0.00% 39 (+2) +5.41%
rollup_root 2,197 (+239) +12.21% 104,111 (+4,987) +5.03%
rollup_base 161,626 (+187) +0.12% 1,733,594 (+7,044) +0.41%

@AztecBot
Copy link
Collaborator

AztecBot commented Feb 29, 2024

Benchmark results

Metrics with a significant change:

  • circuit_simulation_time_in_ms (merge-rollup): 8.67 (+52%)
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 959158b9 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,480 (+1%) 238,988 469,460
l1_rollup_execution_gas 194,428 500,294 908,718
l2_block_processing_time_in_ms 1,193 (+1%) 4,512 9,019 (+1%)
note_successful_decrypting_time_in_ms 203 554 1,013 (+2%)
note_trial_decrypting_time_in_ms 8.89 (+8%) 74.7 (+10%) 38.2 (-70%)
l2_block_building_time_in_ms 16,366 (+1%) 65,022 130,602 (+1%)
l2_block_rollup_simulation_time_in_ms 12,465 (+1%) 49,623 (+1%) 99,770 (+1%)
l2_block_public_tx_process_time_in_ms 3,869 15,313 30,707

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 14,116 (-4%) 27,234 (-3%)
note_history_successful_decrypting_time_in_ms 1,230 (-6%) 2,394 (-2%)
note_history_trial_decrypting_time_in_ms 76.5 (-9%) 141 (-3%)
node_database_size_in_bytes 18,808,912 35,237,968 (-1%)
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 252 44,736 28,001
private-kernel-ordering 193 (+1%) 52,625 14,627
base-rollup 1,333 (+2%) 177,932 997 (+7%)
root-rollup 72.9 (+3%) 4,320 (+3%) 825
private-kernel-inner 320 (+1%) 73,715 28,001
public-kernel-app-logic 195 32,254 25,379
merge-rollup ⚠️ 8.67 (+52%) 2,840 (+5%) 997 (+7%)

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.88 (+1%) 10.4 13.9 (-6%) 16.0 (-1%) 22.4 (+2%) 35.6 (+2%) 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.573 0.579 0.589 (-6%) 0.495 (-1%) 0.467 (+1%) 0.444 (+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.7 72.4 (+1%) 231 442 (-1%) 877 (+1%) 1,749 (+2%)
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.469 0.447 (+1%) 0.421 0.415 0.417 (+1%) 0.419 (+2%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A N/A N/A N/A 55.1 107 (+1%) 341 (+1%) 657 (-1%) 1,317 2,628 (+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.490 0.483 (+1%) 0.459 0.452 (-1%) 0.456 0.456 (+1%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A N/A 61.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.534 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,594 (-1%) 1,376
Metric 0 public data writes 1 public data writes
tx_sequencer_processing_time_ms 0.0333 (+5%) 477

Copy link
Contributor

@LHerskind LHerskind left a comment

Choose a reason for hiding this comment

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

A few comments. Please add a small test for the hashes as well so we have something to match against, should help on the sizing issue 👍

@sklppy88 sklppy88 marked this pull request as ready for review March 1, 2024 11:14
@sklppy88 sklppy88 requested a review from LHerskind March 4, 2024 18:00
Copy link
Contributor

@LHerskind LHerskind left a comment

Choose a reason for hiding this comment

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

Good stuff 👍

@LHerskind
Copy link
Contributor

There is a default_previous_rollup_data function in the tests that should probably be updated for this, atm it will just have zeros, but likely a better option to fill in some values similar to what is done for other hashes.

@sklppy88 sklppy88 merged commit 06a9116 into master Mar 6, 2024
94 of 95 checks passed
@sklppy88 sklppy88 deleted the ek/feat/compute-out-hash-in-circuits branch March 6, 2024 13:24
PhilWindle pushed a commit that referenced this pull request Mar 6, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[0.26.4](aztec-package-v0.26.3...aztec-package-v0.26.4)
(2024-03-06)


### Miscellaneous

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

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

##
[0.26.4](barretenberg.js-v0.26.3...barretenberg.js-v0.26.4)
(2024-03-06)


### Miscellaneous

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

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

##
[0.26.4](aztec-cli-v0.26.3...aztec-cli-v0.26.4)
(2024-03-06)


### Miscellaneous

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

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

##
[0.26.4](aztec-packages-v0.26.3...aztec-packages-v0.26.4)
(2024-03-06)


### Features

* **avm:** ALU &lt;--&gt; MAIN inter table relation on intermediate
registers copy
([#4945](#4945))
([8708131](8708131)),
closes
[#4613](#4613)
* Circuit checker class
([#4931](#4931))
([4eba266](4eba266))
* Compute out hash in circuits
[#4561](#4561)
([#4873](#4873))
([06a9116](06a9116))


### Bug Fixes

* **ci:** Noir mirror base commit
([#4969](#4969))
([546c666](546c666))
* Fix release
([#4994](#4994))
([19a8728](19a8728))


### Miscellaneous

* Use public constructors where possible
([#4937](#4937))
([225aad6](225aad6))
</details>

<details><summary>barretenberg: 0.26.4</summary>

##
[0.26.4](barretenberg-v0.26.3...barretenberg-v0.26.4)
(2024-03-06)


### Features

* **avm:** ALU &lt;--&gt; MAIN inter table relation on intermediate
registers copy
([#4945](#4945))
([8708131](8708131)),
closes
[#4613](#4613)
* Circuit checker class
([#4931](#4931))
([4eba266](4eba266))
</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 7, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[0.26.4](AztecProtocol/aztec-packages@aztec-package-v0.26.3...aztec-package-v0.26.4)
(2024-03-06)


### Miscellaneous

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

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

##
[0.26.4](AztecProtocol/aztec-packages@barretenberg.js-v0.26.3...barretenberg.js-v0.26.4)
(2024-03-06)


### Miscellaneous

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

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

##
[0.26.4](AztecProtocol/aztec-packages@aztec-cli-v0.26.3...aztec-cli-v0.26.4)
(2024-03-06)


### Miscellaneous

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

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

##
[0.26.4](AztecProtocol/aztec-packages@aztec-packages-v0.26.3...aztec-packages-v0.26.4)
(2024-03-06)


### Features

* **avm:** ALU &lt;--&gt; MAIN inter table relation on intermediate
registers copy
([#4945](AztecProtocol/aztec-packages#4945))
([8708131](AztecProtocol/aztec-packages@8708131)),
closes
[#4613](AztecProtocol/aztec-packages#4613)
* Circuit checker class
([#4931](AztecProtocol/aztec-packages#4931))
([4eba266](AztecProtocol/aztec-packages@4eba266))
* Compute out hash in circuits
[#4561](AztecProtocol/aztec-packages#4561)
([#4873](AztecProtocol/aztec-packages#4873))
([06a9116](AztecProtocol/aztec-packages@06a9116))


### Bug Fixes

* **ci:** Noir mirror base commit
([#4969](AztecProtocol/aztec-packages#4969))
([546c666](AztecProtocol/aztec-packages@546c666))
* Fix release
([#4994](AztecProtocol/aztec-packages#4994))
([19a8728](AztecProtocol/aztec-packages@19a8728))


### Miscellaneous

* Use public constructors where possible
([#4937](AztecProtocol/aztec-packages#4937))
([225aad6](AztecProtocol/aztec-packages@225aad6))
</details>

<details><summary>barretenberg: 0.26.4</summary>

##
[0.26.4](AztecProtocol/aztec-packages@barretenberg-v0.26.3...barretenberg-v0.26.4)
(2024-03-06)


### Features

* **avm:** ALU &lt;--&gt; MAIN inter table relation on intermediate
registers copy
([#4945](AztecProtocol/aztec-packages#4945))
([8708131](AztecProtocol/aztec-packages@8708131)),
closes
[#4613](AztecProtocol/aztec-packages#4613)
* Circuit checker class
([#4931](AztecProtocol/aztec-packages#4931))
([4eba266](AztecProtocol/aztec-packages@4eba266))
</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.

feat(Outbox): compute out_hash in circuits
3 participants