Skip to content

Commit e0366c9

Browse files
authored
fix: nargo fmt for backported nested_utility tests (#23117)
## 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
2 parents c391d68 + 5a1a2a1 commit e0366c9

2 files changed

Lines changed: 8 additions & 29 deletions

File tree

noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,7 @@ impl<let N: u32, let T: u32> CallPrivateOptions<N, T> {
159159
self,
160160
additional_scopes: [AztecAddress; N_2],
161161
) -> CallPrivateOptions<N_2, T> {
162-
CallPrivateOptions {
163-
additional_scopes,
164-
authorized_utility_call_targets: self.authorized_utility_call_targets,
165-
}
162+
CallPrivateOptions { additional_scopes, authorized_utility_call_targets: self.authorized_utility_call_targets }
166163
}
167164

168165
/// Authorizes cross-contract utility calls to the given target contracts during this call.
@@ -173,10 +170,7 @@ impl<let N: u32, let T: u32> CallPrivateOptions<N, T> {
173170
self,
174171
targets: [AztecAddress; T_2],
175172
) -> CallPrivateOptions<N, T_2> {
176-
CallPrivateOptions {
177-
additional_scopes: self.additional_scopes,
178-
authorized_utility_call_targets: targets,
179-
}
173+
CallPrivateOptions { additional_scopes: self.additional_scopes, authorized_utility_call_targets: targets }
180174
}
181175
}
182176

@@ -214,10 +208,7 @@ impl<let S: u32, let T: u32> ViewPrivateOptions<S, T> {
214208
self,
215209
additional_scopes: [AztecAddress; S2],
216210
) -> ViewPrivateOptions<S2, T> {
217-
ViewPrivateOptions {
218-
additional_scopes,
219-
authorized_utility_call_targets: self.authorized_utility_call_targets,
220-
}
211+
ViewPrivateOptions { additional_scopes, authorized_utility_call_targets: self.authorized_utility_call_targets }
221212
}
222213

223214
/// Authorizes cross-contract utility calls to the given target contracts during this call.
@@ -228,10 +219,7 @@ impl<let S: u32, let T: u32> ViewPrivateOptions<S, T> {
228219
self,
229220
targets: [AztecAddress; T_2],
230221
) -> ViewPrivateOptions<S, T_2> {
231-
ViewPrivateOptions {
232-
additional_scopes: self.additional_scopes,
233-
authorized_utility_call_targets: targets,
234-
}
222+
ViewPrivateOptions { additional_scopes: self.additional_scopes, authorized_utility_call_targets: targets }
235223
}
236224
}
237225

@@ -773,10 +761,7 @@ impl TestEnvironment {
773761
/// let contract_addr = env.deploy("SampleContract").without_initializer();
774762
/// let return_value = env.execute_utility(SampleContract::at(contract_addr).sample_utility_function());
775763
/// ```
776-
pub unconstrained fn execute_utility<let M: u32, let N: u32, T>(
777-
self: Self,
778-
call: UtilityCall<M, N, T>,
779-
) -> T
764+
pub unconstrained fn execute_utility<let M: u32, let N: u32, T>(self: Self, call: UtilityCall<M, N, T>) -> T
780765
where
781766
T: Deserialize,
782767
{

noir-projects/noir-contracts/contracts/test/nested_utility_contract/src/test.nr

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,22 @@ unconstrained fn same_contract_utility_call_from_utility_succeeds() {
2424
unconstrained fn same_contract_utility_call_from_private_succeeds() {
2525
let (env, account, addr_a, _) = setup();
2626

27-
let result: Field =
28-
env.call_private(account, NestedUtility::at(addr_a).pow_private(2, 10));
27+
let result: Field = env.call_private(account, NestedUtility::at(addr_a).pow_private(2, 10));
2928
assert_eq(result, 1024);
3029
}
3130

3231
#[test(should_fail_with = "Cross-contract utility call denied")]
3332
unconstrained fn cross_contract_utility_call_from_utility_denied_by_default() {
3433
let (env, _, addr_a, addr_b) = setup();
3534

36-
let _: Field = env.execute_utility(
37-
NestedUtility::at(addr_a).delegate_pow_utility(addr_b, 2, 3),
38-
);
35+
let _: Field = env.execute_utility(NestedUtility::at(addr_a).delegate_pow_utility(addr_b, 2, 3));
3936
}
4037

4138
#[test(should_fail_with = "Cross-contract utility call denied")]
4239
unconstrained fn cross_contract_utility_call_from_private_denied_by_default() {
4340
let (env, account, addr_a, addr_b) = setup();
4441

45-
let _: Field = env.call_private(
46-
account,
47-
NestedUtility::at(addr_a).delegate_pow_private(addr_b, 2, 3),
48-
);
42+
let _: Field = env.call_private(account, NestedUtility::at(addr_a).delegate_pow_private(addr_b, 2, 3));
4943
}
5044

5145
#[test]

0 commit comments

Comments
 (0)