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

fix: using different generators in private refund #7414

Merged

Conversation

benesjan
Copy link
Contributor

Fixes #7320

Copy link
Contributor Author

benesjan commented Jul 10, 2024

@benesjan benesjan force-pushed the 07-10-fix_using_different_generators_in_private_refund branch from 94413f0 to 82d090e Compare July 10, 2024 09:20
@benesjan benesjan changed the base branch from 07-10-feat_typing_return_values_of_embedded_curve_ops to 07-09-refactor_private_refund_cleanup July 10, 2024 09:20
@AztecBot
Copy link
Collaborator

AztecBot commented Jul 10, 2024

Benchmark results

Metrics with a significant change:

  • avm_simulation_time_ms (Token:mint_public): 47.8 (-37%)
  • app_circuit_proving_time_in_ms (SchnorrAccount:entrypoint): 6,622 (+36%)
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,697 1,533 701 743 767
proof_construction_time_sha256_30_ms 11,609 (-1%) 3,124 (-1%) 1,406 1,423 1,469 (+1%)
proof_construction_time_sha256_100_ms 43,762 11,703 (-1%) 6,052 (+12%) 5,429 (+1%) 5,336
proof_construction_time_poseidon_hash_ms 78.0 34.0 34.0 59.0 88.0
proof_construction_time_poseidon_hash_30_ms 1,515 413 198 (-1%) 228 (+3%) 265 (-1%)
proof_construction_time_poseidon_hash_100_ms 5,601 1,506 (-1%) 676 716 (-2%) 741 (-1%)

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 708 708 708
l1_rollup_calldata_gas 6,600 6,592 6,600
l1_rollup_execution_gas 583,062 583,205 583,364
l2_block_processing_time_in_ms 757 (-1%) 1,422 2,725 (-1%)
l2_block_building_time_in_ms 13,071 25,583 50,556
l2_block_rollup_simulation_time_in_ms 13,071 25,583 50,556
l2_block_public_tx_process_time_in_ms 10,983 23,358 48,294

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 7,063 (+1%) 9,940
node_database_size_in_bytes 12,402,768 16,207,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 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 110 426 12,907 (-6%) 20,002 55,022 76,256 2,316 524,288
private-kernel-inner 226 800 (+5%) 46,231 (-2%) 82,134 55,022 76,256 2,316 2,097,152
private-kernel-tail 1,065 2,552 (+1%) 43,945 (-4%) 62,409 62,089 14,944 400 2,097,152
base-parity 6.32 (-1%) 902 (-5%) 2,486 (-1%) 160 96.0 2,240 3.00 131,072
root-parity 70.6 61.0 34,406 (+1%) 27,868 96.0 2,752 19.0 2,097,152
base-rollup 4,153 5,118 (+1%) 78,847 172,028 632 3,552 44.0 4,194,304
root-rollup 129 (-2%) 75.4 19,657 25,053 652 3,488 42.0 1,048,576
public-kernel-setup 192 2,345 36,514 (-1%) 103,911 80,310 108,992 3,339 2,097,152
public-kernel-app-logic 148 3,272 37,034 103,911 80,310 108,992 3,339 2,097,152
public-kernel-tail 896 (-1%) 23,410 (-4%) 156,803 (-4%) 400,808 10,046 14,944 400 8,388,608
private-kernel-reset-small 296 (+1%) 1,150 (+1%) 23,497 (-2%) 79,273 55,022 76,256 2,316 1,048,576
public-kernel-teardown 137 3,300 (+1%) 37,256 103,911 80,310 108,992 3,339 2,097,152
merge-rollup 40.1 (-1%) N/A N/A 16,094 632 N/A N/A N/A
private-kernel-tail-to-public N/A 3,318 (+8%) 44,853 N/A N/A 108,992 3,339 2,097,152

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,312 9,344 394 N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,376 9,344 25.4 N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,888 9,344 626 N/A N/A N/A N/A
GasToken:deploy 1,344 9,344 568 N/A N/A N/A N/A
SchnorrAccount:constructor 1,280 9,344 437 N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,272 9,344 773 (-1%) 16,352 ⚠️ 6,622 (+36%) 131,072 444
Token:privately_mint_private_note 1,248 9,344 528 (-4%) N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,312 9,344 105 (-5%) 16,352 1,951 (+7%) 65,536 444
Token:transfer 1,280 9,344 1,605 (-5%) 16,352 10,052 (-4%) 524,288 444
AuthRegistry:set_authorized (avm) 19,222 N/A N/A 95,392 1,387 (+15%) N/A N/A
FPC:prepare_fee (avm) 26,664 N/A N/A 95,456 2,053 (+2%) N/A N/A
Token:transfer_public (avm) 42,914 N/A N/A 95,456 2,413 (+5%) N/A N/A
AuthRegistry:consume (avm) 33,100 N/A N/A 95,424 2,030 (+4%) N/A N/A
FPC:pay_refund (avm) 36,829 N/A N/A 95,424 9,238 (+2%) N/A N/A
Benchmarking:create_note 1,312 9,344 423 N/A N/A N/A N/A
SchnorrAccount:verify_private_authwit 1,248 9,344 41.5 N/A N/A N/A N/A
Token:unshield 1,344 9,344 1,309 (-1%) N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,344 9,344 1,680 N/A N/A N/A N/A

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
GasToken:_increase_public_balance 79.6 (-2%) 13,790
GasToken:set_portal 10.9 (-23%) 3,339
Token:constructor 106 (+3%) 23,692
FPC:constructor 72.0 (+1%) 13,592
GasToken:mint_public 62.1 10,158
Token:mint_public ⚠️ 47.8 (-37%) 19,034
Token:assert_minter_and_mint 93.8 12,925
AuthRegistry:set_authorized 36.1 (+3%) 7,812
FPC:prepare_fee 109 (-2%) 15,062
Token:transfer_public 37.5 (-2%) 31,218
FPC:pay_refund 129 (-2%) 25,260
Benchmarking:increment_balance 1,326 15,267
Token:_increase_public_balance 15.2 (+3%) 15,006
FPC:pay_refund_with_shielded_rebate 165 (+2%) 26,347

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.154 (+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 10.4 16.8 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.601 0.516 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 48.5 75.7 131 245 469 (-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.495 0.466 0.452 0.444 0.438 (-1%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 59.8 111 (-1%) 182 (-1%) 352 691 (-1%)
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 109 207 355 691 1,363
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.505 0.498 (-1%) 0.482 (-1%) 0.477 0.474 (-1%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 73.0 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A 133 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A 0.519 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 74,105 667,868

Transaction size based on fee payment method

| Metric | |
| - | |

@benesjan benesjan force-pushed the 07-09-refactor_private_refund_cleanup branch from b456086 to 7371f62 Compare July 10, 2024 10:34
@benesjan benesjan force-pushed the 07-10-fix_using_different_generators_in_private_refund branch from fd48654 to 8caa2ac Compare July 10, 2024 10:34
@benesjan benesjan marked this pull request as ready for review July 10, 2024 11:17
@benesjan benesjan requested review from LHerskind and just-mitch July 10, 2024 11:17
Copy link
Collaborator

@just-mitch just-mitch left a comment

Choose a reason for hiding this comment

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

🔥

Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome! I had no idea derive_generators was a thing. This is perfect!!

@benesjan benesjan force-pushed the 07-09-refactor_private_refund_cleanup branch from 7371f62 to 2502937 Compare July 10, 2024 13:53
@benesjan benesjan force-pushed the 07-10-fix_using_different_generators_in_private_refund branch from f54844e to 689361c Compare July 10, 2024 13:53
Base automatically changed from 07-09-refactor_private_refund_cleanup to master July 10, 2024 14:38
@benesjan benesjan force-pushed the 07-10-fix_using_different_generators_in_private_refund branch from 689361c to c5e6ed9 Compare July 10, 2024 14:44
@benesjan benesjan enabled auto-merge (squash) July 10, 2024 14:45
@benesjan benesjan merged commit 59b92ca into master Jul 10, 2024
90 checks passed
@benesjan benesjan deleted the 07-10-fix_using_different_generators_in_private_refund branch July 10, 2024 20:24
rahul-kothari pushed a commit that referenced this pull request Jul 11, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.46.3</summary>

##
[0.46.3](aztec-package-v0.46.2...aztec-package-v0.46.3)
(2024-07-11)


### Miscellaneous

* **aztec-package:** Synchronize aztec-packages versions
</details>

<details><summary>barretenberg.js: 0.46.3</summary>

##
[0.46.3](barretenberg.js-v0.46.2...barretenberg.js-v0.46.3)
(2024-07-11)


### Miscellaneous

* **barretenberg.js:** Synchronize aztec-packages versions
</details>

<details><summary>aztec-packages: 0.46.3</summary>

##
[0.46.3](aztec-packages-v0.46.2...aztec-packages-v0.46.3)
(2024-07-11)


### Features

* Add CLI argument for debugging comptime blocks
(noir-lang/noir#5192)
([97ecff5](97ecff5))
* Add reset tiny and optimize tail
([#7422](#7422))
([399917b](399917b))
* **avm:** Calldatacopy and return gadget
([#7415](#7415))
([ec39e4e](ec39e4e)),
closes
[#7381](#7381)
[#7211](#7211)
* **avm:** Make ProverPolynomials::get_row return references
([#7419](#7419))
([108fc5f](108fc5f))
* Integrate new proving systems in e2e
([#6971](#6971))
([723a0c1](723a0c1))
* Lsp rename/find-all-references for struct members
(noir-lang/noir#5443)
([97ecff5](97ecff5))
* MSM sorting
([#7351](#7351))
([5cbdc54](5cbdc54))
* **optimization:** Deduplicate more instructions
(noir-lang/noir#5457)
([97ecff5](97ecff5))
* Prefix operator overload trait dispatch
(noir-lang/noir#5423)
([97ecff5](97ecff5))
* Remove proof from L1 Rollup process
([#7347](#7347))
([2645eab](2645eab)),
closes
[#7346](#7346)
* Remove ram tables in note_getter
([#7434](#7434))
([fd67da3](fd67da3))
* Sync from aztec-packages (noir-lang/noir#5467)
([97ecff5](97ecff5))
* Typing return values of embedded_curve_ops
([#7413](#7413))
([db96077](db96077))


### Bug Fixes

* **avm:** Fixes AVM full tests and decrease timeout to 35 minutes
([#7438](#7438))
([2a7494b](2a7494b))
* Memory init with no other ops gate counting
([#7427](#7427))
([e7177ba](e7177ba))
* Pass secrets to ci-arm.yml
([#7436](#7436))
([619501d](619501d))
* Remove compile-time error for invalid indices
(noir-lang/noir#5466)
([97ecff5](97ecff5))
* Using different generators in private refund
([#7414](#7414))
([59b92ca](59b92ca)),
closes
[#7320](#7320)


### Miscellaneous

* **bb:** Fix double increment
([#7428](#7428))
([7870a58](7870a58))
* **boxes:** Adding an init command for an empty project
([#7398](#7398))
([a6a605d](a6a605d))
* Bump bb to 0.45.1 (noir-lang/noir#5469)
([97ecff5](97ecff5))
* Disable flaky cheat code test
([7b8c2ba](7b8c2ba))
* Document EmbeddedCurvePoint
(noir-lang/noir#5468)
([97ecff5](97ecff5))
* Minimize usage of get_row in inverse computation
([#7431](#7431))
([f177887](f177887))
* Private refund cleanup
([#7403](#7403))
([ebec8ff](ebec8ff))
* Replace relative paths to noir-protocol-circuits
([842f6d1](842f6d1))
* Unbundle `check_array_is_initialized`
(noir-lang/noir#5451)
([97ecff5](97ecff5))
</details>

<details><summary>barretenberg: 0.46.3</summary>

##
[0.46.3](barretenberg-v0.46.2...barretenberg-v0.46.3)
(2024-07-11)


### Features

* **avm:** Calldatacopy and return gadget
([#7415](#7415))
([ec39e4e](ec39e4e)),
closes
[#7381](#7381)
[#7211](#7211)
* **avm:** Make ProverPolynomials::get_row return references
([#7419](#7419))
([108fc5f](108fc5f))
* Integrate new proving systems in e2e
([#6971](#6971))
([723a0c1](723a0c1))
* MSM sorting
([#7351](#7351))
([5cbdc54](5cbdc54))


### Bug Fixes

* **avm:** Fixes AVM full tests and decrease timeout to 35 minutes
([#7438](#7438))
([2a7494b](2a7494b))
* Memory init with no other ops gate counting
([#7427](#7427))
([e7177ba](e7177ba))


### Miscellaneous

* **bb:** Fix double increment
([#7428](#7428))
([7870a58](7870a58))
* Minimize usage of get_row in inverse computation
([#7431](#7431))
([f177887](f177887))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
AztecBot added a commit to AztecProtocol/barretenberg that referenced this pull request Jul 12, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.46.3</summary>

##
[0.46.3](AztecProtocol/aztec-packages@aztec-package-v0.46.2...aztec-package-v0.46.3)
(2024-07-11)


### Miscellaneous

* **aztec-package:** Synchronize aztec-packages versions
</details>

<details><summary>barretenberg.js: 0.46.3</summary>

##
[0.46.3](AztecProtocol/aztec-packages@barretenberg.js-v0.46.2...barretenberg.js-v0.46.3)
(2024-07-11)


### Miscellaneous

* **barretenberg.js:** Synchronize aztec-packages versions
</details>

<details><summary>aztec-packages: 0.46.3</summary>

##
[0.46.3](AztecProtocol/aztec-packages@aztec-packages-v0.46.2...aztec-packages-v0.46.3)
(2024-07-11)


### Features

* Add CLI argument for debugging comptime blocks
(noir-lang/noir#5192)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Add reset tiny and optimize tail
([#7422](AztecProtocol/aztec-packages#7422))
([399917b](AztecProtocol/aztec-packages@399917b))
* **avm:** Calldatacopy and return gadget
([#7415](AztecProtocol/aztec-packages#7415))
([ec39e4e](AztecProtocol/aztec-packages@ec39e4e)),
closes
[#7381](AztecProtocol/aztec-packages#7381)
[#7211](AztecProtocol/aztec-packages#7211)
* **avm:** Make ProverPolynomials::get_row return references
([#7419](AztecProtocol/aztec-packages#7419))
([108fc5f](AztecProtocol/aztec-packages@108fc5f))
* Integrate new proving systems in e2e
([#6971](AztecProtocol/aztec-packages#6971))
([723a0c1](AztecProtocol/aztec-packages@723a0c1))
* Lsp rename/find-all-references for struct members
(noir-lang/noir#5443)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* MSM sorting
([#7351](AztecProtocol/aztec-packages#7351))
([5cbdc54](AztecProtocol/aztec-packages@5cbdc54))
* **optimization:** Deduplicate more instructions
(noir-lang/noir#5457)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Prefix operator overload trait dispatch
(noir-lang/noir#5423)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Remove proof from L1 Rollup process
([#7347](AztecProtocol/aztec-packages#7347))
([2645eab](AztecProtocol/aztec-packages@2645eab)),
closes
[#7346](AztecProtocol/aztec-packages#7346)
* Remove ram tables in note_getter
([#7434](AztecProtocol/aztec-packages#7434))
([fd67da3](AztecProtocol/aztec-packages@fd67da3))
* Sync from aztec-packages (noir-lang/noir#5467)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Typing return values of embedded_curve_ops
([#7413](AztecProtocol/aztec-packages#7413))
([db96077](AztecProtocol/aztec-packages@db96077))


### Bug Fixes

* **avm:** Fixes AVM full tests and decrease timeout to 35 minutes
([#7438](AztecProtocol/aztec-packages#7438))
([2a7494b](AztecProtocol/aztec-packages@2a7494b))
* Memory init with no other ops gate counting
([#7427](AztecProtocol/aztec-packages#7427))
([e7177ba](AztecProtocol/aztec-packages@e7177ba))
* Pass secrets to ci-arm.yml
([#7436](AztecProtocol/aztec-packages#7436))
([619501d](AztecProtocol/aztec-packages@619501d))
* Remove compile-time error for invalid indices
(noir-lang/noir#5466)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Using different generators in private refund
([#7414](AztecProtocol/aztec-packages#7414))
([59b92ca](AztecProtocol/aztec-packages@59b92ca)),
closes
[#7320](AztecProtocol/aztec-packages#7320)


### Miscellaneous

* **bb:** Fix double increment
([#7428](AztecProtocol/aztec-packages#7428))
([7870a58](AztecProtocol/aztec-packages@7870a58))
* **boxes:** Adding an init command for an empty project
([#7398](AztecProtocol/aztec-packages#7398))
([a6a605d](AztecProtocol/aztec-packages@a6a605d))
* Bump bb to 0.45.1 (noir-lang/noir#5469)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Disable flaky cheat code test
([7b8c2ba](AztecProtocol/aztec-packages@7b8c2ba))
* Document EmbeddedCurvePoint
(noir-lang/noir#5468)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Minimize usage of get_row in inverse computation
([#7431](AztecProtocol/aztec-packages#7431))
([f177887](AztecProtocol/aztec-packages@f177887))
* Private refund cleanup
([#7403](AztecProtocol/aztec-packages#7403))
([ebec8ff](AztecProtocol/aztec-packages@ebec8ff))
* Replace relative paths to noir-protocol-circuits
([842f6d1](AztecProtocol/aztec-packages@842f6d1))
* Unbundle `check_array_is_initialized`
(noir-lang/noir#5451)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
</details>

<details><summary>barretenberg: 0.46.3</summary>

##
[0.46.3](AztecProtocol/aztec-packages@barretenberg-v0.46.2...barretenberg-v0.46.3)
(2024-07-11)


### Features

* **avm:** Calldatacopy and return gadget
([#7415](AztecProtocol/aztec-packages#7415))
([ec39e4e](AztecProtocol/aztec-packages@ec39e4e)),
closes
[#7381](AztecProtocol/aztec-packages#7381)
[#7211](AztecProtocol/aztec-packages#7211)
* **avm:** Make ProverPolynomials::get_row return references
([#7419](AztecProtocol/aztec-packages#7419))
([108fc5f](AztecProtocol/aztec-packages@108fc5f))
* Integrate new proving systems in e2e
([#6971](AztecProtocol/aztec-packages#6971))
([723a0c1](AztecProtocol/aztec-packages@723a0c1))
* MSM sorting
([#7351](AztecProtocol/aztec-packages#7351))
([5cbdc54](AztecProtocol/aztec-packages@5cbdc54))


### Bug Fixes

* **avm:** Fixes AVM full tests and decrease timeout to 35 minutes
([#7438](AztecProtocol/aztec-packages#7438))
([2a7494b](AztecProtocol/aztec-packages@2a7494b))
* Memory init with no other ops gate counting
([#7427](AztecProtocol/aztec-packages#7427))
([e7177ba](AztecProtocol/aztec-packages@e7177ba))


### Miscellaneous

* **bb:** Fix double increment
([#7428](AztecProtocol/aztec-packages#7428))
([7870a58](AztecProtocol/aztec-packages@7870a58))
* Minimize usage of get_row in inverse computation
([#7431](AztecProtocol/aztec-packages#7431))
([f177887](AztecProtocol/aztec-packages@f177887))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

bug(PartialNotes): use separate generators for the constituent pieces of PrivateToken
3 participants