Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add example for recursion on the CLI #6389

Merged
merged 8 commits into from
May 29, 2024
Merged

Conversation

TomAFrench
Copy link
Member

This PR adds an example script which does recursive verification using nargo and the bb binary as based on @jzaki's javascript example noir-lang/noir#4969.

@TomAFrench TomAFrench requested a review from jzaki May 14, 2024 13:44
@AztecBot
Copy link
Collaborator

AztecBot commented May 20, 2024

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,750 1,549 698 753 (+1%) 771 (-1%)
proof_construction_time_sha256_30_ms 11,757 3,144 1,407 1,444 (+1%) 1,469 (+1%)
proof_construction_time_sha256_100_ms 43,877 11,793 5,417 5,378 5,346
proof_construction_time_poseidon_hash_ms 78.0 34.0 34.0 57.0 (-2%) 87.0
proof_construction_time_poseidon_hash_30_ms 1,522 419 202 231 (+3%) 266 (-1%)
proof_construction_time_poseidon_hash_100_ms 5,740 1,564 724 778 (-1%) 801

L2 block published to L1

Each column represents the number of txs on an L2 block published to L1.

Metric 8 txs 32 txs 64 txs
l1_rollup_calldata_size_in_bytes 1,412 1,412 1,412
l1_rollup_calldata_gas 9,464 9,464 9,440
l1_rollup_execution_gas 616,105 616,105 616,081
l2_block_processing_time_in_ms 1,293 (+1%) 4,810 9,572
l2_block_building_time_in_ms 45,961 (-2%) 182,373 (-5%) 364,332 (-3%)
l2_block_rollup_simulation_time_in_ms 45,789 (-2%) 181,736 (-5%) 363,076 (-3%)
l2_block_public_tx_process_time_in_ms 24,680 (-5%) 103,283 (-5%) 211,083 (-3%)

L2 chain processing

Each column represents the number of blocks on the L2 chain where each block has 16 txs.

Metric 3 blocks 5 blocks
node_history_sync_time_in_ms 9,537 (+1%) 14,552 (+1%)
node_database_size_in_bytes 14,508,112 21,393,488
pxe_database_size_in_bytes 18,071 29,868

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 proving_time_in_ms input_size_in_bytes output_size_in_bytes proof_size_in_bytes num_public_inputs size_in_gates
private-kernel-init 136 (-4%) 476 (-13%) 13,661 (+6%) 20,630 64,614 89,536 2,731 524,288
private-kernel-inner 410 (-4%) 925 (-3%) 47,149 (+9%) 92,318 64,614 89,536 2,731 2,097,152
private-kernel-tail 584 (-3%) 2,860 (-5%) 43,886 (-5%) 96,541 77,732 11,648 297 2,097,152
base-parity 6.44 (-1%) 1,229 (+10%) 2,790 (+1%) 128 64.0 2,208 2.00 131,072
root-parity 48.8 77.5 (+25%) 50,654 (-2%) 27,084 64.0 2,720 18.0 2,097,152
base-rollup 741 (-1%) 2,385 (+2%) 85,655 119,734 756 3,648 47.0 4,194,304
root-rollup 109 73.0 (-1%) 23,898 (+2%) 25,297 620 3,456 41.0 1,048,576
public-kernel-app-logic 539 (-1%) 3,084 (+1%) 51,602 105,253 86,550 116,768 3,582 2,097,152
public-kernel-tail 1,123 (-2%) 26,077 (+10%) 178,475 (-1%) 401,002 7,646 11,648 297 8,388,608
private-kernel-reset-small 590 (-2%) 1,965 (-2%) 49,239 120,733 64,614 89,536 2,731 2,097,152
merge-rollup 28.8 (-1%) N/A N/A 16,534 756 N/A N/A N/A
public-kernel-setup 656 (+4%) N/A N/A 105,253 86,550 N/A N/A N/A
public-kernel-teardown 555 (+4%) N/A N/A 105,253 86,550 N/A N/A N/A
private-kernel-tail-to-public N/A 8,231 (+1%) 106,092 (+3%) N/A N/A 116,768 3,582 4,194,304

