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

chore: update escrow to use PrivateImmutable #4942

Merged
merged 1 commit into from
Mar 5, 2024
Merged

Conversation

nventuro
Copy link
Contributor

@nventuro nventuro commented Mar 5, 2024

Working on #4940 I found that this contract uses PrivateSet (aka Set), when PrivateImmutable would actually be a much better fit. The escrow was reading set notes without nullifying them because it doesn't ever remove notes from the set (and hence all notes that were ever created are always valid). This can be very confusing for a beginner, and was a bad example to showcase.

I also removed the docs decorators since we don't ever reference them.

@nventuro nventuro marked this pull request as ready for review March 5, 2024 01:21
@AztecBot
Copy link
Collaborator

AztecBot commented Mar 5, 2024

Benchmark results

Metrics with a significant change:

  • note_history_successful_decrypting_time_in_ms (5): 1,366 (-17%)
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 8ffe5df7 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,048 238,700 469,796
l1_rollup_execution_gas 193,996 500,006 909,054
l2_block_processing_time_in_ms 1,213 (+2%) 4,544 (-2%) 9,021
note_successful_decrypting_time_in_ms 199 552 (+3%) 1,038 (+3%)
note_trial_decrypting_time_in_ms 112 80.6 (+38%) 60.2 (+64%)
l2_block_building_time_in_ms 15,884 (-1%) 63,259 (-1%) 127,065
l2_block_rollup_simulation_time_in_ms 12,087 48,203 (-1%) 96,856
l2_block_public_tx_process_time_in_ms 3,768 (-1%) 14,983 (-1%) 30,050

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,507 (-5%) 27,513 (-2%)
note_history_successful_decrypting_time_in_ms ⚠️ 1,366 (-17%) 2,385 (-2%)
note_history_trial_decrypting_time_in_ms 100 (-15%) 146 (-9%)
node_database_size_in_bytes 18,796,624 35,582,032 (+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 248 (-1%) 44,736 28,001
private-kernel-ordering 177 (-1%) 52,625 14,627
base-rollup 1,276 (-2%) 177,932 933
root-rollup 70.7 (-1%) 4,192 825
private-kernel-inner 311 (-2%) 73,715 28,001
public-kernel-app-logic 190 (-1%) 32,254 25,379
merge-rollup 5.70 (-2%) 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.86 11.1 (+1%) 12.6 (+1%) 16.1 (-2%) 22.5 (-3%) 35.7 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.571 0.613 (+1%) 0.534 (+1%) 0.498 (-1%) 0.469 (-4%) 0.443 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.8 72.6 232 443 867 (-4%) 1,738
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.448 0.421 0.415 0.413 (-4%) 0.415
batch_insert_into_indexed_tree_20_depth_ms N/A N/A N/A N/A N/A 54.7 (+1%) 108 343 (+1%) 660 1,313 (-3%) 2,622
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.480 0.486 0.460 0.453 0.454 (-3%) 0.454
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A N/A 61.3 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.535 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,606 (-2%) 1,345 (-1%)
Metric 0 public data writes 1 public data writes
tx_sequencer_processing_time_ms 0.0296 (-2%) 464 (-1%)

Copy link
Contributor

@benesjan benesjan left a comment

Choose a reason for hiding this comment

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

Makes sense 👍

@nventuro nventuro changed the title Update escrow to use PrivateImmutable chore: update escrow to use PrivateImmutable Mar 5, 2024
@nventuro nventuro merged commit 245d801 into master Mar 5, 2024
66 of 67 checks passed
@nventuro nventuro deleted the nv/escrow-singleton branch March 5, 2024 13:22
TomAFrench added a commit that referenced this pull request Mar 5, 2024
* master:
  chore: unused vars cleanup + updated TODOs (#4883)
  feat!: Internal as a macro (#4898)
  chore: update escrow to use PrivateImmutable (#4942)
  chore: fixed call nesting, tests and docs (#4932)
  chore(master): Release 0.25.0 (#4569)
  docs: add prelude note to migration (#4949)
rahul-kothari pushed a commit that referenced this pull request Mar 5, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[0.26.0](aztec-package-v0.25.0...aztec-package-v0.26.0)
(2024-03-05)


### ⚠ BREAKING CHANGES

* move noir out of yarn-project
([#4479](#4479))
* note type ids
([#4500](#4500))
* aztec binary
([#3927](#3927))

### Features

* Aztec binary
([#3927](#3927))
([12356d9](12356d9))
* Note type ids
([#4500](#4500))
([e1da2fd](e1da2fd))
* Parallel native/wasm bb builds. Better messaging around using ci
cache.
([#4766](#4766))
([a924e55](a924e55))


### Bug Fixes

* Add new oracle contract to devnet in CI
([#4687](#4687))
([920fa10](920fa10))
* Add registry contract to list
([#4694](#4694))
([3675e1d](3675e1d))
* Aztec binary fixes
([#4273](#4273))
([84e1f7d](84e1f7d))
* L1 contract address config
([#4684](#4684))
([20e7605](20e7605))
* P2p-bootstrap ECS command + /status route
([#4682](#4682))
([21ec23d](21ec23d))
* Relative LogFn import
([#4328](#4328))
([1faead5](1faead5))


### Miscellaneous

* Lift rollup address check & deplot kv-store to npm
([#4483](#4483))
([92d0aa4](92d0aa4))
* Move noir out of yarn-project
([#4479](#4479))
([1fe674b](1fe674b)),
closes
[#4107](#4107)
* Squash yp ypb + other build improvements.
([#4901](#4901))
([be5855c](be5855c))
* Updating viem
([#4783](#4783))
([23bc26a](23bc26a))
</details>

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

##
[0.26.0](barretenberg.js-v0.25.0...barretenberg.js-v0.26.0)
(2024-03-05)


### Miscellaneous

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

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

##
[0.26.0](aztec-cli-v0.25.0...aztec-cli-v0.26.0)
(2024-03-05)


### ⚠ BREAKING CHANGES

* Use new deployment flow in ContractDeployer
([#4497](#4497))
* move noir out of yarn-project
([#4479](#4479))
* note type ids
([#4500](#4500))
* Include contract class id in deployment info
([#4223](#4223))
* aztec binary
([#3927](#3927))

### Features

* **avm-transpiler:** Brillig to AVM transpiler
([#4227](#4227))
([c366c6e](c366c6e))
* Aztec binary
([#3927](#3927))
([12356d9](12356d9))
* Aztec.js API for registering a contract class
([#4469](#4469))
([d566c74](d566c74))
* Include contract class id in deployment info
([#4223](#4223))
([0ed4126](0ed4126)),
closes
[#4054](#4054)
* Moving the unbox option to npx command
([#4718](#4718))
([4c3bb92](4c3bb92))
* Note type ids
([#4500](#4500))
([e1da2fd](e1da2fd))
* Parallel native/wasm bb builds. Better messaging around using ci
cache.
([#4766](#4766))
([a924e55](a924e55))
* Use new deployment flow in ContractDeployer
([#4497](#4497))
([0702dc6](0702dc6))


### Bug Fixes

* Add new oracle contract to devnet in CI
([#4687](#4687))
([920fa10](920fa10))
* Load contract artifact from json
([#4352](#4352))
([47a0a79](47a0a79))


### Miscellaneous

* **docs:** Fix a few links to docs
([#4260](#4260))
([1c8ea49](1c8ea49))
* Move noir out of yarn-project
([#4479](#4479))
([1fe674b](1fe674b)),
closes
[#4107](#4107)
* Remove stubbed docs
([#4196](#4196))
([25a4bc4](25a4bc4))
* Squash yp ypb + other build improvements.
([#4901](#4901))
([be5855c](be5855c))
* Updating viem
([#4783](#4783))
([23bc26a](23bc26a))
</details>

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

##
[0.26.0](aztec-packages-v0.25.0...aztec-packages-v0.26.0)
(2024-03-05)


### ⚠ BREAKING CHANGES

* Internal as a macro
([#4898](#4898))

### Features

* Add init check by default to public fns
([#4897](#4897))
([4550f25](4550f25))
* Enable public constructor functions
([#4896](#4896))
([7b06895](7b06895))
* Internal as a macro
([#4898](#4898))
([73d640a](73d640a))
* We no longer update version packages via scripts
([#4962](#4962))
([31d470b](31d470b))


### Miscellaneous

* Disable failing test temporarily
([ec61974](ec61974))
* Fixed call nesting, tests and docs
([#4932](#4932))
([bd5c879](bd5c879))
* Specify packages individually for release-please
([#4960](#4960))
([dddc35f](dddc35f))
* Sync noir repo
([#4947](#4947))
([7ff9b71](7ff9b71))
* Unused vars cleanup + updated TODOs
([#4883](#4883))
([3747619](3747619))
* Update escrow to use PrivateImmutable
([#4942](#4942))
([245d801](245d801))
</details>

<details><summary>barretenberg: 0.26.0</summary>

##
[0.26.0](barretenberg-v0.25.0...barretenberg-v0.26.0)
(2024-03-05)


### Miscellaneous

* **barretenberg:** Synchronize aztec-packages versions
</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 6, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[0.26.0](AztecProtocol/aztec-packages@aztec-package-v0.25.0...aztec-package-v0.26.0)
(2024-03-05)


### ⚠ BREAKING CHANGES

* move noir out of yarn-project
([#4479](AztecProtocol/aztec-packages#4479))
* note type ids
([#4500](AztecProtocol/aztec-packages#4500))
* aztec binary
([#3927](AztecProtocol/aztec-packages#3927))

### Features

* Aztec binary
([#3927](AztecProtocol/aztec-packages#3927))
([12356d9](AztecProtocol/aztec-packages@12356d9))
* Note type ids
([#4500](AztecProtocol/aztec-packages#4500))
([e1da2fd](AztecProtocol/aztec-packages@e1da2fd))
* Parallel native/wasm bb builds. Better messaging around using ci
cache.
([#4766](AztecProtocol/aztec-packages#4766))
([a924e55](AztecProtocol/aztec-packages@a924e55))


### Bug Fixes

* Add new oracle contract to devnet in CI
([#4687](AztecProtocol/aztec-packages#4687))
([920fa10](AztecProtocol/aztec-packages@920fa10))
* Add registry contract to list
([#4694](AztecProtocol/aztec-packages#4694))
([3675e1d](AztecProtocol/aztec-packages@3675e1d))
* Aztec binary fixes
([#4273](AztecProtocol/aztec-packages#4273))
([84e1f7d](AztecProtocol/aztec-packages@84e1f7d))
* L1 contract address config
([#4684](AztecProtocol/aztec-packages#4684))
([20e7605](AztecProtocol/aztec-packages@20e7605))
* P2p-bootstrap ECS command + /status route
([#4682](AztecProtocol/aztec-packages#4682))
([21ec23d](AztecProtocol/aztec-packages@21ec23d))
* Relative LogFn import
([#4328](AztecProtocol/aztec-packages#4328))
([1faead5](AztecProtocol/aztec-packages@1faead5))


### Miscellaneous

* Lift rollup address check & deplot kv-store to npm
([#4483](AztecProtocol/aztec-packages#4483))
([92d0aa4](AztecProtocol/aztec-packages@92d0aa4))
* Move noir out of yarn-project
([#4479](AztecProtocol/aztec-packages#4479))
([1fe674b](AztecProtocol/aztec-packages@1fe674b)),
closes
[#4107](AztecProtocol/aztec-packages#4107)
* Squash yp ypb + other build improvements.
([#4901](AztecProtocol/aztec-packages#4901))
([be5855c](AztecProtocol/aztec-packages@be5855c))
* Updating viem
([#4783](AztecProtocol/aztec-packages#4783))
([23bc26a](AztecProtocol/aztec-packages@23bc26a))
</details>

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

##
[0.26.0](AztecProtocol/aztec-packages@barretenberg.js-v0.25.0...barretenberg.js-v0.26.0)
(2024-03-05)


### Miscellaneous

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

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

##
[0.26.0](AztecProtocol/aztec-packages@aztec-cli-v0.25.0...aztec-cli-v0.26.0)
(2024-03-05)


### ⚠ BREAKING CHANGES

* Use new deployment flow in ContractDeployer
([#4497](AztecProtocol/aztec-packages#4497))
* move noir out of yarn-project
([#4479](AztecProtocol/aztec-packages#4479))
* note type ids
([#4500](AztecProtocol/aztec-packages#4500))
* Include contract class id in deployment info
([#4223](AztecProtocol/aztec-packages#4223))
* aztec binary
([#3927](AztecProtocol/aztec-packages#3927))

### Features

* **avm-transpiler:** Brillig to AVM transpiler
([#4227](AztecProtocol/aztec-packages#4227))
([c366c6e](AztecProtocol/aztec-packages@c366c6e))
* Aztec binary
([#3927](AztecProtocol/aztec-packages#3927))
([12356d9](AztecProtocol/aztec-packages@12356d9))
* Aztec.js API for registering a contract class
([#4469](AztecProtocol/aztec-packages#4469))
([d566c74](AztecProtocol/aztec-packages@d566c74))
* Include contract class id in deployment info
([#4223](AztecProtocol/aztec-packages#4223))
([0ed4126](AztecProtocol/aztec-packages@0ed4126)),
closes
[#4054](AztecProtocol/aztec-packages#4054)
* Moving the unbox option to npx command
([#4718](AztecProtocol/aztec-packages#4718))
([4c3bb92](AztecProtocol/aztec-packages@4c3bb92))
* Note type ids
([#4500](AztecProtocol/aztec-packages#4500))
([e1da2fd](AztecProtocol/aztec-packages@e1da2fd))
* Parallel native/wasm bb builds. Better messaging around using ci
cache.
([#4766](AztecProtocol/aztec-packages#4766))
([a924e55](AztecProtocol/aztec-packages@a924e55))
* Use new deployment flow in ContractDeployer
([#4497](AztecProtocol/aztec-packages#4497))
([0702dc6](AztecProtocol/aztec-packages@0702dc6))


### Bug Fixes

* Add new oracle contract to devnet in CI
([#4687](AztecProtocol/aztec-packages#4687))
([920fa10](AztecProtocol/aztec-packages@920fa10))
* Load contract artifact from json
([#4352](AztecProtocol/aztec-packages#4352))
([47a0a79](AztecProtocol/aztec-packages@47a0a79))


### Miscellaneous

* **docs:** Fix a few links to docs
([#4260](AztecProtocol/aztec-packages#4260))
([1c8ea49](AztecProtocol/aztec-packages@1c8ea49))
* Move noir out of yarn-project
([#4479](AztecProtocol/aztec-packages#4479))
([1fe674b](AztecProtocol/aztec-packages@1fe674b)),
closes
[#4107](AztecProtocol/aztec-packages#4107)
* Remove stubbed docs
([#4196](AztecProtocol/aztec-packages#4196))
([25a4bc4](AztecProtocol/aztec-packages@25a4bc4))
* Squash yp ypb + other build improvements.
([#4901](AztecProtocol/aztec-packages#4901))
([be5855c](AztecProtocol/aztec-packages@be5855c))
* Updating viem
([#4783](AztecProtocol/aztec-packages#4783))
([23bc26a](AztecProtocol/aztec-packages@23bc26a))
</details>

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

##
[0.26.0](AztecProtocol/aztec-packages@aztec-packages-v0.25.0...aztec-packages-v0.26.0)
(2024-03-05)


### ⚠ BREAKING CHANGES

* Internal as a macro
([#4898](AztecProtocol/aztec-packages#4898))

### Features

* Add init check by default to public fns
([#4897](AztecProtocol/aztec-packages#4897))
([4550f25](AztecProtocol/aztec-packages@4550f25))
* Enable public constructor functions
([#4896](AztecProtocol/aztec-packages#4896))
([7b06895](AztecProtocol/aztec-packages@7b06895))
* Internal as a macro
([#4898](AztecProtocol/aztec-packages#4898))
([73d640a](AztecProtocol/aztec-packages@73d640a))
* We no longer update version packages via scripts
([#4962](AztecProtocol/aztec-packages#4962))
([31d470b](AztecProtocol/aztec-packages@31d470b))


### Miscellaneous

* Disable failing test temporarily
([ec61974](AztecProtocol/aztec-packages@ec61974))
* Fixed call nesting, tests and docs
([#4932](AztecProtocol/aztec-packages#4932))
([bd5c879](AztecProtocol/aztec-packages@bd5c879))
* Specify packages individually for release-please
([#4960](AztecProtocol/aztec-packages#4960))
([dddc35f](AztecProtocol/aztec-packages@dddc35f))
* Sync noir repo
([#4947](AztecProtocol/aztec-packages#4947))
([7ff9b71](AztecProtocol/aztec-packages@7ff9b71))
* Unused vars cleanup + updated TODOs
([#4883](AztecProtocol/aztec-packages#4883))
([3747619](AztecProtocol/aztec-packages@3747619))
* Update escrow to use PrivateImmutable
([#4942](AztecProtocol/aztec-packages#4942))
([245d801](AztecProtocol/aztec-packages@245d801))
</details>

<details><summary>barretenberg: 0.26.0</summary>

##
[0.26.0](AztecProtocol/aztec-packages@barretenberg-v0.25.0...barretenberg-v0.26.0)
(2024-03-05)


### Miscellaneous

* **barretenberg:** Synchronize aztec-packages versions
</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