Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,6 @@ unconstrained fn transfer_to_private_external_orchestration() {
&mut env.public(),
);

// 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.
let private_nfts_recipient_slot =
derive_storage_slot_in_map(NFT::storage_layout().private_nfts.slot, recipient);

env.add_note(
&mut NFTNote {
token_id,
owner: recipient,
randomness: note_randomness,
header: NoteHeader::empty(),
},
private_nfts_recipient_slot,
nft_contract_address,
);

// Recipient should have the note in their private nfts
utils::assert_owns_private_nft(nft_contract_address, recipient, token_id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,6 @@ pub unconstrained fn setup_mint_and_transfer_to_private(
&mut env.private(),
);

// 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.
let private_nfts_owner_slot =
derive_storage_slot_in_map(NFT::storage_layout().private_nfts.slot, owner);

env.add_note(
&mut NFTNote {
token_id: minted_token_id,
owner,
randomness: note_randomness,
header: NoteHeader::empty(),
},
private_nfts_owner_slot,
nft_contract_address,
);

(env, nft_contract_address, owner, recipient, minted_token_id)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,6 @@ unconstrained fn setup_refund_success() {
//`mint_amount - funded_amount`. When completing the refund, we would've constructed a hash corresponding to a note
// worth `funded_amount - transaction_fee`. We "know" the transaction fee was 1 (it is hardcoded in
// `executePublicFunction` TXE oracle) but we need to notify TXE of the note (preimage).
utils::add_token_note(
env,
token_contract_address,
fee_payer,
expected_tx_fee,
fee_payer_randomness,
);
utils::add_token_note(
env,
token_contract_address,
user,
funded_amount - expected_tx_fee,
user_randomness,
);

utils::check_private_balance(token_contract_address, user, mint_amount - expected_tx_fee);
utils::check_private_balance(token_contract_address, fee_payer, expected_tx_fee)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ unconstrained fn transfer_to_private_external_orchestration() {
&mut env.public(),
);

// We need to manually add the note because #8771 has not yet been implemented
utils::add_token_note(
env,
token_contract_address,
recipient,
amount,
note_randomness,
);

// Recipient's private balance should be equal to the amount
utils::check_private_balance(token_contract_address, recipient, amount);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@ pub unconstrained fn mint_to_private(
Token::at(token_contract_address).mint_to_private(from, recipient, amount).call(
&mut env.private(),
);

add_token_note(
env,
token_contract_address,
recipient,
amount,
note_randomness,
);
}

// docs:start:txe_test_read_public
Expand Down Expand Up @@ -130,29 +122,3 @@ pub unconstrained fn check_private_balance(
cheatcodes::set_contract_address(current_contract_address);
}
// docs:end:txe_test_call_unconstrained

// 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.
pub unconstrained fn add_token_note(
env: &mut TestEnvironment,
token_contract_address: AztecAddress,
owner: AztecAddress,
amount: Field,
note_randomness: Field,
) {
// docs:start:txe_test_add_note
let balances_owner_slot =
derive_storage_slot_in_map(Token::storage_layout().balances.slot, owner);

env.add_note(
&mut UintNote {
value: U128::from_integer(amount),
owner: owner,
randomness: note_randomness,
header: NoteHeader::empty(),
},
balances_owner_slot,
token_contract_address,
);
// docs:end:txe_test_add_note
}