Skip to content

feat: note hashes as points#7618

Merged
benesjan merged 24 commits into
masterfrom
janb/note-hashes-as-points
Jul 31, 2024
Merged

feat: note hashes as points#7618
benesjan merged 24 commits into
masterfrom
janb/note-hashes-as-points

Conversation

@benesjan

Copy link
Copy Markdown
Contributor

Making note hashes points.

benesjan commented Jul 25, 2024

Copy link
Copy Markdown
Contributor Author

@benesjan benesjan changed the title WIP feat: note hashes as points Jul 25, 2024
@benesjan benesjan force-pushed the janb/note-hashes-as-points branch from cda6230 to 8b7eab7 Compare July 26, 2024 08:48
@AztecBot

AztecBot commented Jul 26, 2024

Copy link
Copy Markdown
Collaborator

Docs Preview

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

* @param obj - Object to test if it is a point.
* @returns Whether it looks like a point.
*/
export function isPoint(obj: object): obj is Point {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was unused so I nuked it.

Comment thread yarn-project/simulator/src/utils.ts

@nventuro nventuro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks great, thank you for proposing the naming changes and extracting the relevant parts of #7437! This seems to be a very reasonable first step towards partial notes and simplifying hashing.

Comment thread docs/docs/guides/smart_contracts/writing_contracts/storage/storage_slots.md Outdated
Comment thread noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/encrypted_logs/payload.nr
Comment thread noir-projects/aztec-nr/aztec/src/generators.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/note/lifecycle.nr
Comment thread noir/noir-repo/aztec_macros/src/transforms/note_interface.rs Outdated
Comment thread yarn-project/circuits.js/src/hash/hash.ts Outdated
Comment thread yarn-project/circuits.js/src/hash/map_slot.ts Outdated
Comment thread yarn-project/simulator/src/client/test_utils.ts
Comment thread yarn-project/simulator/src/client/db_oracle.ts
@benesjan benesjan force-pushed the janb/note-hashes-as-points branch from 1a534e1 to 1fe89f2 Compare July 29, 2024 07:57
@benesjan benesjan requested a review from nventuro July 29, 2024 09:35
@benesjan benesjan force-pushed the janb/note-hashes-as-points branch from 8e102c4 to eda68a5 Compare July 29, 2024 18:07
@benesjan benesjan changed the base branch from master to gd/dummy_msm July 29, 2024 18:07
@AztecBot

Copy link
Copy Markdown
Collaborator

Benchmark results

Metrics with a significant change:

  • avm_simulation_time_ms (Token:mint_public): 280 (+291%)
  • protocol_circuit_proving_time_in_ms (base-parity): 1,389 (-29%)
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,717 (-1%) 1,559 702 (-1%) 740 (-2%) 768 (-1%)
proof_construction_time_sha256_30_ms 11,448 (-4%) 3,058 (-4%) 1,396 (-2%) 1,432 (-1%) 1,455 (-1%)
proof_construction_time_sha256_100_ms 42,825 (-3%) 11,796 (-2%) 5,412 (-1%) 5,367 (-1%) 5,344 (-1%)
proof_construction_time_poseidon_hash_ms 78.0 (-1%) 34.0 34.0 58.0 87.0 (-1%)
proof_construction_time_poseidon_hash_30_ms 1,518 (-1%) 418 (-1%) 202 231 (+4%) 264 (-3%)
proof_construction_time_poseidon_hash_100_ms 5,608 (-1%) 1,507 (-1%) 671 (-1%) 714 (-2%) 747 (-1%)

L2 block published to L1

Each column represents the number of txs on an L2 block published to L1.

Metric 4 txs 8 txs 16 txs
l1_rollup_calldata_size_in_bytes 708 708 708
l1_rollup_calldata_gas 6,576 6,590 6,600
l1_rollup_execution_gas 584,256 584,421 584,582
l2_block_processing_time_in_ms 760 (-2%) 1,428 (+1%) 2,699 (-4%)
l2_block_building_time_in_ms 10,908 (+1%) 21,358 41,915
l2_block_rollup_simulation_time_in_ms 10,907 (+1%) 21,358 41,915
l2_block_public_tx_process_time_in_ms 9,140 (+1%) 19,344 39,871

L2 chain processing

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

Metric 3 blocks 5 blocks
node_history_sync_time_in_ms 7,149 (+2%) 9,979 (+1%)
node_database_size_in_bytes 12,750,928 16,842,832
pxe_database_size_in_bytes 16,254 26,813

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 input_size_in_bytes output_size_in_bytes proving_time_in_ms proof_size_in_bytes num_public_inputs size_in_gates
private-kernel-init 106 (+1%) 431 (+7%) 21,845 53,090 N/A N/A N/A N/A
private-kernel-inner 189 (+1%) 731 (+4%) 81,005 53,266 N/A N/A N/A N/A
private-kernel-tail 452 902 (+3%) 61,240 57,447 N/A N/A N/A N/A
base-parity 6.49 (+1%) 709 (+3%) 160 96.0 ⚠️ 1,389 (-29%) 13,188 19.0 131,072
root-parity 113 (+1%) 132 (+6%) 69,084 96.0 33,075 (+5%) 13,188 19.0 4,194,304
base-rollup 3,448 (+1%) 4,982 182,192 632 44,936 13,988 44.0 4,194,304
root-rollup 155 124 (+1%) 54,429 652 29,035 13,924 42.0 4,194,304
public-kernel-setup 116 2,761 (+4%) 112,985 80,246 18,355 (+3%) 141,444 4,027 2,097,152
public-kernel-app-logic 121 (-1%) 4,046 112,985 80,246 11,095 (-2%) 141,444 4,027 1,048,576
public-kernel-tail 643 27,201 (-4%) 410,726 10,814 67,809 (-1%) 26,372 431 8,388,608
private-kernel-reset-tiny 234 (+1%) 924 (+6%) 76,596 52,961 N/A N/A N/A N/A
private-kernel-tail-to-public 5,227 (+1%) 1,630 (+3%) 900,419 1,697 N/A N/A N/A N/A
public-kernel-teardown 102 3,973 (-2%) 112,985 80,246 20,378 (+4%) 141,444 4,027 2,097,152
merge-rollup 61.1 N/A 35,678 632 N/A N/A N/A N/A
undefined N/A N/A N/A N/A 159,245 (+3%) N/A N/A N/A

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
ContractClassRegisterer:register 1,312 11,699 346 N/A N/A
ContractInstanceDeployer:deploy 1,376 11,699 27.4 N/A N/A
MultiCallEntrypoint:entrypoint 1,888 11,699 608 N/A N/A
GasToken:deploy 1,344 11,699 443 (+3%) N/A N/A
SchnorrAccount:constructor 1,280 11,699 431 N/A N/A
SchnorrAccount:entrypoint 2,272 11,699 832 (+2%) N/A N/A
Token:privately_mint_private_note 1,248 11,699 505 (-1%) N/A N/A
FPC:fee_entrypoint_public 1,312 11,699 88.4 (-1%) N/A N/A
Token:transfer 1,280 11,699 1,269 (-4%) N/A N/A
AuthRegistry:set_authorized (avm) 21,702 N/A N/A 102,048 2,142 (+3%)
FPC:prepare_fee (avm) 25,150 N/A N/A 102,112 2,203 (+4%)
Token:transfer_public (avm) 58,188 N/A N/A 102,112 6,721 (+1%)
AuthRegistry:consume (avm) 35,580 N/A N/A 102,080 2,587 (+2%)
FPC:pay_refund (avm) 30,010 N/A N/A 102,080 3,549 (-1%)
Benchmarking:create_note 1,312 11,699 428 (+2%) N/A N/A
SchnorrAccount:verify_private_authwit 1,248 11,699 45.3 (+3%) N/A N/A
Token:unshield 1,344 11,699 1,081 (-5%) N/A N/A
FPC:fee_entrypoint_private 1,344 11,699 1,384 (-3%) N/A N/A

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
GasToken:_increase_public_balance 102 (+2%) 13,790
GasToken:set_portal 17.3 (+18%) 3,339
Token:constructor 125 (+1%) 23,692
FPC:constructor 92.4 (-2%) 13,592
GasToken:mint_public 89.8 (+7%) 10,158
Token:mint_public ⚠️ 280 (+291%) 19,034
Token:assert_minter_and_mint 50.7 (-18%) 12,925
AuthRegistry:set_authorized 46.3 (-5%) 7,812
FPC:prepare_fee 253 (-1%) 11,068
Token:transfer_public 36.7 (-18%) 44,012
FPC:pay_refund 75.9 (+4%) 15,961
Benchmarking:increment_balance 1,067 11,281
Token:_increase_public_balance 14.8 15,006
FPC:pay_refund_with_shielded_rebate 154 (+16%) 17,056

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.157 (-4%)

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 256 leaves 512 leaves 1024 leaves
batch_insert_into_append_only_tree_16_depth_ms 10.4 16.7 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.8 31.7 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.599 0.513 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 48.2 75.6 (-4%) 131 (-1%) 245 469
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 95.9 159 287 543 1,055
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.492 0.465 (-3%) 0.451 (-1%) 0.444 0.436 (-1%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 59.4 111 (-1%) 183 (-1%) 352 692 (-1%)
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 109 207 355 691 1,363
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.502 0.498 0.485 (-1%) 0.477 0.476 (-1%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 73.1 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A 133 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A 0.519 N/A N/A N/A N/A

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 72,017 666,910

Transaction size based on fee payment method

| Metric | |
| - | |

@nventuro nventuro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great, thank you very much!

@benesjan benesjan force-pushed the janb/note-hashes-as-points branch from 3a13c5c to 9d1a1a1 Compare July 30, 2024 09:34
@benesjan benesjan changed the base branch from gd/dummy_msm to master July 30, 2024 09:34
@benesjan benesjan force-pushed the janb/note-hashes-as-points branch from 9d1a1a1 to 42a6c36 Compare July 30, 2024 16:32
@benesjan benesjan enabled auto-merge (squash) July 30, 2024 16:51
@benesjan benesjan force-pushed the janb/note-hashes-as-points branch 2 times, most recently from 81546b6 to 96faa8c Compare July 31, 2024 09:33
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