aztec-packages icon indicating copy to clipboard operation
aztec-packages copied to clipboard

refactor: replace token note with uint note

Open sklppy88 opened this issue 1 year ago • 4 comments

In this PR, we are replacing the token note with our previously added U128 note and making BalanceSet hold a UintNote instead of being generic. The token note is now redundant as we have a UintNote in aztec nr now.

Resolves #8107.

sklppy88 avatar Aug 22 '24 12:08 sklppy88

  • #8143 Graphite 👈
  • #8142 Graphite
  • #8141 Graphite
  • #8127 Graphite
  • master

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @sklppy88 and the rest of your teammates on Graphite Graphite

sklppy88 avatar Aug 22 '24 12:08 sklppy88

Benchmark results

Metrics with a significant change:

  • protocol_circuit_simulation_time_in_ms (private-kernel-tail-to-public): 1,491 (+94%)
  • avm_simulation_time_ms (Token:mint_public): 468 (+856%)
  • avm_simulation_time_ms (Token:assert_minter_and_mint): 44.9 (-90%)
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,755 1,581 (+1%) 715 760 (+3%) 775
proof_construction_time_sha256_30_ms 11,583 (+1%) 3,087 1,380 1,435 1,458 (-1%)
proof_construction_time_sha256_100_ms 44,071 11,813 5,466 5,374 (-1%) 6,010 (+3%)
proof_construction_time_poseidon_hash_ms 78.0 34.0 34.0 59.0 (+2%) 87.0 (-1%)
proof_construction_time_poseidon_hash_30_ms 1,529 422 204 231 (+2%) 267 (-1%)
proof_construction_time_poseidon_hash_100_ms 5,651 1,521 (+1%) 680 731 744

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 4,356 7,876 14,884
l1_rollup_calldata_gas 50,292 92,922 178,120
l1_rollup_execution_gas 843,133 1,576,659 3,361,913
l2_block_processing_time_in_ms 256 453 (+2%) 836 (+2%)
l2_block_building_time_in_ms 11,306 (+1%) 22,051 (+1%) 44,231 (+1%)
l2_block_rollup_simulation_time_in_ms 11,305 (+1%) 22,051 (+1%) 44,231 (+1%)
l2_block_public_tx_process_time_in_ms 9,644 (+1%) 20,386 (+1%) 42,527 (+1%)

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 2,950 (-1%) 3,959 (+1%)
node_database_size_in_bytes 12,623,952 16,719,952
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
private-kernel-init 74.3 387 (+2%) 21,391 44,898 N/A
private-kernel-inner 153 (-4%) 689 (+2%) 72,372 45,020 N/A
private-kernel-reset-tiny 294 (-1%) 702 (+1%) 65,097 44,886 N/A
private-kernel-tail 160 (+1%) 133 (-1%) 50,608 52,921 N/A
base-parity 5.75 (+4%) N/A 160 96.0 N/A
root-parity 35.9 (+2%) N/A 73,948 96.0 N/A
base-rollup 2,980 (-4%) N/A 189,195 664 N/A
block-root-rollup 41.1 N/A 58,205 2,448 N/A
public-kernel-setup 81.9 N/A 105,085 71,222 N/A
public-kernel-app-logic 94.2 N/A 104,898 71,222 N/A
public-kernel-tail 843 (+1%) N/A 390,582 16,414 N/A
private-kernel-reset-small 292 (-1%) N/A 66,341 45,629 N/A
private-kernel-tail-to-public :warning: 1,491 (+94%) 592 453,751 1,825 N/A
public-kernel-teardown 80.7 (-1%) N/A 105,349 71,222 N/A
merge-rollup 20.0 (-1%) N/A 38,174 664 N/A
undefined N/A N/A N/A N/A 83,322 (-1%)

Stats on running time collected for app circuits

Function input_size_in_bytes output_size_in_bytes witness_generation_time_in_ms
ContractClassRegisterer:register 1,344 11,731 344
ContractInstanceDeployer:deploy 1,408 11,731 18.2 (+1%)
MultiCallEntrypoint:entrypoint 1,920 11,731 403 (+1%)
FeeJuice:deploy 1,376 11,731 390 (+1%)
SchnorrAccount:constructor 1,312 11,731 62.7 (+1%)
SchnorrAccount:entrypoint 2,336 11,731 370
FeeJuice:claim 1,344 11,731 34.5 (-4%)
Token:privately_mint_private_note 1,280 11,731 72.5 (-5%)
FPC:fee_entrypoint_public 1,344 11,731 24.6 (+2%)
Token:transfer 1,312 11,731 214
Benchmarking:create_note 1,344 11,731 74.2
SchnorrAccount:verify_private_authwit 1,280 11,731 26.7
Token:unshield 1,376 11,731 511 (+2%)
FPC:fee_entrypoint_private 1,376 11,731 672 (-3%)

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
FeeJuice:_increase_public_balance 48.5 (+7%) 2,431
FeeJuice:set_portal 13.1 (+1%) 2,930
Token:constructor 76.3 (+2%) 15,813
FPC:constructor 48.0 (-3%) 9,720
FeeJuice:check_balance 36.2 (-1%) 2,357
Token:mint_public :warning: 468 (+856%) 5,011
Token:assert_minter_and_mint :warning: 44.9 (-90%) 3,155
AuthRegistry:set_authorized 35.6 (-24%) 924
FPC:prepare_fee 70.9 (-7%) 4,245
Token:transfer_public 17.4 (-17%) 10,812
FPC:pay_refund 46.1 (+6%) 5,195
Benchmarking:increment_balance 1,204 (+1%) 3,496
Token:_increase_public_balance 39.5 (-1%) 2,408
FPC:pay_refund_with_shielded_rebate 51.6 (+2%) 5,195

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.150 (-3%)

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 2.19 (+1%) 3.90 (+2%) 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.114 (+1%) 0.110 (+2%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 11.2 (+1%) 17.6 (-1%) 30.3 (-3%) 60.0 (+2%) 113 (-1%)
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.107 (+1%) 0.103 (-1%) 0.0991 (-2%) 0.103 (+2%) 0.101 (-2%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 14.2 (-1%) 25.9 43.4 (-2%) 84.5 (+3%) 161 (-2%)
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 108 207 355 691 1,363
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.109 (-1%) 0.104 0.105 (-2%) 0.104 (+3%) 0.103 (-2%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 16.7 (+2%) N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A 132 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A 0.107 (+2%) 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 64,838 668,997

Transaction size based on fee payment method

| Metric | | | - | |

AztecBot avatar Aug 22 '24 17:08 AztecBot

Docs Preview

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

AztecBot avatar Aug 29 '24 19:08 AztecBot