Skip to content

Commit

Permalink
Increase CU Limit for VSR simulate Transaction (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xShuk authored Dec 15, 2024
1 parent fdff178 commit 51929df
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions hooks/queries/plugins/vsr.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 51929df

Please sign in to comment.