fix: Proof length mismatch after moving to keccak_ultra_honk
See the message from the first commit for context.
I've managed to get past theProof length doesn't match expected length (16 != 409) error here by making some changes blindly to bb. I went to Sean's original PR in which he introduced the UltraKeccakFlavor (merged here), and checked the diffs with UltraFlavor. UltraFlavor has had several changes which were not ported to UltraKeccak (diff ultra_flavor and ultra_keccak.hpp in that commit to see that the diffs should be minimal), so I copied the latest UltraFlavor onto UltraKeccak and applied the same changes as Sean did back then. I also added more keccak_ commands for the CLI, and changed all calls I could find. That got me past the proof length error, but now the PrivateKernelEmpty proof does not verify, even after regenerating the vks
Benchmark results
Metrics with a significant change:
- protocol_circuit_simulation_time_in_ms (private-kernel-tail-to-public): 825 (-39%)
- avm_simulation_time_ms (AuthRegistry:set_authorized): 47.4 (+32%)
- avm_simulation_time_ms (Token:transfer_public): 21.4 (-35%)
- avm_simulation_time_ms (Token:_increase_public_balance): 74.3 (+87%)
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,777 | 1,560 | 704 (+1%) | 762 | 772 (+1%) |
| proof_construction_time_sha256_30_ms | 11,875 | 3,180 | 1,419 | 1,452 (-1%) | 1,490 (+1%) |
| proof_construction_time_sha256_100_ms | 44,288 | 12,451 (+1%) | 5,714 (+1%) | 5,669 (+2%) | 5,515 |
| proof_construction_time_poseidon_hash_ms | 78.0 | 34.0 (-29%) | 34.0 | 60.0 (+3%) | 88.0 |
| proof_construction_time_poseidon_hash_30_ms | 1,529 (-1%) | 419 | 201 | 228 (-2%) | 272 (+1%) |
| proof_construction_time_poseidon_hash_100_ms | 5,665 | 1,534 | 682 (+1%) | 731 (+1%) | 753 (-1%) |
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,312 | 177,404 |
| l1_rollup_execution_gas | 1,294,371 | 2,041,943 | 3,869,074 |
| l2_block_processing_time_in_ms | 256 (-2%) | 445 | 807 (-3%) |
| l2_block_building_time_in_ms | 9,270 (-1%) | 18,276 | 36,631 (+1%) |
| l2_block_rollup_simulation_time_in_ms | 9,270 (-1%) | 18,275 | 36,631 (+1%) |
| l2_block_public_tx_process_time_in_ms | 7,836 (-1%) | 16,702 | 34,996 (+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 | 2,967 (-1%) | 3,794 |
| node_database_size_in_bytes | 12,738,640 | 16,781,392 |
| 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 | 100 (+5%) | 399 | 21,846 | 44,858 | N/A |
| private-kernel-inner | 170 (-2%) | 691 (-2%) | 72,545 | 45,005 | N/A |
| private-kernel-reset-tiny | 509 (+1%) | 1,181 (-3%) | 69,614 | 44,844 | N/A |
| private-kernel-tail | 273 (+1%) | 193 (-2%) | 50,760 | 52,256 | N/A |
| base-parity | 5.58 (+1%) | N/A | 160 | 96.0 | N/A |
| root-parity | 33.4 | N/A | 69,084 | 96.0 | N/A |
| base-rollup | 2,892 (+1%) | N/A | 187,817 | 664 | N/A |
| root-rollup | 38.7 (+1%) | N/A | 54,525 | 716 | N/A |
| public-kernel-setup | 99.3 (-1%) | N/A | 103,760 | 71,222 | N/A |
| public-kernel-app-logic | 106 | N/A | 103,599 | 71,222 | N/A |
| public-kernel-tail | 577 (+1%) | N/A | 409,190 | 16,414 | N/A |
| private-kernel-reset-small | 487 (+1%) | N/A | 66,533 | 45,629 | N/A |
| private-kernel-tail-to-public | :warning: 825 (-39%) | 700 (-2%) | 507,554 | 1,697 | N/A |
| public-kernel-teardown | 94.3 | N/A | 104,005 | 71,222 | N/A |
| merge-rollup | 19.4 (+1%) | N/A | 35,742 | 664 | N/A |
| undefined | N/A | N/A | N/A | N/A | 68,123 (+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 | 346 |
| ContractInstanceDeployer:deploy | 1,408 | 11,731 | 18.1 (-1%) |
| MultiCallEntrypoint:entrypoint | 1,920 | 11,731 | 461 |
| FeeJuice:deploy | 1,376 | 11,731 | 391 (-1%) |
| SchnorrAccount:constructor | 1,312 | 11,731 | 169 (-2%) |
| SchnorrAccount:entrypoint | 2,304 | 11,731 | 509 |
| Token:privately_mint_private_note | 1,280 | 11,731 | 214 (-1%) |
| FPC:fee_entrypoint_public | 1,344 | 11,731 | 22.4 (-10%) |
| Token:transfer | 1,312 | 11,731 | 403 (-1%) |
| Benchmarking:create_note | 1,344 | 11,731 | 166 |
| SchnorrAccount:verify_private_authwit | 1,280 | 11,731 | 27.8 (+2%) |
| Token:unshield | 1,376 | 11,731 | 636 (+2%) |
| FPC:fee_entrypoint_private | 1,376 | 11,731 | 853 (+1%) |
AVM Simulation
Time to simulate various public functions in the AVM.
| Function | time_ms | bytecode_size_in_bytes |
|---|---|---|
| FeeJuice:_increase_public_balance | 53.1 (-1%) | 8,139 |
| FeeJuice:set_portal | 9.96 (+2%) | 2,362 |
| Token:constructor | 84.9 (+3%) | 31,107 |
| FPC:constructor | 54.1 (+5%) | 22,380 |
| FeeJuice:mint_public | 37.5 | 6,150 |
| Token:mint_public | 71.9 (-5%) | 11,720 |
| Token:assert_minter_and_mint | 38.9 | 8,028 |
| AuthRegistry:set_authorized | :warning: 47.4 (+32%) | 4,537 |
| FPC:prepare_fee | 240 (+5%) | 8,812 |
| Token:transfer_public | :warning: 21.4 (-35%) | 47,374 |
| FPC:pay_refund | 63.4 | 12,114 |
| Benchmarking:increment_balance | 982 (+1%) | 7,450 |
| Token:_increase_public_balance | :warning: 74.3 (+87%) | 8,960 |
| FPC:pay_refund_with_shielded_rebate | 68.1 (+2%) | 12,663 |
Public DB Access
Time to access various public DBs.
| Function | time_ms |
|---|---|
| get-nullifier-index | 0.167 (+2%) |
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.17 (-1%) | 3.89 | 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.112 (-1%) | 0.110 (+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.6 (+1%) | 17.6 (-2%) | 30.9 (-2%) | 59.8 (-1%) | 114 (-2%) |
| 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.111 (+1%) | 0.102 (-2%) | 0.100 (-3%) | 0.103 (-1%) | 0.102 (-2%) |
| batch_insert_into_indexed_tree_20_depth_ms | N/A | N/A | 14.5 (+1%) | 26.2 | 43.7 (-1%) | 84.1 | 163 (-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 (+2%) | 0.105 | 0.106 (+1%) | 0.104 | 0.102 (-3%) |
| batch_insert_into_indexed_tree_40_depth_ms | N/A | N/A | 16.5 (-1%) | 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 (-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 | 64,779 | 668,997 |
Transaction size based on fee payment method
| Metric | | | - | |