Skip to content

feat(avm): add temporary sha256 execution#6604

Merged
IlyasRidhuan merged 1 commit intomasterfrom
05-22-feat_avm_add_temporary_sha256_execution
May 30, 2024
Merged

feat(avm): add temporary sha256 execution#6604
IlyasRidhuan merged 1 commit intomasterfrom
05-22-feat_avm_add_temporary_sha256_execution

Conversation

@IlyasRidhuan
Copy link
Contributor

Please read contributing guidelines and remove this line.

Copy link
Contributor Author

IlyasRidhuan commented May 22, 2024

@IlyasRidhuan IlyasRidhuan marked this pull request as ready for review May 22, 2024 16:02
@IlyasRidhuan IlyasRidhuan force-pushed the 05-17-feat_avm_avm_keccak_permutation branch from 7ba1cc9 to 5445448 Compare May 22, 2024 16:22
@IlyasRidhuan IlyasRidhuan force-pushed the 05-22-feat_avm_add_temporary_sha256_execution branch from 8a7869e to e357589 Compare May 22, 2024 16:22
@github-actions
Copy link
Contributor

github-actions bot commented May 22, 2024

Changes to circuit sizes

Generated at commit: 393e59c88db6fe2e545671c2b4e2611eefc9dba0, compared to commit: 1cc6b9321ff2f99a538333cfc8c36b86bb520644

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_merge +1,015 ❌ +333.88% +555,686 ❌ +1208.54%
rollup_root +738 ❌ +52.45% +614,711 ❌ +207.62%
public_kernel_teardown +33,641 ❌ +15.05% +994,808 ❌ +148.95%
public_kernel_setup -2,697 ✅ -1.21% +856,793 ❌ +128.34%
public_kernel_app_logic +4,910 ❌ +1.95% +865,335 ❌ +108.58%
rollup_base +3,310 ❌ +1.83% +346,415 ❌ +19.50%
public_kernel_tail -79,497 ✅ -7.72% +687,448 ❌ +18.53%
private_kernel_tail +4,758 ❌ +2.44% +148,257 ❌ +11.26%
private_kernel_reset_big +5,399 ❌ +3.11% +154,745 ❌ +10.00%
parity_root 0 ➖ 0.00% +75,134 ❌ +7.13%
private_kernel_reset_medium -873 ✅ -0.59% +82,349 ❌ +6.88%
private_kernel_reset_small -2,895 ✅ -2.16% +55,564 ❌ +5.48%
private_kernel_inner +3,274 ❌ +1.25% +70,837 ❌ +4.14%
private_kernel_init +3,058 ❌ +1.34% +29,740 ❌ +3.56%
private_kernel_init_simulated 0 ➖ 0.00% +77 ❌ +2.91%
private_kernel_inner_simulated 0 ➖ 0.00% +77 ❌ +2.91%
private_kernel_reset_simulated 0 ➖ 0.00% +77 ❌ +2.91%
private_kernel_reset_simulated_big 0 ➖ 0.00% +77 ❌ +2.91%
private_kernel_reset_simulated_medium 0 ➖ 0.00% +77 ❌ +2.91%
private_kernel_reset_simulated_small 0 ➖ 0.00% +77 ❌ +2.91%
private_kernel_tail_to_public -51,740 ✅ -8.32% +30,464 ❌ +1.42%
private_kernel_reset -15,477 ✅ -6.01% +17,927 ❌ +0.71%
parity_base 0 ➖ 0.00% -10 ✅ -0.01%
private_kernel_tail_to_public_simulated 0 ➖ 0.00% -79 ✅ -2.20%
public_kernel_app_logic_simulated 0 ➖ 0.00% -79 ✅ -2.20%
public_kernel_setup_simulated 0 ➖ 0.00% -79 ✅ -2.20%
public_kernel_teardown_simulated 0 ➖ 0.00% -79 ✅ -2.20%
private_kernel_tail_simulated 0 ➖ 0.00% -12 ✅ -4.49%
public_kernel_tail_simulated 0 ➖ 0.00% -12 ✅ -4.49%
rollup_base_simulated 0 ➖ 0.00% -11 ✅ -23.40%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_merge 1,319 (+1,015) +333.88% 601,666 (+555,686) +1208.54%
rollup_root 2,145 (+738) +52.45% 910,781 (+614,711) +207.62%
public_kernel_teardown 257,164 (+33,641) +15.05% 1,662,689 (+994,808) +148.95%
public_kernel_setup 220,620 (-2,697) -1.21% 1,524,381 (+856,793) +128.34%
public_kernel_app_logic 256,807 (+4,910) +1.95% 1,662,291 (+865,335) +108.58%
rollup_base 184,437 (+3,310) +1.83% 2,123,315 (+346,415) +19.50%
public_kernel_tail 949,934 (-79,497) -7.72% 4,397,289 (+687,448) +18.53%
private_kernel_tail 199,791 (+4,758) +2.44% 1,465,146 (+148,257) +11.26%
private_kernel_reset_big 178,779 (+5,399) +3.11% 1,701,843 (+154,745) +10.00%
parity_root 2,140 (0) 0.00% 1,129,296 (+75,134) +7.13%
private_kernel_reset_medium 147,187 (-873) -0.59% 1,279,735 (+82,349) +6.88%
private_kernel_reset_small 131,390 (-2,895) -2.16% 1,068,680 (+55,564) +5.48%
private_kernel_inner 265,942 (+3,274) +1.25% 1,783,212 (+70,837) +4.14%
private_kernel_init 231,177 (+3,058) +1.34% 865,493 (+29,740) +3.56%
private_kernel_init_simulated 1 (0) 0.00% 2,720 (+77) +2.91%
private_kernel_inner_simulated 1 (0) 0.00% 2,720 (+77) +2.91%
private_kernel_reset_simulated 1 (0) 0.00% 2,720 (+77) +2.91%
private_kernel_reset_simulated_big 1 (0) 0.00% 2,720 (+77) +2.91%
private_kernel_reset_simulated_medium 1 (0) 0.00% 2,720 (+77) +2.91%
private_kernel_reset_simulated_small 1 (0) 0.00% 2,720 (+77) +2.91%
private_kernel_tail_to_public 569,816 (-51,740) -8.32% 2,177,758 (+30,464) +1.42%
private_kernel_reset 241,966 (-15,477) -6.01% 2,546,062 (+17,927) +0.71%
parity_base 347 (0) 0.00% 79,811 (-10) -0.01%
private_kernel_tail_to_public_simulated 1 (0) 0.00% 3,509 (-79) -2.20%
public_kernel_app_logic_simulated 1 (0) 0.00% 3,509 (-79) -2.20%
public_kernel_setup_simulated 1 (0) 0.00% 3,509 (-79) -2.20%
public_kernel_teardown_simulated 1 (0) 0.00% 3,509 (-79) -2.20%
private_kernel_tail_simulated 1 (0) 0.00% 255 (-12) -4.49%
public_kernel_tail_simulated 1 (0) 0.00% 255 (-12) -4.49%
rollup_base_simulated 1 (0) 0.00% 36 (-11) -23.40%

