Skip to content

feat(avm): integrate AVM with initializers - #5469

Merged
fcarreiro merged 1 commit into
masterfrom
fc/avm-initializers
Apr 4, 2024
Merged

fcarreiro merged 1 commit into
masterfrom
fc/avm-initializers

Conversation

@fcarreiro

@fcarreiro fcarreiro commented Mar 26, 2024

Copy link
Copy Markdown
Contributor

This PR creates private/public/avm variants of some lib functions used for initializers. This is because in general the flow in private/public/avm will be substantially different. The public version will be removed once the AVM is fully enabled.

I'm adding a new AVM test contract because: having an initializer adds a check to EVERY other function in the contract. This makes the unit tests fail.

@fcarreiro
fcarreiro force-pushed the fc/avm-initializers branch from 69b04dd to 074d44b Compare March 26, 2024 19:39

fcarreiro commented Mar 26, 2024

Copy link
Copy Markdown
Contributor Author

@AztecBot

AztecBot commented Mar 26, 2024

Copy link
Copy Markdown
Collaborator

Benchmark results

Metrics with a significant change:

  • note_trial_decrypting_time_in_ms (64): 116 (+119%)
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.

Values are compared against data from master at commit a082723e and shown if the difference exceeds 1%.

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 676 676 676
l1_rollup_calldata_gas 6,400 6,400 6,424
l1_rollup_execution_gas 585,733 585,733 585,757
l2_block_processing_time_in_ms 1,302 (+3%) 4,811 9,527 (+3%)
note_successful_decrypting_time_in_ms 231 (-6%) 590 (+2%) 998 (+7%)
note_trial_decrypting_time_in_ms 33.1 (-29%) 99.3 (+11%) ⚠️ 116 (+119%)
l2_block_building_time_in_ms 11,983 (+2%) 43,466 (+1%) 85,194
l2_block_rollup_simulation_time_in_ms 7,139 (+1%) 24,567 (+1%) 47,016
l2_block_public_tx_process_time_in_ms 4,806 (+2%) 18,769 (+2%) 37,929

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 13,885 (-1%) 27,751 (+1%)
note_history_successful_decrypting_time_in_ms 1,285 (-1%) 2,411 (+1%)
note_history_trial_decrypting_time_in_ms 101 (-2%) 116 (+16%)
node_database_size_in_bytes 18,616,400 34,893,904
pxe_database_size_in_bytes 29,859 59,414

Circuits stats

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

Circuit circuit_simulation_time_in_ms circuit_input_size_in_bytes circuit_output_size_in_bytes
private-kernel-init 179 44,377 26,164
private-kernel-ordering 161 (+1%) 50,830 39,325
base-parity 4,189 (+1%) 128 311
root-parity 1,149 (-1%) 1,244 311
base-rollup 14,440 116,608 861
root-rollup 50.0 (-1%) 4,359 725
private-kernel-inner 218 (+1%) 71,744 26,164
public-kernel-app-logic 120 (+1%) 47,695 40,661
public-kernel-tail 163 (+1%) 53,372 13,269
merge-rollup 9.27 (-9%) 2,568 861
public-kernel-teardown 119 (+3%) 47,695 40,661
public-kernel-setup 118 (+2%) 47,695 40,661

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.1 16.1 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.8 31.6 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.585 0.496 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 46.2 72.8 232 (+1%) 450 873 (+2%) 1,724 (+1%) N/A
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 96.0 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.473 (+1%) 0.448 0.422 (+1%) 0.419 0.415 (+2%) 0.413 (+1%) N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 54.5 (+1%) 108 337 (+2%) 662 1,309 (+1%) 2,608 N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 105 207 691 1,363 2,707 5,395 N/A
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.480 (+1%) 0.483 0.458 (+1%) 0.455 0.454 (+1%) 0.454 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 61.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 109
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.535

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 40,548 501,142

Transaction size based on fee payment method

Metric native fee payment method fpc_public fee payment method fpc_private fee payment method
tx_with_fee_size_in_bytes 905 1,161 1,377

Transaction processing duration by data writes.

