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

Merged
merged 62 commits into from
Jan 30, 2025
Merged

feat: Sync from noir #11294

merged 62 commits into from
Jan 30, 2025

Conversation

AztecBot
Copy link
Collaborator

@AztecBot AztecBot commented Jan 17, 2025

Automated pull of development from the noir programming language, a dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: let add_definition_location take a Location (noir-lang/noir#7185)
fix(LSP): correct signature for assert and assert_eq (noir-lang/noir#7184)
chore(experimental): Prevent enum panics by returning Options where possible instead of panicking (noir-lang/noir#7180)
feat(experimental): Construct enum variants in expressions (noir-lang/noir#7174)
feat: add noir-inspector (noir-lang/noir#7136)
fix: ensure canonical bits decomposition (noir-lang/noir#7168)
fix: Keep inc_rc for array inputs during preprocessing (noir-lang/noir#7163)
fix(docs): Update broken links to EC lib (noir-lang/noir#7141)
feat: inline simple functions (noir-lang/noir#7160)
feat(ssa): Expand feature set of the Brillig constraint check (noir-lang/noir#7060)
fix(ssa): Resolve value before fetching from DFG in a couple cases (noir-lang/noir#7169)
fix: Function::is_no_predicates always returned false for brillig f… (noir-lang/noir#7167)
chore(refactor): Remove globals field on Ssa object and use only the shared globals graph (noir-lang/noir#7156)
chore: let Function::inlined take a should_inline_call function (noir-lang/noir#7149)
chore: add compile-time assertions on generic arguments of stdlib functions (noir-lang/noir#6981)
fix: LSP hover over function with &mut self (noir-lang/noir#7155)
feat(brillig): Set global memory size at program compile time (noir-lang/noir#7151)
feat: LSP autocomplete module declaration (noir-lang/noir#7154)
feat(ssa): Reuse constants from the globals graph when making constants in a function DFG (noir-lang/noir#7153)
feat: LSP chain inlay hints (noir-lang/noir#7152)
chore: turn on overflow checks in CI rust tests (noir-lang/noir#7145)
fix(ssa): Use post order when mapping instructions in loop invariant pass (noir-lang/noir#7140)
fix: preserve types when reading from calldata arrays (noir-lang/noir#7144)
feat: Resolve enums & prepare type system (noir-lang/noir#7115)
feat: loop must have at least one break (noir-lang/noir#7126)
feat: parse globals in SSA parser (noir-lang/noir#7112)
fix: allow calling trait impl method from struct if multiple impls exist (noir-lang/noir#7124)
fix: avoid creating unnecessary memory blocks (noir-lang/noir#7114)
chore: relax threshold for reporting regressions (noir-lang/noir#7130)
fix: proper cleanup when breaking from comptime loop on error (noir-lang/noir#7125)
fix: Prevent overlapping associated types impls (noir-lang/noir#7047)
feat: unconstrained optimizations for BoundedVec (noir-lang/noir#7119)
chore: mark libs good (noir-lang/noir#7123)
chore: remove comments for time/memory benchmarks (noir-lang/noir#7121)
fix: don't always use an exclusive lock in nargo check (noir-lang/noir#7120)
feat(ssa): Pass to preprocess functions (noir-lang/noir#7072)
chore: Formatting issues / minor errors in the docs (noir-lang/noir#7105)
fix: defunctionalize pass on the caller runtime to apply (noir-lang/noir#7100)
feat: Parser and formatter support for enums (noir-lang/noir#7110)
feat(brillig): SSA globals code gen (noir-lang/noir#7021)
feat: loop keyword in runtime and comptime code (noir-lang/noir#7096)
chore: Add benchmarking dashboard (noir-lang/noir#7068)
feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088)
feat(ssa): Add flag to DIE pass to be able to keep store instructions (noir-lang/noir#7106)
chore: Cookbook Onboard integration (noir-lang/noir#7044)
chore: lock to ubuntu 22.04 (noir-lang/noir#7098)
fix: Remove unused brillig functions (noir-lang/noir#7102)
chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
END_COMMIT_OVERRIDE

AztecBot and others added 13 commits January 17, 2025 08:05
…oir-lang/noir#7100)

feat: Parser and formatter support for `enum`s (noir-lang/noir#7110)
feat(brillig): SSA globals code gen (noir-lang/noir#7021)
feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096)
chore: Add benchmarking dashboard (noir-lang/noir#7068)
feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088)
feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106)
chore: Cookbook Onboard integration (noir-lang/noir#7044)
chore: lock to ubuntu 22.04 (noir-lang/noir#7098)
fix: Remove unused brillig functions (noir-lang/noir#7102)
chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
…oir#7100)

feat: Parser and formatter support for `enum`s (noir-lang/noir#7110)
feat(brillig): SSA globals code gen (noir-lang/noir#7021)
feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096)
chore: Add benchmarking dashboard (noir-lang/noir#7068)
feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088)
feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106)
chore: Cookbook Onboard integration (noir-lang/noir#7044)
chore: lock to ubuntu 22.04 (noir-lang/noir#7098)
fix: Remove unused brillig functions (noir-lang/noir#7102)
chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
…oir-lang/noir#7100)

feat: Parser and formatter support for `enum`s (noir-lang/noir#7110)
feat(brillig): SSA globals code gen (noir-lang/noir#7021)
feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096)
chore: Add benchmarking dashboard (noir-lang/noir#7068)
feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088)
feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106)
chore: Cookbook Onboard integration (noir-lang/noir#7044)
chore: lock to ubuntu 22.04 (noir-lang/noir#7098)
fix: Remove unused brillig functions (noir-lang/noir#7102)
chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
…oir#7100)

feat: Parser and formatter support for `enum`s (noir-lang/noir#7110)
feat(brillig): SSA globals code gen (noir-lang/noir#7021)
feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096)
chore: Add benchmarking dashboard (noir-lang/noir#7068)
feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088)
feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106)
chore: Cookbook Onboard integration (noir-lang/noir#7044)
chore: lock to ubuntu 22.04 (noir-lang/noir#7098)
fix: Remove unused brillig functions (noir-lang/noir#7102)
chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
…oir-lang/noir#7100)

feat: Parser and formatter support for `enum`s (noir-lang/noir#7110)
feat(brillig): SSA globals code gen (noir-lang/noir#7021)
feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096)
chore: Add benchmarking dashboard (noir-lang/noir#7068)
feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088)
feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106)
chore: Cookbook Onboard integration (noir-lang/noir#7044)
chore: lock to ubuntu 22.04 (noir-lang/noir#7098)
fix: Remove unused brillig functions (noir-lang/noir#7102)
chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
…oir#7100)

feat: Parser and formatter support for `enum`s (noir-lang/noir#7110)
feat(brillig): SSA globals code gen (noir-lang/noir#7021)
feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096)
chore: Add benchmarking dashboard (noir-lang/noir#7068)
feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088)
feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106)
chore: Cookbook Onboard integration (noir-lang/noir#7044)
chore: lock to ubuntu 22.04 (noir-lang/noir#7098)
fix: Remove unused brillig functions (noir-lang/noir#7102)
chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
* master: (442 commits)
  feat(p2p): request response node sampling (#11330)
  chore: Trace propagation from json rpc client to server (#11325)
  feat(p2p): send goodbye messages on disconnecting to peers (#10920)
  fix(bootstrap): include crates in noir projects hashes (#11344)
  chore: Add OTEL_EXCLUDE_METRICS (#11317)
  chore: Test starting multiple anvils allocates distinct ports (#11314)
  fix: move eslint in circuits.js to dev deps (#11340)
  fix: update devbox (#11339)
  chore(p2p): reorganise reqresp handlers (#11327)
  fix(readme): remove stale link (#11333)
  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
  chore: bump CRS and constants (#11306)
  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
  chore: redo typo PR by nnsW3 (#11322)
  ...
AztecBot and others added 4 commits January 20, 2025 14:55
…oir-lang/noir#7120)

feat(ssa): Pass to preprocess functions (noir-lang/noir#7072)
chore: Formatting issues / minor errors in the docs (noir-lang/noir#7105)
fix: defunctionalize pass on the caller runtime to apply (noir-lang/noir#7100)
feat: Parser and formatter support for `enum`s (noir-lang/noir#7110)
feat(brillig): SSA globals code gen (noir-lang/noir#7021)
feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096)
chore: Add benchmarking dashboard (noir-lang/noir#7068)
feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088)
feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106)
chore: Cookbook Onboard integration (noir-lang/noir#7044)
chore: lock to ubuntu 22.04 (noir-lang/noir#7098)
fix: Remove unused brillig functions (noir-lang/noir#7102)
chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
…oir#7120)

feat(ssa): Pass to preprocess functions (noir-lang/noir#7072)
chore: Formatting issues / minor errors in the docs (noir-lang/noir#7105)
fix: defunctionalize pass on the caller runtime to apply (noir-lang/noir#7100)
feat: Parser and formatter support for `enum`s (noir-lang/noir#7110)
feat(brillig): SSA globals code gen (noir-lang/noir#7021)
feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096)
chore: Add benchmarking dashboard (noir-lang/noir#7068)
feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088)
feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106)
chore: Cookbook Onboard integration (noir-lang/noir#7044)
chore: lock to ubuntu 22.04 (noir-lang/noir#7098)
fix: Remove unused brillig functions (noir-lang/noir#7102)
chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
@aakoshh
Copy link
Contributor

aakoshh commented Jan 20, 2025

Managed to reproduce this failure on the mainframe as follows:

Build the system:

./bootstrap.sh clean
git fetch origin
git checkout --track origin/sync-noir
./bootstrap.sh full
#npm install --global corepack --force
#yarn set version 4.5.2; yarn install

It changed since I last tried and takes a long time, but succeeded.

Then we need to build images and run the test that ci runs; luckily there is bootstrap entry point for it, which also takes care of building the necessary docker images:

./bootstrap.sh test-e2e -- e2e_fees_failures

Alternatively the images can be built as follows:

./bootstrap.sh image-e2e

This shows the same failure as on CI. After this when we change something in the Noir code under noir/noir-repo, we can run ./bootstrap.sh again to rebuild nargo and all the contract and protocol circuits, which unfortunately takes a really long time, without indicating what's happening (haven't found a way to enable verbose logging yet); it's not yet clear what is the minimum that needs to be rebuilt. Altogether it was about 15 minutes for another test run to start (noir-projects/joblog.txt contains timings for the 3 contract directories).

Now, when we run ./bootstrap.sh image-e2e again it says the image already exists, because it uses the git hash to determine the tag, which has not changed (we're using the image pulled from CI). To trigger a change we need to make a git commit, and then rebuild the images locally.

Unfortunately this doesn't work, complaining that the commit wasn't pushed:

Earthly error
================================== ❌ FAILURE ===================================

  +bootstrap-noir-bb *failed* | Repeating the failure error...
  +bootstrap-noir-bb *failed* | --> RUN --raw-output bash -c "$bootstrap_noir_bb"
  +bootstrap-noir-bb *failed* | The commit was not pushed, run aborted.
  +bootstrap-noir-bb *failed* | ERROR Earthfile:32:2
  +bootstrap-noir-bb *failed* |       The command
  +bootstrap-noir-bb *failed* |           RUN --raw-output bash -c "$bootstrap_noir_bb"
  +bootstrap-noir-bb *failed* |       did not complete successfully. Exit code 1
    +bootstrap-aztec | apply build +bootstrap-with-verifier: earthfile2llb for +bootstrap-with-verifier: Earthfile:68:2 copy artifact: apply build +rollup-verifier-contract-with-cache: earthfile2llb for +rollup-verifier-contract-with-cache: Earthfile:268:2 failed to expand LET value "rollup-verifier-contract-$(./noir-projects/bootstrap.sh hash).tar.gz": failed to process "rollup-verifier-contract-$(./noir-projects/bootstrap.sh hash).tar.gz": non constant build arg read request: process "/bin/sh -c CARGO_HOME=/opt/rust/cargo EARTHLY_GIT_HASH=ebb07743425a702b0213e4ccd389aa617a9cdf1a GITHUB_LOG=1 PATH=/opt/rust/cargo/bin:/opt/foundry/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUSTUP_HOME=/opt/rust/rustup bootstrap_noir_bb='rm -rf $(ls -A) &&\n    git init >/dev/null 2>&1 &&\n    git remote add origin https://github.com/aztecprotocol/aztec-packages >/dev/null 2>&1 &&\n    (git fetch --depth 1 origin $EARTHLY_GIT_HASH >/dev/null 2>&1 || (echo \"The commit was not pushed, run aborted.\" && exit 1)) &&\n    git reset --hard FETCH_HEAD >/dev/null 2>&1 &&\n    ./build-images/adhoc-installs.sh &&\n    DENOISE=1 CI=1 ./noir/bootstrap.sh fast &&\n    DENOISE=1 CI=1 ./barretenberg/bootstrap.sh fast &&\n    mv $(ls -A) /usr/src' AWS_ACCESS_KEY_ID=\"$(cat /run/secrets/AWS_ACCESS_KEY_ID)\" AWS_SECRET_ACCESS_KEY=\"$(cat /run/secrets/AWS_SECRET_ACCESS_KEY)\" /usr/bin/earth_debugger /bin/sh -c 'bash -c \"$bootstrap_noir_bb\"'" did not complete successfully: exit code: 1
    +bootstrap-aztec | in		github.com/AztecProtocol/aztec-packages:sync-noir+rollup-verifier-contract-with-cache
    +bootstrap-aztec | in		github.com/AztecProtocol/aztec-packages:sync-noir+bootstrap-with-verifier

Help: To debug your build, you can use the --interactive (-i) flag to drop into a shell of the failing RUN step: "earthly -i --secret AWS_ACCESS_KEY_ID=XXXXX --secret AWS_SECRET_ACCESS_KEY=XXXXX --secret S3_BUILD_CACHE_UPLOAD=XXXXX --secret S3_BUILD_CACHE_DOWNLOAD=XXXXX --secret AZTEC_BOT_COMMENTER_GITHUB_TOKEN=XXXXX --artifact +bootstrap-aztec/usr/src /tmp/tmp.LWZns6APgS/usr/src"

🛰️ Reuse cache between CI runs with Earthly Satellites! 2-20X faster than without cache. Generous free tier https://cloud.earthly.dev

Trying again after creating a branch for my investigations:

git add noir
git commit -m "DEBUG"
git checkout -b af/sync-noir-debug
git push --set-upstream origin af/sync-noir-debug

This time it does the build, but it looks like it's running ./bootstrap.sh full inside the Docker build process again 😣

Okay so either I figure out a different way of running the test script directly against a running container, or use this workflow, but it's less likely that I can limit the build if it has to rebuild an e2e image from scratch. FWIW according to e2e_test_config.yml I have to run e2e_fees/failures.test.ts; the way the docker image does it is here.

EDIT: It's been building the image for over 30 minutes now, at the moment creating the VK for the second protocol contract, which seem to take ages. I used to be able to run these; maybe at the time it ran natively using more CPUs. I'll check it in the morning.

EDIT2: After about 10 more minutes the test ran. I can confirm that disabling the Ssa::preprocess_fns pass the tests do not fail.

…g/noir#7047)

feat: unconstrained optimizations for BoundedVec (noir-lang/noir#7119)
chore: mark libs good (noir-lang/noir#7123)
chore: remove comments for time/memory benchmarks (noir-lang/noir#7121)
fix: don't always use an exclusive lock in `nargo check` (noir-lang/noir#7120)
feat(ssa): Pass to preprocess functions (noir-lang/noir#7072)
chore: Formatting issues / minor errors in the docs (noir-lang/noir#7105)
fix: defunctionalize pass on the caller runtime to apply (noir-lang/noir#7100)
feat: Parser and formatter support for `enum`s (noir-lang/noir#7110)
feat(brillig): SSA globals code gen (noir-lang/noir#7021)
feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096)
chore: Add benchmarking dashboard (noir-lang/noir#7068)
feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088)
feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106)
chore: Cookbook Onboard integration (noir-lang/noir#7044)
chore: lock to ubuntu 22.04 (noir-lang/noir#7098)
fix: Remove unused brillig functions (noir-lang/noir#7102)
chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
feat: unconstrained optimizations for BoundedVec (noir-lang/noir#7119)
chore: mark libs good (noir-lang/noir#7123)
chore: remove comments for time/memory benchmarks (noir-lang/noir#7121)
fix: don't always use an exclusive lock in `nargo check` (noir-lang/noir#7120)
feat(ssa): Pass to preprocess functions (noir-lang/noir#7072)
chore: Formatting issues / minor errors in the docs (noir-lang/noir#7105)
fix: defunctionalize pass on the caller runtime to apply (noir-lang/noir#7100)
feat: Parser and formatter support for `enum`s (noir-lang/noir#7110)
feat(brillig): SSA globals code gen (noir-lang/noir#7021)
feat: `loop` keyword in runtime and comptime code (noir-lang/noir#7096)
chore: Add benchmarking dashboard (noir-lang/noir#7068)
feat(experimental): try to infer lambda argument types inside calls (noir-lang/noir#7088)
feat(ssa): Add flag to DIE pass to be able to keep `store` instructions (noir-lang/noir#7106)
chore: Cookbook Onboard integration (noir-lang/noir#7044)
chore: lock to ubuntu 22.04 (noir-lang/noir#7098)
fix: Remove unused brillig functions (noir-lang/noir#7102)
chore(ssa): Use correct prefix when printing array values in global space (noir-lang/noir#7095)
@aakoshh
Copy link
Contributor

aakoshh commented Jan 21, 2025

Found the way to execute the test without involving the image-e2e step, which saves the 30 minute rebuild of the images after each change:

cd yarn-project/end-to-end
test_name=e2e_fees_failures
test_path=$(yq e ".tests.${test_name}.test_path" "scripts/e2e_test_config.yml")
export LOG_LEVEL=debug
yarn test:e2e $test_path -t "fails transaction that error in setup"  

This runs the failure tests, which uses the FeesTest fixture to set up the test, including the SnapshotManager that starts Anvil and deploys L1 contracts, so this particular test doesn't have external dependencies such as docker compose (unlike some others).

This way we can rebuild after a change with the following commands:

./noir/bootstrap.sh
./noir-projects/bootstrap.sh
./yarn-project/bootstrap.sh

These take 5, 10 and 2 minutes, respectively, so ideally we should still narrow it down to the contract that fails.

EDIT: ./noir-projects/noir-protocol-circuits/bootstrap.sh and ./noir-projects/noir-contracts/bootstrap.sh take an optional parameter to specify which circuit/contract to compile.

@TomAFrench
Copy link
Member

I've disabled the sync workflow so that this branch is stable while we debug.

@aakoshh
Copy link
Contributor

aakoshh commented Jan 21, 2025

With export LOG_LEVEL=debug I saw that the error isn't coming from the execution of the user contract:

[12:08:11.407] DEBUG: simulator:acvm Oracle callback callPrivateFunction
[12:08:11.407] DEBUG: simulator:client_execution_context Calling private function 0x0000000000000000000000000000000000000000000000000000000000000004:0xcd9728af from 0x0000000000000000000000000000000000000000000000000000000000000004
[12:08:11.440] VERBOSE: simulator:private_execution Executing private function SchnorrAccount:constructor {"contract":"0x09e77cf1e2ad3aa1792c300eaf73615b6ba81543c87f3cff2fa0b8d27b643130"}
[12:08:11.461] DEBUG: simulator:acvm Oracle callback getContractInstance
[12:08:11.464] DEBUG: simulator:acvm Oracle callback notifyCreatedNullifier
[12:08:11.467] DEBUG: simulator:acvm Oracle callback notifyCreatedNote
[12:08:11.467] DEBUG: simulator:acvm Oracle callback debugLog
[12:08:11.474] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.475] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.475] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.475] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.475] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.476] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.476] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.476] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.476] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.476] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.477] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.477] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.477] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.477] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.478] DEBUG: simulator:acvm Oracle callback getRandomField
[12:08:11.502] DEBUG: simulator:acvm Oracle callback getIndexedTaggingSecretAsSender
[12:08:11.514] DEBUG: simulator:acvm Oracle callback notifyCreatedNullifier
[12:08:11.515] DEBUG: simulator:acvm Oracle callback notifyCreatedNullifier
[12:08:11.542] DEBUG: simulator:private_execution Ran external function 0x0b09fc3f35c38e157bc9f3ebe6bc2d5c69260b26a8d4766cefdaff48cd5579bf:0xcd9728af {"circuitName":"app-circuit","duration":883.6424932479858,"eventName":"circuit-witness-generation","inputSize":1344,"outputSize":17993,"appCircuitName":"SchnorrAccount:constructor"}
[12:08:11.545] DEBUG: simulator:private_execution Ran external function 0x123c3f390bfb61a1d831a90a39bdfcfdaf0d8879605deb0b1d67ff06dd8fc998:0xcd9728af {"circuitName":"app-circuit","duration":887.01926612854,"eventName":"circuit-witness-generation","inputSize":1344,"outputSize":17993,"appCircuitName":"SchnorrAccount:constructor"}
[12:08:11.546] DEBUG: simulator:private_execution Returning from call to 0x0b09fc3f35c38e157bc9f3ebe6bc2d5c69260b26a8d4766cefdaff48cd5579bf:0xcd9728af
[12:08:11.546] DEBUG: simulator:private_execution Returning from call to 0x123c3f390bfb61a1d831a90a39bdfcfdaf0d8879605deb0b1d67ff06dd8fc998:0xcd9728af
[12:08:11.585] DEBUG: simulator:private_execution Ran external function 0x0000000000000000000000000000000000000000000000000000000000000004:0xea92cc40 {"circuitName":"app-circuit","duration":1177.359474182129,"eventName":"circuit-witness-generation","inputSize":1952,"outputSize":17993,"appCircuitName":"MultiCallEntrypoint:entrypoint"}
[12:08:11.588] DEBUG: simulator:private_execution Ran external function 0x0000000000000000000000000000000000000000000000000000000000000004:0xea92cc40 {"circuitName":"app-circuit","duration":1185.167963027954,"eventName":"circuit-witness-generation","inputSize":1952,"outputSize":17993,"appCircuitName":"MultiCallEntrypoint:entrypoint"}
[12:08:11.588] DEBUG: simulator:private_execution Returning from call to 0x0000000000000000000000000000000000000000000000000000000000000004:0xea92cc40
[12:08:11.588] DEBUG: simulator:private_execution Returning from call to 0x0000000000000000000000000000000000000000000000000000000000000004:0xea92cc40
[12:08:11.589] DEBUG: pxe:service Private simulation completed for 0x0000000000000000000000000000000000000000000000000000000000000004:entrypoint
[12:08:11.589] DEBUG: pxe:service Private simulation completed for 0x0000000000000000000000000000000000000000000000000000000000000004:entrypoint

Instead we fail to simulate the kernel proof. With some extra logging added:

[12:08:11.591] DEBUG: pxe:service Executing kernel prover (simulate: true, profile: false, dryRun: true)...
[12:08:11.613] DEBUG: pxe:kernel-prover Calling private kernel init with isPrivateOnly true and firstNullifierHint 0x094d50d426951f38f96a1f237e60171ada982d3d759d3a5eda7f2be3ebdea3fc {"simulate":true}
[12:08:11.739] DEBUG: bb-prover:wasm:bundle Simulated PrivateKernelInitArtifact {"eventName":"circuit-simulation","circuitName":"private-kernel-init","duration":90.9289779663086,"inputSize":23650,"outputSize":55856}
[12:08:11.883] DEBUG: bb-prover:wasm:bundle Failed to simulate PrivateKernelInnerArtifact {"circuitName":"private-kernel-inner","witness":{}}
    error: {
      "callStack": [
        "0.2656",
        "0.7920",
        "0.16878"
      ],
      "rawAssertionPayload": {
        "selector": "2920182694213909827",
        "data": []
      },
      "brilligFunctionId": 0
    }
[12:08:11.892] ERROR: pxe:service Error: Error: Circuit execution failed (simulation_provider): attempt to subtract with overflow
    at Object.<anonymous>.module.exports.__wbg_constructor_a10f2b77c63b8d5e (/mnt/user-data/akosh/aztec-packages/noir/packages/acvm_js/nodejs/acvm_js.js:675:17)
    at acvm_js::js_execution_error::JsExecutionError::new::h8a9de55c9a82dc5a (wasm://wasm/00939eea:1:1193712)
    at acvm_js::execute::ProgramExecutor<B>::execute_circuit::{{closure}}::h9b9eb41499ff1a7b (wasm://wasm/00939eea:1:422002)
    at acvm_js::execute::execute_program_with_native_program_and_return::{{closure}}::h2efe214fe0bd0eb8 (wasm://wasm/00939eea:1:971037)
    at acvm_js::execute::execute_program_with_native_type_return::{{closure}}::h6f9a02ef14028ff7 (wasm://wasm/00939eea:1:1133753)
    at wasm_bindgen_futures::future_to_promise::{{closure}}::{{closure}}::hf6a5876861a1a114 (wasm://wasm/00939eea:1:884387)
    at wasm_bindgen_futures::queue::Queue::new::{{closure}}::hf077634dad17addb (wasm://wasm/00939eea:1:1235773)
    at wasm_bindgen::convert::closures::invoke1_mut::h7f1511a2915e72e7 (wasm://wasm/00939eea:1:1573526)
    at __wbg_adapter_22 (/mnt/user-data/akosh/aztec-packages/noir/packages/acvm_js/nodejs/acvm_js.js:220:10)
    at real (/mnt/user-data/akosh/aztec-packages/noir/packages/acvm_js/nodejs/acvm_js.js:205:20) {
  callStack: [ '0.2656', '0.7920', '0.16878' ],
  rawAssertionPayload: { selector: '2920182694213909827', data: [] },
  brilligFunctionId: 0
}

I tried to log the input witness in bb_private_kernel_prover like this:

    const outputWitness = await this.simulationProvider
      .executeProtocolCircuit(witnessMap, compiledCircuit)
      .catch((err: Error) => {
        this.log.debug(`Failed to simulate ${circuitType}`, {
          circuitName: mapProtocolArtifactNameToCircuitName(circuitType),
          witness: witnessMap,
          error: err,
        });
        throw err;
      });

Unfortunately it shows up as empty in the logs, not sure if that is the problem. It's called from the kernel_prover

(To iterate these it's enough to run ./yarn-project/bootstrap.sh which is relatively quick).

@aakoshh
Copy link
Contributor

aakoshh commented Jan 21, 2025

Logging the input witnesses with console.log shows it's not empty (attached).
inner-witness.txt

@aakoshh
Copy link
Contributor

aakoshh commented Jan 21, 2025

Here it is in JSON as well.
inner-witness.json

It was captured like so:

    console.log(
      'WITNESS INPUTS',
      JSON.stringify(mapped, (_, v) => (typeof v === 'bigint' ? v.toString() : v)),
    );

NB the data can be captured during the run if the AZTEC_GENERATE_TEST_DATA env var is true, and it could be saved in the test like this, but it's an ad-hoc thing, and because in our case the test fails, we might as well capture it where it's emitted.

I'll tweak nargo execute to accept JSON and try to run it.

@aakoshh
Copy link
Contributor

aakoshh commented Jan 29, 2025

After disabling the step marking the arrays in the terminator as mutable in ac9e584, the integration tests fail with the same assertion on a different input (attached).
Prover2.toml.txt

This time re-enabling both the terminator and input parameter marking makes it go away 🙃

Going to try moving part of RC tracking to the function level.

@aakoshh
Copy link
Contributor

aakoshh commented Jan 29, 2025

Here's a way to iterate faster on testing #11294 (comment)

I assume that a full build has been done before on one's mainframe, and we're in aztec-packages:

If we change something in nargo, run the following to rebuild:

./noir/bootstrap.sh

If we change something in nargo or the contract, run the following to recompile just that contract, and copy the artefact to where the test will look for it:

./noir-projects/noir-contracts/bootstrap.sh compile stateful_test_contract && \ 
cp ./noir-projects/noir-contracts/target/stateful_test_contract-StatefulTest.json \
    ./yarn-project/noir-contracts.js/artifacts/stateful_test_contract-StatefulTest.json   

Finally execute the test:

cd yarn-project/simulator && yarn test -t "should run the destroy_and_create function" 

@aakoshh
Copy link
Contributor

aakoshh commented Jan 29, 2025

Here's what I managed to find out during debugging the stateful_test_contract:

The test fails because it expects to find 2 non-empty nullifiers (the array is 16 long). An empty nullifier is where note hash, the nullifier, and the counter are all zero, like this:

Nullifier {
          value: Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
          counter: 0,
          noteHash: Fr<0x0000000000000000000000000000000000000000000000000000000000000000>
        },

The contract and the libraries do emit notifications about nullifiers, which I am able to see if I add some extra logging in the notifyNullifiedNote method in client_execution_context.ts. Strangely the noteHash is zero, but the other fields are not:

[20:21:08.218] DEBUG: simulator:acvm Oracle callback notifyNullifiedNote
[20:21:08.218] DEBUG: simulator:client_execution_context notifyNullifiedNote nullifier=0x10c01d7d5206e5332e299ce799e9ce0f39565f6a54d3ae8a169c148def8967e1 noteHash=0x0000000000000000000000000000000000000000000000000000000000000000 counter=5

I can add an assertion in the destroy_and_create_no_init_check method stateful_test_contract/src/main.rs such as this:

        let sender_notes = storage.notes.at(sender);
        decrement(sender_notes, amount, sender, sender);
        assert_eq(sender_notes.context.nullifiers.len(), 2);

and the circuit will complete, only the test will fail because it will not find any nullifiers, so there are nullifiers in there.

If on top of that I add the following assertion:

        assert_eq(sender_notes.context.nullifiers.len(), 2);

        for i in 0..16 {
            if i < sender_notes.context.nullifiers.len() {
                assert(sender_notes.context.nullifiers.get(i).value != 0);
            }
        }

then the test passes, it finally gets the nullifiers in the return value.

So I can't see what the #[aztec], #[private] and #[noinitcheck] macros do to the code, how the storage is supposed to feed the notifiers back to the output, but something gets lost.

NB I did these experiments with the following things disabled:

  • Ssa::inline_simple_functions
  • Ssa::preprocess_fns
  • Function::is_no_predicate as it was before
  • DIE pass not removing instructions reported by the RcTracker

We can have a look at the SSA of the method under test with this:

cargo run -q -p nargo_cli -- --program-dir ../../noir-projects/noir-contracts compile --package stateful_test_contract --silence-warnings --show-ssa --show-contract-fn destroy_and_create_no_init_check

@aakoshh
Copy link
Contributor

aakoshh commented Jan 29, 2025

I'm not sure yet why, but things seem to go south after the 2nd Mem2Reg pass.

Before that, the return value from b0 of destroy_and_create_no_init_check looks like this:

    v4863 = make_array [v699, ..., v745, v4081, v4082, v4083, ..., v4862, v738, ..., v736, v737] : [Field; 741]
    return v4863

After it, most of the return value is 0, except a few fields at the end which seem to be coming from the inputs

v3408 = make_array [v42, v43, v44, v45, v89, Field 0, u32 0, u1 0, u1 0, u32 0, Field 0, u32 0, Field 0, u32 0, Field 0, ..., u32 0, Field 0, u32 0, Field 0, v81, v562, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63, v64, v65, v66, v67, v68, v69, v70, v71, v72, v73, v74, v75, v76, v77, v78, v79, v80] : [Field; 741]
    return v3408

Adding back the assertions mentioned above preserves the variables to be returned:

v4291 = make_array [v3410, v3411, ..., v3447, v3448] : [Field; 741]

@aakoshh
Copy link
Contributor

aakoshh commented Jan 30, 2025

NB I did these experiments with the following things disabled:

I noticed now that I forgot to disable one of the new passes, namely the Mem2Reg (1st) pass which was added after the new Inlining Simple Functions pass. Testing indicates that removing just this SSA pass fixes the test.

* master: (67 commits)
  chore: pull out more sync stuff (#11617)
  refactor: consolidate contract functions in pxe (#10480)
  feat: txe native world state  (#11226)
  feat(avm): vm2 bitwise subtrace (#11473)
  fix: boxes playwright + web bundles (#11615)
  chore: pull lazy memory initialization from sync (#11607)
  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
  chore: add method to filemanager (#11610)
  feat(avm): get_row optimization - 25x faster logderiv inv (#11605)
  fix(spartan): get svc addresses from load balancers (#11606)
  chore: remove old public circuit public inputs (#11594)
  fix: fix boxes (#11592)
  fix: only set node version in node pools (#11604)
  chore: replace usage of stdlib with sha256 library (#11394)
  fix: pin k8s version (#11599)
  chore: make target contract public (#11582)
  fix(spartan): reduce l1 deploy retry time (#11591)
  ...
@TomAFrench TomAFrench closed this Jan 30, 2025
@TomAFrench TomAFrench reopened this Jan 30, 2025
@aakoshh
Copy link
Contributor

aakoshh commented Jan 30, 2025

The latest build failure after disabling Mem2Reg (1st) is this:

% cargo run -q -p nargo_cli -- --program-dir ../../noir-projects/noir-contracts compile --package token_contract --silence-warnings --inliner-aggressiveness 0                              35s ~/aztec-packages/noir/noir-repo sync-noir+ akosh-box
The application panicked (crashed).
Message:  Attempted to insert instruction not handled by runtime: EnableSideEffectsIf { condition: Id(211) }
Location: compiler/noirc_evaluator/src/ssa/ir/dfg.rs:306

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━                             
...
noirc_evaluator::ssa::ssa_gen::program::Ssa>::inline_functions_with_no_predicates::h7e950d60a7dac5a8
      at /mnt/user-data/akosh/aztec-packages/noir/noir-repo/compiler/noirc_evaluator/src/ssa/opt/inlining.rs:56
  36: noirc_evaluator::ssa::optimize_all::{{closure}}::h24a6951eec9d0574
      at /mnt/user-data/akosh/aztec-packages/noir/noir-repo/compiler/noirc_evaluator/src/ssa.rs:190

It happens in the Inlining (2nd) pass, and only with the non-default --inliner-aggressiveness 0, which the build script uses.

@aakoshh
Copy link
Contributor

aakoshh commented Jan 30, 2025

The latest test failure is:

% cd yarn-project/bb-prover && yarn test -t "public fee payment" ; cd -                                                                                                                                         
 FAIL  src/avm_proving_tests/avm_proving.test.ts (5.11 s)
  ● AVM WitGen & Circuit › public fee payment › fee payment

    Not enough balance for fee payer to pay for transaction (got 10000 needs 16794)

      435 |     if (currentBalance.lt(txFee)) {
      436 |       if (this.enforceFeePayment) {
    > 437 |         throw new Error(
          |               ^
      438 |           `Not enough balance for fee payer to pay for transaction (got ${currentBalance.toBigInt()} needs ${txFee.toBigInt()})`,
      439 |         );
      440 |       } else {

      at PublicTxSimulator.payFee (../../simulator/src/public/public_tx_simulator.ts:437:15)
      at PublicTxSimulator.simulate (../../simulator/src/public/public_tx_simulator.ts:118:5)
      at AvmProvingTester.simulateTx (../../simulator/src/public/fixtures/public_tx_simulation_tester.ts:122:23)
      at AvmProvingTester.simProveVerify (avm_proving_tests/avm_proving_tester.ts:89:20)
      at Object.<anonymous> (avm_proving_tests/avm_proving.test.ts:424:9)

Test Suites: 1 failed, 2 skipped, 1 of 3 total
Tests:       1 failed, 21 skipped, 22 total
Snapshots:   0 total
Time:        5.521 s
Ran all test suites with tests matching "public fee payment".

It looks like the call consumed more gas than expected. The test account gets a balance of 10000 hardcoded in the test, but the 16794 is based on the gas consumed in the transaction (which is just adding two numbers):

[14:12:50.203] DEBUG: simulator:avm(f:public_dispatch) Executed 338 instructions and consumed 5598 L2 Gas
[14:12:50.204] DEBUG: simulator:avm(f:public_dispatch) Printing tallies per opcode sorted by gas...
[14:12:50.204] DEBUG: simulator:avm(f:public_dispatch) Mov executed 123 times consuming a total of 2214 L2 gas
[14:12:50.204] DEBUG: simulator:avm(f:public_dispatch) Add executed 66 times consuming a total of 1782 L2 gas
[14:12:50.204] DEBUG: simulator:avm(f:public_dispatch) Set executed 72 times consuming a total of 648 L2 gas
[14:12:50.204] DEBUG: simulator:avm(f:public_dispatch) Eq executed 12 times consuming a total of 324 L2 gas
[14:12:50.204] DEBUG: simulator:avm(f:public_dispatch) Lt executed 7 times consuming a total of 210 L2 gas
[14:12:50.204] DEBUG: simulator:avm(f:public_dispatch) JumpI executed 21 times consuming a total of 189 L2 gas
[14:12:50.205] DEBUG: simulator:avm(f:public_dispatch) Lte executed 2 times consuming a total of 60 L2 gas
[14:12:50.205] DEBUG: simulator:avm(f:public_dispatch) CalldataCopy executed 2 times consuming a total of 57 L2 gas
[14:12:50.205] DEBUG: simulator:avm(f:public_dispatch) InternalCall executed 11 times consuming a total of 33 L2 gas
[14:12:50.205] DEBUG: simulator:avm(f:public_dispatch) Jump executed 11 times consuming a total of 33 L2 gas
[14:12:50.205] DEBUG: simulator:avm(f:public_dispatch) InternalReturn executed 10 times consuming a total of 30 L2 gas
[14:12:50.205] DEBUG: simulator:avm(f:public_dispatch) Return executed 1 times consuming a total of 18 L2 gas
...
[14:12:50.208] DEBUG: simulator:public_tx_context Computed tx fee {"txFee":"0x000000000000000000000000000000000000000000000000000000000000419a","gasUsed":"Gas { daGas=0 l2Gas=5598 }","gasFees":"GasFees { feePerDaGas=0x0000000000000000000000000000000000000000000000000000000000000002 feePerL2Gas=0x0000000000000000000000000000000000000000000000000000000000000003 }"}
[14:12:50.208] DEBUG: simulator:public_tx_simulator Deducting 16794 balance in Fee Juice for 0x000000000000000000000000000000000000000000000000000000000000002a

@aakoshh
Copy link
Contributor

aakoshh commented Jan 30, 2025

After increasing the initial balance to 20000 we have this (with LOG_LEVEL=debug):

[15:03:20.256] DEBUG: simulator:public_tx_simulator Deducting 17928 balance in Fee Juice for 0x000000000000000000000000000000000000000000000000000000000000002a
...
[15:03:20.278] DEBUG: simulator:public_tx_context Computed tx fee {"txFee":"0x0000000000000000000000000000000000000000000000000000000000004608","gasUsed":"Gas { daGas=0 l2Gas=5976 }","gasFees":"GasFees { feePerDaGas=0x0000000000000000000000000000000000000000000000000000000000000002 feePerL2Gas=0x0000000000000000000000000000000000000000000000000000000000000003 }"}
...
[15:03:20.351] VERBOSE: avm-simulation-tester AvmCircuit (check_circuit) BB out - Executing BB with: /mnt/user-data/akosh/aztec-packages/barretenberg/cpp/build/bin/bb avm_check_circuit --avm-public-inputs /tmp/bb-E9kvb1/avm_public_inputs.bin --avm-hints /tmp/bb-E9kvb1/avm_hints.bin -o /tmp/bb-E9kvb1 -d --check-circuit-only
...
[15:03:22.646] VERBOSE: avm-simulation-tester AvmCircuit (check_circuit) BB out - Not enough balance for fee payer to pay for transaction (got 0x0000000000000000000000000000000000000000000000000000000000004e20 needs 0x0000000000000000000000000000000000000000000000000000000000004608
[15:03:22.647] VERBOSE: avm-simulation-tester AvmCircuit (check_circuit) BB out - Not enough balance for fee payer to pay for transaction
[15:03:22.709] ERROR: avm-simulation-tester Proof generation failed: Failed to generate proof. Exit code 1. Signal null.
 FAIL  src/avm_proving_tests/avm_proving.test.ts (6.784 s)
  ● AVM WitGen & Circuit › public fee payment › fee payment

    expect(received).toEqual(expected) // deep equality

    Expected: 0
    Received: 1

      91 |     const avmCircuitInputs = simRes.avmProvingRequest.inputs;
      92 |     const provingRes = await this.prove(avmCircuitInputs);
    > 93 |     expect(provingRes.status).toEqual(BB_RESULT.SUCCESS);
         |                               ^
      94 |     const verificationRes = await this.verify(provingRes as BBSuccess);
      95 |     expect(verificationRes.status).toBe(BB_RESULT.SUCCESS);
      96 |   }

      at AvmProvingTester.toEqual [as simProveVerify] (avm_proving_tests/avm_proving_tester.ts:93:31)
      at Object.<anonymous> (avm_proving_tests/avm_proving.test.ts:424:9)

What's strange is that x4608 does equal 17928, x4e20 is 20000, so why does barretenberg fail the test like this?

The log is written here, originally emitted by bb.

@vezenovm
Copy link
Contributor

vezenovm commented Jan 30, 2025

What's strange is that x4608 does equal 17928, x4e20 is 20000, so why does barretenberg fail the test like this?

Hmm that is very strange.

In trace.cpp I see:

    if (current_balance < tx_fee) {
        info("Not enough balance for fee payer to pay for transaction (got ", current_balance, " needs ", tx_fee);
        throw std::runtime_error("Not enough balance for fee payer to pay for transaction");
    }

So we are failing if the current_balance to be less than the tx_fee, but we do not have that...

Copy link
Contributor

Changes to public function bytecode sizes

Generated at commit: efe3f79f47bb9fab1f697a7f25b640a99f7ac3fd, compared to commit: 7f802a48b428b89d5a0c99e286432d2b1142d668

🧾 Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
NFT::mint +1,152 ❌ +54.06%
AuthRegistry::public_dispatch +1,735 ❌ +25.35%
AuthRegistry::consume +730 ❌ +24.33%
AuthRegistry::set_authorized +407 ❌ +24.28%
AuthRegistry::_set_authorized +407 ❌ +23.62%
AuthRegistry::is_consumable +403 ❌ +23.29%
AMM::public_dispatch +4,045 ❌ +18.39%
Lending::get_position +683 ❌ +15.85%
NFT::public_dispatch +2,389 ❌ +10.46%
TokenBlacklist::public_dispatch +2,079 ❌ +8.84%
AvmTest::set_opcode_small_field +12 ❌ +8.70%
Token::public_dispatch +2,577 ❌ +8.31%
AvmTest::set_opcode_big_field +12 ❌ +7.79%
AvmTest::set_opcode_really_big_field +12 ❌ +7.79%
Lending::public_dispatch +1,732 ❌ +6.66%
AMM::_add_liquidity +516 ❌ +6.02%
Test::public_dispatch +942 ❌ +5.38%
AvmTest::new_note_hash +6 ❌ +4.96%
AvmTest::new_nullifier +6 ❌ +4.96%
Test::emit_nullifier_public +6 ❌ +4.96%
AvmTest::get_fee_per_l2_gas +6 ❌ +4.92%
AvmTest::get_chain_id +6 ❌ +4.92%
AvmTest::get_transaction_fee +6 ❌ +4.92%
AvmTest::get_block_number +6 ❌ +4.92%
AvmTest::get_fee_per_da_gas +6 ❌ +4.92%
AvmTest::get_l2_gas_left +6 ❌ +4.92%
AvmTest::get_address +6 ❌ +4.92%
AvmTest::get_timestamp +6 ❌ +4.92%
AvmTest::get_version +6 ❌ +4.92%
AvmTest::set_opcode_u8 +6 ❌ +4.92%
AvmTest::get_da_gas_left +6 ❌ +4.92%
AvmTest::get_sender +6 ❌ +4.92%
AvmTest::assert_calldata_copy +24 ❌ +4.85%
AvmTest::nullifier_collision +6 ❌ +4.80%
AvmTest::set_opcode_u32 +6 ❌ +4.76%
AvmTest::set_storage_single +6 ❌ +4.69%
AvmTest::send_l2_to_l1_msg +6 ❌ +4.65%
Test::create_l2_to_l1_message_arbitrary_recipient_public +6 ❌ +4.65%
AvmTest::set_opcode_u64 +6 ❌ +4.62%
AvmTest::read_storage_single +6 ❌ +4.55%
DocsExample::spend_public_authwit +6 ❌ +4.55%
Uniswap::public_dispatch +1,114 ❌ +4.46%
AvmTest::divide_by_zero +6 ❌ +4.41%
AvmTest::add_args_return +6 ❌ +4.35%
AvmTest::set_read_storage_single +6 ❌ +4.29%
AvmTest::nullifier_exists +6 ❌ +4.29%
AvmTest::note_hash_exists +6 ❌ +4.26%
AvmTest::l1_to_l2_msg_exists +6 ❌ +4.26%
AvmTest::modulo2 +6 ❌ +4.17%
AvmTest::set_storage_list +6 ❌ +4.14%
TokenBlacklist::transfer_public +219 ❌ +4.10%
Test::dummy_public_call +6 ❌ +3.82%
Test::is_time_equal +6 ❌ +3.82%
StatefulTest::public_dispatch +217 ❌ +3.81%
Router::_check_block_number +36 ❌ +3.72%
TokenBridge::public_dispatch +751 ❌ +3.69%
AvmTest::read_assert_storage_single +6 ❌ +3.66%
Router::_check_timestamp +36 ❌ +3.65%
AvmTest::assert_timestamp +6 ❌ +3.64%
AvmTest::assert_nullifier_exists +6 ❌ +3.61%
Child::pub_get_value +6 ❌ +3.57%
AvmTest::add_u128 +9 ❌ +3.56%
AvmTest::emit_nullifier_and_check +6 ❌ +3.53%
AvmTest::assert_same +6 ❌ +3.53%
TokenBlacklist::total_supply +12 ❌ +3.48%
AppSubscription::public_dispatch +141 ❌ +3.47%
InclusionProofs::push_nullifier_public +6 ❌ +3.43%
Token::_reduce_total_supply +15 ❌ +3.42%
AvmTest::n_new_nullifiers +6 ❌ +3.26%
AvmTest::n_new_note_hashes +6 ❌ +3.26%
AvmInitializerTest::read_storage_immutable +6 ❌ +3.23%
AvmTest::n_new_l2_to_l1_msgs +6 ❌ +3.23%
FPC::public_dispatch +251 ❌ +3.05%
InclusionProofs::test_nullifier_inclusion_from_public +6 ❌ +2.99%
DocsExample::update_leader +6 ❌ +2.96%
AvmTest::variable_base_msm +6 ❌ +2.88%
DocsExample::get_public_immutable_constrained_public +6 ❌ +2.80%
StaticChild::pub_get_value +6 ❌ +2.80%
NFT::public_get_symbol +6 ❌ +2.69%
TokenBridge::get_token +6 ❌ +2.69%
Token::get_admin +6 ❌ +2.69%
DocsExample::initialize_public_immutable +6 ❌ +2.67%
EasyPrivateVoting::end_vote +6 ❌ +2.63%
AuthWitTest::consume_public +17 ❌ +2.62%
Child::pub_set_value +6 ❌ +2.62%
NFT::set_admin +6 ❌ +2.62%
StaticChild::pub_set_value +6 ❌ +2.62%
Token::set_admin +6 ❌ +2.62%
Test::consume_mint_to_public_message +277 ❌ +2.62%
NFT::public_get_name +6 ❌ +2.59%
NFT::get_admin +6 ❌ +2.59%
Token::public_get_symbol +6 ❌ +2.59%
Token::public_get_name +6 ❌ +2.59%
Child::pub_inc_value +6 ❌ +2.50%
StaticChild::pub_inc_value +6 ❌ +2.50%
TokenBridge::exit_to_l1_public +194 ❌ +2.49%
Token::public_get_decimals +6 ❌ +2.43%
TokenBridge::claim_public +294 ❌ +2.37%
TokenBridge::_assert_token_is_same +6 ❌ +2.27%
TokenBridge::get_portal_address_public +6 ❌ +2.27%
AvmTest::n_new_public_logs +6 ❌ +2.22%
StaticChild::pub_illegal_inc_value +6 ❌ +2.14%
AvmTest::read_storage_list +6 ❌ +2.11%
Parent::public_dispatch +158 ❌ +2.11%
Child::pub_inc_value_internal +6 ❌ +2.10%
AvmTest::sha256_hash +69 ❌ +2.05%
AvmTest::external_call_to_assertion_failure +10 ❌ +2.04%
AvmTest::external_call_to_divide_by_zero +10 ❌ +2.04%
AvmTest::nested_call_to_nothing +10 ❌ +2.04%
AvmTest::nested_call_to_assert_same +12 ❌ +2.02%
AvmTest::nested_call_to_add +12 ❌ +2.02%
AvmTest::nested_static_call_to_add +12 ❌ +2.02%
AvmTest::nested_call_to_nothing_recovers +6 ❌ +1.99%
AvmTest::nested_static_call_to_set_storage +10 ❌ +1.98%
FeeJuice::set_portal +6 ❌ +1.98%
ImportTest::pub_call_public_fn +10 ❌ +1.98%
NFT::constructor +83 ❌ +1.97%
AvmTest::create_same_nullifier_in_nested_call +10 ❌ +1.96%
Token::constructor +83 ❌ +1.94%
AvmTest::create_different_nullifier_in_nested_call +10 ❌ +1.92%
AvmTest::revert_oracle +8 ❌ +1.92%
AvmTest::return_oracle +8 ❌ +1.91%
CardGame::public_dispatch +267 ❌ +1.78%
Test::consume_message_from_arbitrary_sender_public +136 ❌ +1.78%
TokenBlacklist::constructor +116 ❌ +1.75%
StaticParent::public_get_value_from_child +10 ❌ +1.72%
AvmTest::u128_from_integer_overflow +13 ❌ +1.67%
Parent::pub_entry_point +10 ❌ +1.66%
StaticParent::public_call +10 ❌ +1.66%
Child::set_value_twice_with_nested_last +10 ❌ +1.63%
DocsExample::get_public_immutable_constrained_public_multiple +6 ❌ +1.62%
Router::public_dispatch +36 ❌ +1.60%
Child::set_value_twice_with_nested_first +10 ❌ +1.59%
Uniswap::swap_public +239 ❌ +1.55%
AvmTest::keccak_hash +34 ❌ +1.52%
AvmTest::nested_call_to_add_n_times_different_addresses +12 ❌ +1.51%
Test::assert_public_global_vars +6 ❌ +1.50%
DocsExample::get_public_immutable_constrained_public_indirect +10 ❌ +1.47%
Token::total_supply +5 ❌ +1.47%
Auth::get_authorized +26 ❌ +1.42%
AvmTest::nested_call_to_add_with_gas +8 ❌ +1.40%
AvmTest::to_radix_le +6 ❌ +1.39%
Auth::set_authorized_delay +66 ❌ +1.35%
Uniswap::_assert_token_is_same +10 ❌ +1.35%
Auth::set_authorized +64 ❌ +1.34%
Auth::get_scheduled_authorized +23 ❌ +1.33%
AvmTest::test_get_contract_instance_matches +6 ❌ +1.32%
AvmTest::test_get_contract_instance +6 ❌ +1.31%
AppSubscription::constructor +39 ❌ +1.29%
TokenBlacklist::get_roles +34 ❌ +1.27%
AvmTest::keccak_f1600 +6 ❌ +1.20%
AvmTest::pedersen_commit +14 ❌ +1.20%
AvmTest::public_dispatch +748 ❌ +1.20%
Test::create_l2_to_l1_message_public +23 ❌ +1.16%
AvmTest::elliptic_curve_add +6 ❌ +1.03%
Token::finalize_mint_to_private +49 ❌ +1.03%
Auth::get_authorized_delay +20 ❌ +1.02%
Token::_finalize_mint_to_private_unsafe +49 ❌ +1.02%
NFT::_store_payload_in_transient_storage_unsafe +11 ❌ +0.97%
Token::_store_payload_in_transient_storage_unsafe +11 ❌ +0.97%
CardGame::on_cards_claimed +74 ❌ +0.96%
FeeJuice::_increase_public_balance +18 ❌ +0.94%
Lending::_deposit +22 ❌ +0.88%
Parent::public_static_call +10 ❌ +0.86%
StaticParent::public_static_call +10 ❌ +0.86%
AvmTest::elliptic_curve_add_and_double +6 ❌ +0.84%
Crowdfunding::init +23 ❌ +0.84%
TokenBlacklist::burn_public +41 ❌ +0.83%
StatefulTest::public_constructor +24 ❌ +0.83%
CardGame::start_game +58 ❌ +0.83%
TokenBlacklist::mint_private +30 ❌ +0.81%
NFT::finalize_transfer_to_private +37 ❌ +0.81%
Auth::public_dispatch +74 ❌ +0.81%
Uniswap::constructor +20 ❌ +0.80%
AvmTest::pedersen_hash_with_index +23 ❌ +0.80%
AvmTest::pedersen_hash +23 ❌ +0.80%
NFT::_finalize_transfer_to_private_unsafe +37 ❌ +0.80%
EasyPrivateVoting::constructor +20 ❌ +0.79%
Auth::constructor +20 ❌ +0.79%
Claim::constructor +21 ❌ +0.76%
AvmTest::u128_addition_overflow +9 ❌ +0.70%
FPC::constructor +18 ❌ +0.68%
TokenBridge::constructor +18 ❌ +0.67%
Lending::get_asset +15 ❌ +0.67%
TokenBlacklist::update_roles +42 ❌ +0.66%
AvmInitializerTest::constructor +12 ❌ +0.64%
FPC::pay_refund +16 ❌ +0.60%
AvmTest::poseidon2_hash +9 ❌ +0.60%
Claim::public_dispatch +21 ❌ +0.59%
Benchmarking::increment_balance +13 ❌ +0.59%
StaticParent::public_dispatch +32 ❌ +0.57%
AvmTest::set_storage_map +9 ❌ +0.57%
AvmTest::add_storage_map +9 ❌ +0.53%
EasyPrivateVoting::add_to_tally_public +9 ❌ +0.49%
Lending::borrow_public +10 ❌ +0.49%
Lending::withdraw_public +10 ❌ +0.49%
StaticParent::public_nested_static_call +10 ❌ +0.47%
AvmInitializerTest::public_dispatch +12 ❌ +0.46%
AvmTest::debug_logging +6 ❌ +0.46%
Token::finalize_transfer_to_private +23 ❌ +0.45%
Token::_finalize_transfer_to_private_unsafe +23 ❌ +0.45%
PriceFeed::public_dispatch +10 ❌ +0.37%
Parent::public_nested_static_call +13 ❌ +0.37%
AvmTest::external_call_to_divide_by_zero_recovers +9 ❌ +0.32%
AuthWitTest::public_dispatch +4 ❌ +0.27%
Token::complete_refund +9 ❌ +0.16%
TokenBlacklist::mint_public +3 ❌ +0.09%
Lending::_borrow +4 ❌ +0.05%
Lending::_withdraw +4 ❌ +0.05%
Spam::public_spam +1 ❌ +0.05%
Lending::init +1 ❌ +0.04%
Spam::public_dispatch +1 ❌ +0.03%
CardGame::on_card_played -7 ✅ -0.11%
Token::_increase_public_balance -3 ✅ -0.14%
FeeJuice::public_dispatch -15 ✅ -0.33%
TokenBlacklist::_reduce_total_supply -2 ✅ -0.37%
FPC::pull_funds -14 ✅ -0.51%
Token::transfer_in_public -23 ✅ -0.53%
AvmTest::n_storage_writes -9 ✅ -0.57%
TokenBlacklist::shield -40 ✅ -0.71%
AMM::constructor -21 ✅ -0.77%
InclusionProofs::constructor -19 ✅ -0.79%
TokenBlacklist::_increase_public_balance -20 ✅ -0.88%
Token::mint_to_public -21 ✅ -0.93%
AMM::_remove_liquidity -90 ✅ -1.25%
Lending::_repay -73 ✅ -1.36%
Token::balance_of_public -24 ✅ -1.39%
FeeJuice::balance_of_public -24 ✅ -1.43%
PriceFeed::get_price -24 ✅ -1.43%
ImportTest::public_dispatch -16 ✅ -1.44%
FeeJuice::check_balance -32 ✅ -1.63%
Lending::update_accumulator -98 ✅ -1.77%
Token::set_minter -30 ✅ -1.84%
Benchmarking::broadcast -30 ✅ -1.87%
StatefulTest::increment_public_value -30 ✅ -1.90%
TokenBlacklist::balance_of_public -33 ✅ -1.90%
NFT::owner_of -35 ✅ -1.96%
InclusionProofs::public_dispatch -75 ✅ -1.96%
StatefulTest::increment_public_value_no_init_check -30 ✅ -1.96%
AvmTest::bulk_testing -461 ✅ -2.04%
PriceFeed::set_price -32 ✅ -2.05%
Token::is_minter -34 ✅ -2.08%
NFT::set_minter -35 ✅ -2.14%
NFT::_finish_transfer_to_public -35 ✅ -2.16%
StatefulTest::get_public_value -34 ✅ -2.17%
AuthRegistry::set_reject_all -35 ✅ -2.28%
NFT::is_minter -39 ✅ -2.38%
AuthRegistry::is_reject_all -39 ✅ -2.47%
AvmTest::read_storage_map -39 ✅ -2.53%
Lending::deposit_public -72 ✅ -2.53%
Lending::repay_public -72 ✅ -2.66%
AMM::_swap_tokens_for_exact_tokens -172 ✅ -2.68%
EasyPrivateVoting::public_dispatch -132 ✅ -2.79%
Benchmarking::public_dispatch -97 ✅ -2.82%
AMM::_swap_exact_tokens_for_tokens -164 ✅ -2.87%
DocsExample::public_dispatch -117 ✅ -3.12%
Child::set_value_with_two_nested_calls -33 ✅ -3.41%
NFT::transfer_in_public -133 ✅ -3.81%
Token::burn_public -170 ✅ -3.95%
Child::public_dispatch -211 ✅ -4.44%
Parent::pub_entry_point_twice -46 ✅ -4.60%
AvmTest::get_args_hash -101 ✅ -5.54%
CardGame::on_game_joined -338 ✅ -6.05%
StaticChild::public_dispatch -131 ✅ -6.46%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 -498 ✅ -7.00%
Crowdfunding::public_dispatch -331 ✅ -7.50%
AvmTest::emit_public_log -258 ✅ -9.74%
Lending::get_assets -43 ✅ -9.95%
Test::emit_public -263 ✅ -18.80%
AvmTest::returndata_copy_oracle -338 ✅ -19.58%
TestLog::public_dispatch -474 ✅ -21.59%
AvmTest::assertion_failure -52 ✅ -24.19%
TestLog::emit_unencrypted_events -333 ✅ -30.41%
Crowdfunding::_publish_donation_receipts -532 ✅ -59.24%

Full diff report 👇
Program Bytecode size in bytes (+/-) %
NFT::mint 3,283 (+1,152) +54.06%
AuthRegistry::public_dispatch 8,578 (+1,735) +25.35%
AuthRegistry::consume 3,730 (+730) +24.33%
AuthRegistry::set_authorized 2,083 (+407) +24.28%
AuthRegistry::_set_authorized 2,130 (+407) +23.62%
AuthRegistry::is_consumable 2,133 (+403) +23.29%
AMM::public_dispatch 26,045 (+4,045) +18.39%
Lending::get_position 4,993 (+683) +15.85%
NFT::public_dispatch 25,239 (+2,389) +10.46%
TokenBlacklist::public_dispatch 25,586 (+2,079) +8.84%
AvmTest::set_opcode_small_field 150 (+12) +8.70%
Token::public_dispatch 33,597 (+2,577) +8.31%
AvmTest::set_opcode_big_field 166 (+12) +7.79%
AvmTest::set_opcode_really_big_field 166 (+12) +7.79%
Lending::public_dispatch 27,720 (+1,732) +6.66%
AMM::_add_liquidity 9,092 (+516) +6.02%
Test::public_dispatch 18,464 (+942) +5.38%
AvmTest::new_note_hash 127 (+6) +4.96%
AvmTest::new_nullifier 127 (+6) +4.96%
Test::emit_nullifier_public 127 (+6) +4.96%
AvmTest::get_fee_per_l2_gas 128 (+6) +4.92%
AvmTest::get_chain_id 128 (+6) +4.92%
AvmTest::get_transaction_fee 128 (+6) +4.92%
AvmTest::get_block_number 128 (+6) +4.92%
AvmTest::get_fee_per_da_gas 128 (+6) +4.92%
AvmTest::get_l2_gas_left 128 (+6) +4.92%
AvmTest::get_address 128 (+6) +4.92%
AvmTest::get_timestamp 128 (+6) +4.92%
AvmTest::get_version 128 (+6) +4.92%
AvmTest::set_opcode_u8 128 (+6) +4.92%
AvmTest::get_da_gas_left 128 (+6) +4.92%
AvmTest::get_sender 128 (+6) +4.92%
AvmTest::assert_calldata_copy 519 (+24) +4.85%
AvmTest::nullifier_collision 131 (+6) +4.80%
AvmTest::set_opcode_u32 132 (+6) +4.76%
AvmTest::set_storage_single 134 (+6) +4.69%
AvmTest::send_l2_to_l1_msg 135 (+6) +4.65%
Test::create_l2_to_l1_message_arbitrary_recipient_public 135 (+6) +4.65%
AvmTest::set_opcode_u64 136 (+6) +4.62%
AvmTest::read_storage_single 138 (+6) +4.55%
DocsExample::spend_public_authwit 138 (+6) +4.55%
Uniswap::public_dispatch 26,068 (+1,114) +4.46%
AvmTest::divide_by_zero 142 (+6) +4.41%
AvmTest::add_args_return 144 (+6) +4.35%
AvmTest::set_read_storage_single 146 (+6) +4.29%
AvmTest::nullifier_exists 146 (+6) +4.29%
AvmTest::note_hash_exists 147 (+6) +4.26%
AvmTest::l1_to_l2_msg_exists 147 (+6) +4.26%
AvmTest::modulo2 150 (+6) +4.17%
AvmTest::set_storage_list 151 (+6) +4.14%
TokenBlacklist::transfer_public 5,565 (+219) +4.10%
Test::dummy_public_call 163 (+6) +3.82%
Test::is_time_equal 163 (+6) +3.82%
StatefulTest::public_dispatch 5,909 (+217) +3.81%
Router::_check_block_number 1,004 (+36) +3.72%
TokenBridge::public_dispatch 21,090 (+751) +3.69%
AvmTest::read_assert_storage_single 170 (+6) +3.66%
Router::_check_timestamp 1,021 (+36) +3.65%
AvmTest::assert_timestamp 171 (+6) +3.64%
AvmTest::assert_nullifier_exists 172 (+6) +3.61%
Child::pub_get_value 174 (+6) +3.57%
AvmTest::add_u128 262 (+9) +3.56%
AvmTest::emit_nullifier_and_check 176 (+6) +3.53%
AvmTest::assert_same 176 (+6) +3.53%
TokenBlacklist::total_supply 357 (+12) +3.48%
AppSubscription::public_dispatch 4,206 (+141) +3.47%
InclusionProofs::push_nullifier_public 181 (+6) +3.43%
Token::_reduce_total_supply 454 (+15) +3.42%
AvmTest::n_new_nullifiers 190 (+6) +3.26%
AvmTest::n_new_note_hashes 190 (+6) +3.26%
AvmInitializerTest::read_storage_immutable 192 (+6) +3.23%
AvmTest::n_new_l2_to_l1_msgs 192 (+6) +3.23%
FPC::public_dispatch 8,482 (+251) +3.05%
InclusionProofs::test_nullifier_inclusion_from_public 207 (+6) +2.99%
DocsExample::update_leader 209 (+6) +2.96%
AvmTest::variable_base_msm 214 (+6) +2.88%
DocsExample::get_public_immutable_constrained_public 220 (+6) +2.80%
StaticChild::pub_get_value 220 (+6) +2.80%
NFT::public_get_symbol 229 (+6) +2.69%
TokenBridge::get_token 229 (+6) +2.69%
Token::get_admin 229 (+6) +2.69%
DocsExample::initialize_public_immutable 231 (+6) +2.67%
EasyPrivateVoting::end_vote 234 (+6) +2.63%
AuthWitTest::consume_public 665 (+17) +2.62%
Child::pub_set_value 235 (+6) +2.62%
NFT::set_admin 235 (+6) +2.62%
StaticChild::pub_set_value 235 (+6) +2.62%
Token::set_admin 235 (+6) +2.62%
Test::consume_mint_to_public_message 10,852 (+277) +2.62%
NFT::public_get_name 238 (+6) +2.59%
NFT::get_admin 238 (+6) +2.59%
Token::public_get_symbol 238 (+6) +2.59%
Token::public_get_name 238 (+6) +2.59%
Child::pub_inc_value 246 (+6) +2.50%
StaticChild::pub_inc_value 246 (+6) +2.50%
TokenBridge::exit_to_l1_public 7,986 (+194) +2.49%
Token::public_get_decimals 253 (+6) +2.43%
TokenBridge::claim_public 12,711 (+294) +2.37%
TokenBridge::_assert_token_is_same 270 (+6) +2.27%
TokenBridge::get_portal_address_public 270 (+6) +2.27%
AvmTest::n_new_public_logs 276 (+6) +2.22%
StaticChild::pub_illegal_inc_value 287 (+6) +2.14%
AvmTest::read_storage_list 290 (+6) +2.11%
Parent::public_dispatch 7,637 (+158) +2.11%
Child::pub_inc_value_internal 292 (+6) +2.10%
AvmTest::sha256_hash 3,429 (+69) +2.05%
AvmTest::external_call_to_assertion_failure 500 (+10) +2.04%
AvmTest::external_call_to_divide_by_zero 500 (+10) +2.04%
AvmTest::nested_call_to_nothing 500 (+10) +2.04%
AvmTest::nested_call_to_assert_same 607 (+12) +2.02%
AvmTest::nested_call_to_add 607 (+12) +2.02%
AvmTest::nested_static_call_to_add 607 (+12) +2.02%
AvmTest::nested_call_to_nothing_recovers 308 (+6) +1.99%
AvmTest::nested_static_call_to_set_storage 514 (+10) +1.98%
FeeJuice::set_portal 309 (+6) +1.98%
ImportTest::pub_call_public_fn 515 (+10) +1.98%
NFT::constructor 4,289 (+83) +1.97%
AvmTest::create_same_nullifier_in_nested_call 520 (+10) +1.96%
Token::constructor 4,364 (+83) +1.94%
AvmTest::create_different_nullifier_in_nested_call 530 (+10) +1.92%
AvmTest::revert_oracle 424 (+8) +1.92%
AvmTest::return_oracle 426 (+8) +1.91%
CardGame::public_dispatch 15,234 (+267) +1.78%
Test::consume_message_from_arbitrary_sender_public 7,776 (+136) +1.78%
TokenBlacklist::constructor 6,726 (+116) +1.75%
StaticParent::public_get_value_from_child 591 (+10) +1.72%
AvmTest::u128_from_integer_overflow 790 (+13) +1.67%
Parent::pub_entry_point 614 (+10) +1.66%
StaticParent::public_call 614 (+10) +1.66%
Child::set_value_twice_with_nested_last 625 (+10) +1.63%
DocsExample::get_public_immutable_constrained_public_multiple 377 (+6) +1.62%
Router::public_dispatch 2,290 (+36) +1.60%
Child::set_value_twice_with_nested_first 638 (+10) +1.59%
Uniswap::swap_public 15,686 (+239) +1.55%
AvmTest::keccak_hash 2,275 (+34) +1.52%
AvmTest::nested_call_to_add_n_times_different_addresses 805 (+12) +1.51%
Test::assert_public_global_vars 406 (+6) +1.50%
DocsExample::get_public_immutable_constrained_public_indirect 692 (+10) +1.47%
Token::total_supply 346 (+5) +1.47%
Auth::get_authorized 1,852 (+26) +1.42%
AvmTest::nested_call_to_add_with_gas 578 (+8) +1.40%
AvmTest::to_radix_le 439 (+6) +1.39%
Auth::set_authorized_delay 4,953 (+66) +1.35%
Uniswap::_assert_token_is_same 753 (+10) +1.35%
Auth::set_authorized 4,855 (+64) +1.34%
Auth::get_scheduled_authorized 1,754 (+23) +1.33%
AvmTest::test_get_contract_instance_matches 459 (+6) +1.32%
AvmTest::test_get_contract_instance 464 (+6) +1.31%
AppSubscription::constructor 3,062 (+39) +1.29%
TokenBlacklist::get_roles 2,705 (+34) +1.27%
AvmTest::keccak_f1600 504 (+6) +1.20%
AvmTest::pedersen_commit 1,176 (+14) +1.20%
AvmTest::public_dispatch 63,030 (+748) +1.20%
Test::create_l2_to_l1_message_public 1,999 (+23) +1.16%
AvmTest::elliptic_curve_add 586 (+6) +1.03%
Token::finalize_mint_to_private 4,805 (+49) +1.03%
Auth::get_authorized_delay 1,980 (+20) +1.02%
Token::_finalize_mint_to_private_unsafe 4,852 (+49) +1.02%
NFT::_store_payload_in_transient_storage_unsafe 1,141 (+11) +0.97%
Token::_store_payload_in_transient_storage_unsafe 1,141 (+11) +0.97%
CardGame::on_cards_claimed 7,755 (+74) +0.96%
FeeJuice::_increase_public_balance 1,925 (+18) +0.94%
Lending::_deposit 2,517 (+22) +0.88%
Parent::public_static_call 1,174 (+10) +0.86%
StaticParent::public_static_call 1,174 (+10) +0.86%
AvmTest::elliptic_curve_add_and_double 719 (+6) +0.84%
Crowdfunding::init 2,769 (+23) +0.84%
TokenBlacklist::burn_public 4,955 (+41) +0.83%
StatefulTest::public_constructor 2,911 (+24) +0.83%
CardGame::start_game 7,048 (+58) +0.83%
TokenBlacklist::mint_private 3,712 (+30) +0.81%
NFT::finalize_transfer_to_private 4,606 (+37) +0.81%
Auth::public_dispatch 9,260 (+74) +0.81%
Uniswap::constructor 2,506 (+20) +0.80%
AvmTest::pedersen_hash_with_index 2,892 (+23) +0.80%
AvmTest::pedersen_hash 2,892 (+23) +0.80%
NFT::_finalize_transfer_to_private_unsafe 4,653 (+37) +0.80%
EasyPrivateVoting::constructor 2,543 (+20) +0.79%
Auth::constructor 2,547 (+20) +0.79%
Claim::constructor 2,787 (+21) +0.76%
AvmTest::u128_addition_overflow 1,302 (+9) +0.70%
FPC::constructor 2,649 (+18) +0.68%
TokenBridge::constructor 2,688 (+18) +0.67%
Lending::get_asset 2,242 (+15) +0.67%
TokenBlacklist::update_roles 6,417 (+42) +0.66%
AvmInitializerTest::constructor 1,886 (+12) +0.64%
FPC::pay_refund 2,678 (+16) +0.60%
AvmTest::poseidon2_hash 1,521 (+9) +0.60%
Claim::public_dispatch 3,552 (+21) +0.59%
Benchmarking::increment_balance 2,202 (+13) +0.59%
StaticParent::public_dispatch 5,638 (+32) +0.57%
AvmTest::set_storage_map 1,595 (+9) +0.57%
AvmTest::add_storage_map 1,697 (+9) +0.53%
EasyPrivateVoting::add_to_tally_public 1,849 (+9) +0.49%
Lending::borrow_public 2,065 (+10) +0.49%
Lending::withdraw_public 2,065 (+10) +0.49%
StaticParent::public_nested_static_call 2,124 (+10) +0.47%
AvmInitializerTest::public_dispatch 2,644 (+12) +0.46%
AvmTest::debug_logging 1,324 (+6) +0.46%
Token::finalize_transfer_to_private 5,131 (+23) +0.45%
Token::_finalize_transfer_to_private_unsafe 5,178 (+23) +0.45%
PriceFeed::public_dispatch 2,698 (+10) +0.37%
Parent::public_nested_static_call 3,514 (+13) +0.37%
AvmTest::external_call_to_divide_by_zero_recovers 2,828 (+9) +0.32%
AuthWitTest::public_dispatch 1,505 (+4) +0.27%
Token::complete_refund 5,641 (+9) +0.16%
TokenBlacklist::mint_public 3,532 (+3) +0.09%
Lending::_borrow 8,258 (+4) +0.05%
Lending::_withdraw 8,424 (+4) +0.05%
Spam::public_spam 2,194 (+1) +0.05%
Lending::init 2,729 (+1) +0.04%
Spam::public_dispatch 2,975 (+1) +0.03%
CardGame::on_card_played 6,415 (-7) -0.11%
Token::_increase_public_balance 2,163 (-3) -0.14%
FeeJuice::public_dispatch 4,562 (-15) -0.33%
TokenBlacklist::_reduce_total_supply 536 (-2) -0.37%
FPC::pull_funds 2,754 (-14) -0.51%
Token::transfer_in_public 4,351 (-23) -0.53%
AvmTest::n_storage_writes 1,560 (-9) -0.57%
TokenBlacklist::shield 5,602 (-40) -0.71%
AMM::constructor 2,692 (-21) -0.77%
InclusionProofs::constructor 2,398 (-19) -0.79%
TokenBlacklist::_increase_public_balance 2,245 (-20) -0.88%
Token::mint_to_public 2,242 (-21) -0.93%
AMM::_remove_liquidity 7,112 (-90) -1.25%
Lending::_repay 5,305 (-73) -1.36%
Token::balance_of_public 1,706 (-24) -1.39%
FeeJuice::balance_of_public 1,652 (-24) -1.43%
PriceFeed::get_price 1,652 (-24) -1.43%
ImportTest::public_dispatch 1,097 (-16) -1.44%
FeeJuice::check_balance 1,933 (-32) -1.63%
Lending::update_accumulator 5,440 (-98) -1.77%
Token::set_minter 1,600 (-30) -1.84%
Benchmarking::broadcast 1,571 (-30) -1.87%
StatefulTest::increment_public_value 1,547 (-30) -1.90%
TokenBlacklist::balance_of_public 1,701 (-33) -1.90%
NFT::owner_of 1,753 (-35) -1.96%
InclusionProofs::public_dispatch 3,750 (-75) -1.96%
StatefulTest::increment_public_value_no_init_check 1,498 (-30) -1.96%
AvmTest::bulk_testing 22,134 (-461) -2.04%
PriceFeed::set_price 1,527 (-32) -2.05%
Token::is_minter 1,597 (-34) -2.08%
NFT::set_minter 1,600 (-35) -2.14%
NFT::_finish_transfer_to_public 1,582 (-35) -2.16%
StatefulTest::get_public_value 1,533 (-34) -2.17%
AuthRegistry::set_reject_all 1,498 (-35) -2.28%
NFT::is_minter 1,597 (-39) -2.38%
AuthRegistry::is_reject_all 1,543 (-39) -2.47%
AvmTest::read_storage_map 1,502 (-39) -2.53%
Lending::deposit_public 2,769 (-72) -2.53%
Lending::repay_public 2,639 (-72) -2.66%
AMM::_swap_tokens_for_exact_tokens 6,257 (-172) -2.68%
EasyPrivateVoting::public_dispatch 4,592 (-132) -2.79%
Benchmarking::public_dispatch 3,347 (-97) -2.82%
AMM::_swap_exact_tokens_for_tokens 5,550 (-164) -2.87%
DocsExample::public_dispatch 3,636 (-117) -3.12%
Child::set_value_with_two_nested_calls 936 (-33) -3.41%
NFT::transfer_in_public 3,358 (-133) -3.81%
Token::burn_public 4,129 (-170) -3.95%
Child::public_dispatch 4,542 (-211) -4.44%
Parent::pub_entry_point_twice 955 (-46) -4.60%
AvmTest::get_args_hash 1,721 (-101) -5.54%
CardGame::on_game_joined 5,245 (-338) -6.05%
StaticChild::public_dispatch 1,896 (-131) -6.46%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 6,617 (-498) -7.00%
Crowdfunding::public_dispatch 4,081 (-331) -7.50%
AvmTest::emit_public_log 2,390 (-258) -9.74%
Lending::get_assets 389 (-43) -9.95%
Test::emit_public 1,136 (-263) -18.80%
AvmTest::returndata_copy_oracle 1,388 (-338) -19.58%
TestLog::public_dispatch 1,721 (-474) -21.59%
AvmTest::assertion_failure 163 (-52) -24.19%
TestLog::emit_unencrypted_events 762 (-333) -30.41%
Crowdfunding::_publish_donation_receipts 366 (-532) -59.24%

Copy link
Contributor

Changes to circuit sizes

Generated at commit: efe3f79f47bb9fab1f697a7f25b640a99f7ac3fd, compared to commit: 7f802a48b428b89d5a0c99e286432d2b1142d668

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_inner -1 ✅ -0.00% -1 ✅ -0.00%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_inner 28,367 (-1) -0.00% 72,233 (-1) -0.00%

@aakoshh
Copy link
Contributor

aakoshh commented Jan 30, 2025

For posterity: the docs of the > operator of Field explains that these should not be used for arithmetic comparison. It's not that the results are inverted per se, but that they are for all intents and purposes arbitrary (though deterministic). So if previously it agreed that a fee of, say, 7500 was less than the balance of 10000, it can at the same time say that 17000 is more than the balance of 20000.

Also: the print itself brought it back into human readable(ish) form with the from_montgomery_form method.

@TomAFrench TomAFrench merged commit a7f8d96 into master Jan 30, 2025
52 checks passed
@TomAFrench TomAFrench deleted the sync-noir branch January 30, 2025 18:29
Comment on lines +163 to 164
&& self.structs.is_empty()
&& self.type_aliases.is_empty()
Copy link
Member

Choose a reason for hiding this comment

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

@jfecher looks like this didn't get updated to reflect enums

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.

4 participants