Skip to content

fix: shared mutable private getter fixes#6652

Merged
sklppy88 merged 3 commits into
masterfrom
ek/fix/shared-mutable-private-getter-context-fix-failing-test
May 24, 2024
Merged

fix: shared mutable private getter fixes#6652
sklppy88 merged 3 commits into
masterfrom
ek/fix/shared-mutable-private-getter-context-fix-failing-test

Conversation

@sklppy88

@sklppy88 sklppy88 commented May 23, 2024

Copy link
Copy Markdown
Contributor

When I was making some changes to the SharedMutablePrivateGetter, I ran into some issues with it.

The first was that the context variable was not being correctly updated / propogated due to not passing it as a mutable reference. The second was that the SharedMutablePrivateGetter was reading the delay of slot of its own address, and not reading the address of the specific other contract to read from. The value was reading correctly but the delay was not. I added two tests, one as a basic one to test max_block_number propogation, and the other to test changing delays in SharedMutable, and seeing whether the SharedMutablePrivateGetter would accurately reflect those changes.

sklppy88 commented May 23, 2024

Copy link
Copy Markdown
Contributor Author

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

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

@AztecBot

AztecBot commented May 24, 2024

Copy link
Copy Markdown
Collaborator

Benchmark results

Metrics with a significant change:

  • app_circuit_proving_time_in_ms (Token:transfer): 60,378 (+16%)
  • protocol_circuit_proving_time_in_ms (private-kernel-reset-small): 49,534 (+18%)
  • protocol_circuit_proving_time_in_ms (private-kernel-tail): 43,194 (+19%)
  • protocol_circuit_proving_time_in_ms (base-rollup): 86,115 (+16%)
  • protocol_circuit_proving_time_in_ms (root-rollup): 22,253 (+16%)
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 5,842 (+1%) 1,602 (+2%) 727 (+2%) 780 (+2%) 789 (+2%)

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 1,412 1,412 1,412
l1_rollup_calldata_gas 9,464 9,464 9,476
l1_rollup_execution_gas 616,105 616,105 616,117
l2_block_processing_time_in_ms 1,383 (-1%) 5,269 (+1%) 10,537 (+2%)
l2_block_building_time_in_ms 47,770 190,303 381,586
l2_block_rollup_simulation_time_in_ms 47,594 189,646 380,282
l2_block_public_tx_process_time_in_ms 26,109 107,097 (-2%) 219,865

L2 chain processing

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

