Skip to content

feat!: storage_layout and #[aztec(storage)]#5387

Merged
Thunkar merged 90 commits into
masterfrom
gj/storage_layout
Apr 8, 2024
Merged

feat!: storage_layout and #[aztec(storage)]#5387
Thunkar merged 90 commits into
masterfrom
gj/storage_layout

Conversation

@Thunkar

@Thunkar Thunkar commented Mar 22, 2024

Copy link
Copy Markdown
Collaborator

Requires #5386

Closes #5079

Leveraging the new #[abi(tag)] export attribute, the #[aztec(storage] and #[aztec(note)] decorators are now used by the aztec macros to generate exportable global structs that include storage and notes info. These are then interpreted by noir-compiler in the ts codegen and exposed through the contract classes.

MyContractClass.storage.my_storage_variable.slot: Fr;
MyContractClass.notes.MyNote.id: Fr;

In the process I realized we didn't really need the process_def_collector pass, which has been removed (one less thing to worry about before moving to metaprogramming!) in favor of using #[aztec(note)] to identify notes that need to get included in the autogenerated compute_note_hash_and_nullifier implementation.

@Thunkar Thunkar changed the title initial version wip feat: storage_layout Mar 22, 2024
@Thunkar Thunkar force-pushed the gj/contract_abi_exports branch from 14b4fde to 44981a4 Compare March 22, 2024 11:59
@Thunkar Thunkar force-pushed the gj/storage_layout branch from d958ec9 to 0d8dd6e Compare March 22, 2024 12:41
@Thunkar Thunkar force-pushed the gj/contract_abi_exports branch from dda80d9 to 8e9e449 Compare March 22, 2024 14:19
@Thunkar Thunkar force-pushed the gj/storage_layout branch from 0d8dd6e to 35ddcab Compare March 22, 2024 14:19
@Thunkar Thunkar force-pushed the gj/contract_abi_exports branch from 8e9e449 to 81195fd Compare March 25, 2024 09:59
@Thunkar Thunkar force-pushed the gj/storage_layout branch from 35ddcab to e63b35c Compare March 25, 2024 09:59
@Thunkar Thunkar force-pushed the gj/contract_abi_exports branch from 81195fd to 097e3ae Compare March 26, 2024 08:03
@Thunkar Thunkar force-pushed the gj/storage_layout branch from e63b35c to ced6bcf Compare March 26, 2024 08:03
@Thunkar Thunkar force-pushed the gj/contract_abi_exports branch from 097e3ae to 856f0e6 Compare March 26, 2024 12:55
@Thunkar Thunkar force-pushed the gj/storage_layout branch from ced6bcf to e35698d Compare March 26, 2024 12:55
@AztecBot

AztecBot commented Mar 26, 2024

Copy link
Copy Markdown
Collaborator

Benchmark results

Metrics with a significant change:

  • circuit_simulation_time_in_ms (private-kernel-init): 209 (+16%)
  • circuit_simulation_time_in_ms (root-parity): 1,280 (+28%)
  • circuit_simulation_time_in_ms (private-kernel-inner): 263 (+21%)
  • circuit_input_size_in_bytes (base-rollup): 136,795 (+24%)
  • circuit_output_size_in_bytes (private-kernel-ordering): 26,992 (-31%)
  • circuit_output_size_in_bytes (public-kernel-tail): 17,323 (+143%)
  • tx_pxe_processing_time_ms (1): 1,255 (+16%)
  • tx_size_in_bytes (0): 27,925 (-31%)
  • note_history_trial_decrypting_time_in_ms (10): 234 (+117%)
  • l2_block_rollup_simulation_time_in_ms (8): 9,898 (-17%)
  • l2_block_rollup_simulation_time_in_ms (32): 35,623 (-16%)
  • l2_block_rollup_simulation_time_in_ms (64): 69,902 (-16%)
  • note_trial_decrypting_time_in_ms (64): 132 (+106%)
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 a974ec82 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,388 (-1%) 6,418 6,418
l1_rollup_execution_gas 585,721 585,751 585,751
l2_block_processing_time_in_ms 1,311 (-2%) 4,801 (+2%) 9,405 (-1%)
note_successful_decrypting_time_in_ms 254 (-4%) 563 (-1%) 1,007 (-3%)
note_trial_decrypting_time_in_ms 74.1 (+13%) 78.4 (+3%) ⚠️ 132 (+106%)
l2_block_building_time_in_ms 12,897 (+8%) 47,533 (+11%) 93,962 (+13%)
l2_block_rollup_simulation_time_in_ms ⚠️ 9,898 (-17%) ⚠️ 35,623 (-16%) ⚠️ 69,902 (-16%)
l2_block_public_tx_process_time_in_ms 6,035 (-4%) 23,907 47,992 (+1%)

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,784 (-4%) 26,572 (-4%)
note_history_successful_decrypting_time_in_ms 1,273 (-3%) 2,379 (-3%)
note_history_trial_decrypting_time_in_ms 136 (+7%) ⚠️ 234 (+117%)
node_database_size_in_bytes 18,665,552 35,051,600
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 ⚠️ 209 (+16%) 44,377 27,161 (+4%)
private-kernel-ordering 186 (+16%) 51,827 (+2%) ⚠️ 26,992 (-31%)
base-parity 4,110 (+3%) 128 311
root-parity ⚠️ 1,280 (+28%) 1,244 311
base-rollup 16,078 (+13%) ⚠️ 136,795 (+24%) 861
root-rollup 50.2 (+1%) 4,359 725
private-kernel-inner ⚠️ 263 (+21%) 72,734 (+1%) 27,154 (+4%)
public-kernel-app-logic 123 (+3%) 41,543 (-13%) 34,508 (-15%)
public-kernel-tail 167 (+3%) 47,355 (-11%) ⚠️ 17,323 (+143%)
merge-rollup 9.75 (+4%) 2,568 861
public-kernel-teardown 119 (+3%) 47,695 40,661
public-kernel-setup 118 (+3%) 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.0 (-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.584 (-1%) 0.499 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.3 (+1%) 72.9 (+1%) 233 (+1%) 445 (-1%) 896 (+3%) 1,725 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.476 (+1%) 0.450 (+1%) 0.425 (+1%) 0.416 0.426 (+3%) 0.413 N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 54.1 107 338 660 1,308 (+2%) 2,606 N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 104 (-1%) 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 0.481 (-1%) 0.460 0.454 0.454 (+2%) 0.453 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.2
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 ⚠️ 27,925 (-31%) 495,994

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,879 (+12%) ⚠️ 1,255 (+16%) 5,413
Metric 0 public data writes 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 17.1 656 (+15%) 397 1,082 (+2%) 525 (+3%) 1,771 (+2%) 583 (+2%)

@Thunkar Thunkar force-pushed the gj/storage_layout branch from e35698d to 554d3c1 Compare March 26, 2024 17:05
@Thunkar Thunkar enabled auto-merge (squash) April 8, 2024 17:01
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.

feat(AztecMacro): Extend artifact with storage layout

5 participants