# Is it a good pattern to hint notes? (\`Token::redeem\_shield\` example)

**URL:** <https://forum.aztec.network/t/is-it-a-good-pattern-to-hint-notes-token-redeem-shield-example/6168>\
**Category:** General\
**Created:** [October 1, 2024, 1:20pm UTC](https://forum.aztec.network/t/is-it-a-good-pattern-to-hint-notes-token-redeem-shield-example/6168 "2024-10-01T13:20:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skaunov](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.aztec.network/skaunov/32/1792_2.png) [@skaunov](https://forum.aztec.network/u/skaunov)\
**Post date:** [October 1, 2024, 1:20pm UTC](https://forum.aztec.network/t/is-it-a-good-pattern-to-hint-notes-token-redeem-shield-example/6168/1 "2024-10-01T13:20:59Z")

</div>

👋 While doing the Token contract tutorial I wonder what problems would be encountered if `redeem_shield` would be simplified (I see why a `pop_notes` example is wonderful for tutorial, so just asking my question here).

I mean `pending_shields` are filled from the public execution hence it’s not encrypted and available to anyone to see, so it makes sense to find the relevant note (with its `header`) user wants to redeem, load it into the PXE and then just `remove` from the `pending_shields` set privately using the prepared note as the hint.

I still wonder if `remove` even works this way. Intuition tells me it should just fail if the note isn’t in the set, but I’m having trouble to understand [https://github.com/AztecProtocol/aztec-packages/blob/48914ba71039f18d7cea9fca65997c2a6e263b25/noir-projects/aztec-nr/aztec/src/state\_vars/private\_set.nr#L70](https://github.com/AztecProtocol/aztec-packages/blob/48914ba71039f18d7cea9fca65997c2a6e263b25/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr#L70): if my snippet would pass this assertion while de-serializing or not. Also I’m sure I missed something else and would be happy to learn what I’m overlooking.

And all remarks are welcome! Like is it bad to `insert` directly into a balance set, it feels like it shouldn’t hurt it, since I feel it’s just a trait for the token notes. How bad is it to have `U128` inside a note instead of `Field` (anyway it will be checked, and I wonder why not there).

```rust
#[private]
fn redeem_shield(
    secret: Field, to: AztecAddress, 
    // note_the: TransparentNote
    note_content_serialized: [Field; 3]
) {
    let note_the = 
        TransparentNote::deserialize_content(note_content_serialized);
    assert(note_the.secret_hashed == compute_secret_hash(secret));
    let amount = note_the.amount;
    storage.pending_shields.remove(note_the);
    let to_keys = get_public_keys(to);
    storage.balances.at(to).set.insert(&mut TokenNote{
        amount, 
        npk_m_hashed: to_keys.npk_m.hash(), 
        randomness: dep::aztec::oracle::unsafe_rand::unsafe_rand(), header: dep::aztec::prelude::NoteHeader::empty()
    }).emit(encode_and_encrypt_note_with_keys(
        &mut context, 
        get_public_keys(context.msg_sender()).ovpk_m, 
        to_keys.ivpk_m, 
        to
    ));
}

```
