1

I have a PD vault account, I transfer some amount of SOL to WSOL token account for this vault and then I try to call the SyncNative instruction that results into err:

  'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]',
  'Program log: Instruction: SyncNative',
  'Program log: Error: IncorrectProgramId',
  'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 884 of 153908 compute units',
  'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: incorrect program id for instruction',
  'Program 7Ppq5s4BFH4uyx3p8y4e33Sp7GL9NCBJeBcrw8ojnY6z consumed 46976 of 200000 compute units',
  'Program 7Ppq5s4BFH4uyx3p8y4e33Sp7GL9NCBJeBcrw8ojnY6z failed: incorrect program id for instruction'

here is a piece of code:

    // Sync the native token to reflect the new SOL balance as wSOL
    let cpi_accounts = token::SyncNative {
        account: wsol_account.to_account_info(),
    };
    let cpi_program = token_program_account.to_account_info();
    let cpi_ctx = CpiContext::new_with_signer(cpi_program, cpi_accounts, vault_signer);
    token::sync_native(cpi_ctx)?;

and here are the accounts I pass the call:

 { pubkey: vault, isSigner: false, isWritable: true },
 { pubkey: signer, isSigner: true, isWritable: true },
 { pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
 { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
 { pubkey: vaultAssociatedTokenAccount, isSigner: false, isWritable: true }

1 Answer 1

2

I finally figured out the problem:

  • I was not initializing the ATA(I assumed it happens automatically when doing a transaction), the owner of the ATA was not the Token Program

  • One more point worth noting is this bug: GitHub Issue, quoting billythedummy:

    I think this means programs cannot do the following basic procedure: transfer lamports to a wSOL token account by directly decrementing lamports from a program owned account SyncNative the wSOL account

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.