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

feat!: migrate public to avm simulator #6448

Merged
merged 4 commits into from
May 21, 2024
Merged

Conversation

fcarreiro
Copy link
Contributor

@fcarreiro fcarreiro commented May 16, 2024

This PR migrates the public (execution) environment to use the AVM simulator. The idea of this PR is to be as minimal as possible, as to enable easy rollbacks if needed. If things go well, there is a lot of cleanup to do afterwards, which we are tracking in this issue.

Major Changes

  • PublicContext gets replaced with what was the AvmContext.
  • Noir Aztec macros now always take the AVM path for public.
  • Migration notes are added.

Other changes

  • Delegate call tests are disabled, since the AVM doesn't support delegate calls.
  • ACIR public execution tests are disabled.
  • Fees were changed in bench_tx_size_fees since the cost is now different (bytecode and L2 gas changes).

Copy link
Contributor Author

fcarreiro commented May 16, 2024

@fcarreiro fcarreiro force-pushed the fc/avm-switch-error-messages branch from 5d6513a to 6f39822 Compare May 16, 2024 09:51
@fcarreiro fcarreiro force-pushed the fc/avm-switch-error-messages branch from 6f39822 to 2a1f2a6 Compare May 16, 2024 10:02
@fcarreiro fcarreiro changed the base branch from fc/avm-switch-error-messages to fc/avm-wrap-unconstrained-2 May 16, 2024 10:03
@fcarreiro fcarreiro marked this pull request as ready for review May 16, 2024 10:23
@fcarreiro fcarreiro requested a review from dbanks12 as a code owner May 16, 2024 10:23
@fcarreiro fcarreiro marked this pull request as draft May 16, 2024 10:23
@fcarreiro fcarreiro force-pushed the fc/avm-wrap-unconstrained-2 branch 3 times, most recently from 28a0fd5 to 3c6d42c Compare May 16, 2024 18:46
@fcarreiro fcarreiro force-pushed the fc/avm-wrap-unconstrained-2 branch 4 times, most recently from 773fba2 to 9b116e4 Compare May 16, 2024 22:07
Base automatically changed from fc/avm-wrap-unconstrained-2 to master May 16, 2024 22:46
@fcarreiro fcarreiro removed the request for review from dbanks12 May 17, 2024 08:14
@fcarreiro fcarreiro force-pushed the fc/migrate-to-simulator branch 2 times, most recently from bf86310 to 895dfa6 Compare May 17, 2024 09:19
@AztecBot
Copy link
Collaborator

AztecBot commented May 17, 2024

Docs Preview

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

@fcarreiro fcarreiro force-pushed the fc/migrate-to-simulator branch 3 times, most recently from cadddc9 to e250a18 Compare May 17, 2024 10:54
@AztecBot
Copy link
Collaborator

AztecBot commented May 17, 2024

Benchmark results

No base data found for comparison.

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 5,979 1,619 737 800 807

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 772 772 772
l1_rollup_calldata_gas 6,868 6,856 6,856
l1_rollup_execution_gas 587,408 587,396 587,396
l2_block_processing_time_in_ms 1,402 5,110 10,094
l2_block_building_time_in_ms 34,574 138,558 272,238
l2_block_rollup_simulation_time_in_ms 34,386 137,866 270,956
l2_block_public_tx_process_time_in_ms 18,249 77,247 155,224

L2 chain processing

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

Metric 5 blocks 10 blocks
node_history_sync_time_in_ms 15,260 28,453
node_database_size_in_bytes 21,233,744 38,133,840
pxe_database_size_in_bytes 29,868 59,425

Circuits stats

Stats on running time and I/O sizes collected for every kernel circuit run across all benchmarks.