Metric 0 new note hashes 1 new note hashes 2 new note hashes
tx_pxe_processing_time_ms 1,706 1,081 5,418 (-1%)
Metric 1 public data writes 2 public data writes 3 public data writes 4 public data writes 5 public data writes 8 public data writes
tx_sequencer_processing_time_ms 578 (+1%) 443 (+2%) 1,078 (+1%) 527 (+1%) 1,767 (+1%) 592 (+1%)

@fcarreiro
fcarreiro force-pushed the fc/avm-initializers branch 2 times, most recently from 37bc5fc to 3af25bb Compare March 27, 2024 12:39
@fcarreiro
fcarreiro force-pushed the fc/avm-unify-macros branch from 1b390fb to db2b0d0 Compare March 27, 2024 14:33
Base automatically changed from fc/avm-unify-macros to master March 27, 2024 15:06
@fcarreiro
fcarreiro force-pushed the fc/avm-initializers branch from 3af25bb to 3a23b34 Compare March 27, 2024 18:16
@fcarreiro
fcarreiro changed the base branch from master to fc/avm-fix-nullifiers March 27, 2024 18:16
@fcarreiro fcarreiro changed the title feat(avm): partially integrate with initializers feat(avm): integrate AVM with initializers Mar 27, 2024
@fcarreiro
fcarreiro force-pushed the fc/avm-fix-nullifiers branch from 2d8b9f2 to bd9e8d1 Compare March 28, 2024 10:02
@fcarreiro
fcarreiro force-pushed the fc/avm-initializers branch from 3a23b34 to d4f8121 Compare March 28, 2024 10:02
@fcarreiro
fcarreiro force-pushed the fc/avm-fix-nullifiers branch from bd9e8d1 to 7af910f Compare March 28, 2024 10:16
@fcarreiro
fcarreiro force-pushed the fc/avm-initializers branch from d4f8121 to 5f1cc3f Compare March 28, 2024 10:16
@fcarreiro
fcarreiro force-pushed the fc/avm-fix-nullifiers branch from 7af910f to 631fdb0 Compare April 2, 2024 10:12
@fcarreiro
fcarreiro force-pushed the fc/avm-initializers branch from 5f1cc3f to 5f0ae1f Compare April 2, 2024 10:12
@fcarreiro
fcarreiro force-pushed the fc/avm-fix-nullifiers branch from 631fdb0 to 60163ed Compare April 2, 2024 10:28
@fcarreiro
fcarreiro force-pushed the fc/avm-initializers branch from 5f0ae1f to 50a5ec5 Compare April 2, 2024 10:28
@fcarreiro
fcarreiro force-pushed the fc/avm-fix-nullifiers branch from 60163ed to fb89f86 Compare April 2, 2024 10:38
@fcarreiro
fcarreiro force-pushed the fc/avm-initializers branch 2 times, most recently from 3f676da to 41eeb0f Compare April 2, 2024 10:42
@fcarreiro
fcarreiro force-pushed the fc/avm-fix-nullifiers branch from fb89f86 to c5fb078 Compare April 2, 2024 11:00
@fcarreiro
fcarreiro force-pushed the fc/avm-initializers branch from 41eeb0f to 9520c32 Compare April 2, 2024 11:00
@fcarreiro
fcarreiro force-pushed the fc/avm-fix-nullifiers branch from c5fb078 to 15ce335 Compare April 2, 2024 12:19
@fcarreiro
fcarreiro force-pushed the fc/avm-initializers branch from 9520c32 to 25f7557 Compare April 2, 2024 12:19
@fcarreiro
fcarreiro force-pushed the fc/avm-fix-nullifiers branch from 15ce335 to d0997a3 Compare April 2, 2024 16:30
@fcarreiro
fcarreiro merged commit 59799f2 into master Apr 4, 2024
@fcarreiro
fcarreiro deleted the fc/avm-initializers branch April 4, 2024 11:55

Copy link
Copy Markdown
Contributor Author

Merge activity

AztecBot pushed a commit to noir-lang/noir that referenced this pull request Apr 4, 2024
…ges#5469)

This PR creates private/public/avm variants of some lib functions used for initializers. This is because in general the flow in private/public/avm will be substantially different. The public version will be removed once the AVM is fully enabled.

I'm adding a new AVM test contract because: having an initializer adds a check to EVERY other function in the contract. This makes the unit tests fail.
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