-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Description:
from the original logic, you can see:
if token_swap
.check_pool_fee_info(pool_fee_account_info)
.is_ok()
{
Self::token_mint_to(
swap_info.key,
pool_token_program_info.clone(),
pool_mint_info.clone(),
pool_fee_account_info.clone(),
authority_info.clone(),
token_swap.bump_seed(),
to_u64(pool_token_amount)?,
)?;
};which is from here in solana-program-library
it calls a method check_pool_fee_info, this method validates if the account is correct, (like with correct owner, is from pool_mint, is create by the correct token program). But the problem is, it if the account is invalidate it will skip the mint to logic.
The issue:
when the client is calling this instruction, it may incorrectly input a wrong pub key of this pool_fee_account. HOWEVER, as long as the account is invalid it will continue to execute, but it just skips minting pool_token_amount to pool_fee_account!!
This is like I work in a company, I need to provide a bank account to recieve my salary. The company cannot skip paying my salary if something wrong with my bank account. (like I provided the wrong number, wrong spelling of my name, or the bank may suspend my account for some reasons).
Proposed fix
In such case, if the pool_fee_acount is not valid, it should fail the transaction and provide the defailed error message informing the client that this anccount is not correct. I fixed in this anchor implemenation, so I just open this ticket to mark this issue from the original code.