Stats on running time collected for app circuits

Function input_size_in_bytes output_size_in_bytes witness_generation_time_in_ms proof_size_in_bytes proving_time_in_ms size_in_gates num_public_inputs
ContractClassRegisterer:register 1,344 9,944 461 N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,408 9,944 40.9 N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,920 9,944 1,680 (-1%) N/A N/A N/A N/A
SchnorrAccount:constructor 1,312 9,944 1,425 (-2%) N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,304 9,944 2,644 (-2%) 16,768 52,450 (-12%) 2,097,152 457
Token:privately_mint_private_note 1,280 9,944 1,545 (+1%) N/A N/A N/A N/A
Token:transfer 1,376 9,944 4,903 16,768 57,523 (+14%) 2,097,152 457
Benchmarking:create_note 1,344 9,944 1,405 (-4%) N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,344 9,944 231 (+1%) N/A N/A N/A N/A
SchnorrAccount:spend_private_authwit 1,280 9,944 76.9 (-12%) N/A N/A N/A N/A
Token:unshield 1,376 9,944 3,708 N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,376 9,944 4,563 (-1%) N/A N/A N/A N/A

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 512 leaves 1024 leaves 2048 leaves 4096 leaves 32 leaves
batch_insert_into_append_only_tree_16_depth_ms 10.4 (-1%) 16.8 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.7 31.8 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.602 (-2%) 0.516 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 48.4 (-2%) 76.2 245 (-1%) 478 (+1%) 927 1,842 N/A
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 95.9 159 543 1,055 2,079 4,127 N/A
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.494 (-2%) 0.468 0.445 (-1%) 0.445 (+1%) 0.439 0.439 N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 57.9 (-2%) 112 356 703 (+1%) 1,384 2,756 N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 106 208 692 1,363 2,707 5,395 N/A
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.501 (-2%) 0.503 0.481 0.482 (+1%) 0.478 0.477 N/A
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A N/A N/A N/A N/A N/A 62.6 (-1%)
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A N/A N/A N/A N/A N/A N/A 107
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A N/A N/A N/A N/A N/A N/A 0.554 (-1%)

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 84,050 665,267

Transaction size based on fee payment method

| Metric | |
| - | |

noir/Earthfile Outdated Show resolved Hide resolved
Copy link
Contributor

@jzaki jzaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor points that may be ignored.

@TomAFrench TomAFrench enabled auto-merge (squash) May 22, 2024 17:45
@TomAFrench TomAFrench merged commit e704ff6 into master May 29, 2024
86 checks passed
@TomAFrench TomAFrench deleted the tf/native-recursion branch May 29, 2024 18:56
Maddiaa0 pushed a commit that referenced this pull request Jun 5, 2024
This PR adds an example script which does recursive verification using
`nargo` and the `bb` binary as based on @jzaki's javascript example
noir-lang/noir#4969.
Maddiaa0 pushed a commit that referenced this pull request Jun 5, 2024
This PR adds an example script which does recursive verification using
`nargo` and the `bb` binary as based on @jzaki's javascript example
noir-lang/noir#4969.
github-merge-queue bot pushed a commit to noir-lang/noir that referenced this pull request Jun 11, 2024
Automated pull of Noir development from
[aztec-packages](https://github.com/AztecProtocol/aztec-packages).
BEGIN_COMMIT_OVERRIDE
chore: add example for recursion on the CLI
(AztecProtocol/aztec-packages#6389)
feat(nargo): hidden option to show contract artifact paths written by
`nargo compile`
(AztecProtocol/aztec-packages#6131)
chore: add bench programs
(AztecProtocol/aztec-packages#6566)
END_COMMIT_OVERRIDE

---------

Co-authored-by: TomAFrench <[email protected]>
Co-authored-by: Tom French <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants