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!: keccak in noir using a permutation opcode #3726

Closed
wants to merge 12 commits into from

Conversation

guipublic
Copy link
Contributor

Please provide a paragraph or two giving a summary of the change, including relevant motivation and context.

Checklist:

Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge.

  • If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag.
  • I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code.
  • Every change is related to the PR description.
  • I have linked this pull request to relevant issues (if any exist).

@AztecBot
Copy link
Collaborator

AztecBot commented Dec 18, 2023

Benchmark results

Metrics with a significant change:

  • note_successful_decrypting_time_in_ms (8): 517 (+35%)
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 88fcf8d3 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 223,044 868,220 3,448,220
l1_rollup_execution_gas 867,153 3,746,273 23,304,985
l2_block_processing_time_in_ms 1,344 (-11%) 5,081 20,981
note_successful_decrypting_time_in_ms ⚠️ 517 (+35%) 1,110 (+1%) 4,136 (+1%)
note_trial_decrypting_time_in_ms 25.3 (-73%) 39.8 (+13%) 138 (+1%)
l2_block_building_time_in_ms 14,943 59,373 238,050
l2_block_rollup_simulation_time_in_ms 10,614 42,153 169,801
l2_block_public_tx_process_time_in_ms 4,299 (+1%) 17,141 (+1%) 67,896

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 15,455 (+1%) 29,428 (+2%)
note_history_successful_decrypting_time_in_ms 2,703 (-3%) 5,673 (+4%)
note_history_trial_decrypting_time_in_ms 99.6 (-31%) 148 (-10%)
node_database_size_in_bytes 3,615,097 3,720,675
pxe_database_size_in_bytes 29,923 59,478

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 210 44,709 25,561
private-kernel-ordering 137 (+1%) 30,953 14,809
base-rollup 1,077 128,374 881
root-rollup 82.7 (-4%) 4,088 889
private-kernel-inner 287 71,236 25,561
public-kernel-private-input 202 31,891 25,561
public-kernel-non-first-iteration 200 31,933 25,561
merge-rollup 9.74 2,608 881

Miscellaneous

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

Metric 0 deployed contracts 1 deployed contracts
tx_size_in_bytes 15,487 31,878

@kevaundray kevaundray changed the title feat: keccak in noir using a permutation opcode feat!: keccak in noir using a permutation opcode Dec 18, 2023
0x8000000080008008u64,
];

const RHO: [u32; 24] =
Copy link
Contributor

Choose a reason for hiding this comment

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

Leaving this for now, we should probably just use https://docs.rs/keccakf/latest/keccakf/ in a later PR or something that has keccak and keccakf

kevaundray added a commit that referenced this pull request Jan 5, 2024
…#3854)

This is #3726 but without the keccak changes in Noir which are not
currently working

# Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if
the PR is ready to merge.
- [ ] If the pull request requires a cryptography review (e.g.
cryptographic algorithm implementations) I have added the 'crypto' tag.
- [ ] I have reviewed my diff in github, line by line and removed
unexpected formatting changes, testing logs, or commented-out code.
- [ ] Every change is related to the PR description.
- [ ] I have
[linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
this pull request to relevant issues (if any exist).

---------

Co-authored-by: guipublic <guipublic@gmail.com>
Co-authored-by: guipublic <47281315+guipublic@users.noreply.github.com>
@TomAFrench
Copy link
Member

Closing as only the noir implementation is left so we can do this in the other repository.

@ludamad ludamad deleted the gd/keccak_with_permutation branch August 22, 2024 15:20
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.

4 participants