Description
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
withConfidentialTransferInstruction::Deposit
tx2
withConfidentialTransferInstruction::ApplyPendingBalance
tx3
withConfidentialTransferInstruction::Withdraw
You will succesfully be able with withdraw the 10
tokens that were deposited.