I realized the issue:
- I did not pass the system_program into instruction.
pub system_program: Program<'info, System>
- Need to use invoke_signed to also let pda to sign
invoke_signed(
&create_acc_ix,
&[
self.minter.clone(),
self.mint_pda_acc.clone(),
],
&[&[ &mint_seed.as_ref(), &[*bump_seed] ]]
)?;
solved Solana CPI (runtime) invoke fails when creating a new account by system_instruction::create_account (on-chain program with anchor framework)