Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change nullifier tree height to 20 #2988

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

rahul-kothari
Copy link
Contributor

@rahul-kothari rahul-kothari commented Oct 24, 2023

Fix #2947.

Note - had to change the nullifier height to 20 instead of 32 since circuit tests use NullifierMemoryTreeTestingHarness which uses BB's Memory Tree which is limited to a max height of 20. I can't change it to 32 due to bad_alloc.

@AztecBot
Copy link
Collaborator

AztecBot commented Oct 24, 2023

Benchmark results

Metrics with a significant change:

  • circuit_simulation_time_in_ms (private-kernel-init): 47.4 (-47%)
  • circuit_simulation_time_in_ms (private-kernel-ordering): 23.4 (-57%)
  • circuit_simulation_time_in_ms (base-rollup): 862 (-61%)
  • circuit_simulation_time_in_ms (root-rollup): 39.0 (-60%)
  • circuit_simulation_time_in_ms (private-kernel-inner): 42.7 (-33%)
  • node_history_sync_time_in_ms (5): 12,444 (-56%)
  • node_history_sync_time_in_ms (10): 23,717 (-58%)
  • note_history_successful_decrypting_time_in_ms (5): 2,550 (-66%)
  • note_history_successful_decrypting_time_in_ms (10): 5,086 (-66%)
  • l2_block_building_time_in_ms (8): 8,959 (-43%)
  • l2_block_building_time_in_ms (32): 35,921 (-42%)
  • l2_block_building_time_in_ms (128): 158,386 (-36%)
  • l2_block_rollup_simulation_time_in_ms (8): 6,654 (-49%)
  • l2_block_rollup_simulation_time_in_ms (32): 26,600 (-49%)
  • l2_block_rollup_simulation_time_in_ms (128): 106,156 (-49%)
  • l2_block_public_tx_process_time_in_ms (128): 51,584 (+28%)
  • l2_block_processing_time_in_ms (8): 1,002 (-56%)
  • l2_block_processing_time_in_ms (32): 3,868 (-56%)
  • l2_block_processing_time_in_ms (128): 15,242 (-55%)
  • note_successful_decrypting_time_in_ms (8): 330 (-53%)
  • note_successful_decrypting_time_in_ms (32): 1,013 (-60%)
  • note_successful_decrypting_time_in_ms (128): 3,908 (-59%)
  • note_trial_decrypting_time_in_ms (8): 33.0 (+560%)
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 6c4e26cf 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 128 txs
l1_rollup_calldata_size_in_bytes 45,444 179,588 716,132
l1_rollup_calldata_gas 222,936 868,100 3,449,672
l1_rollup_execution_gas 842,023 3,595,208 22,205,041
l2_block_processing_time_in_ms ⚠️ 1,002 (-56%) ⚠️ 3,868 (-56%) ⚠️ 15,242 (-55%)
note_successful_decrypting_time_in_ms ⚠️ 330 (-53%) ⚠️ 1,013 (-60%) ⚠️ 3,908 (-59%)
note_trial_decrypting_time_in_ms ⚠️ 33.0 (+560%) 109 (+1%) 137 (+1%)
l2_block_building_time_in_ms ⚠️ 8,959 (-43%) ⚠️ 35,921 (-42%) ⚠️ 158,386 (-36%)
l2_block_rollup_simulation_time_in_ms ⚠️ 6,654 (-49%) ⚠️ 26,600 (-49%) ⚠️ 106,156 (-49%)
l2_block_public_tx_process_time_in_ms 2,267 (-10%) 9,199 (-8%) ⚠️ 51,584 (+28%)

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 ⚠️ 12,444 (-56%) ⚠️ 23,717 (-58%)
note_history_successful_decrypting_time_in_ms ⚠️ 2,550 (-66%) ⚠️ 5,086 (-66%)
note_history_trial_decrypting_time_in_ms 125 (-1%) 147 (-5%)
node_database_size_in_bytes 1,631,607 1,101,191
pxe_database_size_in_bytes 27,188 54,187

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 ⚠️ 47.4 (-47%) 61,697 18,841
private-kernel-ordering ⚠️ 23.4 (-57%) 24,233 8,089
base-rollup ⚠️ 862 (-61%) 656,309 (+3%) 811
root-rollup ⚠️ 39.0 (-60%) 4,072 1,097
private-kernel-inner ⚠️ 42.7 (-33%) 81,504 18,841
public-kernel-private-input 48.4 (-4%) 41,455 18,841
public-kernel-non-first-iteration 31.2 (-1%) 41,497 18,841
merge-rollup 0.877 (-10%) 2,592 873

Miscellaneous

Transaction sizes based on how many contracts are deployed in the tx.

Metric 0 deployed contracts 1 deployed contracts
tx_size_in_bytes 8,723 27,510 (-6%)

@rahul-kothari rahul-kothari force-pushed the rk/nullifier_tree_height branch from 22601fb to eadd88f Compare October 24, 2023 10:17
@rahul-kothari rahul-kothari changed the title double nullifier tree height feat: change nullifier tree height to 20 Oct 24, 2023
@rahul-kothari rahul-kothari enabled auto-merge (squash) October 24, 2023 10:45
Copy link
Contributor

@benesjan benesjan left a comment

Choose a reason for hiding this comment

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

LGTM. Happy it didn’t require too many changes. Our code might not be 💩🤣

@rahul-kothari rahul-kothari merged commit 118f9d5 into master Oct 24, 2023
3 of 4 checks passed
@rahul-kothari rahul-kothari deleted the rk/nullifier_tree_height branch October 24, 2023 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Nullifier tree size exceeded in Sandbox after 256 blocks
3 participants