@AztecBot
Copy link
Collaborator

AztecBot commented May 22, 2024

Benchmark results

Metrics with a significant change:

  • batch_insert_into_append_only_tree_32_depth_ms (1024): 477 (-21%)
  • batch_insert_into_indexed_tree_20_depth_ms (1024): 701 (-25%)
  • protocol_circuit_proving_time_in_ms (private-kernel-tail-to-public): 111,724 (+16%)
  • protocol_circuit_proving_time_in_ms (private-kernel-tail): 42,884 (+18%)
  • protocol_circuit_proving_time_in_ms (base-rollup): 81,169 (+24%)
  • protocol_circuit_proving_time_in_ms (public-kernel-app-logic): 45,403 (+17%)
  • protocol_circuit_proving_time_in_ms (root-parity): 39,930 (+18%)
  • protocol_circuit_proving_time_in_ms (public-kernel-tail): 191,337 (+23%)
  • protocol_circuit_proving_time_in_ms (root-rollup): 22,955 (+19%)
  • node_history_sync_time_in_ms (5): 14,610 (-20%)
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,766 1,576 (+1%) 714 (+1%) 755 773 (-1%)
proof_construction_time_sha256_30_ms 11,482 (-5%) 3,070 (-4%) 1,376 (-2%) 1,423 (-2%) 1,469
proof_construction_time_sha256_100_ms 44,085 (-3%) 11,814 (-3%) 5,420 (-4%) 5,396 (-3%) 5,378 (-2%)
proof_construction_time_poseidon_hash_ms 78.0 (-1%) 34.0 (-3%) 34.0 59.0 (+4%) 88.0 (-1%)
proof_construction_time_poseidon_hash_30_ms 1,531 (-1%) 423 203 226 (+3%) 267 (-2%)
proof_construction_time_poseidon_hash_100_ms 5,791 1,597 (+1%) 722 (-2%) 778 (-2%) 793

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,452
l1_rollup_execution_gas 616,105 616,105 616,093
l2_block_processing_time_in_ms 1,283 4,802 9,522
l2_block_building_time_in_ms 42,822 (-1%) 169,631 (-1%) 339,144 (-1%)
l2_block_rollup_simulation_time_in_ms 42,642 (-1%) 168,893 (-1%) 337,826 (-1%)
l2_block_public_tx_process_time_in_ms 37,073 (-1%) 165,619 (-1%) 332,137 (-1%)

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,589 (+1%) ⚠️ 14,610 (-20%)
node_database_size_in_bytes 14,475,344 21,344,336
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 133 (-4%) 467 (-6%) 14,169 (+7%) 20,634 64,614 89,536 2,731 524,288
private-kernel-inner 404 (-6%) 949 (-5%) 47,636 (+13%) 92,326 64,614 89,536 2,731 2,097,152
private-kernel-tail 582 (-6%) 2,687 (-5%) ⚠️ 42,884 (+18%) 96,545 77,732 11,648 297 2,097,152
base-parity 6.40 (-3%) 584 (-9%) 2,715 (+5%) 128 64.0 2,208 2.00 131,072
root-parity 48.4 (-2%) 57.4 (+18%) ⚠️ 39,930 (+18%) 27,100 64.0 2,720 18.0 2,097,152
base-rollup 8,863 (-5%) 2,321 (+1%) ⚠️ 81,169 (+24%) 119,738 756 3,648 47.0 4,194,304
root-rollup 109 (-3%) 77.8 (+20%) ⚠️ 22,955 (+19%) 25,309 620 3,456 41.0 1,048,576
public-kernel-app-logic 545 (-5%) 3,594 (+2%) ⚠️ 45,403 (+17%) 106,345 86,550 116,768 3,582 2,097,152
public-kernel-tail 1,115 (-4%) 24,570 (+7%) ⚠️ 191,337 (+23%) 401,006 7,646 11,648 297 8,388,608
private-kernel-reset-small 588 (-6%) 1,948 (-8%) 51,107 (+12%) 120,737 64,614 89,536 2,731 2,097,152
merge-rollup 31.1 (-6%) N/A N/A 16,542 756 N/A N/A N/A
public-kernel-setup 650 (+1%) N/A N/A 106,345 86,550 N/A N/A N/A
public-kernel-teardown 553 N/A N/A 106,345 86,550 N/A N/A N/A
private-kernel-tail-to-public N/A 8,209 (-7%) ⚠️ 111,724 (+16%) 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 457 (-2%) N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,408 9,944 41.0 (-5%) N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,920 9,944 1,697 (-3%) N/A N/A N/A N/A
SchnorrAccount:constructor 1,312 9,944 1,424 (-3%) N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,304 9,944 2,641 (-5%) 16,768 53,080 (+7%) 2,097,152 457
Token:privately_mint_private_note 1,280 9,944 1,540 (-6%) N/A N/A N/A N/A
Token:transfer 1,376 9,944 4,931 (-3%) 16,768 58,085 (+6%) 2,097,152 457
Benchmarking:create_note 1,344 9,944 1,393 (-5%) N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,344 9,944 239 N/A N/A N/A N/A
SchnorrAccount:spend_private_authwit 1,280 9,944 84.8 (+10%) N/A N/A N/A N/A
Token:unshield 1,376 9,944 3,743 N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,376 9,944 4,601 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.9 (-6%) 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.601 (-1%) 0.515 (-6%) 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 (-3%) 76.1 246 ⚠️ 477 (-21%) 929 1,840 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.493 (-3%) 0.469 0.447 0.445 (-22%) 0.440 0.439 N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 58.0 (-3%) 113 (+1%) 356 ⚠️ 701 (-25%) 1,387 2,760 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 (-4%) 0.504 0.482 0.480 (-26%) 0.479 0.479 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 (-4%)
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 (-4%)

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 | |
| - | |

