feat(p2p): request response skeleton
Overview
Part of #7964
This is a minimal implementation of the guts of a request and response protocol that dials the connected peers and asks for a given data.
The current design relies on the protocol mapping, which maps a protocol to a handler, the idea being that this service will be wrapped by the larger p2p client which will have direct access to the relevant tx / attestation pools.
Issues spawned from this work
- https://github.com/AztecProtocol/aztec-packages/issues/8077
This stack of pull requests is managed by Graphite. Learn more about stacking.
Join @Maddiaa0 and the rest of your teammates on
Graphite
Benchmark results
No metrics with a significant change found.
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,753 | 1,553 (-1%) | 714 | 742 (-1%) | 773 |
| proof_construction_time_sha256_30_ms | 11,475 | 3,070 (-1%) | 1,376 (-1%) | 1,427 | 1,462 (-1%) |
| proof_construction_time_sha256_100_ms | 44,085 (-1%) | 11,873 (-1%) | 5,433 (-3%) | 5,417 (-3%) | 5,764 |
| proof_construction_time_poseidon_hash_ms | 78.0 | 34.0 | 34.0 | 58.0 | 87.0 (-2%) |
| proof_construction_time_poseidon_hash_30_ms | 1,531 | 421 | 202 | 228 (-1%) | 281 (+5%) |
| proof_construction_time_poseidon_hash_100_ms | 5,648 | 1,512 | 672 | 732 | 747 (-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,356 | 7,876 | 14,884 |
| l1_rollup_calldata_gas | 50,172 | 93,018 | 178,180 |
| l1_rollup_execution_gas | 842,957 | 1,576,699 | 3,361,917 |
| l2_block_processing_time_in_ms | 244 (-7%) | 434 (-4%) | 815 (-1%) |
| l2_block_building_time_in_ms | 11,372 (-1%) | 22,256 | 44,450 (-1%) |
| l2_block_rollup_simulation_time_in_ms | 11,372 (-1%) | 22,255 | 44,450 (-1%) |
| l2_block_public_tx_process_time_in_ms | 9,651 (-1%) | 20,461 | 42,609 (-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,979 (+2%) | 3,714 (-4%) |
| node_database_size_in_bytes | 12,607,568 | 16,695,376 |
| 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 | 91.9 (-1%) | 393 (-2%) | 21,735 | 44,860 | N/A |
| private-kernel-inner | 176 (-1%) | 700 | 72,544 | 45,007 | N/A |
| private-kernel-reset-tiny | 312 | 715 | 65,593 | 44,846 | N/A |
| private-kernel-tail | 166 (-1%) | 135 (-3%) | 50,644 | 52,257 | N/A |
| base-parity | 5.60 (-1%) | N/A | 160 | 96.0 | N/A |
| root-parity | 35.7 | N/A | 73,948 | 96.0 | N/A |
| base-rollup | 3,445 | N/A | 189,136 | 664 | N/A |
| block-root-rollup | 41.3 (-1%) | N/A | 58,205 | 2,448 | N/A |
| public-kernel-setup | 85.1 (-1%) | N/A | 105,085 | 71,222 | N/A |
| public-kernel-app-logic | 96.7 (-1%) | N/A | 104,911 | 71,222 | N/A |
| public-kernel-tail | 861 | N/A | 390,582 | 16,414 | N/A |
| private-kernel-reset-small | 311 (+1%) | N/A | 66,341 | 45,629 | N/A |
| private-kernel-tail-to-public | 668 | 612 | 455,400 | 1,825 | N/A |
| public-kernel-teardown | 86.1 (+1%) | N/A | 105,349 | 71,222 | N/A |
| merge-rollup | 20.1 (-2%) | N/A | 38,174 | 664 | N/A |
| undefined | N/A | N/A | N/A | N/A | 77,778 (+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.3 (-1%) |
| MultiCallEntrypoint:entrypoint | 1,920 | 11,731 | 405 (-1%) |
| FeeJuice:deploy | 1,376 | 11,731 | 390 (-1%) |
| SchnorrAccount:constructor | 1,312 | 11,731 | 73.6 (-1%) |
| SchnorrAccount:entrypoint | 2,304 | 11,731 | 395 (-1%) |
| Token:privately_mint_private_note | 1,280 | 11,731 | 106 (+7%) |
| FPC:fee_entrypoint_public | 1,344 | 11,731 | 26.1 (-6%) |
| Token:transfer | 1,312 | 11,731 | 235 (+3%) |
| Benchmarking:create_note | 1,344 | 11,731 | 87.8 (-1%) |
| SchnorrAccount:verify_private_authwit | 1,280 | 11,731 | 28.3 (+2%) |
| Token:unshield | 1,376 | 11,731 | 529 (+1%) |
| FPC:fee_entrypoint_private | 1,376 | 11,731 | 720 (-6%) |
AVM Simulation
Time to simulate various public functions in the AVM.
| Function | time_ms | bytecode_size_in_bytes |
|---|---|---|
| FeeJuice:_increase_public_balance | 54.9 (-1%) | 7,101 |
| FeeJuice:set_portal | 12.6 (+6%) | 2,128 |
| Token:constructor | 79.1 (-1%) | 25,285 |
| FPC:constructor | 54.1 | 17,853 |
| FeeJuice:mint_public | 39.9 (+12%) | 5,415 |
| Token:mint_public | 45.4 (-1%) | 10,101 |
| Token:assert_minter_and_mint | 65.8 (-5%) | 6,844 |
| AuthRegistry:set_authorized | 38.1 (-22%) | 3,969 |
| FPC:prepare_fee | 238 (-2%) | 6,747 |
| Token:transfer_public | 19.6 (-28%) | 38,126 |
| FPC:pay_refund | 50.6 (-14%) | 9,398 |
| Benchmarking:increment_balance | 1,197 | 6,179 |
| Token:_increase_public_balance | 42.8 (+6%) | 7,705 |
| FPC:pay_refund_with_shielded_rebate | 59.8 (-3%) | 9,881 |
Public DB Access
Time to access various public DBs.
| Function | time_ms |
|---|---|
| get-nullifier-index | 0.156 (-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.16 (-2%) | 3.90 | 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 (-2%) | 0.110 | N/A | N/A | N/A | N/A | N/A |
| batch_insert_into_append_only_tree_32_depth_ms | N/A | N/A | 11.3 (-2%) | 18.0 (-4%) | 30.7 (-4%) | 60.1 (-1%) | 115 (-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.108 (-2%) | 0.105 (-4%) | 0.100 (-3%) | 0.103 | 0.103 (-1%) |
| batch_insert_into_indexed_tree_20_depth_ms | N/A | N/A | 14.3 (-2%) | 25.3 (-3%) | 43.6 (-2%) | 81.9 (-2%) | 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.108 (-3%) | 0.102 (-3%) | 0.106 (-2%) | 0.101 (-2%) | 0.104 (+1%) |
| batch_insert_into_indexed_tree_40_depth_ms | N/A | N/A | 16.6 (-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 (-2%) | 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 | | | - | |