fix: making sent tx's fail at validation, rather than waiting for the non inclusion of the tx at a block
Right now when we send a TX to the node, it gets "fake" validated; because if invalid, a no-op occurs, it doesn't give users feedback directly in any way. The transaction is not forwarded to the p2p client, and nothing is returned to the user.
This change makes a sent transaction fail early if the transaction is invalid (that is, unable to be included in any block to advance state).
The mechanism by which this occurs is similar to what is implemented for a simulation, that is we use the previously introduced endpoint on the node to validate if the transaction is not invalid according to our above definition, and if it is invalid, we throw an error on the spot.
- #7852

- #7841
👈 - #7951
: 2 other dependent PRs (#8157
, #8220
) - #7839
: 1 other dependent PR (#7840
) master
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 (base-rollup): 3,122 (+19%)
- protocol_circuit_simulation_time_in_ms (private-kernel-tail-to-public): 1,079 (-22%)
- avm_simulation_time_ms (Token:mint_public): 301 (+474%)
- avm_simulation_time_ms (AuthRegistry:set_authorized): 49.2 (+31%)
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,757 | 1,559 | 717 | 767 (+1%) | 776 (-1%) |
| proof_construction_time_sha256_30_ms | 11,456 | 3,084 | 1,381 (-1%) | 1,454 (+1%) | 1,455 (-1%) |
| proof_construction_time_sha256_100_ms | 44,107 | 11,840 | 5,475 | 5,518 (+1%) | 5,633 (-2%) |
| proof_construction_time_poseidon_hash_ms | 78.0 | 34.0 | 34.0 | 57.0 | 87.0 (-2%) |
| proof_construction_time_poseidon_hash_30_ms | 1,531 | 421 | 202 (-1%) | 221 (-2%) | 269 (+1%) |
| proof_construction_time_poseidon_hash_100_ms | 5,643 | 1,511 (-1%) | 678 | 724 (-1%) | 750 |
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,268 | 92,980 | 178,144 |
| l1_rollup_execution_gas | 843,087 | 1,576,695 | 3,361,915 |
| l2_block_processing_time_in_ms | 250 (-2%) | 446 (+3%) | 810 |
| l2_block_building_time_in_ms | 11,493 (+1%) | 22,548 (+1%) | 44,398 (-1%) |
| l2_block_rollup_simulation_time_in_ms | 11,492 (+1%) | 22,547 (+1%) | 44,398 (-1%) |
| l2_block_public_tx_process_time_in_ms | 9,801 (+1%) | 20,833 (+1%) | 42,678 (-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,013 (+3%) | 3,910 (+4%) |
| node_database_size_in_bytes | 12,607,568 | 16,699,472 |
| 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 | 92.2 (-5%) | 378 (-3%) | 21,474 | 44,898 | N/A |
| private-kernel-inner | 170 (-3%) | 702 (+2%) | 72,411 | 45,020 | N/A |
| private-kernel-reset-tiny | 320 (+4%) | 698 (-2%) | 65,240 | 44,886 | N/A |
| private-kernel-tail | 168 | 131 (-5%) | 50,608 | 52,921 | N/A |
| base-parity | 5.57 | N/A | 160 | 96.0 | N/A |
| root-parity | 35.0 | N/A | 73,948 | 96.0 | N/A |
| base-rollup | :warning: 3,122 (+19%) | N/A | 189,195 | 664 | N/A |
| block-root-rollup | 41.1 | N/A | 58,205 | 2,448 | N/A |
| public-kernel-setup | 85.4 (+1%) | N/A | 105,085 | 71,222 | N/A |
| public-kernel-app-logic | 97.9 (+1%) | N/A | 104,898 | 71,222 | N/A |
| public-kernel-tail | 858 | N/A | 390,582 | 16,414 | N/A |
| private-kernel-reset-small | 308 | N/A | 66,341 | 45,629 | N/A |
| private-kernel-tail-to-public | :warning: 1,079 (-22%) | 594 (-1%) | 455,400 | 1,825 | N/A |
| public-kernel-teardown | 83.7 | N/A | 105,349 | 71,222 | N/A |
| merge-rollup | 20.2 (+1%) | N/A | 38,174 | 664 | N/A |
| undefined | N/A | N/A | N/A | N/A | 82,212 |
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 | 343 (-1%) |
| ContractInstanceDeployer:deploy | 1,408 | 11,731 | 18.3 (-2%) |
| MultiCallEntrypoint:entrypoint | 1,920 | 11,731 | 406 (-1%) |
| FeeJuice:deploy | 1,376 | 11,731 | 386 (-3%) |
| SchnorrAccount:constructor | 1,312 | 11,731 | 72.8 (-6%) |
| SchnorrAccount:entrypoint | 2,336 | 11,731 | 383 (-1%) |
| FeeJuice:claim | 1,344 | 11,731 | 39.1 (-1%) |
| Token:privately_mint_private_note | 1,280 | 11,731 | 99.6 |
| FPC:fee_entrypoint_public | 1,344 | 11,731 | 25.7 (-2%) |
| Token:transfer | 1,312 | 11,731 | 221 (-9%) |
| Benchmarking:create_note | 1,344 | 11,731 | 86.0 |
| SchnorrAccount:verify_private_authwit | 1,280 | 11,731 | 27.7 (-12%) |
| Token:unshield | 1,376 | 11,731 | 520 (-4%) |
| FPC:fee_entrypoint_private | 1,376 | 11,731 | 696 (-2%) |
AVM Simulation
Time to simulate various public functions in the AVM.
| Function | time_ms | bytecode_size_in_bytes |
|---|---|---|
| FeeJuice:_increase_public_balance | 49.4 (-4%) | 8,174 |
| FeeJuice:set_portal | 11.6 (-23%) | 4,055 |
| Token:constructor | 87.1 (+5%) | 29,082 |
| FPC:constructor | 55.6 (-1%) | 18,940 |
| FeeJuice:check_balance | 38.6 (-2%) | 5,978 |
| Token:mint_public | :warning: 301 (+474%) | 12,704 |
| Token:assert_minter_and_mint | 478 (-1%) | 8,467 |
| AuthRegistry:set_authorized | :warning: 49.2 (+31%) | 4,194 |
| FPC:prepare_fee | 246 (+10%) | 6,747 |
| Token:transfer_public | 36.1 (+25%) | 39,863 |
| FPC:pay_refund | 54.6 (+2%) | 9,398 |
| Benchmarking:increment_balance | 1,227 | 7,263 |
| Token:_increase_public_balance | 50.5 (+19%) | 8,686 |
| FPC:pay_refund_with_shielded_rebate | 62.4 | 9,881 |
Public DB Access
Time to access various public DBs.
| Function | time_ms |
|---|---|
| get-nullifier-index | 0.153 (-6%) |
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.18 | 3.82 (-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.113 (+1%) | 0.107 (-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.1 (-1%) | 18.0 (+3%) | 31.0 (+1%) | 59.8 | 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.106 (-1%) | 0.104 (+2%) | 0.100 | 0.103 | 0.102 (+1%) |
| batch_insert_into_indexed_tree_20_depth_ms | N/A | N/A | 14.4 (-1%) | 25.7 | 44.0 (+1%) | 83.1 (+1%) | 160 (-1%) |
| batch_insert_into_indexed_tree_20_depth_hash_count | N/A | N/A | 108 | 207 | 355 | 691 | 1,363 |
| batch_insert_into_indexed_tree_20_depth_hash_ms | N/A | N/A | 0.111 | 0.104 (+1%) | 0.106 | 0.103 | 0.102 (-1%) |
| 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 (+1%) | 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,838 | 668,997 |
Transaction size based on fee payment method
| Metric | | | - | |
Closing as stale.