@IlyasRidhuan IlyasRidhuan force-pushed the 05-17-feat_avm_avm_keccak_permutation branch from 5445448 to 1d469dd Compare May 28, 2024 08:54
@IlyasRidhuan IlyasRidhuan force-pushed the 05-22-feat_avm_add_temporary_sha256_execution branch from e357589 to 109b167 Compare May 28, 2024 08:54
Copy link
Contributor

@jeanmon jeanmon left a comment

Choose a reason for hiding this comment

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

LGTM. Please look at the comments.

@IlyasRidhuan IlyasRidhuan force-pushed the 05-17-feat_avm_avm_keccak_permutation branch 3 times, most recently from 442b868 to dafcfbf Compare May 30, 2024 08:35
Base automatically changed from 05-17-feat_avm_avm_keccak_permutation to master May 30, 2024 09:27
@IlyasRidhuan IlyasRidhuan force-pushed the 05-22-feat_avm_add_temporary_sha256_execution branch from 109b167 to 0c41a63 Compare May 30, 2024 09:34
@IlyasRidhuan IlyasRidhuan merged commit 34088b4 into master May 30, 2024
@IlyasRidhuan IlyasRidhuan deleted the 05-22-feat_avm_add_temporary_sha256_execution branch May 30, 2024 10:18
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