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 #7170

Merged
merged 42 commits into from
Jun 27, 2024
Merged

feat: Sync from noir #7170

merged 42 commits into from
Jun 27, 2024

Conversation

AztecBot
Copy link
Collaborator

Automated pull of development from the noir programming language, a dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: add back Pedersen blackbox functions (revert PR 5221) (noir-lang/noir#5318)
fix: skip emission of brillig calls which will never be executed (noir-lang/noir#5314)
feat: Make macros operate on token streams instead of AST nodes (noir-lang/noir#5301)
chore: Bundle SSA Evaluator Options (noir-lang/noir#5317)
fix: Replace panic in monomorphization with an error (noir-lang/noir#5305)
fix(nargo_fmt): Account for spaces before the generic list of a function (noir-lang/noir#5303)
fix: update in_contract flag before handling function metadata in elaborator (noir-lang/noir#5292)
fix: fix incorrect return type being applied to stdlib functions modulus_be_bytes(), modulus_be_bits(), etc. (noir-lang/noir#5278)
chore: refactor test case generation in build.rs (noir-lang/noir#5280)
fix: handle struct with nested arrays in oracle return values (noir-lang/noir#5244)
feat: build simple dictionary from inspecting ACIR program (noir-lang/noir#5264)
fix: Add more thorough check for whether a type is valid when passing it from constrained code to unconstrained code (noir-lang/noir#5009)
chore: Pedersen commitment in Noir (noir-lang/noir#5221)
chore: pedersen hash in Noir (noir-lang/noir#5217)
fix: Don't lazily elaborate functions (noir-lang/noir#5282)
fix: avoid unnecessarily splitting expressions with multiplication terms with a shared term (noir-lang/noir#5291)
fix: avoid duplicating constant arrays (noir-lang/noir#5287)
feat: add fuzzer for Noir programs (noir-lang/noir#5251)
feat: Run comptime code from annotations on a type definition (noir-lang/noir#5256)
feat: implement comptime support for as_slice builtin (noir-lang/noir#5276)
chore: create separate crate just for noir artifacts (noir-lang/noir#5162)
feat: add support for wildcard types (noir-lang/noir#5275)
chore: replace logical operators with bitwise in DebugToString (noir-lang/noir#5236)
fix: use proper serialization in AbiValue (noir-lang/noir#5270)
chore: simplify compilation flow to write to file immediately (noir-lang/noir#5265)
feat: implement comptime support for array_len builtin (noir-lang/noir#5272)
chore: Use the elaborator by default (noir-lang/noir#5246)
chore: Release Noir(0.31.0) (noir-lang/noir#5166)
feat!: remove dep:: prefix (noir-lang/noir#4946)
feat: Sync from aztec-packages (noir-lang/noir#5242)
chore: replace is_bn254 implementation to not rely on truncation of literals (noir-lang/noir#5247)
chore: add no-predicate to hash implementations (noir-lang/noir#5253)
feat(experimental): Implement macro calls & splicing into Expr values (noir-lang/noir#5203)
feat: add BoundedVec::map (noir-lang/noir#5250)
chore: add no predicate to poseidon2 (noir-lang/noir#5252)
feat: add set and set_unchecked methods to Vec and BoundedVec (noir-lang/noir#5241)
fix: Disable if optimization (noir-lang/noir#5240)
chore: redo typo PR by dropbigfish (noir-lang/noir#5234)
chore: add property tests for ABI encoding (noir-lang/noir#5216)
chore: thread generics through ACIR/brillig gen (noir-lang/noir#5120)
chore: copy across typo PR script from aztec-packages (noir-lang/noir#5235)
chore(docs): fixing trailing slash issue (noir-lang/noir#5233)
fix: add support for nested arrays returned by oracles (noir-lang/noir#5132)
chore: Parse macros (noir-lang/noir#5229)
chore: Optimize the elaborator (noir-lang/noir#5230)
fix(elaborator): Fix regression introduced by lazy-global changes (noir-lang/noir#5223)
fix(elaborator): Fix duplicate methods error (noir-lang/noir#5225)
chore: fixing all relative paths (noir-lang/noir#5220)
chore: push code related to ABI gen into noirc_driver (noir-lang/noir#5218)
END_COMMIT_OVERRIDE

AztecBot and others added 14 commits June 24, 2024 19:52
…21) (noir-lang/noir#5318)

fix: skip emission of brillig calls which will never be executed (noir-lang/noir#5314)
feat: Make macros operate on token streams instead of AST nodes (noir-lang/noir#5301)
chore: Bundle SSA Evaluator Options (noir-lang/noir#5317)
fix: Replace panic in monomorphization with an error (noir-lang/noir#5305)
fix(nargo_fmt): Account for spaces before the generic list of a function (noir-lang/noir#5303)
fix: update `in_contract` flag before handling function metadata in elaborator (noir-lang/noir#5292)
fix: fix incorrect return type being applied to stdlib functions `modulus_be_bytes()`, `modulus_be_bits()`, etc. (noir-lang/noir#5278)
chore: refactor test case generation in build.rs (noir-lang/noir#5280)
fix: handle struct with nested arrays in oracle return values (noir-lang/noir#5244)
feat: build simple dictionary from inspecting ACIR program (noir-lang/noir#5264)
fix: Add more thorough check for whether a type is valid when passing it from constrained code to unconstrained code (noir-lang/noir#5009)
chore: Pedersen commitment in Noir (noir-lang/noir#5221)
chore: pedersen hash in Noir (noir-lang/noir#5217)
fix: Don't lazily elaborate functions (noir-lang/noir#5282)
fix: avoid unnecessarily splitting expressions with multiplication terms with a shared term (noir-lang/noir#5291)
fix: avoid duplicating constant arrays (noir-lang/noir#5287)
feat: add fuzzer for Noir programs (noir-lang/noir#5251)
feat: Run `comptime` code from annotations on a type definition (noir-lang/noir#5256)
feat: implement comptime support for `as_slice` builtin (noir-lang/noir#5276)
chore: create separate crate just for noir artifacts (noir-lang/noir#5162)
feat: add support for wildcard types (noir-lang/noir#5275)
chore: replace logical operators with bitwise in `DebugToString` (noir-lang/noir#5236)
fix: use proper serialization in `AbiValue` (noir-lang/noir#5270)
chore: simplify compilation flow to write to file immediately (noir-lang/noir#5265)
feat: implement comptime support for `array_len` builtin (noir-lang/noir#5272)
chore: Use the elaborator by default (noir-lang/noir#5246)
chore: Release Noir(0.31.0) (noir-lang/noir#5166)
feat!: remove `dep::` prefix (noir-lang/noir#4946)
feat: Sync from aztec-packages (noir-lang/noir#5242)
chore: replace `is_bn254` implementation to not rely on truncation of literals (noir-lang/noir#5247)
chore: add no-predicate to hash implementations (noir-lang/noir#5253)
feat(experimental): Implement macro calls & splicing into `Expr` values (noir-lang/noir#5203)
feat: add BoundedVec::map (noir-lang/noir#5250)
chore: add no predicate to poseidon2 (noir-lang/noir#5252)
feat: add `set` and `set_unchecked` methods to `Vec` and `BoundedVec` (noir-lang/noir#5241)
fix: Disable `if` optimization (noir-lang/noir#5240)
chore: redo typo PR by dropbigfish (noir-lang/noir#5234)
chore: add property tests for ABI encoding (noir-lang/noir#5216)
chore: thread generics through ACIR/brillig gen (noir-lang/noir#5120)
chore: copy across typo PR script from aztec-packages (noir-lang/noir#5235)
chore(docs): fixing trailing slash issue (noir-lang/noir#5233)
fix: add support for nested arrays returned by oracles (noir-lang/noir#5132)
chore: Parse macros (noir-lang/noir#5229)
chore: Optimize the elaborator (noir-lang/noir#5230)
fix(elaborator): Fix regression introduced by lazy-global changes (noir-lang/noir#5223)
fix(elaborator): Fix duplicate methods error (noir-lang/noir#5225)
chore: fixing all relative paths (noir-lang/noir#5220)
chore: push code related to ABI gen into `noirc_driver` (noir-lang/noir#5218)
Copy link
Contributor

github-actions bot commented Jun 24, 2024

Changes to circuit sizes

Generated at commit: ac0b832518e1ccf92ee1a4ed57a5e51c77b79222, compared to commit: eb00830fce7afae60447bec5383349d7f490e4d7

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
public_kernel_tail +959 ❌ +0.08% +959 ❌ +0.02%
rollup_base +260 ❌ +0.08% +260 ❌ +0.01%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
public_kernel_tail 1,217,548 (+959) +0.08% 5,427,671 (+959) +0.02%
rollup_base 339,228 (+260) +0.08% 3,064,150 (+260) +0.01%

@AztecBot
Copy link
Collaborator Author

AztecBot commented Jun 24, 2024

Benchmark results

Metrics with a significant change:

  • app_circuit_input_size_in_bytes (FPC:pay_refund (avm)): 41,394 (+24%)
  • avm_simulation_time_ms (FPC:pay_refund): 198 (+42%)
  • avm_simulation_time_ms (FPC:pay_refund_with_shielded_rebate): 207 (+47%)
  • avm_simulation_bytecode_size_in_bytes (FPC:pay_refund): 28,061 (+40%)
  • avm_simulation_bytecode_size_in_bytes (FPC:pay_refund_with_shielded_rebate): 29,148 (+38%)
  • app_circuit_proving_time_in_ms (FPC:pay_refund (avm)): 16,818 (+86%)
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,380 (-1%) 3,069 (-1%) 1,392 (-1%) 1,658 (-2%) 1,544 (+2%)
proof_construction_time_sha256_100_ms 43,722 (-2%) 11,819 (-1%) 5,423 (-1%) 5,446 (-1%) 5,367 (-1%)
proof_construction_time_poseidon_hash_ms 78.0 (-1%) 34.0 (-3%) 34.0 58.0 87.0 (-1%)
proof_construction_time_poseidon_hash_30_ms 1,516 (-1%) 416 (-1%) 201 226 269 (+1%)
proof_construction_time_poseidon_hash_100_ms 5,748 (-2%) 1,566 (-1%) 721 781 (+1%) 792 (-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 1,412 1,412 1,412
l1_rollup_calldata_gas 9,464 9,462 9,452
l1_rollup_execution_gas 610,285 610,283 610,273
l2_block_processing_time_in_ms 753 (-1%) 1,405 (-1%) 2,692 (-1%)
l2_block_building_time_in_ms 25,469 (-1%) 50,837 99,715 (-1%)
l2_block_rollup_simulation_time_in_ms 25,469 (-1%) 50,837 99,715 (-1%)
l2_block_public_tx_process_time_in_ms 21,916 (-1%) 47,047 95,986 (-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 6,976 (-1%) 9,834
node_database_size_in_bytes 12,165,200 16,052,304
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 121 488 (-1%) 12,052 (-2%) 20,634 67,190 92,352 2,819 524,288
private-kernel-inner 381 997 (-5%) 44,277 (-1%) 94,902 67,190 92,352 2,819 2,097,152
private-kernel-tail 309 1,795 (-2%) 46,157 (+1%) 99,121 71,733 14,912 399 2,097,152
base-parity 6.27 2,008 (+2%) 2,503 (-2%) 128 64.0 2,208 2.00 131,072
root-parity 49.4 59.4 (+2%) 33,980 27,100 64.0 2,720 18.0 2,097,152
base-rollup 7,916 (-1%) 5,006 71,904 (-1%) 170,330 756 3,648 47.0 4,194,304
root-rollup 112 76.6 (-5%) 19,557 25,309 620 3,456 41.0 1,048,576
public-kernel-setup 720 (-1%) 3,674 38,861 (-1%) 116,905 93,334 125,344 3,850 2,097,152
public-kernel-app-logic 630 (-1%) 4,871 (+2%) 39,973 (-1%) 116,905 93,334 125,344 3,850 2,097,152
public-kernel-tail 1,402 (+1%) 33,656 (-10%) 165,090 (-3%) 511,910 10,014 14,912 399 8,388,608
private-kernel-reset-small 557 2,060 (-11%) 41,078 (-1%) 123,313 67,190 92,352 2,819 2,097,152
public-kernel-teardown 635 (-1%) 4,880 (+1%) 39,757 (-1%) 116,905 93,334 125,344 3,850 2,097,152
merge-rollup 29.0 (+1%) N/A N/A 16,542 756 N/A N/A N/A
private-kernel-tail-to-public N/A 7,226 (+1%) 85,115 (+1%) 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 424 N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,408 9,944 40.5 N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,920 9,944 1,809 N/A N/A N/A N/A
GasToken:deploy 1,376 9,944 1,006 N/A N/A N/A N/A
SchnorrAccount:constructor 1,312 9,944 1,444 N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,304 9,944 2,842 16,768 50,441 (-1%) 2,097,152 457
Token:privately_mint_private_note 1,280 9,944 1,705 N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,344 9,944 378 (+1%) 16,768 10,210 (-3%) 524,288 457
Token:transfer 1,312 9,944 4,553 (-1%) 16,768 41,217 (-1%) 2,097,152 457
AuthRegistry:set_authorized (avm) 21,043 N/A N/A 87,200 1,652 (+5%) N/A N/A
FPC:prepare_fee (avm) 28,495 N/A N/A 88,032 4,821 (-1%) N/A N/A
Token:transfer_public (avm) 44,885 N/A N/A 87,754 3,592 (+1%) N/A N/A
AuthRegistry:consume (avm) 34,973 N/A N/A 87,616 2,866 N/A N/A
FPC:pay_refund (avm) ⚠️ 41,394 (+24%) N/A N/A 88,864 ⚠️ 16,818 (+86%) N/A N/A
Benchmarking:create_note 1,344 9,944 1,398 (+1%) N/A N/A N/A N/A
SchnorrAccount:verify_private_authwit 1,280 9,944 73.9 (+1%) N/A N/A N/A N/A
Token:unshield 1,376 9,944 3,690 N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,376 9,944 4,629 (-1%) 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 68.8 (-3%) 13,873
GasToken:set_portal 16.9 (+1%) 3,495
Token:constructor 94.5 24,207
FPC:constructor 63.7 (-1%) 13,893
GasToken:mint_public 53.5 (-1%) 10,241
Token:mint_public 630 19,216
Token:assert_minter_and_mint 60.8 (-28%) 13,034
AuthRegistry:set_authorized 31.0 (-6%) 7,869
FPC:prepare_fee 148 (-7%) 15,129
Token:transfer_public 35.4 (-26%) 31,425
FPC:pay_refund ⚠️ 198 (+42%) ⚠️ 28,061 (+40%)
Benchmarking:increment_balance 2,687 (-1%) 15,407
Token:_increase_public_balance 55.7 (-2%) 15,089
FPC:pay_refund_with_shielded_rebate ⚠️ 207 (+47%) ⚠️ 29,148 (+38%)

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.146 (-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.602 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.4 77.2 (+1%) 131 (-1%) 244 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.473 (+1%) 0.450 (-1%) 0.443 0.439 (-1%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 59.8 (-1%) 112 183 (-1%) 352 692 (-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.506 (-1%) 0.501 0.485 0.476 0.475 (-1%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 72.9 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 85,672 670,983

Transaction size based on fee payment method

| Metric | |
| - | |

@TomAFrench
Copy link
Member

@benesjan @sirasistant Do you have any idea why the PXE is saying that the note hashes are zero? Can't see anything on the noir side which would cause this.

@benesjan
Copy link
Contributor

benesjan commented Jun 25, 2024

Do you have any idea why the PXE is saying that the note hashes are zero?

@TomAFrench I can debug it. Which test is it? (CI has not yet finished)

@TomAFrench
Copy link
Member

Thanks @benesjan, I was seeing this on a previous run on the commit 7ec2c33, the issue is visible here: https://github.com/AztecProtocol/aztec-packages/actions/runs/9660771908/job/26647636578

@TomAFrench
Copy link
Member

TomAFrench commented Jun 25, 2024

CI is being a bit finicky so I've just pushed a new commit for a fresh run.

TomAFrench added a commit that referenced this pull request Jun 26, 2024
This PR pulls out a bunch of changes from #7170 which are just muddying
the diff with noise.
@TomAFrench TomAFrench merged commit ed815a3 into master Jun 27, 2024
90 checks passed
@TomAFrench TomAFrench deleted the sync-noir branch June 27, 2024 16: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