Overview
If a transaction is submitted which contains a ConfidentialTransferInstruction::Deposit instruction 1, and ConfidentialTransferInstruction::ApplyPendingBalance instruction 2, then the relationship between Available Balance and Decryptable Available Balance is corrupted, resulting in "lost" funds.
I'm not sure if the funds are truly lost, however the amount of tokens that were deposited in ConfidentialTransferInstruction::Deposit are deducted from the token account's non confidential balance, but subsequently not made available as the confidential balance.
For example if your non confidential balance is 100, and you submit tx1 which contains a ConfidentialTransferInstruction::Deposit instruction for 10 tokens, and a ConfidentialTransferInstruction::ApplyPendingBalance, once the transaction is finalized your non confidential balance will now be 90.
If you then submit tx2 which contains a ConfidentialTransferInstruction::Withdraw for 10 tokens, the transaction will fail with an error InsufficientFunds.
If however you broke tx1 into two separate transactions:
tx1 with ConfidentialTransferInstruction::Deposit
tx2 with ConfidentialTransferInstruction::ApplyPendingBalance
tx3 with ConfidentialTransferInstruction::Withdraw
You will succesfully be able with withdraw the 10 tokens that were deposited.
Overview
If a transaction is submitted which contains a
ConfidentialTransferInstruction::Depositinstruction1, andConfidentialTransferInstruction::ApplyPendingBalanceinstruction2, then the relationship betweenAvailable BalanceandDecryptable Available Balanceis corrupted, resulting in "lost" funds.I'm not sure if the funds are truly lost, however the amount of tokens that were deposited in
ConfidentialTransferInstruction::Depositare deducted from the token account's non confidential balance, but subsequently not made available as the confidential balance.For example if your non confidential balance is
100, and you submittx1which contains aConfidentialTransferInstruction::Depositinstruction for10tokens, and aConfidentialTransferInstruction::ApplyPendingBalance, once the transaction is finalized your non confidential balance will now be90.If you then submit
tx2which contains aConfidentialTransferInstruction::Withdrawfor 10 tokens, the transaction will fail with an errorInsufficientFunds.If however you broke
tx1into two separate transactions:tx1withConfidentialTransferInstruction::Deposittx2withConfidentialTransferInstruction::ApplyPendingBalancetx3withConfidentialTransferInstruction::WithdrawYou will succesfully be able with withdraw the
10tokens that were deposited.