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: refactor to use mod.nr support #7259

Merged
merged 3 commits into from
Jul 2, 2024
Merged

chore: refactor to use mod.nr support #7259

merged 3 commits into from
Jul 2, 2024

Conversation

TomAFrench
Copy link
Member

This PR refactors noir-projects to use the fact that mod foo can now resolve to a ./foo/mod.nr file rather than just a ./foo.nr file.

@AztecBot
Copy link
Collaborator

AztecBot commented Jul 2, 2024

Docs Preview

Hey there! 👋 You can check your preview at https://6684137b049b6288812012f5--aztec-docs-dev.netlify.app

@AztecBot
Copy link
Collaborator

AztecBot commented Jul 2, 2024

Benchmark results

Metrics with a significant change:

  • avm_simulation_time_ms (Token:mint_public): 72.5 (-88%)
  • avm_simulation_time_ms (Token:assert_minter_and_mint): 197 (+240%)
  • avm_simulation_time_ms (Token:transfer_public): 48.6 (+51%)
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,714 (-1%) 1,545 (-1%) 711 (-1%) 760 (+1%) 776 (-1%)
proof_construction_time_sha256_30_ms 11,792 (-2%) 3,147 (-1%) 1,419 (-1%) 1,455 1,478
proof_construction_time_sha256_100_ms 43,764 (-1%) 11,814 5,609 (+1%) 5,478 5,439
proof_construction_time_poseidon_hash_ms 78.0 (-1%) 35.0 (+3%) 34.0 57.0 (-2%) 87.0 (-1%)
proof_construction_time_poseidon_hash_30_ms 1,516 (-1%) 416 (-1%) 201 230 (+2%) 269 (+1%)
proof_construction_time_poseidon_hash_100_ms 5,724 (-1%) 1,562 (-1%) 728 779 (-3%) 792 (-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 1,412 1,412 1,412
l1_rollup_calldata_gas 9,476 9,466 9,476
l1_rollup_execution_gas 611,215 611,356 611,517
l2_block_processing_time_in_ms 769 (+2%) 1,414 2,722 (+1%)
l2_block_building_time_in_ms 24,687 (+1%) 48,979 96,107 (-1%)
l2_block_rollup_simulation_time_in_ms 24,687 (+1%) 48,979 96,106 (-1%)
l2_block_public_tx_process_time_in_ms 21,169 (+1%) 45,329 92,518 (-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 7,060 (+1%) 9,881 (+1%)
node_database_size_in_bytes 12,234,832 16,187,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 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 115 (-1%) 486 (+4%) 12,685 (-2%) 20,634 67,190 92,352 2,819 524,288
private-kernel-inner 358 914 (+1%) 49,847 (+2%) 94,902 67,190 92,352 2,819 2,097,152
private-kernel-tail 1,138 (+1%) 2,558 53,360 (+6%) 74,513 71,733 14,912 399 2,097,152
base-parity 6.26 (+2%) 1,788 (+2%) 2,655 128 64.0 2,208 2.00 131,072
root-parity 49.2 (+1%) 69.2 (-6%) 39,039 (-4%) 27,100 64.0 2,720 18.0 2,097,152
base-rollup 7,676 4,846 (-1%) 90,879 (+1%) 170,330 728 3,648 47.0 4,194,304
root-rollup 110 89.2 (+4%) 24,582 (+7%) 25,253 620 3,456 41.0 1,048,576
public-kernel-setup 633 3,605 (-3%) 44,364 (-2%) 116,905 93,334 125,344 3,850 2,097,152
public-kernel-app-logic 580 4,616 47,683 (+5%) 116,905 93,334 125,344 3,850 2,097,152
public-kernel-tail 1,375 (-1%) 37,733 (+6%) 192,451 511,910 10,014 14,912 399 8,388,608
private-kernel-reset-small 552 1,882 (-1%) 48,550 (+2%) 123,313 67,190 92,352 2,819 2,097,152
public-kernel-teardown 573 (-4%) 4,584 (-3%) 45,837 (-3%) 116,905 93,334 125,344 3,850 2,097,152
merge-rollup 29.1 (-1%) N/A N/A 16,486 728 N/A N/A N/A
private-kernel-tail-to-public N/A 8,544 53,452 (+3%) N/A N/A 125,344 3,850 2,097,152

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 404 (-1%) N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,408 9,944 39.3 (-1%) N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,920 9,944 1,288 (-1%) N/A N/A N/A N/A
GasToken:deploy 1,376 9,944 947 (-2%) N/A N/A N/A N/A
SchnorrAccount:constructor 1,312 9,944 488 N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,304 9,944 1,869 (-1%) 16,768 57,478 (+6%) 2,097,152 457
Token:privately_mint_private_note 1,280 9,944 632 (-1%) N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,344 9,944 299 (-1%) 16,768 11,966 (+1%) 524,288 457
Token:transfer 1,312 9,944 2,886 (-6%) 16,768 23,440 1,048,576 457
AuthRegistry:set_authorized (avm) 20,954 N/A N/A 94,336 1,253 (-6%) N/A N/A
FPC:prepare_fee (avm) 28,396 N/A N/A 94,400 2,829 (-6%) N/A N/A
Token:transfer_public (avm) 44,612 N/A N/A 94,400 3,808 (-3%) N/A N/A
AuthRegistry:consume (avm) 34,832 N/A N/A 94,336 2,881 (-6%) N/A N/A
FPC:pay_refund (avm) 38,561 N/A N/A 94,368 23,697 (+2%) N/A N/A
Benchmarking:create_note 1,344 9,944 483 (+1%) N/A N/A N/A N/A
SchnorrAccount:verify_private_authwit 1,280 9,944 72.4 N/A N/A N/A N/A
Token:unshield 1,376 9,944 2,703 N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,376 9,944 3,497 N/A N/A N/A N/A

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
GasToken:_increase_public_balance 70.7 (+5%) 13,790
GasToken:set_portal 17.6 (+9%) 3,305
Token:constructor 93.9 (-4%) 23,658
FPC:constructor 61.7 (-2%) 13,592
GasToken:mint_public 53.4 (+3%) 10,158
Token:mint_public ⚠️ 72.5 (-88%) 19,000
Token:assert_minter_and_mint ⚠️ 197 (+240%) 12,891
AuthRegistry:set_authorized 35.2 (+13%) 7,812
FPC:prepare_fee 139 (+4%) 15,062
Token:transfer_public ⚠️ 48.6 (+51%) 31,184
FPC:pay_refund 147 (-1%) 25,260
Benchmarking:increment_balance 2,604 15,233
Token:_increase_public_balance 57.5 (-1%) 14,972
FPC:pay_refund_with_shielded_rebate 131 (-2%) 26,347

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.152 (+1%)

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 10.3 (-1%) 16.6 (-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.597 (-1%) 0.511 (-1%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 48.2 75.9 131 (-1%) 245 470
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.493 0.467 0.451 0.444 0.439
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 59.4 112 182 353 693
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.502 0.503 0.480 0.479 0.477
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 72.7 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A 133 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A 0.518 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 85,707 670,983

Transaction size based on fee payment method

| Metric | |
| - | |

@TomAFrench TomAFrench merged commit cda45db into master Jul 2, 2024
91 checks passed
@TomAFrench TomAFrench deleted the tf/use-mod-nr branch July 2, 2024 15:21
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