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: Sync from noir #7223

Merged
merged 17 commits into from
Jun 28, 2024
Merged

feat: Sync from noir #7223

merged 17 commits into from
Jun 28, 2024

Conversation

AztecBot
Copy link
Collaborator

Automated pull of development from the noir programming language, a dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
fix: Implement generic functions in the interpreter (noir-lang/noir#5330)
feat: Insert trait impls into the program from type annotations (noir-lang/noir#5327)
feat: Sync from aztec-packages (noir-lang/noir#5340)
chore: address TODO in compat.nr (noir-lang/noir#5339)
chore: use push_err more in elaborator (noir-lang/noir#5336)
chore: remove is_unconstrained_fn field from elaborator (noir-lang/noir#5335)
fix: Error when a local function is called in a comptime context (noir-lang/noir#5334)
feat: Add map, fold, reduce, any, and all for slices (noir-lang/noir#5331)
fix: Avoid panic in type system (noir-lang/noir#5332)
chore: remove panic for unimplemented trait dispatch (noir-lang/noir#5329)
feat: Use runtime loops for brillig array initialization (noir-lang/noir#5243)
fix: Fix tokenization of unquoted types in macros (noir-lang/noir#5326)
chore: replace cached in_contract with in_contract() method (noir-lang/noir#5324)
fix: fix usage of #[abi(tag)] attribute with elaborator (noir-lang/noir#5298)
fix: don't benchmark the "prove" command as it doesn't exist anymore (noir-lang/noir#5323)
feat(stdlib): Update stdlib to use explicit numeric generics (noir-lang/noir#5306)
feat: let should_fail_with check that the failure reason contains the expected message (noir-lang/noir#5319)
chore: bump bb to 0.43.0 (noir-lang/noir#5321)
feat(frontend): Explicit numeric generics and type kinds (noir-lang/noir#5155)
feat(frontend): Where clause on impl (noir-lang/noir#5320)
END_COMMIT_OVERRIDE

AztecBot and others added 10 commits June 27, 2024 16:11
…-lang/noir#5330)

feat: Insert trait impls into the program from type annotations (noir-lang/noir#5327)
feat: Sync from aztec-packages (noir-lang/noir#5340)
chore: address TODO in `compat.nr` (noir-lang/noir#5339)
chore: use `push_err` more in elaborator (noir-lang/noir#5336)
chore: remove `is_unconstrained_fn` field from elaborator (noir-lang/noir#5335)
fix: Error when a local function is called in a comptime context (noir-lang/noir#5334)
feat: Add `map`, `fold`, `reduce`, `any`, and `all` for slices (noir-lang/noir#5331)
fix: Avoid panic in type system (noir-lang/noir#5332)
chore: remove panic for unimplemented trait dispatch (noir-lang/noir#5329)
feat: Use runtime loops for brillig array initialization (noir-lang/noir#5243)
fix: Fix tokenization of unquoted types in macros (noir-lang/noir#5326)
chore: replace cached `in_contract` with `in_contract()` method (noir-lang/noir#5324)
fix: fix usage of `#[abi(tag)]` attribute with elaborator (noir-lang/noir#5298)
fix: don't benchmark the "prove" command as it doesn't exist anymore (noir-lang/noir#5323)
feat(stdlib): Update stdlib to use explicit numeric generics (noir-lang/noir#5306)
feat: let `should_fail_with` check that the failure reason contains the expected message (noir-lang/noir#5319)
chore: bump `bb` to 0.43.0 (noir-lang/noir#5321)
feat(frontend): Explicit numeric generics and type kinds (noir-lang/noir#5155)
feat(frontend): Where clause on impl (noir-lang/noir#5320)
@TomAFrench
Copy link
Member

@vezenovm We're also getting errors on where clauses related to the NoteInterface trait which looks like it could stem from your PR.

@TomAFrench
Copy link
Member

For reference, this is the error

image

@vezenovm
Copy link
Contributor

For reference, this is the error

I know what is happening I will investigate the fix. I may end up just switching them over to explicit numeric generics.

@TomAFrench
Copy link
Member

TomAFrench commented Jun 28, 2024

Thanks! Would be good to pull a regression test over to the main repo as part of this.

@vezenovm
Copy link
Contributor

Thanks! Would be good to pull a regression test over to the main repo as part of this.

I was struggling to reproduce a small example. I think the order of resolution across crates matters in this bug which complicates things. The bug was exclusive to the legacy resolver as well so I just fixed it here.

@vezenovm vezenovm enabled auto-merge (squash) June 28, 2024 19:36
@vezenovm vezenovm merged commit f2abb4e into master Jun 28, 2024
89 checks passed
@vezenovm vezenovm deleted the sync-noir branch June 28, 2024 19:40
@AztecBot
Copy link
Collaborator Author

Benchmark results

Metrics with a significant change:

  • protocol_circuit_simulation_time_in_ms (public-kernel-setup): 636 (-19%)
  • avm_simulation_time_ms (GasToken:_increase_public_balance): 66.8 (-41%)
  • avm_simulation_time_ms (Token:mint_public): 70.6 (-89%)
  • avm_simulation_time_ms (Token:assert_minter_and_mint): 209 (+124%)
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_30_ms 11,507 3,191 (+3%) 1,390 (-5%) 1,427 (-15%) 1,462 (-5%)
proof_construction_time_sha256_100_ms 44,304 11,869 5,462 5,389 5,369
proof_construction_time_poseidon_hash_ms 79.0 34.0 34.0 58.0 87.0
proof_construction_time_poseidon_hash_30_ms 1,534 419 201 222 (-1%) 268 (+2%)
proof_construction_time_poseidon_hash_100_ms 5,814 1,582 724 771 (-2%) 798

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 1,412 1,412 1,412
l1_rollup_calldata_gas 9,464 9,462 9,464
l1_rollup_execution_gas 610,285 610,283 610,285
l2_block_processing_time_in_ms 760 (-1%) 1,427 2,715
l2_block_building_time_in_ms 24,567 (-4%) 49,792 (-3%) 96,095 (-4%)
l2_block_rollup_simulation_time_in_ms 24,567 (-4%) 49,791 (-3%) 96,095 (-4%)
l2_block_public_tx_process_time_in_ms 21,114 (-4%) 46,099 (-3%) 92,498 (-4%)

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,077 9,999
node_database_size_in_bytes 12,177,488 16,035,920
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 116 (-5%) 455 (-2%) 12,823 (-4%) 20,634 67,190 92,352 2,819 524,288
private-kernel-inner 359 (-7%) 1,109 (+15%) 48,204 (-8%) 94,902 67,190 92,352 2,819 2,097,152
private-kernel-tail 301 (-5%) 1,720 (-2%) 50,287 (-6%) 99,121 71,733 14,912 399 2,097,152
base-parity 6.40 (-3%) 1,825 (-5%) 2,755 (-1%) 128 64.0 2,208 2.00 131,072
root-parity 49.1 (-5%) 70.1 (-7%) 40,299 (-1%) 27,100 64.0 2,720 18.0 2,097,152
base-rollup 7,734 (-3%) 4,941 83,965 (-5%) 170,330 756 3,648 47.0 4,194,304
root-rollup 110 96.7 (+7%) 22,500 (-8%) 25,309 620 3,456 41.0 1,048,576
public-kernel-setup ⚠️ 636 (-19%) 3,699 (-2%) 45,825 (-1%) 116,905 93,334 125,344 3,850 2,097,152
public-kernel-app-logic 586 (-8%) 4,745 45,354 (-2%) 116,905 93,334 125,344 3,850 2,097,152
public-kernel-tail 1,389 (-1%) 39,462 (+7%) 191,617 (-1%) 511,910 10,014 14,912 399 8,388,608
private-kernel-reset-small 553 (-2%) 1,921 (-10%) 45,818 (-4%) 123,313 67,190 92,352 2,819 2,097,152
public-kernel-teardown 580 (-9%) 4,762 46,527 (+2%) 116,905 93,334 125,344 3,850 2,097,152
merge-rollup 29.0 N/A N/A 16,542 756 N/A N/A N/A
private-kernel-tail-to-public N/A 7,828 (+8%) 98,923 (-3%) N/A N/A 125,344 3,850 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 409 (-4%) N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,408 9,944 39.6 (-2%) N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,920 9,944 1,762 (-2%) N/A N/A N/A N/A
GasToken:deploy 1,376 9,944 957 (-4%) N/A N/A N/A N/A
SchnorrAccount:constructor 1,312 9,944 1,407 N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,304 9,944 2,799 (-3%) 16,768 54,233 (-5%) 2,097,152 457
Token:privately_mint_private_note 1,280 9,944 1,614 (-13%) N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,344 9,944 351 (-4%) 16,768 11,891 (+3%) 524,288 457
Token:transfer 1,312 9,944 4,458 (-10%) 16,768 48,100 (-1%) 2,097,152 457
AuthRegistry:set_authorized (avm) 21,043 N/A N/A 87,552 1,389 N/A N/A
FPC:prepare_fee (avm) 28,484 N/A N/A 88,448 5,842 (+2%) N/A N/A
Token:transfer_public (avm) 44,885 N/A N/A 88,170 3,881 (-5%) N/A N/A
AuthRegistry:consume (avm) 34,973 N/A N/A 87,968 2,876 (-6%) N/A N/A
FPC:pay_refund (avm) 38,649 (-7%) N/A N/A 89,248 23,011 (-2%) N/A N/A
Benchmarking:create_note 1,344 9,944 1,394 N/A N/A N/A N/A
SchnorrAccount:verify_private_authwit 1,280 9,944 72.6 (-1%) N/A N/A N/A N/A
Token:unshield 1,376 9,944 3,708 (-13%) N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,376 9,944 4,609 (-15%) 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 ⚠️ 66.8 (-41%) 13,873
GasToken:set_portal 19.6 (+11%) 3,495
Token:constructor 81.6 (-11%) 24,207
FPC:constructor 62.7 (-3%) 13,893
GasToken:mint_public 52.1 (-2%) 10,241
Token:mint_public ⚠️ 70.6 (-89%) 19,216
Token:assert_minter_and_mint ⚠️ 209 (+124%) 13,034
AuthRegistry:set_authorized 31.2 (-11%) 7,869
FPC:prepare_fee 183 (+12%) 15,118
Token:transfer_public 31.8 (-5%) 31,425
FPC:pay_refund 163 (-26%) 25,316 (-10%)
Benchmarking:increment_balance 2,616 (-4%) 15,396
Token:_increase_public_balance 62.5 (-11%) 15,089
FPC:pay_refund_with_shielded_rebate 199 (+1%) 26,403 (-9%)

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.158 (-2%)

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.7 76.7 132 (+1%) 248 (+1%) 474
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.497 0.471 (+1%) 0.454 (+1%) 0.448 (+1%) 0.443 (+1%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 59.9 113 184 (+1%) 356 697
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.506 0.504 0.487 (+1%) 0.481 0.478
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 73.1 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.520 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 85,672 670,983

Transaction size based on fee payment method

| Metric | |
| - | |

TomAFrench added a commit that referenced this pull request Jul 1, 2024
* master: (29 commits)
  refactor: gets rid of unencrypted emit in private_context (#7236)
  git subrepo push --branch=master noir-projects/aztec-nr
  git_subrepo.sh: Fix parent in .gitrepo file. [skip ci]
  chore: replace relative paths to noir-protocol-circuits
  git subrepo push --branch=master barretenberg
  fix: reran pil->cpp codegen & encode_and_encrypt_event_with_randomness fix (#7247)
  git subrepo push --branch=master noir-projects/aztec-nr
  git_subrepo.sh: Fix parent in .gitrepo file. [skip ci]
  chore: replace relative paths to noir-protocol-circuits
  git subrepo push --branch=master barretenberg
  feat!: extend storage read oracle to receive address and block number (#7243)
  feat: example of private token transfer event (#7242)
  feat: Constant Honk proof sizes (#6954)
  feat: add outgoing keys support to getEvents (#7239)
  feat: Sync from noir (#7223)
  feat!: split storage access oracles (#7237)
  feat: add new lenses for encryted notes (#7238)
  feat(avm): calldata gadget preliminaries (#7227)
  fix(docs): Historical reference library updates (#7166)
  chore: avoid building contracts when producing gates report (#7136)
  ...
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