fix: add double double spend tx validator to node
Right now, when we send a transaction, we are not actually validating said transaction on its emission of duplicate nullifiers.
This stack of pull requests is managed by Graphite. Learn more about stacking.
Join @sklppy88 and the rest of your teammates on
Graphite
Benchmark results
Metrics with a significant change:
- protocol_circuit_simulation_time_in_ms (private-kernel-tail-to-public): 1,331 (+101%)
- avm_simulation_time_ms (FeeJuice:mint_public): 39.9 (-82%)
- avm_simulation_time_ms (Token:mint_public): 46.2 (-86%)
- avm_simulation_time_ms (Token:assert_minter_and_mint): 320 (+649%)
- avm_simulation_time_ms (Token:transfer_public): 22.5 (-40%)
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,758 | 1,560 (-1%) | 715 (+1%) | 758 | 780 (+1%) |
| proof_construction_time_sha256_30_ms | 11,520 | 3,095 | 1,386 (+1%) | 1,452 (+2%) | 1,464 |
| proof_construction_time_sha256_100_ms | 44,282 | 11,920 (+1%) | 5,502 (+2%) | 5,456 | 5,765 (+1%) |
| proof_construction_time_poseidon_hash_ms | 78.0 | 34.0 | 34.0 | 58.0 | 88.0 |
| proof_construction_time_poseidon_hash_30_ms | 1,529 | 421 | 205 (+1%) | 222 | 279 (+4%) |
| proof_construction_time_poseidon_hash_100_ms | 5,651 | 1,515 | 682 (+1%) | 734 (+3%) | 745 (-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,160 | 93,042 | 177,976 |
| l1_rollup_execution_gas | 842,820 | 1,576,598 | 3,361,588 |
| l2_block_processing_time_in_ms | 257 (-4%) | 452 | 828 (-9%) |
| l2_block_building_time_in_ms | 11,384 | 22,339 | 44,356 (-1%) |
| l2_block_rollup_simulation_time_in_ms | 11,384 | 22,338 | 44,356 (-1%) |
| l2_block_public_tx_process_time_in_ms | 9,685 (-1%) | 20,619 | 42,621 (-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 | 3,038 (+2%) | 3,916 |
| node_database_size_in_bytes | 12,611,664 | 16,724,048 |
| 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.4 | 424 (+7%) | 21,735 | 44,860 | N/A |
| private-kernel-inner | 173 (-2%) | 752 (+8%) | 72,544 | 45,007 | N/A |
| private-kernel-reset-tiny | 307 (-2%) | 757 (+5%) | 65,593 | 44,846 | N/A |
| private-kernel-tail | 166 (-1%) | 144 (+4%) | 50,644 | 52,257 | N/A |
| base-parity | 5.60 | N/A | 160 | 96.0 | N/A |
| root-parity | 35.7 (+1%) | N/A | 73,948 | 96.0 | N/A |
| base-rollup | 3,118 (+4%) | N/A | 189,136 | 664 | N/A |
| block-root-rollup | 41.7 (+1%) | N/A | 58,205 | 2,448 | N/A |
| public-kernel-setup | 84.4 (-1%) | N/A | 105,085 | 71,222 | N/A |
| public-kernel-app-logic | 97.3 (-1%) | N/A | 104,911 | 71,222 | N/A |
| public-kernel-tail | 859 | N/A | 390,582 | 16,414 | N/A |
| private-kernel-reset-small | 310 (-1%) | N/A | 66,341 | 45,629 | N/A |
| private-kernel-tail-to-public | :warning: 1,331 (+101%) | 655 (+8%) | 455,400 | 1,825 | N/A |
| public-kernel-teardown | 83.6 (-1%) | N/A | 105,349 | 71,222 | N/A |
| merge-rollup | 20.2 | N/A | 38,174 | 664 | N/A |
| undefined | N/A | N/A | N/A | N/A | 78,673 (+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 | 344 |
| ContractInstanceDeployer:deploy | 1,408 | 11,731 | 19.0 (+4%) |
| MultiCallEntrypoint:entrypoint | 1,920 | 11,731 | 416 (+2%) |
| FeeJuice:deploy | 1,376 | 11,731 | 389 (-1%) |
| SchnorrAccount:constructor | 1,312 | 11,731 | 76.3 (+4%) |
| SchnorrAccount:entrypoint | 2,304 | 11,731 | 401 (+2%) |
| Token:privately_mint_private_note | 1,280 | 11,731 | 102 (-1%) |
| FPC:fee_entrypoint_public | 1,344 | 11,731 | 26.4 (+3%) |
| Token:transfer | 1,312 | 11,731 | 228 |
| Benchmarking:create_note | 1,344 | 11,731 | 88.2 (+4%) |
| SchnorrAccount:verify_private_authwit | 1,280 | 11,731 | 28.3 (-14%) |
| Token:unshield | 1,376 | 11,731 | 521 (-1%) |
| FPC:fee_entrypoint_private | 1,376 | 11,731 | 731 (+4%) |
AVM Simulation
Time to simulate various public functions in the AVM.
| Function | time_ms | bytecode_size_in_bytes |
|---|---|---|
| FeeJuice:_increase_public_balance | 61.6 (+1%) | 8,174 |
| FeeJuice:set_portal | 10.9 (-16%) | 4,055 |
| Token:constructor | 82.3 (-2%) | 29,082 |
| FPC:constructor | 62.1 (+14%) | 18,940 |
| FeeJuice:mint_public | :warning: 39.9 (-82%) | 6,522 |
| Token:mint_public | :warning: 46.2 (-86%) | 12,704 |
| Token:assert_minter_and_mint | :warning: 320 (+649%) | 8,467 |
| AuthRegistry:set_authorized | 38.8 (-20%) | 4,194 |
| FPC:prepare_fee | 232 (-5%) | 6,747 |
| Token:transfer_public | :warning: 22.5 (-40%) | 39,863 |
| FPC:pay_refund | 52.2 (-5%) | 9,398 |
| Benchmarking:increment_balance | 1,215 (-1%) | 7,263 |
| Token:_increase_public_balance | 41.8 (-4%) | 8,686 |
| FPC:pay_refund_with_shielded_rebate | 62.4 (-2%) | 9,881 |
Public DB Access
Time to access various public DBs.
| Function | time_ms |
|---|---|
| get-nullifier-index | 0.157 (-3%) |
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 (-4%) | 4.05 | 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.113 (-5%) | 0.114 (-2%) | N/A | N/A | N/A | N/A | N/A |
| batch_insert_into_append_only_tree_32_depth_ms | N/A | N/A | 11.5 (+1%) | 17.7 (-10%) | 31.1 (-15%) | 59.0 (-1%) | 114 (-14%) |
| 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.110 | 0.102 (-10%) | 0.101 (-16%) | 0.102 (-2%) | 0.102 (-15%) |
| batch_insert_into_indexed_tree_20_depth_ms | N/A | N/A | 14.7 (-1%) | 25.8 (-8%) | 44.0 (-9%) | 82.2 (-3%) | 163 (-15%) |
| 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.112 (-1%) | 0.104 (-9%) | 0.106 (-10%) | 0.101 (-3%) | 0.104 (-16%) |
| batch_insert_into_indexed_tree_40_depth_ms | N/A | N/A | 16.6 (-3%) | N/A | N/A | N/A | N/A |
| batch_insert_into_indexed_tree_40_depth_hash_count | N/A | N/A | 132 (-1%) | N/A | N/A | N/A | N/A |
| batch_insert_into_indexed_tree_40_depth_hash_ms | N/A | N/A | 0.106 (-3%) | 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 | | | - | |