Skip to content

chore: update noir to v1.0.0-beta.11#34

Closed
tonyvelichko wants to merge 1 commit into
zkmopro:mainfrom
tonyvelichko:feat/update-noir-to-b11
Closed

chore: update noir to v1.0.0-beta.11#34
tonyvelichko wants to merge 1 commit into
zkmopro:mainfrom
tonyvelichko:feat/update-noir-to-b11

Conversation

@tonyvelichko
Copy link
Copy Markdown

  • switched from the rev based reference in cargo to the tag based one.
  • up noir version to beta.11

moven0831 added a commit that referenced this pull request Apr 13, 2026
Migrates from the custom bb/ crate (hand-written C FFI bindings + custom
download_bb.sh) to the official barretenberg-rs crate from crates.io.

Key changes:
- Delete bb/ crate entirely (~800 lines of unsafe FFI + build scripts)
- Add barretenberg-rs = "=4.2.0-aztecnr-rc.2" with ffi feature
- Bump noir-lang deps to v1.0.0-beta.19 (acvm, bn254_blackbox_solver, nargo, acvm_blackbox_solver)
- Drop separate acir dep (now accessed via acvm::acir::*)
- Add keccak = "=0.2.0-rc.0" pin (beta.19 breaking-change workaround)
- Drop android-compat feature and openssl dep (not needed with rustls-tls)
- Remove x86_64-apple-ios target (no prebuilt binaries; Intel Mac obsolete)

New abstraction:
- noir/src/backends/barretenberg/api.rs wraps barretenberg-rs's FfiBackend +
  BarretenbergApi with settings helpers, proof flattening, and configure_memory()
  that writes to C globals (slow_low_memory, storage_budget) for fine-grained
  mobile memory control.

Module ports:
- prove.rs / verify.rs now route through api.rs; proofs use the
  [4-byte BE num_pub][public_inputs][proof] format so verify can split fields
  without a side-channel num_public_inputs parameter.
- srs/mod.rs initializes SRS via api::srs_init; includes UltraHonk's 8x point
  overhead for witness/permutation/lookup polynomials.
- utils.rs uses circuit_stats() and exposes get_circuit_size_dyadic().
- circuit.rs round-trips through Program::deserialize_program / serialize_program
  so the ACIR handed to barretenberg matches NOIR_SERIALIZATION_FORMAT.
- witness.rs replaces bincode::serialize with WitnessStack::serialize() + gzip
  decompression; fixes unwrap_or_default() bug so invalid hex/decimal strings
  in from_vec_str_to_witness_map now return an error instead of silently
  mapping to zero.
- execute.rs switches to acvm::acir:: imports.

Proof utilities:
- proof_utils.rs updated to the new [4-byte prefix][inputs][proof] format,
  with cross-validation between the embedded count and caller-supplied value.

Dead code cleanup:
- Remove commented-out recursion.rs (referenced the old bb_rs crate name).

Closes #36
Supersedes #34

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
moven0831 added a commit that referenced this pull request Apr 16, 2026
* feat: upgrade to noir v1.0.0-beta.19 and adopt official barretenberg-rs

Migrates from the custom bb/ crate (hand-written C FFI bindings + custom
download_bb.sh) to the official barretenberg-rs crate from crates.io.

Key changes:
- Delete bb/ crate entirely (~800 lines of unsafe FFI + build scripts)
- Add barretenberg-rs = "=4.2.0-aztecnr-rc.2" with ffi feature
- Bump noir-lang deps to v1.0.0-beta.19 (acvm, bn254_blackbox_solver, nargo, acvm_blackbox_solver)
- Drop separate acir dep (now accessed via acvm::acir::*)
- Add keccak = "=0.2.0-rc.0" pin (beta.19 breaking-change workaround)
- Drop android-compat feature and openssl dep (not needed with rustls-tls)
- Remove x86_64-apple-ios target (no prebuilt binaries; Intel Mac obsolete)

New abstraction:
- noir/src/backends/barretenberg/api.rs wraps barretenberg-rs's FfiBackend +
  BarretenbergApi with settings helpers, proof flattening, and configure_memory()
  that writes to C globals (slow_low_memory, storage_budget) for fine-grained
  mobile memory control.

Module ports:
- prove.rs / verify.rs now route through api.rs; proofs use the
  [4-byte BE num_pub][public_inputs][proof] format so verify can split fields
  without a side-channel num_public_inputs parameter.
- srs/mod.rs initializes SRS via api::srs_init; includes UltraHonk's 8x point
  overhead for witness/permutation/lookup polynomials.
- utils.rs uses circuit_stats() and exposes get_circuit_size_dyadic().
- circuit.rs round-trips through Program::deserialize_program / serialize_program
  so the ACIR handed to barretenberg matches NOIR_SERIALIZATION_FORMAT.
