1

i am trying to execute swap instruction using VersionedTransaction and i'm getting this error.

const messageV0 = new TransactionMessage({
    payerKey: payer.publicKey,
    recentBlockhash: blockhash,
    instructions,
}).compileToV0Message();
const tx = VersionedTransaction(messageV0);
tx.sign([payer]);
const signature = await connection.sendTransaction(tx);

SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Program failed to complete

'Program failed to complete: exceeded maximum number of instructions allowed (200000) at instruction #51147'

1 Answer 1

2

Try increasing the compute limit for the transaction.

Solana cookbook reference: https://solanacookbook.com/references/basic-transactions.html#how-to-change-compute-budget-fee-priority-for-a-transaction

By default the compute budget is the product of 200,000 Compute Units (CU) * number of instructions, with a max of 1.4M CU.

Use ComputeBudgetProgram.setComputeUnitLimit({ units: number }) to set the new compute budget. The value provided will replace the default value. Transactions should request the minimum amount of CU required for execution to maximize throughput, or minimize fees.

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.