Metric 3 blocks 5 blocks
node_history_sync_time_in_ms 10,013 (+1%) 15,268 (+1%)
node_database_size_in_bytes 14,487,632 21,348,432
pxe_database_size_in_bytes 18,071 29,868

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 proving_time_in_ms input_size_in_bytes output_size_in_bytes proof_size_in_bytes num_public_inputs size_in_gates
private-kernel-init 165 3,550 (-5%) 25,227 (+13%) 20,630 64,614 89,536 2,731 1,048,576
private-kernel-inner 628 (-1%) 4,051 (-6%) 52,091 (+7%) 92,318 64,614 89,536 2,731 2,097,152
private-kernel-tail 549 (-1%) 2,789 (-5%) ⚠️ 43,194 (+19%) 90,237 77,498 10,656 266 2,097,152
base-parity 6.60 (+2%) 1,278 (-4%) 2,863 (-2%) 128 64.0 2,208 2.00 131,072
root-parity 49.3 (-2%) 72.6 (+13%) 48,639 (+11%) 27,084 64.0 2,720 18.0 2,097,152
base-rollup 805 2,414 (+3%) ⚠️ 86,115 (+16%) 119,610 756 3,648 47.0 4,194,304
root-rollup 113 (-2%) 79.4 (+22%) ⚠️ 22,253 (+16%) 25,297 620 3,456 41.0 1,048,576
public-kernel-app-logic 531 2,797 (-3%) 51,730 (+9%) 104,941 86,302 114,784 3,520 2,097,152
public-kernel-tail 1,201 23,870 176,471 (+14%) 395,386 7,522 10,656 266 8,388,608
private-kernel-reset-small 595 (-1%) 2,117 (-4%) ⚠️ 49,534 (+18%) 120,733 64,614 89,536 2,731 2,097,152
merge-rollup 29.2 (+1%) N/A N/A 16,534 756 N/A N/A N/A
public-kernel-setup 625 N/A N/A 104,941 86,302 N/A N/A N/A
public-kernel-teardown 530 (+1%) N/A N/A 104,941 86,302 N/A N/A N/A
private-kernel-tail-to-public N/A 8,158 (-6%) 92,116 (+13%) N/A N/A 114,784 3,520 4,194,304

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 size_in_gates num_public_inputs
ContractClassRegisterer:register 1,344 9,944 467 (-2%) N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,408 9,944 41.2 (-3%) N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,920 9,944 1,448 (-1%) N/A N/A N/A N/A
SchnorrAccount:constructor 1,312 9,944 1,012 (-1%) N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,304 9,944 2,138 16,768 50,153 (+8%) 2,097,152 457
Token:privately_mint_private_note 1,280 9,944 1,112 (-5%) N/A N/A N/A N/A
Token:transfer 1,376 9,944 4,053 (-1%) 16,768 ⚠️ 60,378 (+16%) 2,097,152 457
Benchmarking:create_note 1,312 9,944 987 N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,344 9,944 231 (+1%) N/A N/A N/A N/A
SchnorrAccount:spend_private_authwit 1,280 9,944 77.8 (+1%) N/A N/A N/A N/A
Token:unshield 1,376 9,944 3,322 (+1%) N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,376 9,944 4,236 (+4%) N/A N/A N/A N/A

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 11.2 (-2%) 18.3 (-2%) 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.7 31.8 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.652 (-2%) 0.561 (-2%) 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 52.4 82.7 (+1%) 266 (-1%) 506 1,021 (+1%) 2,035 (+2%) N/A
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 95.9 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.536 0.510 (+1%) 0.482 (-1%) 0.473 0.484 (+1%) 0.485 (+2%) N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 62.5 (-1%) 122 (+1%) 381 (-2%) 743 1,516 (+1%) 3,028 (+2%) N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 106 208 692 1,363 2,707 5,395 N/A
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.543 (-1%) 0.545 0.517 (-1%) 0.512 0.525 (+1%) 0.526 (+2%) 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 67.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 107
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.595

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 83,794 665,117

Transaction size based on fee payment method

| Metric | |
| - | |

@sklppy88 sklppy88 force-pushed the ek/fix/shared-mutable-private-getter-context-fix-failing-test branch from 91361db to 8cbd13d Compare May 24, 2024 01:08

@LHerskind LHerskind 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.

As mentioned in #6653, think we should merge #6653 in here to make it mergable 👍

Comment thread yarn-project/end-to-end/src/e2e_state_vars.test.ts Outdated
@sklppy88 sklppy88 force-pushed the ek/fix/shared-mutable-private-getter-context-fix-failing-test branch from 7ce1f9f to 9e276ec Compare May 24, 2024 13:15
@sklppy88 sklppy88 force-pushed the ek/fix/shared-mutable-private-getter-context-fix-failing-test branch from 9e276ec to 4ce1f0e Compare May 24, 2024 13:38
@sklppy88 sklppy88 changed the title fix: shared mutable private getter context fix - failing test fix: shared mutable private getter fixes May 24, 2024
@sklppy88 sklppy88 marked this pull request as ready for review May 24, 2024 15:29

@LHerskind LHerskind 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.

Unsure what the boxes issue is, but I think we are good to 🚢

@sklppy88 sklppy88 merged commit a28cd0a into master May 24, 2024
@sklppy88 sklppy88 deleted the ek/fix/shared-mutable-private-getter-context-fix-failing-test branch May 24, 2024 16:34
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