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: add unconstrained context to txe #7448

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

sklppy88
Copy link
Contributor

Please read contributing guidelines and remove this line.

@sklppy88 sklppy88 changed the title init feat: add unconstrained context to txe Jul 11, 2024
@AztecBot
Copy link
Collaborator

AztecBot commented Jul 11, 2024

Benchmark results

Metrics with a significant change:

  • protocol_circuit_simulation_time_in_ms (private-kernel-tail-to-public): 4,439 (-35%)
  • avm_simulation_time_ms (Token:_increase_public_balance): 138 (+650%)
  • avm_simulation_time_ms (FPC:pay_refund_with_shielded_rebate): 123 (-39%)
  • protocol_circuit_proving_time_in_ms (base-parity): 1,388 (-30%)
  • protocol_circuit_proving_time_in_ms (root-parity): 31,148 (-38%)
  • protocol_circuit_proving_time_in_ms (root-rollup): 28,755 (-29%)
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,517 (+2%) 1,507 (+2%) 673 (+1%) 720 (-1%) 736 (+1%)
proof_construction_time_sha256_30_ms 11,081 (+2%) 3,023 (+2%) 1,312 (+1%) 1,365 (-1%) 1,402 (+1%)
proof_construction_time_sha256_100_ms 41,970 (+1%) 11,466 (+1%) 5,629 (+11%) 5,416 (-5%) 5,118 (+1%)
proof_construction_time_poseidon_hash_ms 75.0 34.0 34.0 57.0 90.0 (+1%)
proof_construction_time_poseidon_hash_30_ms 1,456 (+1%) 406 (+1%) 195 (+1%) 220 (+3%) 259 (-1%)
proof_construction_time_poseidon_hash_100_ms 5,502 (+3%) 1,482 (+2%) 654 (+2%) 715 (+4%) 722 (+2%)

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,588 6,590 6,600
l1_rollup_execution_gas 583,050 583,203 583,364
l2_block_processing_time_in_ms 804 1,488 (-1%) 2,881 (-1%)
l2_block_building_time_in_ms 13,692 (-1%) 26,665 (-1%) 52,421 (-1%)
l2_block_rollup_simulation_time_in_ms 13,691 (-1%) 26,665 (-1%) 52,420 (-1%)
l2_block_public_tx_process_time_in_ms 11,488 (-1%) 24,277 (-1%) 50,008 (-1%)

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,391 (-1%) 10,353 (-1%)
node_database_size_in_bytes 12,435,536 16,453,712
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 input_size_in_bytes output_size_in_bytes proving_time_in_ms proof_size_in_bytes num_public_inputs size_in_gates
private-kernel-init 118 (-2%) 404 (+2%) 21,732 54,085 N/A N/A N/A N/A
private-kernel-inner 232 (-2%) 724 (+2%) 81,199 54,264 N/A N/A N/A N/A
private-kernel-tail 1,119 (-2%) 2,495 61,808 61,554 N/A N/A N/A N/A
base-parity 6.76 818 (-5%) 160 96.0 ⚠️ 1,388 (-30%) 12,676 3.00 131,072
root-parity 111 117 64,860 96.0 ⚠️ 31,148 (-38%) 12,676 3.00 4,194,304
base-rollup 4,321 (-1%) 4,969 (+1%) 180,315 632 44,131 (-9%) 13,476 28.0 4,194,304
root-rollup 161 118 (-2%) 51,261 652 ⚠️ 28,755 (-29%) 13,412 26.0 4,194,304
public-kernel-setup 195 (-4%) 2,452 (+1%) 112,536 80,310 18,725 (-15%) 118,916 3,323 2,097,152
public-kernel-app-logic 152 (-2%) 3,343 (+3%) 112,536 80,310 10,202 (+1%) 118,916 3,323 1,048,576
public-kernel-tail 913 (-1%) 27,013 (-1%) 409,413 10,046 67,504 (-7%) 24,868 384 8,388,608
private-kernel-reset-tiny 306 (-1%) 1,007 (+1%) 77,007 53,954 N/A N/A N/A N/A
private-kernel-tail-to-public ⚠️ 4,439 (-35%) 2,848 (+1%) 777,415 1,632 N/A N/A N/A N/A
public-kernel-teardown 140 (-3%) 3,355 (+3%) 112,536 80,310 19,278 (-15%) 118,916 3,323 2,097,152
merge-rollup 59.0 (-3%) N/A 33,566 632 N/A N/A N/A N/A
undefined N/A N/A N/A N/A 164,801 (+2%) N/A N/A N/A

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
ContractClassRegisterer:register 1,312 9,344 411 N/A N/A
ContractInstanceDeployer:deploy 1,376 9,344 26.2 N/A N/A
MultiCallEntrypoint:entrypoint 1,888 9,344 655 N/A N/A
GasToken:deploy 1,344 9,344 581 (-1%) N/A N/A
SchnorrAccount:constructor 1,280 9,344 458 N/A N/A
SchnorrAccount:entrypoint 2,272 9,344 810 (-1%) N/A N/A
Token:privately_mint_private_note 1,248 9,344 523 (-1%) N/A N/A
FPC:fee_entrypoint_public 1,312 9,344 107 (+4%) N/A N/A
Token:transfer 1,280 9,344 1,540 N/A N/A
AuthRegistry:set_authorized (avm) 19,222 N/A N/A 95,392 2,095 (-1%)
FPC:prepare_fee (avm) 26,664 N/A N/A 95,456 2,797 (-1%)
Token:transfer_public (avm) 42,914 N/A N/A 95,456 3,176 (-1%)
AuthRegistry:consume (avm) 33,100 N/A N/A 95,424 2,746 (-2%)
FPC:pay_refund (avm) 36,829 N/A N/A 95,424 10,860 (-1%)
Benchmarking:create_note 1,312 9,344 463 (-1%) N/A N/A
SchnorrAccount:verify_private_authwit 1,248 9,344 44.8 (-3%) N/A N/A
Token:unshield 1,344 9,344 1,255 (-2%) N/A N/A
FPC:fee_entrypoint_private 1,344 9,344 1,645 (-1%) 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 100 (+1%) 13,790
GasToken:set_portal 12.1 (-7%) 3,339
Token:constructor 127 (-2%) 23,692
FPC:constructor 94.9 (+4%) 13,592
GasToken:mint_public 84.1 (+2%) 10,158
Token:mint_public 336 (-3%) 19,034
Token:assert_minter_and_mint 50.2 (+2%) 12,925
AuthRegistry:set_authorized 48.7 (+1%) 7,812
FPC:prepare_fee 108 (-11%) 15,062
Token:transfer_public 35.0 (-19%) 31,218
FPC:pay_refund 134 (+5%) 25,260
Benchmarking:increment_balance 1,375 (-1%) 15,267
Token:_increase_public_balance ⚠️ 138 (+650%) 15,006
FPC:pay_refund_with_shielded_rebate ⚠️ 123 (-39%) 26,347

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.154 (+1%)

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.8 17.4 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.628 0.537 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 50.4 80.1 (-1%) 140 260 503
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.516 0.494 0.480 0.471 (-1%) 0.470
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 62.3 118 (-1%) 195 (-1%) 373 (-1%) 740 (-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.527 0.529 (-1%) 0.509 0.506 0.507 (-1%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 76.4 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.545 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 76,837 667,838

Transaction size based on fee payment method

| Metric | |
| - | |

@sklppy88 sklppy88 force-pushed the ek/feat/add-unconstrained-context-to-txe branch 3 times, most recently from 53d7abe to 71f7739 Compare July 12, 2024 16:36
@sklppy88 sklppy88 requested a review from nventuro July 12, 2024 16:41
@sklppy88 sklppy88 marked this pull request as ready for review July 15, 2024 14:41
@sklppy88 sklppy88 force-pushed the ek/feat/add-unconstrained-context-to-txe branch from 71f7739 to 0ab3f4d Compare July 15, 2024 17:54
@sklppy88 sklppy88 force-pushed the ek/feat/add-unconstrained-context-to-txe branch from 0ab3f4d to 7a31314 Compare July 15, 2024 18:21
@nventuro nventuro merged commit 699fb79 into master Jul 15, 2024
92 checks passed
@nventuro nventuro deleted the ek/feat/add-unconstrained-context-to-txe branch July 15, 2024 20:31
rahul-kothari pushed a commit that referenced this pull request Jul 16, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[0.46.7](aztec-package-v0.46.6...aztec-package-v0.46.7)
(2024-07-16)


### Features

* Devnet updates
([#7421](#7421))
([103f099](103f099))


### Bug Fixes

* Cli l1-chain-id option
([#7490](#7490))
([307bc57](307bc57))


### Miscellaneous

* Turn on elaborator
([#7451](#7451))
([0599500](0599500))
</details>

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

##
[0.46.7](barretenberg.js-v0.46.6...barretenberg.js-v0.46.7)
(2024-07-16)


### Miscellaneous

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

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

##
[0.46.7](aztec-packages-v0.46.6...aztec-packages-v0.46.7)
(2024-07-16)


### Features

* Add unconstrained context to txe
([#7448](#7448))
([699fb79](699fb79))
* Add unconstrained getters to sharedmutable
([#7429](#7429))
([c0ff566](c0ff566))
* Devnet updates
([#7421](#7421))
([103f099](103f099))
* Point::fromXandSign(...)
([#7455](#7455))
([225c6f6](225c6f6))


### Bug Fixes

* **avm:** Update generated verifier
([#7492](#7492))
([f1216a7](f1216a7))
* Cli l1-chain-id option
([#7490](#7490))
([307bc57](307bc57))
* Don't pass secrets to earthly-ci 'publish docs' command
([#7481](#7481))
([a3f6feb](a3f6feb))
* Fix msg_sender direct call exploit
([#7404](#7404))
([1dcae45](1dcae45))
* Missing NoteSelector from JSON RPC proxies
([#7493](#7493))
([b209fad](b209fad))
* **pxe:** Best effort noir call stack generation
([#7336](#7336))
([0c7459b](0c7459b))
* Validate gas used
([#7459](#7459))
([6dc7598](6dc7598))


### Miscellaneous

* **avm:** More stats and codegen cleanup
([#7475](#7475))
([1a6c7f2](1a6c7f2))
* Checking compute_encrypted_note_log against TS impl
([#7491](#7491))
([1e8a597](1e8a597))
* Included subrelation witness degrees in the relations relevant to
zk-sumcheck
([#7479](#7479))
([457a115](457a115))
* Replace relative paths to noir-protocol-circuits
([71960d4](71960d4))
* Turn on elaborator
([#7451](#7451))
([0599500](0599500))
</details>

<details><summary>barretenberg: 0.46.7</summary>

##
[0.46.7](barretenberg-v0.46.6...barretenberg-v0.46.7)
(2024-07-16)


### Features

* Point::fromXandSign(...)
([#7455](#7455))
([225c6f6](225c6f6))


### Bug Fixes

* **avm:** Update generated verifier
([#7492](#7492))
([f1216a7](f1216a7))


### Miscellaneous

* **avm:** More stats and codegen cleanup
([#7475](#7475))
([1a6c7f2](1a6c7f2))
* Included subrelation witness degrees in the relations relevant to
zk-sumcheck
([#7479](#7479))
([457a115](457a115))
</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 17, 2024
🤖 I have created a release *beep* *boop*
---


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

##
[0.46.7](AztecProtocol/aztec-packages@aztec-package-v0.46.6...aztec-package-v0.46.7)
(2024-07-16)


### Features

* Devnet updates
([#7421](AztecProtocol/aztec-packages#7421))
([103f099](AztecProtocol/aztec-packages@103f099))


### Bug Fixes

* Cli l1-chain-id option
([#7490](AztecProtocol/aztec-packages#7490))
([307bc57](AztecProtocol/aztec-packages@307bc57))


### Miscellaneous

* Turn on elaborator
([#7451](AztecProtocol/aztec-packages#7451))
([0599500](AztecProtocol/aztec-packages@0599500))
</details>

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

##
[0.46.7](AztecProtocol/aztec-packages@barretenberg.js-v0.46.6...barretenberg.js-v0.46.7)
(2024-07-16)


### Miscellaneous

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

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

##
[0.46.7](AztecProtocol/aztec-packages@aztec-packages-v0.46.6...aztec-packages-v0.46.7)
(2024-07-16)


### Features

* Add unconstrained context to txe
([#7448](AztecProtocol/aztec-packages#7448))
([699fb79](AztecProtocol/aztec-packages@699fb79))
* Add unconstrained getters to sharedmutable
([#7429](AztecProtocol/aztec-packages#7429))
([c0ff566](AztecProtocol/aztec-packages@c0ff566))
* Devnet updates
([#7421](AztecProtocol/aztec-packages#7421))
([103f099](AztecProtocol/aztec-packages@103f099))
* Point::fromXandSign(...)
([#7455](AztecProtocol/aztec-packages#7455))
([225c6f6](AztecProtocol/aztec-packages@225c6f6))


### Bug Fixes

* **avm:** Update generated verifier
([#7492](AztecProtocol/aztec-packages#7492))
([f1216a7](AztecProtocol/aztec-packages@f1216a7))
* Cli l1-chain-id option
([#7490](AztecProtocol/aztec-packages#7490))
([307bc57](AztecProtocol/aztec-packages@307bc57))
* Don't pass secrets to earthly-ci 'publish docs' command
([#7481](AztecProtocol/aztec-packages#7481))
([a3f6feb](AztecProtocol/aztec-packages@a3f6feb))
* Fix msg_sender direct call exploit
([#7404](AztecProtocol/aztec-packages#7404))
([1dcae45](AztecProtocol/aztec-packages@1dcae45))
* Missing NoteSelector from JSON RPC proxies
([#7493](AztecProtocol/aztec-packages#7493))
([b209fad](AztecProtocol/aztec-packages@b209fad))
* **pxe:** Best effort noir call stack generation
([#7336](AztecProtocol/aztec-packages#7336))
([0c7459b](AztecProtocol/aztec-packages@0c7459b))
* Validate gas used
([#7459](AztecProtocol/aztec-packages#7459))
([6dc7598](AztecProtocol/aztec-packages@6dc7598))


### Miscellaneous

* **avm:** More stats and codegen cleanup
([#7475](AztecProtocol/aztec-packages#7475))
([1a6c7f2](AztecProtocol/aztec-packages@1a6c7f2))
* Checking compute_encrypted_note_log against TS impl
([#7491](AztecProtocol/aztec-packages#7491))
([1e8a597](AztecProtocol/aztec-packages@1e8a597))
* Included subrelation witness degrees in the relations relevant to
zk-sumcheck
([#7479](AztecProtocol/aztec-packages#7479))
([457a115](AztecProtocol/aztec-packages@457a115))
* Replace relative paths to noir-protocol-circuits
([71960d4](AztecProtocol/aztec-packages@71960d4))
* Turn on elaborator
([#7451](AztecProtocol/aztec-packages#7451))
([0599500](AztecProtocol/aztec-packages@0599500))
</details>

<details><summary>barretenberg: 0.46.7</summary>

##
[0.46.7](AztecProtocol/aztec-packages@barretenberg-v0.46.6...barretenberg-v0.46.7)
(2024-07-16)


### Features

* Point::fromXandSign(...)
([#7455](AztecProtocol/aztec-packages#7455))
([225c6f6](AztecProtocol/aztec-packages@225c6f6))


### Bug Fixes

* **avm:** Update generated verifier
([#7492](AztecProtocol/aztec-packages#7492))
([f1216a7](AztecProtocol/aztec-packages@f1216a7))


### Miscellaneous

* **avm:** More stats and codegen cleanup
([#7475](AztecProtocol/aztec-packages#7475))
([1a6c7f2](AztecProtocol/aztec-packages@1a6c7f2))
* Included subrelation witness degrees in the relations relevant to
zk-sumcheck
([#7479](AztecProtocol/aztec-packages#7479))
([457a115](AztecProtocol/aztec-packages@457a115))
</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.

3 participants