Skip to content

feat!: Support contracts with no constructor - #5175

Merged
spalladino merged 10 commits into
masterfrom
palla/allow-no-ctor
Mar 14, 2024
Merged

feat!: Support contracts with no constructor#5175
spalladino merged 10 commits into
masterfrom
palla/allow-no-ctor

Conversation

@spalladino

@spalladino spalladino commented Mar 12, 2024

Copy link
Copy Markdown
Contributor

Changes:

  • Breaking: constructor is no longer an enshrined function name, it's now required to flag the constructor with aztec(initializer).
  • Remove need for a function named constructor in noir aztec-macros and yarn-packages
  • Add isInitializer flag to contract artifact
  • Default the initializer to a function that has the aztec(initializer) attribute, if there's more than one, pick one at random, preferring private ones
  • When there's no initializer, the initializationHash of a contract instance is set to zero
  • Remove empty constructor functions from our contracts, and flag public constructors as initializer where missing

cc @AztecProtocol/devrel

@AztecBot

ghost commented Mar 12, 2024

Copy link
Copy Markdown
Collaborator

Benchmark results

Metrics with a significant change:

  • tx_pxe_processing_time_ms (0): 3,258 (-18%)
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 19eb7f9b 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 5,668 18,820 36,356
l1_rollup_calldata_gas 66,232 238,996 469,616
l1_rollup_execution_gas 666,913 953,906 1,336,973
l2_block_processing_time_in_ms 1,279 (-12%) 4,837 (+3%) 8,963 (+3%)
note_successful_decrypting_time_in_ms 138 473 (-12%) 930 (-6%)
note_trial_decrypting_time_in_ms 41.6 89.2 (+71%) 60.4 (-51%)
l2_block_building_time_in_ms 18,457 69,648 (+1%) 137,531 (+2%)
l2_block_rollup_simulation_time_in_ms 8,273 29,110 (+1%) 56,669 (+2%)
l2_block_public_tx_process_time_in_ms 10,163 40,478 80,763 (+2%)

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 14,499 (+3%) 27,866 (+3%)
note_history_successful_decrypting_time_in_ms 1,189 (-13%) 2,496 (+2%)
note_history_trial_decrypting_time_in_ms 60.6 (+9%) 155 (+20%)
node_database_size_in_bytes 19,079,248 35,639,376
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 284 (+1%) 44,370 27,700
private-kernel-ordering 218 (+1%) 52,324 14,326
base-parity 1,809 (-1%) 128 311
base-rollup 724 177,083 925
root-parity 1,680 (+8%) 1,244 311
root-rollup 68.9 4,487 789
private-kernel-inner 640 (+1%) 73,229 27,700
public-kernel-app-logic 453 (+2%) 35,262 28,215
public-kernel-tail 178 (+2%) 40,926 28,215
merge-rollup 8.25 (+1%) 2,696 925

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 9.99 16.0 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.583 0.494 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.1 (+2%) 71.7 (+1%) 231 444 (+1%) 869 (+1%) 1,721 (+4%) 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.474 (+2%) 0.443 (+1%) 0.422 (+1%) 0.416 (+1%) 0.413 (+1%) 0.412 (+4%) N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 54.6 (+3%) 106 (+1%) 338 (-1%) 669 (+2%) 1,301 2,594 (+3%) N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 104 207 691 1,363 2,707 5,395 N/A
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.488 (+3%) 0.478 (+1%) 0.459 (-1%) 0.462 (+2%) 0.452 (+1%) 0.452 (+3%) 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.1 (+1%)
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.536 (+1%)

Miscellaneous

Transaction sizes based on how many contract classes are registered in the tx.

Metric 0 registered classes
tx_size_in_bytes 22,014

Transaction processing duration by data writes.

Metric 0 new note hashes 1 new note hashes
tx_pxe_processing_time_ms ⚠️ 3,258 (-18%) 1,746 (+1%)
Metric 0 public data writes 1 public data writes
tx_sequencer_processing_time_ms 12.9 (+1%) 1,264 (+1%)

@spalladino
spalladino force-pushed the palla/check-init-args branch from cf5f242 to ecfead7 Compare March 13, 2024 11:36
@spalladino
spalladino force-pushed the palla/allow-no-ctor branch from af09d7a to 44af89e Compare March 13, 2024 11:36
Base automatically changed from palla/check-init-args to master March 13, 2024 12:02
@spalladino
spalladino force-pushed the palla/allow-no-ctor branch 3 times, most recently from a0cfd89 to 9d95634 Compare March 13, 2024 18:06
@spalladino
spalladino marked this pull request as ready for review March 13, 2024 18:43
@spalladino spalladino changed the title feat: Support contracts with no constructor feat!: Support contracts with no constructor Mar 13, 2024
@spalladino
spalladino enabled auto-merge (squash) March 13, 2024 19:07
@critesjosh

ghost commented Mar 13, 2024

Copy link
Copy Markdown
Contributor

Can you add a note to the Migration Notes page (docs/docs/misc/migration_notes.md) about the breaking change?

@spalladino

ghost commented Mar 13, 2024

Copy link
Copy Markdown
Contributor Author

@critesjosh done!

@spalladino
spalladino force-pushed the palla/allow-no-ctor branch from fb2d7d7 to 62093a9 Compare March 13, 2024 22:15
@AztecBot

ghost commented Mar 13, 2024

Copy link
Copy Markdown
Collaborator

Docs Preview

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

@spalladino
spalladino merged commit df7fa32 into master Mar 14, 2024
@spalladino
spalladino deleted the palla/allow-no-ctor branch March 14, 2024 11:52
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.

4 participants