Skip to content

test(aztec-nr): expand compile-failure coverage for macro panics#22752

Open
vezenovm wants to merge 2 commits intomv/f-577-unified-noir-contract-error-snapshot-testingfrom
mv/expand-contract-compile-failure-test-coverage
Open

test(aztec-nr): expand compile-failure coverage for macro panics#22752
vezenovm wants to merge 2 commits intomv/f-577-unified-noir-contract-error-snapshot-testingfrom
mv/expand-contract-compile-failure-test-coverage

Conversation

@vezenovm
Copy link
Copy Markdown
Contributor

@vezenovm vezenovm commented Apr 23, 2026

Motivation

PR #22733 unified the compile-failure runner and migrated four legacy cases into noir-contracts-comp-failures/, bringing total coverage to 22 contracts. That left ~28 user-reachable panic! sites in aztec-nr/aztec/src/macros/ with no dedicated test. This PR closes those gaps so every user-reachable panic has a pinned snapshot.

Approach

For each gap, a minimal contracts/<name>/ contract triggers the target panic and an expected_error file pins nargo's output verbatim. Contracts that would otherwise cascade into an unrelated panic (the generic check_each_fn_macroified message, or the "noinitcheck without initializer" message) are isolated with a #[contract_library_method] marker or a stub #[initializer] so each test pins exactly one target.

Changes

  • noir-contracts-comp-failures/contracts/: 28 new contracts, one per previously-uncovered panic site (see diff for details). One contract (authorize_once_before_external) ships with an empty expected_error as a known-unreachable reproducer.
  • Realistic cascading errors: In addition to the 28 isolated cases, contracts/bob_token/ pins the full cascade behavior of the current library on a realistic program. It's a token contract adapted from the https://docs.aztec.network/developers/docs/tutorials/contract_tutorials/token_contract with four broken functions.
  • noir-contracts-comp-failures/bootstrap.sh: empty expected_error now means "expect compile success"; ACCEPT_SNAPSHOTS=1 writes an empty file when compilation succeeds. Wrong count or content falls through to the existing count-mismatch path.
  • noir-contracts-comp-failures/README.md: one-line note on the empty-snapshot convention.

Follow-ups

  • F-579: the #[authorize_once] attribute-ordering panic at helpers.nr:55 does not fire for the documented trigger; the reproducer ships with an empty snapshot.
  • F-580: #[authorization] is pub but has no downstream consumers; its generated code references crate::authwit::* paths that don't resolve from a downstream crate, producing a 5-line cascade before the target diagnostic.

Building off of #22733

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.

1 participant