Skip to content

feat(txe): allow authorizing cross-contract utility calls in nr tests#23064

Merged
nchamo merged 3 commits into
merge-train/fairiesfrom
nchamo/f-638-allow-devs-to-authorize-cross-contract-utility-calls-from
May 8, 2026
Merged

feat(txe): allow authorizing cross-contract utility calls in nr tests#23064
nchamo merged 3 commits into
merge-train/fairiesfrom
nchamo/f-638-allow-devs-to-authorize-cross-contract-utility-calls-from

Conversation

@nchamo

@nchamo nchamo commented May 7, 2026

Copy link
Copy Markdown
Contributor

Why we are doing this

Noir tests using the TXE had no way to authorize cross-contract utility calls. #23007 added PXE execution hooks so JavaScript callers could authorize these calls, but the same mechanism wasn't wired up for the Noir test environment.

Our fix

Adds with_authorized_utility_call_targets to CallPrivateOptions, ViewPrivateOptions, and a new ExecuteUtilityOptions on TestEnvironment. Test authors can now pass a list of contracts allowed to receive cross-contract utility calls, mirroring what the PXE hooks provide for JavaScript tests.

Fixes F-638

@nchamo nchamo requested a review from nventuro as a code owner May 7, 2026 20:24
@nchamo nchamo self-assigned this May 7, 2026
@nchamo nchamo requested a review from vezenovm May 7, 2026 21:02

@vezenovm vezenovm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good!

Comment on lines +43 to +44

mod test;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: prefer this at the top of the file

@nchamo nchamo merged commit 1aeaa37 into merge-train/fairies May 8, 2026
14 checks passed
@nchamo nchamo deleted the nchamo/f-638-allow-devs-to-authorize-cross-contract-utility-calls-from branch May 8, 2026 19:05
@AztecBot

AztecBot commented May 8, 2026

Copy link
Copy Markdown
Collaborator

✅ Successfully backported to backport-to-v4-next-staging #23080.

}
}

/// Authorizes cross-contract utility calls to the given target contracts during this call.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

loooooooooooooooooooooooooooooooong

@@ -155,10 +156,27 @@ impl<let N: u32> CallPrivateOptions<N> {
/// Example usage includes accounts withdrawing from an escrow, which may require accessing the escrow's own notes
/// and secrets.
pub fn with_additional_scopes<let N_2: u32>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There should be docs (error page? idk) that tell you how to fix the issue when you run into it, incl. the fact that if in a test you can do this. They should also explain why this is not allowed by default.

Thunkar added a commit that referenced this pull request May 9, 2026
## Summary

CI3 on PR #23080 failed in the `noir-projects build` `prep` step because
the new `nested_utility_contract/src/test.nr` (added by the backport of
#23064 — feat(txe) authorize cross-contract utility calls) wasn't
formatted by v4-next's pinned nargo. Three statements were committed
multi-line that v4-next's `nargo fmt --check` wants on a single line.

CI log: http://ci.aztec-labs.com/0ef270f34a64bc9b

## Fix

Apply `nargo fmt` exactly per the CI diff:

- `same_contract_utility_call_from_private_succeeds`: collapse the `let
result: Field =
        env.call_private(...)` to one line.
- `cross_contract_utility_call_from_utility_denied_by_default`: collapse
the `env.execute_utility(
        ...,
    )` to one line.
- `cross_contract_utility_call_from_private_denied_by_default`: collapse
the `env.call_private(
        account,
        ...,
    )` to one line.

The two `*_with_authorization` tests already use multi-line because
their bodies are too wide for one line — left unchanged.

## Test plan

- CI3 on PR #23080 should clear the `prep` step (`noir-projects build`)
once this lands on `backport-to-v4-next-staging`.


ClaudeBox log: https://claudebox.work/s/ea70ef48e7a85dfe?run=3
AztecBot added a commit that referenced this pull request May 9, 2026
BEGIN_COMMIT_OVERRIDE
fix(aztec-up): Aztec installer does not shadow user installed binaries
on PATH (#22902)
fix: include sqlite binary in its npm package (#23039)
chore: backport #23041 (add sendMessagesAs to wallet api schemas) to
v4-next (#23081)
chore: backport DeployMethod refactor (#22985) to v4-next (#23029)
refactor(pxe): deduplicate tx hash lookups in MessageContextService
(#23075)
refactor(pxe): batch tagged private log queries across all secrets
(#23048)
refactor(pxe): batch log RPC calls in LogService.fetchLogsByTag (#23088)
feat(aztec-nr): Initial handshake registry contract with non interactive
handshake function (#22854)
fix: add Tag.random() helper required by backported #23088 tests
(#23094)
chore: backport: fix(aztec-up): installer does not shadow user binaries
on PATH (#22902) (#23060)
chore: backport handshake registry contract (#22854) to v4-next (#23063)
feat: deploy method refactor 2 (#23033)
refactor(pxe): skip redundant getBlock RPC when querying at anchor block
(#23100)
port(v4-next): feat(docs): autogenerate node JSON-RPC API reference
(#22543) (#23046)
chore: backport feat: deploy method refactor 2 (#23033) to v4-next
(#23103)
port(v4-next): feat(ci): Snapshots for aztec-nr contract compilation
failures and nargo expand (#23061) (#23104)
feat(txe): allow authorizing cross-contract utility calls in nr tests
(#23064)
END_COMMIT_OVERRIDE
github-merge-queue Bot pushed a commit that referenced this pull request May 10, 2026
BEGIN_COMMIT_OVERRIDE
fix: include sqlite binary in its npm package (#23039)
fix: add sendMessagesAs to wallet api schemas (#23041)
refactor(pxe): deduplicate tx hash lookups in MessageContextService
(#23075)
refactor(pxe): batch tagged private log queries across all secrets
(#23048)
refactor(pxe): batch log RPC calls in LogService.fetchLogsByTag (#23088)
feat(pxe,nr): flesh out account stubs and don't exclude syncing for
overrides (#23054)
feat: deploy method refactor 2 (#23033)
feat: fastForwardContractUpdate cheatcode for simulating contract
updates (#22905)
refactor(stdlib): consolidate find-function-by-selector helpers (#23008)
feat(ci): Snapshots for aztec-nr contract compilation failures and nargo
expand (#23061)
chore: kv store test fully on vitest (#23096)
refactor(pxe): skip redundant getBlock RPC when querying at anchor block
(#23100)
chore(playground): bump main chunk size limit 1750 → 1800 KB (#23107)
feat(txe): allow authorizing cross-contract utility calls in nr tests
(#23064)
chore: bench public fns with emit repro (#23105)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants