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
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-reachablepanic!sites inaztec-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 anexpected_errorfile pins nargo's output verbatim. Contracts that would otherwise cascade into an unrelated panic (the genericcheck_each_fn_macroifiedmessage, 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 emptyexpected_erroras a known-unreachable reproducer.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.selfand call each other, the snapshot captures 38 error lines (when we should only have 4 errors).noir-contracts-comp-failures/bootstrap.sh: emptyexpected_errornow means "expect compile success";ACCEPT_SNAPSHOTS=1writes 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
#[authorize_once]attribute-ordering panic athelpers.nr:55does not fire for the documented trigger; the reproducer ships with an empty snapshot.#[authorization]ispubbut has no downstream consumers; its generated code referencescrate::authwit::*paths that don't resolve from a downstream crate, producing a 5-line cascade before the target diagnostic.Building off of #22733