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

refactor: Use public constructors where possible #4937

Merged
merged 4 commits into from
Mar 6, 2024

Conversation

spalladino
Copy link
Collaborator

Where possible, removes private constructors that just call an internal public initializer, and instead just declares a public constructor.

Depends on #4896

@AztecBot
Copy link
Collaborator

AztecBot commented Mar 4, 2024

Docs Preview

Hey there! 👋 You can check your preview at https://65e785eac2449c63c2b2d3c6--aztec-docs-dev.netlify.app

@AztecBot
Copy link
Collaborator

AztecBot commented Mar 4, 2024

Benchmark results

Metrics with a significant change:

  • note_trial_decrypting_time_in_ms (8): 10.1 (-91%)
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 4c6820f6 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,228 239,108 469,640
l1_rollup_execution_gas 194,176 500,414 908,898
l2_block_processing_time_in_ms 1,191 (+1%) 4,491 8,901 (-1%)
note_successful_decrypting_time_in_ms 204 (+4%) 540 (-2%) 995 (+1%)
note_trial_decrypting_time_in_ms ⚠️ 10.1 (-91%) 59.6 (-20%) 132 (+12%)
l2_block_building_time_in_ms 16,389 (+1%) 64,524 129,715
l2_block_rollup_simulation_time_in_ms 12,452 (+1%) 49,072 98,800
l2_block_public_tx_process_time_in_ms 3,909 (+1%) 15,384 30,786 (+1%)

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,250 (-1%) 26,036 (-1%)
note_history_successful_decrypting_time_in_ms 1,203 (-2%) 2,300 (-4%)
note_history_trial_decrypting_time_in_ms 60.2 (-27%) 103 (-23%)
node_database_size_in_bytes 18,772,048 35,504,208
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 251 (-1%) 44,736 28,001
private-kernel-ordering 191 (-2%) 52,625 14,627
base-rollup 1,304 (-1%) 177,932 933
root-rollup 69.7 (-1%) 4,192 825
private-kernel-inner 318 (-2%) 73,715 28,001
public-kernel-app-logic 194 (-2%) 32,254 25,379
merge-rollup 5.69 (-1%) 2,712 933

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.76 (-1%) 10.1 (-3%) 13.9 (+9%) 16.0 (-3%) 25.0 (+12%) 35.3 (+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.566 (-1%) 0.563 (-3%) 0.592 (+9%) 0.495 (-2%) 0.520 (+11%) 0.439 (+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.3 (-1%) 71.6 (-1%) 229 435 (-2%) 874 (+1%) 1,719
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.464 (-1%) 0.441 (-1%) 0.418 0.407 (-2%) 0.415 (+1%) 0.412
batch_insert_into_indexed_tree_20_depth_ms N/A N/A N/A N/A N/A 53.1 (-1%) 106 (-1%) 338 644 (-3%) 1,304 (-1%) 2,606
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.473 (-1%) 0.477 (-1%) 0.456 0.443 (-3%) 0.453 (-1%) 0.453
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A N/A 60.1 (-2%) 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.526 (-2%) 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,628 1,364 (-2%)
Metric 0 public data writes 1 public data writes
tx_sequencer_processing_time_ms 0.0323 (+13%) 474 (-1%)

Copy link
Contributor

github-actions bot commented Mar 4, 2024

Changes to circuit sizes

Generated at commit: bbbdfaf8456e52319639e66d67065d757d8406d7, compared to commit: 4c6820f6359a2db4863502d36b188dd52d2d32b1

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
public_kernel_teardown +3 ❌ +0.01% +3 ❌ +0.00%
public_kernel_setup +3 ❌ +0.01% +3 ❌ +0.00%
public_kernel_app_logic +3 ❌ +0.01% +3 ❌ +0.00%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
public_kernel_teardown 26,106 (+3) +0.01% 175,825 (+3) +0.00%
public_kernel_setup 26,119 (+3) +0.01% 175,837 (+3) +0.00%
public_kernel_app_logic 43,488 (+3) +0.01% 240,199 (+3) +0.00%

@just-mitch
Copy link
Collaborator

Is it possible to deploy a contract with a public initializer and a signerless wallet?

@spalladino spalladino force-pushed the palla/contract-deploy-21 branch from 3dd1231 to 4b37252 Compare March 5, 2024 16:56
Base automatically changed from palla/contract-deploy-21 to master March 5, 2024 17:22
@spalladino spalladino force-pushed the palla/contract-deploy-22 branch from 602797d to edaef21 Compare March 5, 2024 17:39
@spalladino
Copy link
Collaborator Author

Is it possible to deploy a contract with a public initializer and a signerless wallet?

It shouldn't be possible, you need a private entrypoint (be it a wallet or just a contract with a private function that calls to public) to start your tx.

@spalladino spalladino force-pushed the palla/contract-deploy-22 branch from edaef21 to 268456e Compare March 5, 2024 20:37
@spalladino spalladino enabled auto-merge (squash) March 5, 2024 20:37
@spalladino spalladino merged commit 225aad6 into master Mar 6, 2024
80 checks passed
@spalladino spalladino deleted the palla/contract-deploy-22 branch March 6, 2024 13:22
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.

4 participants