Corner case description:
a) When a CPI error occurs, the entire transaction is aborted immediately, which may cause potential state inconsistency.
b) The probability of a subtract operation failure is much lower than the failure of the transfer CPI call.
c) Subtract balance after successful transfer may be better since we can't really handle the error from invoke or invoke_signed.
Proposed solution: swap the execution order of balance subtract and transfer CPI
Corner case description: a) When a CPI error occurs, the entire transaction is aborted immediately, which may cause potential state inconsistency. b) The probability of a subtract operation failure is much lower than the failure of the transfer CPI call. c) Subtract balance after successful transfer may be better since we can't really handle the error from invoke or invoke_signed.
Proposed solution: swap the execution order of balance subtract and transfer CPI