AztecProtocol / aztec-packages

Apache License 2.0
155 stars 157 forks source link

chore: fix negative tests in AVM circuit for context input lookups #7261

Closed dbanks12 closed 3 days ago

dbanks12 commented 4 days ago

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

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

AztecBot commented 4 days 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/7261.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,859 (-2%) | 3,184 (-1%) | :warning: 1,453 (**-22%**) | 1,623 | 1,482 (-5%) | proof_construction_time_sha256_100_ms | 44,159 (-2%) | 11,830 (-2%) | 5,513 | 5,452 (-1%) | 5,429 | proof_construction_time_poseidon_hash_ms | 78.0 (-2%) | 34.0 (-3%) | 34.0 (-3%) | 58.0 (-2%) | 87.0 (-1%) | proof_construction_time_poseidon_hash_30_ms | 1,527 (-2%) | 419 (-1%) | 201 (-1%) | 229 (-1%) | 270 | proof_construction_time_poseidon_hash_100_ms | 5,774 (-2%) | 1,573 (-2%) | 729 (-1%) | 772 (-1%) | 794 (-2%) | ### 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,470 | 9,440 | l1_rollup_execution_gas | 611,203 | 611,360 | 611,481 | l2_block_processing_time_in_ms | 752 (-3%) | 1,412 | 2,703 (-4%) | l2_block_building_time_in_ms | 24,563 (-7%) | 49,379 | 96,320 (-7%) | l2_block_rollup_simulation_time_in_ms | 24,563 (-7%) | 49,379 | 96,319 (-7%) | l2_block_public_tx_process_time_in_ms | 21,111 (-7%) | 45,704 | 92,703 (-7%) | ### 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,029 | 9,818 (-1%) | node_database_size_in_bytes | 12,263,504 | 16,138,320 | 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 | 115 (-1%) | 460 | 13,447 (+1%) | 20,634 | 67,190 | 92,352 | 2,819 | 524,288 | private-kernel-inner | 366 (+1%) | 1,056 (-1%) | 50,473 (+4%) | 94,902 | 67,190 | 92,352 | 2,819 | 2,097,152 | private-kernel-tail | 301 (-1%) | 1,766 | 49,556 (+1%) | 99,121 | 71,733 | 14,912 | 399 | 2,097,152 | base-parity | 6.39 (+2%) | 1,791 (-1%) | 2,747 (-3%) | 128 | 64.0 | 2,208 | 2.00 | 131,072 | root-parity | 49.6 (-1%) | 73.3 (-2%) | 43,289 (+5%) | 27,100 | 64.0 | 2,720 | 18.0 | 2,097,152 | base-rollup | 7,695 (-2%) | 5,012 (+1%) | 85,485 | 170,330 | 728 | 3,648 | 47.0 | 4,194,304 | root-rollup | 111 (-1%) | 87.4 (-5%) | 23,710 | 25,253 | 620 | 3,456 | 41.0 | 1,048,576 | public-kernel-setup | 640 | 3,808 | 46,516 (+3%) | 116,905 | 93,334 | 125,344 | 3,850 | 2,097,152 | public-kernel-app-logic | 588 (-2%) | 4,789 | 45,049 (-8%) | 116,905 | 93,334 | 125,344 | 3,850 | 2,097,152 | public-kernel-tail | 1,384 (-2%) | 40,511 (+4%) | 190,499 (+3%) | 511,910 | 10,014 | 14,912 | 399 | 8,388,608 | private-kernel-reset-small | 552 (-1%) | 2,018 (+3%) | 47,489 | 123,313 | 67,190 | 92,352 | 2,819 | 2,097,152 | public-kernel-teardown | 572 | 4,770 (-2%) | 47,611 (-1%) | 116,905 | 93,334 | 125,344 | 3,850 | 2,097,152 | merge-rollup | 29.1 (-3%) | N/A | N/A | 16,486 | 728 | N/A | N/A | N/A | private-kernel-tail-to-public | N/A | 6,904 | 98,766 (+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 | 413 | N/A | N/A | N/A | N/A | ContractInstanceDeployer:deploy | 1,408 | 9,944 | 39.8 (-1%) | N/A | N/A | N/A | N/A | MultiCallEntrypoint:entrypoint | 1,920 | 9,944 | 1,311 | N/A | N/A | N/A | N/A | GasToken:deploy | 1,376 | 9,944 | 963 | N/A | N/A | N/A | N/A | SchnorrAccount:constructor | 1,312 | 9,944 | 496 | N/A | N/A | N/A | N/A | SchnorrAccount:entrypoint | 2,304 | 9,944 | 1,893 | 16,768 | 56,200 (+1%) | 2,097,152 | 457 | Token:privately_mint_private_note | 1,280 | 9,944 | 639 (-1%) | N/A | N/A | N/A | N/A | FPC:fee_entrypoint_public | 1,344 | 9,944 | 307 | 16,768 | 11,920 (+4%) | 524,288 | 457 | Token:transfer | 1,312 | 9,944 | 2,919 (+1%) | 16,768 | 23,250 (+2%) | 1,048,576 | 457 | AuthRegistry:set_authorized (avm) | 20,954 | N/A | N/A | 94,336 | 1,339 (-6%) | N/A | N/A | FPC:prepare_fee (avm) | 28,396 | N/A | N/A | 94,400 | 3,018 (-5%) | N/A | N/A | Token:transfer_public (avm) | 44,612 | N/A | N/A | 94,400 | 3,919 (-3%) | N/A | N/A | AuthRegistry:consume (avm) | 34,832 | N/A | N/A | 94,336 | 2,927 (-2%) | N/A | N/A | FPC:pay_refund (avm) | 38,561 | N/A | N/A | 94,368 | 23,679 (-1%) | N/A | N/A | Benchmarking:create_note | 1,344 | 9,944 | 485 | N/A | N/A | N/A | N/A | SchnorrAccount:verify_private_authwit | 1,280 | 9,944 | 72.3 | N/A | N/A | N/A | N/A | Token:unshield | 1,376 | 9,944 | 2,707 (+1%) | N/A | N/A | N/A | N/A | FPC:fee_entrypoint_private | 1,376 | 9,944 | 3,472 | 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 | 68.0 (-15%) | 13,790 | GasToken:set_portal | 18.4 (-3%) | 3,305 | Token:constructor | 105 (+6%) | 23,658 | FPC:constructor | 64.4 (+1%) | 13,592 | GasToken:mint_public | 51.3 | 10,158 | Token:mint_public | 64.1 (-11%) | 19,000 | Token:assert_minter_and_mint | 208 (-5%) | 12,891 | AuthRegistry:set_authorized | 32.9 (-1%) | 7,812 | FPC:prepare_fee | 140 (+5%) | 15,062 | Token:transfer_public | :warning: 34.5 (**-53%**) | 31,184 | FPC:pay_refund | 158 (+7%) | 25,260 | Benchmarking:increment_balance | 2,608 (-2%) | 15,233 | Token:_increase_public_balance | 56.0 | 14,972 | FPC:pay_refund_with_shielded_rebate | 132 (-27%) | 26,347 | ### Public DB Access Time to access various public DBs. | Function | time_ms | | - | - | get-nullifier-index | 0.169 (+5%) | ### 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.5 (-1%) | 16.7 (-2%) | 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.606 (-1%) | 0.513 (-2%) | N/A | N/A | N/A | N/A | N/A | batch_insert_into_append_only_tree_32_depth_ms | N/A | N/A | 48.3 (-2%) | 75.8 (-2%) | 132 (-4%) | 245 | 472 (-4%) | 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 (-2%) | 0.466 (-2%) | 0.454 (-4%) | 0.444 (-1%) | 0.440 (-4%) | batch_insert_into_indexed_tree_20_depth_ms | N/A | N/A | 59.8 (-2%) | 112 (-2%) | 184 (-4%) | 352 (-1%) | 697 (-3%) | 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.504 (-2%) | 0.501 (-2%) | 0.486 (-4%) | 0.477 (-1%) | 0.478 (-3%) | batch_insert_into_indexed_tree_40_depth_ms | N/A | N/A | 72.9 (-1%) | 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.519 (-1%) | 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,707 | 670,983 | Transaction size based on fee payment method | Metric | | | - | |