Skip to content
This repository was archived by the owner on Jul 10, 2026. It is now read-only.

Commit d6dfc3a

Browse files
authored
Merge branch 'dev' into feat/403
2 parents e5d2abc + 4ae194b commit d6dfc3a

4 files changed

Lines changed: 27 additions & 29 deletions

File tree

src/escrow_contract/src/test/test_logic_contract/src/test/withdraw.nr

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
use crate::test::utils as logic_utils;
22
use crate::TestLogic;
3+
use aztec::test::helpers::test_environment::CallPrivateOptions;
34
use escrow_contract::test::utils as escrow_utils;
45
use token::{test::utils as token_utils, Token};
56

6-
// TODO (reenable test): TXE scope enforcement means only the `from` address's notes are accessible during
7-
// private execution. The escrow's token notes are not in scope when called from the logic contract.
8-
// The TS tests handle this via `additionalScopes: [escrow.address]`, but TXE doesn't support it yet.
9-
// See: https://github.com/AztecProtocol/aztec-packages/blob/v4.2.0-aztecnr-rc.2/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr#L953-L954
10-
#[allow(dead_code)]
7+
#[test]
118
unconstrained fn withdraw_success() {
129
let (mut env, token, _owner, recipient, minter) = token_utils::setup_with_minter(false);
1310

@@ -23,7 +20,11 @@ unconstrained fn withdraw_success() {
2320
token_utils::check_private_balance(env, token, escrow, amount);
2421

2522
let caller = env.create_light_account();
26-
env.call_private(caller, TestLogic::at(logic).withdraw(escrow, recipient, token, amount));
23+
env.call_private_opts(
24+
caller,
25+
CallPrivateOptions::new().with_additional_scopes([escrow]),
26+
TestLogic::at(logic).withdraw(escrow, recipient, token, amount),
27+
);
2728

2829
// Check recipient got tokens
2930
token_utils::check_private_balance(env, token, recipient, amount);

src/escrow_contract/src/test/test_logic_contract/src/test/withdraw_nft.nr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
use crate::test::utils as logic_utils;
22
use crate::TestLogic;
3-
use aztec::test::helpers::test_environment::TestEnvironment;
3+
use aztec::test::helpers::test_environment::{CallPrivateOptions, TestEnvironment};
44
use escrow_contract::test::utils as escrow_utils;
55
use nft::{NFT, test::utils as nft_utils};
66

7-
// TODO (reenable test): TXE scope enforcement means only the `from` address's notes are accessible during
8-
// private execution. The escrow's NFT notes are not in scope when called from the logic contract.
9-
// The TS tests handle this via `additionalScopes: [escrow.address]`, but TXE doesn't support it yet.
10-
// See: https://github.com/AztecProtocol/aztec-packages/blob/v4.2.0-aztecnr-rc.2/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr#L953-L954
11-
#[allow(dead_code)]
7+
#[test]
128
unconstrained fn withdraw_nft_success() {
139
let mut env = TestEnvironment::new();
1410
let owner = env.create_light_account();
@@ -29,7 +25,11 @@ unconstrained fn withdraw_nft_success() {
2925
nft_utils::assert_owns_private_nft(env, nft, escrow, token_id);
3026

3127
let caller = env.create_light_account();
32-
env.call_private(caller, TestLogic::at(logic).withdraw_nft(escrow, recipient, nft, token_id));
28+
env.call_private_opts(
29+
caller,
30+
CallPrivateOptions::new().with_additional_scopes([escrow]),
31+
TestLogic::at(logic).withdraw_nft(escrow, recipient, nft, token_id),
32+
);
3333

3434
// Check recipient got NFT
3535
nft_utils::assert_owns_private_nft(env, nft, recipient, token_id);

src/escrow_contract/src/test/withdraw.nr

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
use crate::Escrow;
22
use crate::test::utils as escrow_utils;
3+
use aztec::test::helpers::test_environment::CallPrivateOptions;
34
use token::{test::utils as token_utils, Token};
45

5-
// TODO (reenable test): TXE scope enforcement means only the `from` address's notes are accessible during
6-
// private execution. The escrow's token notes are not in scope when called from logic_contract_address.
7-
// The TS tests handle this via `additionalScopes: [escrow.address]`, but TXE doesn't support it yet.
8-
// See: https://github.com/AztecProtocol/aztec-packages/blob/v4.2.0-aztecnr-rc.2/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr#L953-L954
9-
#[allow(dead_code)]
6+
#[test]
107
unconstrained fn escrow_withdraw_success() {
118
let escrow_secret: Field = 123456;
129
let (mut env, escrow_contract_address, token_contract_address, _, _, recipient, minter, logic_contract_address) =
@@ -27,17 +24,17 @@ unconstrained fn escrow_withdraw_success() {
2724
amount,
2825
);
2926

30-
env.call_private(
27+
env.call_private_opts(
3128
logic_contract_address,
29+
CallPrivateOptions::new().with_additional_scopes([escrow_contract_address]),
3230
Escrow::at(escrow_contract_address).withdraw(token_contract_address, amount, recipient),
3331
);
3432

3533
// Check recipient got tokens
3634
token_utils::check_private_balance(env, token_contract_address, recipient, amount);
3735
}
3836

39-
// TODO (reenable test): same TXE scope enforcement issue as escrow_withdraw_success (see comment above).
40-
#[allow(dead_code)]
37+
#[test]
4138
unconstrained fn escrow_withdraw_twice_success() {
4239
let escrow_secret: Field = 123456;
4340
let (mut env, escrow_contract_address, token_contract_address, _, _, recipient, minter, logic_contract_address) =
@@ -60,8 +57,9 @@ unconstrained fn escrow_withdraw_twice_success() {
6057

6158
let amount: u128 = token_utils::mint_amount;
6259
// Partial withdrawal
63-
env.call_private(
60+
env.call_private_opts(
6461
logic_contract_address,
62+
CallPrivateOptions::new().with_additional_scopes([escrow_contract_address]),
6563
Escrow::at(escrow_contract_address).withdraw(token_contract_address, amount, recipient),
6664
);
6765

@@ -75,8 +73,9 @@ unconstrained fn escrow_withdraw_twice_success() {
7573
);
7674

7775
// Complete withdrawal
78-
env.call_private(
76+
env.call_private_opts(
7977
logic_contract_address,
78+
CallPrivateOptions::new().with_additional_scopes([escrow_contract_address]),
8079
Escrow::at(escrow_contract_address).withdraw(token_contract_address, amount, recipient),
8180
);
8281

src/escrow_contract/src/test/withdraw_nft.nr

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
use crate::Escrow;
22
use crate::test::utils as escrow_utils;
3+
use aztec::test::helpers::test_environment::CallPrivateOptions;
34
use nft::{NFT, test::utils as nft_utils};
45

5-
// TODO (reenable test): TXE scope enforcement means only the `from` address's notes are accessible during
6-
// private execution. The escrow's NFT notes are not in scope when called from logic_contract_address.
7-
// The TS tests handle this via `additionalScopes: [escrow.address]`, but TXE doesn't support it yet.
8-
// See: https://github.com/AztecProtocol/aztec-packages/blob/v4.2.0-aztecnr-rc.2/noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr#L953-L954
9-
#[allow(dead_code)]
6+
#[test]
107
unconstrained fn escrow_withdraw_nft_success() {
118
let escrow_secret: Field = 123456;
129
let (mut env, escrow_contract_address, _, nft_contract_address, _, recipient, minter, logic_contract_address) =
@@ -27,8 +24,9 @@ unconstrained fn escrow_withdraw_nft_success() {
2724
token_id,
2825
);
2926

30-
env.call_private(
27+
env.call_private_opts(
3128
logic_contract_address,
29+
CallPrivateOptions::new().with_additional_scopes([escrow_contract_address]),
3230
Escrow::at(escrow_contract_address).withdraw_nft(nft_contract_address, token_id, recipient),
3331
);
3432

0 commit comments

Comments
 (0)