From 5521592d45d60fc2521d88d69d26a20050127902 Mon Sep 17 00:00:00 2001 From: benesjan Date: Thu, 10 Oct 2024 15:40:06 +0000 Subject: [PATCH] last touches --- .../nft_contract/src/test/transfer_to_private.nr | 4 +++- .../contracts/nft_contract/src/test/utils.nr | 8 ++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/noir-projects/noir-contracts/contracts/nft_contract/src/test/transfer_to_private.nr b/noir-projects/noir-contracts/contracts/nft_contract/src/test/transfer_to_private.nr index def5494917f..6b4c8b7b4e0 100644 --- a/noir-projects/noir-contracts/contracts/nft_contract/src/test/transfer_to_private.nr +++ b/noir-projects/noir-contracts/contracts/nft_contract/src/test/transfer_to_private.nr @@ -20,8 +20,10 @@ unconstrained fn transfer_to_private_to_self() { utils::assert_owns_public_nft(env, nft_contract_address, AztecAddress::zero(), token_id); } +/// External orchestration means that the calls to prepare and finalize are not done by the NFT contract. This flow +/// will typically be used by a DEX. #[test] -unconstrained fn transfer_to_private_to_a_different_account() { +unconstrained fn transfer_to_private_external_orchestration() { // Setup without account contracts. We are not using authwits here, so dummy accounts are enough let (env, nft_contract_address, sender, recipient, token_id) = utils::setup_and_mint(/* with_account_contracts */ false); diff --git a/noir-projects/noir-contracts/contracts/nft_contract/src/test/utils.nr b/noir-projects/noir-contracts/contracts/nft_contract/src/test/utils.nr index 46376b342f7..f55c70888f9 100644 --- a/noir-projects/noir-contracts/contracts/nft_contract/src/test/utils.nr +++ b/noir-projects/noir-contracts/contracts/nft_contract/src/test/utils.nr @@ -54,12 +54,8 @@ unconstrained pub fn setup_mint_and_transfer_to_private(with_account_contracts: // We mock the Oracle to return the note randomness such that later on we can manually add the note let _ = OracleMock::mock("getRandomField").returns(note_randomness); - // We prepare the transfer with user being both the sender and the recipient (classical "shield" flow) - let slot_commitment: Field = env.call_private(NFT::at(nft_contract_address).prepare_transfer_to_private(owner, owner)); - - // Finalize the transfer of the NFT - let finalize_transfer_to_private_call_interface = NFT::at(nft_contract_address).finalize_transfer_to_private(minted_token_id, slot_commitment); - env.call_public(finalize_transfer_to_private_call_interface); + // We transfer the public NFT to private. + env.call_private_void(NFT::at(nft_contract_address).transfer_to_private(owner, minted_token_id)); // TODO(#8771): We need to manually add the note because in the partial notes flow `notify_created_note_oracle` // is not called and we don't have a `NoteProcessor` in TXE.