Circuit protocol_circuit_simulation_time_in_ms protocol_circuit_witness_generation_time_in_ms protocol_circuit_proving_time_in_ms protocol_circuit_input_size_in_bytes protocol_circuit_output_size_in_bytes protocol_circuit_proof_size_in_bytes protocol_circuit_num_public_inputs protocol_circuit_size_in_gates
private-kernel-init 160 3,661 22,532 19,985 61,999 86,720 2,643 1,048,576
private-kernel-inner 605 5,176 40,623 89,053 61,999 86,720 2,643 2,097,152
private-kernel-reset-small 576 2,422 23,614 117,961 61,999 86,720 2,643 1,048,576
private-kernel-tail 531 2,848 40,055 86,849 79,454 10,688 267 2,097,152
base-parity 7.63 2,434 3,408 128 64.0 2,208 2.00 131,072
root-parity 50.0 130 42,087 27,064 64.0 2,720 18.0 2,097,152
base-rollup 840 2,869 43,432 111,158 957 3,136 31.0 2,097,152
root-rollup 93.8 120 8,409 11,518 821 3,456 41.0 524,288
public-kernel-app-logic 247 201 861 96,978 85,095 116,448 3,572 4,096
public-kernel-tail 893 836 983 388,207 7,755 10,176 251 512
public-kernel-setup 221 256 805 138,309 85,095 116,448 3,572 4,096
public-kernel-teardown 230 232 903 143,320 85,095 116,448 3,572 4,096
merge-rollup 6.51 95.9 1,583 2,760 957 3,136 31.0 65,536
private-kernel-tail-to-public N/A 10,123 72,821 N/A N/A 116,960 3,588 4,194,304

Stats on running time collected for app circuits

Function app_circuit_proof_size_in_bytes app_circuit_proving_time_in_ms app_circuit_size_in_gates app_circuit_num_public_inputs
SchnorrAccount:entrypoint 16,128 48,046 2,097,152 437
Test:emit_nullifier 16,128 2,280 65,536 437
FPC:fee_entrypoint_public 16,128 8,420 524,288 437
FPC:fee_entrypoint_private 16,128 8,896 524,288 437
Token:unshield 16,128 50,092 2,097,152 437
SchnorrAccount:spend_private_authwit 16,128 2,689 131,072 437
Token:transfer 16,128 35,074 2,097,152 437

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 11.3 18.4 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.656 0.564 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 52.4 81.3 262 506 995 1,966 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.536 0.501 0.476 0.473 0.472 0.469 N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 62.8 119 379 743 1,480 2,937 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.545 0.536 0.514 0.511 0.513 0.510 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 67.9
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 108
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.594

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,741 673,219

Transaction size based on fee payment method

| Metric | |
| - | |

Transaction processing duration by data writes.

Metric 0 new note hashes 1 new note hashes 2 new note hashes
tx_pxe_processing_time_ms 29,637 4,245 100,798
Metric 0 public data writes 1 public data writes 2 public data writes 4 public data writes 8 public data writes
tx_sequencer_processing_time_ms 1,410 2,293 1,992 3,159 2,007

@fcarreiro fcarreiro force-pushed the fc/migrate-to-simulator branch 2 times, most recently from d659d23 to 8f4187c Compare May 21, 2024 15:14
@fcarreiro fcarreiro closed this May 21, 2024
@fcarreiro fcarreiro reopened this May 21, 2024
@fcarreiro fcarreiro changed the base branch from master to nv/context-traits May 21, 2024 15:15
@fcarreiro fcarreiro marked this pull request as ready for review May 21, 2024 15:16
@fcarreiro fcarreiro requested a review from dbanks12 May 21, 2024 15:16
@fcarreiro fcarreiro marked this pull request as draft May 21, 2024 15:16
Copy link
Contributor

@dbanks12 dbanks12 left a comment

Choose a reason for hiding this comment

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

LGTM!

avm-transpiler/src/transpile_contract.rs Show resolved Hide resolved
Comment on lines 9 to 10
## TBD

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this TBD intended to mean "release number TBD"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! It gets changed before the actual release, but maybe I could just do 0.42

@@ -6,6 +6,26 @@ keywords: [sandbox, cli, aztec, notes, migration, updating, upgrading]

Aztec is in full-speed development. Literally every version breaks compatibility with the previous ones. This page attempts to target errors and difficulties you might encounter when upgrading, and how to resolve them.

## TBD
Copy link
Contributor

Choose a reason for hiding this comment

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

can you move it into 0.41?


**What does this mean for me?**

It should be mostly transparent, with a few caveats:
Copy link
Contributor

Choose a reason for hiding this comment

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

this is great! Thank you! Everything before it feels like it can be in docs and doesn't need to be in these notes. We tend to keep these notes as succinct as possible

Base automatically changed from nv/context-traits to master May 21, 2024 17:18
@fcarreiro fcarreiro marked this pull request as ready for review May 21, 2024 17:52
@dbanks12
Copy link
Contributor

Followup issues: #5818 #6583 #6578

@dbanks12 dbanks12 merged commit c45e8c2 into master May 21, 2024
73 checks passed
@dbanks12 dbanks12 deleted the fc/migrate-to-simulator branch May 21, 2024 23:31
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.

None yet

4 participants