- witness.rs replaces bincode::serialize with WitnessStack::serialize() + gzip
  decompression; fixes unwrap_or_default() bug so invalid hex/decimal strings
  in from_vec_str_to_witness_map now return an error instead of silently
  mapping to zero.
- execute.rs switches to acvm::acir:: imports.

Proof utilities:
- proof_utils.rs updated to the new [4-byte prefix][inputs][proof] format,
  with cross-validation between the embedded count and caller-supplied value.

Dead code cleanup:
- Remove commented-out recursion.rs (referenced the old bb_rs crate name).

Closes #36
Supersedes #34

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: load product circuit at runtime and add beta.19 coverage

Previous tests hardcoded a base64 bytecode constant that was compiled with
nargo 1.0.0-beta.8 and is incompatible with beta.19's ACIR format.

Changes:
- Replace the inline BYTECODE constant with load_product_bytecode() that
  reads circuits/target/product.json, so tests always use artifacts that
  match the installed nargo version.
- Update proof_utils tests to use the product circuit (same a * b == result
  shape as the old Multiplier2, with 1 public input).
- Add test_invalid_witness_input_error to cover the from_vec_str_to_witness_map
  error-propagation fix (previously silently returned zero).
- Add test_circuit_format_round_trip to cover Program::deserialize_program +
  serialize_program, catching ACIR format drift across noir versions.
- Replace acir_get_slow_low_memory assertions with get_slow_low_memory() from
  api.rs (reads the same C global the old bb crate exposed).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ci: update workflow for nargo v1.0.0-beta.19 and drop x86_64-apple-ios

- Bump nargo toolchain from 1.0.0-beta.8 to 1.0.0-beta.19 across all jobs
- Drop x86_64-apple-ios target and its build step (barretenberg-rs has no
  prebuilt binaries for Intel iOS simulator; Apple Silicon only since M1)
- Remove bb/target/ from cargo build cache paths (crate no longer exists)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(srs): apply UltraHonk overhead multiplier only when deriving from gates

Previously setup_srs() applied the 8x UltraHonk overhead multiplier on every
caller, which broke test_srs_setup_from_circuit_size (expected 33 points,
got 257) and any consumer that computes their own SRS size.

Move the multiplier into setup_srs_from_bytecode() where we actually derive
size from the raw dyadic gate count. setup_srs() now treats its argument as
the final desired subgroup size (no scaling).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ci: build product circuit, drop test-x86_64 job, cover x86_64 Android on Linux

- Add the product circuit to the circuit build step. Tests load it at runtime
  via circuits/target/product.json, so CI has to compile it alongside keccak
  and keccak_large.
- Remove the test-x86_64 job entirely. The macos-13 runner is no longer
  supported ("configuration 'macos-13-us-default' is not supported"), and
  Intel Macs are EOL (Apple Silicon only since M1 in 2020).
- Move the x86_64-linux-android cross-compile build to the test-linux job so
  we still verify that Android target on every PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(srs): add 5 minute timeout to SRS download client

The default reqwest blocking client has no overall timeout and relies on
TCP keepalive settings. On CI runners with slow/flaky network paths to
crs.aztec.network this was flaking the keccak_large low-memory test with
reqwest::Error { kind: Decode, source: TimedOut }.

Add an explicit 5 minute timeout to the blocking Client. That covers
legitimate large SRS downloads (tens of MB for >262k points) while still
failing fast on genuine outages. Also swap `.unwrap()` for `.expect()` with
descriptive messages so future failures are easier to diagnose.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ci: split jobs by target platform (macos, ios, linux, android)

Previously jobs were named inconsistently ("test-aarch64" named an
architecture, "test-linux" named an OS). Reorganize into four jobs, each
scoped to one target platform. This makes the matrix match the README's
supported-targets section and surfaces per-platform failures independently.

- test-macos (macos-latest runner): runs cargo test natively, builds
  aarch64-apple-darwin and x86_64-apple-darwin (the latter cross-compiled
  from the arm64 runner, restoring coverage lost with the deprecated
  macos-13 runner).
- test-ios (macos-latest runner): cross-compiles aarch64-apple-ios and
  aarch64-apple-ios-sim. Does not run tests (no simulator in CI).
- test-linux (ubuntu-latest runner): runs cargo test natively, builds
  x86_64-unknown-linux-gnu.
- test-android (ubuntu-latest runner): cross-compiles aarch64-linux-android
  and x86_64-linux-android via cargo-ndk. Linux runner for cost; Android
  builds do not need macOS. Does not run tests (no emulator in CI).

Also switch the feature flag on macOS and Linux build steps from the legacy
`ios-build` alias to `barretenberg` directly. iOS and Android retain their
platform-specific feature flags for clarity.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@moven0831
Copy link
Copy Markdown
Contributor

Hi, thanks for raising this. The later PR (#37) has upgraded Noir to a newer stable version.

@moven0831 moven0831 closed this Apr 16, 2026
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.

2 participants