aztec-packages icon indicating copy to clipboard operation
aztec-packages copied to clipboard

feat: automate verify_honk_proof input generation

Open lucasxia01 opened this issue 1 year ago • 1 comments

This script replaces the gen_inner_proof_inputs_ultra_honk.sh with regenerate_verify_honk_proof_inputs.sh, which does the resetting of test_programs and input copying automatically so that people don't have to know intricate details on what to do to regenerate the inputs for the verify_honk_proof test program.

As part of this, I created a python script barretenberg/acir_tests/update_verify_honk_proof_inputs.py, which does the copying/surgery of the proofs. This python script shouldn't have to be run by itself.

It also updates the rebuild.sh script to actually output which test_programs failed. Before, it always outputted that the rebuild succeeded... It also allows for users to specify which test_programs that they want to rebuild.

lucasxia01 avatar Aug 20 '24 17:08 lucasxia01

Benchmark results

Metrics with a significant change:

  • avm_simulation_time_ms (Token:mint_public): 69.6 (+52%)
  • avm_simulation_time_ms (Token:assert_minter_and_mint): 41.4 (-38%)
  • avm_simulation_time_ms (Token:transfer_public): 19.8 (-37%)
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.

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_ms 5,776 1,569 713 747 (-1%) 772
proof_construction_time_sha256_30_ms 11,511 3,108 1,387 1,436 (+1%) 1,465 (+1%)
proof_construction_time_sha256_100_ms 44,127 11,848 5,431 5,482 (-3%) 5,651
proof_construction_time_poseidon_hash_ms 78.0 (-1%) 34.0 34.0 58.0 (-2%) 87.0 (-2%)
proof_construction_time_poseidon_hash_30_ms 1,536 423 203 224 (-2%) 269 (-2%)
proof_construction_time_poseidon_hash_100_ms 5,665 1,521 674 723 (-3%) 747

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 4,324 7,844 14,852
l1_rollup_calldata_gas 49,708 92,450 177,668
l1_rollup_execution_gas 1,373,736 2,107,374 3,892,648
l2_block_processing_time_in_ms 247 (-2%) 437 (-2%) 809
l2_block_building_time_in_ms 8,949 (-1%) 17,416 (-1%) 34,663 (-2%)
l2_block_rollup_simulation_time_in_ms 8,948 (-1%) 17,415 (-1%) 34,663 (-2%)
l2_block_public_tx_process_time_in_ms 7,545 (-1%) 15,922 (-1%) 33,137 (-2%)

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 2,885 (+1%) 3,749 (-5%)
node_database_size_in_bytes 12,615,760 (-1%) 16,711,760
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 input_size_in_bytes output_size_in_bytes proving_time_in_ms
private-kernel-init 87.9 (-2%) 397 (-1%) 21,755 44,860 N/A
private-kernel-inner 168 703 (-1%) 72,566 45,007 N/A
private-kernel-reset-tiny 459 (-1%) 866 (-2%) 65,675 44,846 N/A
private-kernel-tail 194 (-1%) 157 (-2%) 50,686 52,257 N/A
base-parity 5.64 N/A 160 96.0 N/A
root-parity 36.2 (+1%) N/A 73,948 96.0 N/A
base-rollup 2,733 (-2%) N/A 189,136 664 N/A
root-rollup 40.4 (-1%) N/A 58,173 716 N/A
public-kernel-setup 83.6 (-1%) N/A 105,085 71,222 N/A
public-kernel-app-logic 95.1 (-1%) N/A 104,911 71,222 N/A
public-kernel-tail 552 (-1%) N/A 410,534 16,414 N/A
private-kernel-reset-small 462 (-9%) N/A 66,341 45,629 N/A
private-kernel-tail-to-public 1,347 (-3%) 652 (-1%) 460,796 1,825 N/A
public-kernel-teardown 82.4 (-1%) N/A 105,349 71,222 N/A
merge-rollup 20.0 (-5%) N/A 38,174 664 N/A
undefined N/A N/A N/A N/A 78,685 (-1%)

Stats on running time collected for app circuits

Function input_size_in_bytes output_size_in_bytes witness_generation_time_in_ms
ContractClassRegisterer:register 1,344 11,731 342 (-1%)
ContractInstanceDeployer:deploy 1,408 11,731 18.5
MultiCallEntrypoint:entrypoint 1,920 11,731 408
FeeJuice:deploy 1,376 11,731 393 (-1%)
SchnorrAccount:constructor 1,312 11,731 75.1
SchnorrAccount:entrypoint 2,304 11,731 414
Token:privately_mint_private_note 1,280 11,731 107 (+5%)
FPC:fee_entrypoint_public 1,344 11,731 29.0 (-7%)
Token:transfer 1,312 11,731 235 (+1%)
Benchmarking:create_note 1,344 11,731 88.9
SchnorrAccount:verify_private_authwit 1,280 11,731 27.3 (-12%)
Token:unshield 1,376 11,731 525 (-1%)
FPC:fee_entrypoint_private 1,376 11,731 706 (-2%)

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
FeeJuice:_increase_public_balance 56.3 (+1%) 7,739
FeeJuice:set_portal 11.8 (-5%) 2,354
Token:constructor 78.3 (-4%) 26,051
FPC:constructor 52.9 (-1%) 18,001
FeeJuice:mint_public 39.5 (-1%) 5,877
Token:mint_public :warning: 69.6 (+52%) 10,917
Token:assert_minter_and_mint :warning: 41.4 (-38%) 7,512
AuthRegistry:set_authorized 37.9 (-19%) 4,391
FPC:prepare_fee 224 (-3%) 7,043
Token:transfer_public :warning: 19.8 (-37%) 39,426
FPC:pay_refund 51.3 (-23%) 10,234
Benchmarking:increment_balance 929 (-1%) 6,563
Token:_increase_public_balance 40.5 (-1%) 8,433
FPC:pay_refund_with_shielded_rebate 63.7 (+2%) 10,783

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.158 (-4%)

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 2.20 3.91 (+1%) 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.114 (-1%) 0.111 (+1%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 11.7 17.8 (-1%) 31.0 59.6 114 (+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.112 (+1%) 0.103 (-1%) 0.101 (+1%) 0.102 0.102
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 14.5 (-2%) 26.0 43.9 83.5 162 (+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.110 (-1%) 0.104 0.106 0.103 0.102
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 16.5 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A 132 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A 0.106 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 64,779 668,997

Transaction size based on fee payment method

| Metric | | | - | |

AztecBot avatar Aug 20 '24 17:08 AztecBot