AztecProtocol / aztec-packages

Apache License 2.0
181 stars 184 forks source link

feat: constrain event encryption and unify note and event emit api #7171

Closed sklppy88 closed 3 months ago

sklppy88 commented 3 months ago

resolves #6952 resolves #7160

sklppy88 commented 3 months ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @sklppy88 and the rest of your teammates on Graphite Graphite

AztecBot commented 3 months ago

Benchmark results

Metrics with a significant change:

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](https://aztec-ci-artifacts.s3.us-east-2.amazonaws.com/benchmarks-v1/pulls/7171.json). ### Proof generation Each column represents the number of threads used in proof generation. | Metric | 1 threads | 4 threads | 16 threads | 32 threads | 64 threads | | - | - | - | - | - | - | proof_construction_time_sha256_30_ms | 11,678 (-1%) | 3,218 (-1%) | 1,727 | 1,460 (-7%) | 1,469 (-1%) | proof_construction_time_sha256_100_ms | 44,908 (-1%) | 11,843 | 5,433 | 5,421 (-1%) | 5,363 | proof_construction_time_poseidon_hash_ms | 78.0 | 34.0 | 34.0 | 58.0 (-2%) | 87.0 (-1%) | proof_construction_time_poseidon_hash_30_ms | 1,514 (-1%) | 416 (-1%) | 199 (-1%) | 236 (+5%) | 265 | proof_construction_time_poseidon_hash_100_ms | 5,735 (-1%) | 1,576 (-1%) | 727 | 770 (-1%) | 793 | ### L2 block published to L1 Each column represents the number of txs on an L2 block published to L1. | Metric | 4 txs | 8 txs | 16 txs | | - | - | - | - | l1_rollup_calldata_size_in_bytes | 1,412 | 1,412 | 1,412 | l1_rollup_calldata_gas | 9,464 | 9,468 | 9,452 | l1_rollup_execution_gas | 610,285 | 610,289 | 610,273 | l2_block_processing_time_in_ms | 752 | 1,411 | 2,673 (-1%) | l2_block_building_time_in_ms | 25,628 (+2%) | 51,968 (+1%) | 100,590 (+1%) | l2_block_rollup_simulation_time_in_ms | 25,532 (+2%) | 51,665 (+1%) | 100,241 (+1%) | l2_block_public_tx_process_time_in_ms | 21,950 (+2%) | 47,843 (+1%) | 96,479 (+1%) | ### L2 chain processing Each column represents the number of blocks on the L2 chain where each block has 8 txs. | Metric | 3 blocks | 5 blocks | | - | - | - | node_history_sync_time_in_ms | 7,054 (+1%) | 9,897 (+1%) | node_database_size_in_bytes | 12,148,816 | 16,097,360 | pxe_database_size_in_bytes | 16,254 | 26,813 | ### Circuits stats Stats on running time and I/O sizes collected for every kernel circuit run across all benchmarks. | Circuit | simulation_time_in_ms | witness_generation_time_in_ms | proving_time_in_ms | input_size_in_bytes | output_size_in_bytes | proof_size_in_bytes | num_public_inputs | size_in_gates | | - | - | - | - | - | - | - | - | - | private-kernel-init | 130 | 483 (+5%) | 13,013 (+2%) | 20,634 | 67,190 | 92,352 | 2,819 | 524,288 | private-kernel-inner | 394 (+1%) | 1,145 | 49,453 (+1%) | 94,902 | 67,190 | 92,352 | 2,819 | 2,097,152 | private-kernel-tail | 374 (+1%) | 1,856 (+4%) | 51,710 (+3%) | 99,121 | 71,733 | 14,912 | 399 | 2,097,152 | base-parity | 6.19 (+1%) | 1,974 (+6%) | 2,753 (-1%) | 128 | 64.0 | 2,208 | 2.00 | 131,072 | root-parity | 49.3 (+1%) | 74.3 (-1%) | 42,348 (+4%) | 27,100 | 64.0 | 2,720 | 18.0 | 2,097,152 | base-rollup | 8,017 (+2%) | 4,977 | 86,249 (+1%) | 170,330 | 756 | 3,648 | 47.0 | 4,194,304 | root-rollup | 110 | 87.7 (+3%) | 23,606 (+2%) | 25,309 | 620 | 3,456 | 41.0 | 1,048,576 | public-kernel-setup | 723 (+1%) | 3,741 (-1%) | 45,543 (+4%) | 116,905 | 93,334 | 125,344 | 3,850 | 2,097,152 | public-kernel-app-logic | 623 (+2%) | 4,675 (-1%) | 49,696 (+8%) | 116,905 | 93,334 | 125,344 | 3,850 | 2,097,152 | public-kernel-tail | 1,430 (+1%) | 35,457 (-1%) | 200,410 (-3%) | 511,910 | 10,014 | 14,912 | 399 | 8,388,608 | private-kernel-reset-small | 601 (+2%) | 2,218 (-4%) | 45,926 | 123,313 | 67,190 | 92,352 | 2,819 | 2,097,152 | public-kernel-teardown | 621 | 4,795 | 46,077 (-2%) | 116,905 | 93,334 | 125,344 | 3,850 | 2,097,152 | merge-rollup | 28.9 (+1%) | N/A | N/A | 16,542 | 756 | N/A | N/A | N/A | private-kernel-tail-to-public | N/A | 7,293 (+7%) | 100,558 (+3%) | N/A | N/A | 125,344 | 3,850 | 4,194,304 | Stats on running time collected for app circuits | Function | input_size_in_bytes | output_size_in_bytes | witness_generation_time_in_ms | proof_size_in_bytes | proving_time_in_ms | size_in_gates | num_public_inputs | | - | - | - | - | - | - | - | - | ContractClassRegisterer:register | 1,344 | 9,944 | 425 (+2%) | N/A | N/A | N/A | N/A | ContractInstanceDeployer:deploy | 1,408 | 9,944 | 39.7 (+1%) | N/A | N/A | N/A | N/A | MultiCallEntrypoint:entrypoint | 1,920 | 9,944 | 1,777 | N/A | N/A | N/A | N/A | GasToken:deploy | 1,376 | 9,944 | 983 (+2%) | N/A | N/A | N/A | N/A | SchnorrAccount:constructor | 1,312 | 9,944 | 1,409 | N/A | N/A | N/A | N/A | SchnorrAccount:entrypoint | 2,304 | 9,944 | 2,822 | 16,768 | 55,437 (+1%) | 2,097,152 | 457 | Token:privately_mint_private_note | 1,280 | 9,944 | 1,647 (+3%) | N/A | N/A | N/A | N/A | FPC:fee_entrypoint_public | 1,344 | 9,944 | 353 (+3%) | 16,768 | 10,966 (-3%) | 524,288 | 457 | Token:transfer | 1,312 | 9,944 | 4,494 | 16,768 | 46,599 (+4%) | 2,097,152 | 457 | AuthRegistry:set_authorized (avm) | 21,043 | N/A | N/A | 87,200 | 1,386 (+1%) | N/A | N/A | FPC:prepare_fee (avm) | 28,841 | N/A | N/A | 88,032 | 5,960 (+5%) | N/A | N/A | Token:transfer_public (avm) | 44,971 | N/A | N/A | 87,865 | 4,846 (+1%) | N/A | N/A | AuthRegistry:consume (avm) | 34,973 | N/A | N/A | 87,616 | 3,023 (-4%) | N/A | N/A | FPC:pay_refund (avm) | 33,573 | N/A | N/A | 88,448 | 11,677 (+5%) | N/A | N/A | Benchmarking:create_note | 1,344 | 9,944 | 1,411 (+1%) | N/A | N/A | N/A | N/A | SchnorrAccount:verify_private_authwit | 1,280 | 9,944 | 77.9 (+6%) | N/A | N/A | N/A | N/A | Token:unshield | 1,376 | 9,944 | 3,683 (-1%) | N/A | N/A | N/A | N/A | FPC:fee_entrypoint_private | 1,376 | 9,944 | 4,631 (-1%) | N/A | N/A | N/A | N/A | ### AVM Simulation Time to simulate various public functions in the AVM. | Function | time_ms | bytecode_size_in_bytes | | - | - | - | GasToken:_increase_public_balance | 70.3 (-1%) | 13,873 | GasToken:set_portal | 16.7 (+1%) | 3,495 | Token:constructor | 90.8 | 24,207 | FPC:constructor | 64.0 (+4%) | 13,893 | GasToken:mint_public | 53.1 (+2%) | 10,241 | Token:mint_public | :warning: 631 (**+953%**) | 19,216 | Token:assert_minter_and_mint | :warning: 76.0 (**-65%**) | 13,034 | AuthRegistry:set_authorized | 31.7 (-13%) | 7,869 | FPC:prepare_fee | 197 (+4%) | 15,187 | Token:transfer_public | 34.4 (-25%) | 31,425 | FPC:pay_refund | 128 (+10%) | 20,080 | Benchmarking:increment_balance | 2,729 (+1%) | 15,465 | Token:_increase_public_balance | 61.3 (+10%) | 15,089 | FPC:pay_refund_with_shielded_rebate | 154 (+7%) | 21,167 | ### Public DB Access Time to access various public DBs. | Function | time_ms | | - | - | get-nullifier-index | 0.153 | ### 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 | 256 leaves | 512 leaves | 1024 leaves | | - | - | - | - | - | - | - | - | batch_insert_into_append_only_tree_16_depth_ms | 10.3 | 16.7 | N/A | N/A | N/A | N/A | N/A | batch_insert_into_append_only_tree_16_depth_hash_count | 16.8 | 31.7 | N/A | N/A | N/A | N/A | N/A | batch_insert_into_append_only_tree_16_depth_hash_ms | 0.597 | 0.513 | N/A | N/A | N/A | N/A | N/A | batch_insert_into_append_only_tree_32_depth_ms | N/A | N/A | 48.2 | 75.9 | 131 | 245 | 467 (-1%) | batch_insert_into_append_only_tree_32_depth_hash_count | N/A | N/A | 95.9 | 159 | 287 | 543 | 1,055 | batch_insert_into_append_only_tree_32_depth_hash_ms | N/A | N/A | 0.493 | 0.467 | 0.450 | 0.443 | 0.437 | batch_insert_into_indexed_tree_20_depth_ms | N/A | N/A | 59.8 (+1%) | 112 | 183 (+1%) | 352 | 689 (-1%) | batch_insert_into_indexed_tree_20_depth_hash_count | N/A | N/A | 109 | 207 | 355 | 691 | 1,363 | batch_insert_into_indexed_tree_20_depth_hash_ms | N/A | N/A | 0.507 (+1%) | 0.501 | 0.483 | 0.476 | 0.474 (-1%) | batch_insert_into_indexed_tree_40_depth_ms | N/A | N/A | 72.8 | N/A | N/A | N/A | N/A | batch_insert_into_indexed_tree_40_depth_hash_count | N/A | N/A | 133 | N/A | N/A | N/A | N/A | batch_insert_into_indexed_tree_40_depth_hash_ms | N/A | N/A | 0.518 | N/A | N/A | N/A | N/A | ### Miscellaneous Transaction sizes based on how many contract classes are registered in the tx. | Metric | 0 registered classes | 1 registered classes | | - | - | - | tx_size_in_bytes | 85,672 | 670,983 | Transaction size based on fee payment method | Metric | | | - | |