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(avm): avm circuit actually uses public inputs columns passed from TS #6819

Merged

Conversation

dbanks12
Copy link
Collaborator

@dbanks12 dbanks12 commented Jun 2, 2024

No description provided.

Copy link
Collaborator Author

dbanks12 commented Jun 2, 2024

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

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

@dbanks12 dbanks12 force-pushed the db/avm-use-public-inputs-from-ts branch 2 times, most recently from cf95f3a to b5f5341 Compare June 2, 2024 21:42
@dbanks12 dbanks12 force-pushed the db/avm-execution-hints-ts branch from 11b6e5a to c9d1527 Compare June 2, 2024 21:47
@dbanks12 dbanks12 force-pushed the db/avm-use-public-inputs-from-ts branch from b5f5341 to 675e66b Compare June 2, 2024 21:47
@dbanks12 dbanks12 force-pushed the db/avm-execution-hints-ts branch from c9d1527 to c1c8278 Compare June 2, 2024 21:49
@dbanks12 dbanks12 force-pushed the db/avm-use-public-inputs-from-ts branch from 675e66b to cde66ab Compare June 2, 2024 21:49
@AztecBot
Copy link
Collaborator

AztecBot commented Jun 2, 2024

Benchmark results

Metrics with a significant change:

  • protocol_circuit_witness_generation_time_in_ms (base-parity): 853 (-49%)
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,746 (-1%) 1,561 701 (-1%) 744 (-3%) 781
proof_construction_time_sha256_30_ms 11,991 3,168 1,403 1,451 (+1%) 1,468
proof_construction_time_sha256_100_ms 45,432 12,132 (-1%) 5,686 5,591 5,502 (-1%)
proof_construction_time_poseidon_hash_ms 78.0 (-1%) 34.0 35.0 (+3%) 58.0 87.0 (-1%)
proof_construction_time_poseidon_hash_30_ms 1,528 423 203 232 267 (-1%)
proof_construction_time_poseidon_hash_100_ms 5,768 1,569 (-1%) 729 (+1%) 788 793 (-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 1,412 1,412 1,412
l1_rollup_calldata_gas 9,452 9,476 9,476
l1_rollup_execution_gas 607,988 608,012 608,012
l2_block_processing_time_in_ms 1,288 4,826 9,599
l2_block_building_time_in_ms 44,099 174,298 348,493
l2_block_rollup_simulation_time_in_ms 43,903 173,571 347,052
l2_block_public_tx_process_time_in_ms 40,663 170,264 343,679

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 9,423 14,409
node_database_size_in_bytes 14,475,344 21,368,912
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 137 (+1%) 467 (-2%) 12,966 (-1%) 20,634 64,614 89,536 2,731 524,288
private-kernel-inner 405 1,009 (+4%) 50,152 (+1%) 92,326 64,614 89,536 2,731 2,097,152
private-kernel-tail 581 (-1%) 2,627 (-1%) 50,800 (-9%) 96,545 77,732 11,648 297 2,097,152
base-parity 6.42 ⚠️ 853 (-49%) 2,740 128 64.0 2,208 2.00 131,072
root-parity 48.8 63.4 (-1%) 41,152 (+3%) 27,100 64.0 2,720 18.0 2,097,152
base-rollup 12,016 (+1%) 2,364 (-1%) 78,783 (+3%) 119,738 756 3,648 47.0 4,194,304
root-rollup 110 (+1%) 76.1 23,331 (+1%) 25,309 620 3,456 41.0 1,048,576
public-kernel-app-logic 569 3,490 (-4%) 44,373 (-3%) 108,073 86,550 116,768 3,582 2,097,152
public-kernel-tail 1,124 24,657 (+4%) 175,742 (-7%) 403,238 7,646 11,648 297 8,388,608
private-kernel-reset-small 588 1,986 (+2%) 45,492 (-2%) 120,737 64,614 89,536 2,731 2,097,152
public-kernel-setup 655 2,744 (-2%) 44,198 108,073 86,550 116,768 3,582 2,097,152
public-kernel-teardown 561 3,564 47,345 108,073 86,550 116,768 3,582 2,097,152
merge-rollup 29.1 (+1%) N/A N/A 16,542 756 N/A N/A N/A
private-kernel-tail-to-public N/A 9,150 (+4%) 97,788 (-6%) N/A N/A 116,768 3,582 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 458 (-1%) N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,408 9,944 42.0 (+2%) N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,920 9,944 1,752 (-1%) N/A N/A N/A N/A
SchnorrAccount:constructor 1,312 9,944 1,425 N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,304 9,944 2,733 16,768 53,222 (-5%) 2,097,152 457
Token:privately_mint_private_note 1,280 9,944 1,559 (-1%) N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,344 9,944 1,029 (-1%) 16,768 10,854 524,288 457
Token:transfer 1,376 9,944 5,312 16,768 51,893 (-1%) 2,097,152 457
Benchmarking:create_note 1,344 9,944 1,393 N/A N/A N/A N/A
SchnorrAccount:spend_private_authwit 1,280 9,944 77.5 (-11%) N/A N/A N/A N/A
Token:unshield 1,376 9,944 3,923 (-5%) N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,376 9,944 4,789 (-6%) 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 10.4 (-1%) 17.3 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.602 (-1%) 0.518 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 48.4 75.8 (-1%) 245 (-1%) 474 930 (-1%) 1,844 (-1%) 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.494 0.467 (-1%) 0.446 0.442 0.441 0.440 N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 58.1 113 355 (-1%) 697 1,388 2,762 (-1%) 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.502 0.504 0.482 0.479 0.480 0.480 (-1%) 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 62.6
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.553

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 84,053 665,267

Transaction size based on fee payment method

| Metric | |
| - | |

@dbanks12 dbanks12 force-pushed the db/avm-execution-hints-ts branch from c1c8278 to 2bacc0f Compare June 3, 2024 14:52
@dbanks12 dbanks12 force-pushed the db/avm-use-public-inputs-from-ts branch from cde66ab to a550043 Compare June 3, 2024 14:53
@dbanks12 dbanks12 force-pushed the db/avm-execution-hints-ts branch 3 times, most recently from 7a194c4 to f24b767 Compare June 3, 2024 16:18
@dbanks12 dbanks12 force-pushed the db/avm-use-public-inputs-from-ts branch from a550043 to 8726b46 Compare June 3, 2024 16:18
@dbanks12 dbanks12 marked this pull request as ready for review June 3, 2024 16:19
@dbanks12 dbanks12 force-pushed the db/avm-use-public-inputs-from-ts branch from 8726b46 to 57be540 Compare June 3, 2024 16:23
@dbanks12 dbanks12 requested review from Maddiaa0 and fcarreiro June 3, 2024 16:28
{
if (public_inputs_vec.size() != PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH) {
throw_or_abort("Public inputs vector is not of PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH");
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: if you have to modify this PR for some other reason, you could add the expected vs gotten sizes here.

Comment on lines +68 to +69
HonkProof proof(public_inputs_vec);
auto raw_proof = prover.construct_proof();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm ok with keeping the order, but I'd switch the types:

std::vector<ff> proof(public_inputs_vec);
HonkProof raw_proof = prover.construct_proof();

Copy link
Collaborator

@AztecBot AztecBot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'C++ Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05.

Benchmark suite Current: 57be540 Previous: f24b767 Ratio
nativeconstruct_proof_ultrahonk_power_of_2/20 5912.58711399999 ms/iter 5509.176739000011 ms/iter 1.07

This comment was automatically generated by workflow using github-action-benchmark.

CC: @ludamad @codygunton

@dbanks12 dbanks12 merged commit ebfda51 into db/avm-execution-hints-ts Jun 3, 2024
54 of 57 checks passed
@dbanks12 dbanks12 deleted the db/avm-use-public-inputs-from-ts branch June 3, 2024 17:09
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