From 7b8ce7e20c656bc75bcae870b9c7373a725ddcbf Mon Sep 17 00:00:00 2001 From: Utkarsh <83659045+0xShuk@users.noreply.github.com> Date: Mon, 16 Dec 2024 00:01:35 +0530 Subject: [PATCH] Increase CU Limit for VSR simulate Transaction --- hooks/queries/plugins/vsr.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hooks/queries/plugins/vsr.ts b/hooks/queries/plugins/vsr.ts index 14bacac08..938178696 100644 --- a/hooks/queries/plugins/vsr.ts +++ b/hooks/queries/plugins/vsr.ts @@ -1,5 +1,5 @@ import { BN, EventParser, Program } from '@coral-xyz/anchor' -import { PublicKey, Transaction, Connection } from '@solana/web3.js' +import { PublicKey, Transaction, Connection, ComputeBudgetProgram } from '@solana/web3.js' import { SIMULATION_WALLET } from '@tools/constants' import { getRegistrarPDA, getVoterPDA } from 'VoteStakeRegistry/sdk/accounts' import { fetchRealmByPubkey, useRealmQuery } from '../realm' @@ -202,13 +202,17 @@ const voterPowerLogQueryFn = async ( depositEntryBegin = 0, depositEntryCount = 0 ) => { + const increaseCuIx = ComputeBudgetProgram.setComputeUnitLimit({ + units: 1_400_000, + }); + const ix = await program.methods .logVoterInfo(depositEntryBegin, depositEntryCount) .accounts({ registrar, voter }) .instruction() const transaction = new Transaction({ feePayer: new PublicKey(SIMULATION_WALLET), - }).add(ix) + }).add(increaseCuIx, ix) const sim = await connection.simulateTransaction(transaction) const parser = new EventParser(program.programId, program.coder) if (sim.value.logs === null) {