Bläddra i källkod

fix(xc_admin/crank_pythnet_relayer): increase compute unit limit (#1577)

* fix(xc_admin/crank_pythnet_relayer): increase compute unit limit

By default the compute unit limit for a tx is 200k but this is not
enough for all of our instructions. This change adds an instruction
to the pythnet relayer to set it to 1m to make sure all instructions
can be executed without problem.

* fix: address review comments
Ali Behjati 1 år sedan
förälder
incheckning
6e505ac3d8
1 ändrade filer med 6 tillägg och 0 borttagningar
  1. 6 0
      governance/xc_admin/packages/crank_pythnet_relayer/src/index.ts

+ 6 - 0
governance/xc_admin/packages/crank_pythnet_relayer/src/index.ts

@@ -11,6 +11,7 @@ import {
 import {
   AccountMeta,
   Commitment,
+  ComputeBudgetProgram,
   Connection,
   Keypair,
   PublicKey,
@@ -177,6 +178,11 @@ async function run() {
             })
             .remainingAccounts(extraAccountMetas)
             .preInstructions(preInstructions)
+            // Use a high compute unit limit to avoid running out of compute units
+            // as some operations can use a lot of compute units.
+            .postInstructions([
+              ComputeBudgetProgram.setComputeUnitLimit({ units: 1000000 }),
+            ])
             .rpc({ skipPreflight: true });
         } catch (e) {
           if (SKIP_FAILED_REMOTE_INSTRUCTIONS) {