11use crate::Escrow ;
22use crate::test::utils as escrow_utils ;
3+ use aztec::test::helpers::test_environment::CallPrivateOptions ;
34use 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]
107unconstrained 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]
4138unconstrained 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
0 commit comments