Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions scripts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ async function initializeVault(
systemProgram: SystemProgram.programId,
})
.signers([conditionalOnFinalizeKP, conditionalOnRevertKP])
.preInstructions([
ComputeBudgetProgram.setComputeUnitLimit({
units: 150_000
}),
ComputeBudgetProgram.setComputeUnitPrice({
microLamports: 100
}),
])
.postInstructions([addMetadataToConditionalTokensIx])
.rpc();

Expand Down Expand Up @@ -403,13 +411,17 @@ export async function initializeProposal(
daoTreasury
);

const cuIx = ComputeBudgetProgram.setComputeUnitPrice({
const cuPriceIx = ComputeBudgetProgram.setComputeUnitPrice({
microLamports: 100,
});
const cuLimitIx = ComputeBudgetProgram.setComputeUnitLimit({
units: 150_000
});

let tx1 = new Transaction();
tx1.add(...passMarketInstructions);
tx1.add(cuIx);
tx1.add(cuPriceIx);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the compute budget program instructions get called after the pass market instructions? Does it matter what order the instructions get called in. Only asking because in an early function they're added as preInstructions.

tx1.add(cuLimitIx);

let blockhash = await provider.connection.getLatestBlockhash();
tx1.recentBlockhash = blockhash.blockhash;
Expand Down Expand Up @@ -451,7 +463,8 @@ export async function initializeProposal(

let tx = new Transaction();
tx.add(...openbookFailMarketIx[0]);
tx.add(cuIx);
tx.add(cuPriceIx);
tx.add(cuLimitIx);

blockhash = await provider.connection.getLatestBlockhash();
tx.recentBlockhash = blockhash.blockhash;
Expand Down Expand Up @@ -480,6 +493,8 @@ export async function initializeProposal(
twapMarket: openbookTwapFailMarket,
})
.instruction(),
cuPriceIx,
cuLimitIx,
])
.accounts({
proposal: proposalKeypair.publicKey,
Expand Down