Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solana Post VAA improvement #880

Merged
merged 10 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
computedBudget commented
  • Loading branch information
yuli-ferna committed Jun 18, 2024
commit 8ae76088c3bf1e39921b0840ce5d3de80ee321bf
4 changes: 2 additions & 2 deletions src/contexts/SolanaWalletContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {
createInitializeAccountInstruction,
getMinimumBalanceForRentExemptAccount,
} from "@solana/spl-token";
import { addComputeBudget } from "../utils/computeBudget";
//import { addComputeBudget } from "../utils/computeBudget";

export const getWrappedWallets = (): Wallet[] => {
const wallets: SolanaAdapter[] = [
Expand Down Expand Up @@ -205,7 +205,7 @@ export async function transferNativeSol(
tokenBridgeTransferIx,
closeAccountIx
);
await addComputeBudget(connection!, transaction);
//await addComputeBudget(connection!, transaction);
transaction.partialSign(message, ancillaryKeypair);
return transaction;
}
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useHandleRedeem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ import { fromUint8Array } from "js-base64";
import { useSeiWallet } from "../contexts/SeiWalletContext";
import { SeiWallet } from "@xlabs-libs/wallet-aggregator-sei";
import { calculateFeeForContractExecution } from "../utils/sei";
import { addComputeBudget } from "../utils/computeBudget";
//import { addComputeBudget } from "../utils/computeBudget";
import { redeemAndUnwrapOnSolana } from "../utils/redeemAndUnwrap";

async function algo(
Expand Down Expand Up @@ -470,7 +470,7 @@ async function solana(
signedVAA
);

if (!isNative) await addComputeBudget(connection!, transaction);
//if (!isNative) await addComputeBudget(connection!, transaction);
const txid = await signSendAndConfirm(wallet, transaction);
// TODO: didn't want to make an info call we didn't need, can we get the block without it by modifying the above call?
dispatch(setRedeemTx({ id: txid, block: 1 }));
Expand Down
4 changes: 2 additions & 2 deletions src/utils/redeemAndUnwrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
Transaction,
} from "@solana/web3.js";
import { createCompleteTransferNativeInstruction } from "@certusone/wormhole-sdk/lib/esm/solana/tokenBridge";
import { addComputeBudget } from "./computeBudget";
//import { addComputeBudget } from "./computeBudget";

// This is taken from SDKv1 and adds a budget before partial signing
// Setting the budget after partial signing will result in a
Expand Down Expand Up @@ -103,7 +103,7 @@ export async function redeemAndUnwrapOnSolana(
closeAccountIx
);
// Set the compute budget before signing
await addComputeBudget(connection, transaction, undefined, 0.9, 500_000);
//await addComputeBudget(connection, transaction, undefined, 0.9, 500_000);
transaction.partialSign(ancillaryKeypair);
return transaction;
}
6 changes: 3 additions & 3 deletions src/utils/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
SignatureResult,
} from "@solana/web3.js";
import { SolanaWallet } from "@xlabs-libs/wallet-aggregator-solana";
import { addComputeBudget } from "./computeBudget";
//import { addComputeBudget } from "./computeBudget";
export declare type SignTransaction = (
transaction: Transaction
) => Promise<Transaction>;
Expand Down Expand Up @@ -116,7 +116,7 @@ export async function postVaa(

for (const unsignedTransaction of unsignedTransactions) {
unsignedTransaction.feePayer = new PublicKey(payer);
await addComputeBudget(connection, unsignedTransaction, [], 0.75, 1, true);
//await addComputeBudget(connection, unsignedTransaction, [], 0.75, 1, true);
}

const verifySignatures = async (transaction: Transaction) =>
Expand All @@ -143,7 +143,7 @@ export async function postVaa(
}

//While the signature_set is used to create the final instruction, it doesn't need to sign it.
await addComputeBudget(connection, postVaaTransaction, [], 0.75, 1, true);
//await addComputeBudget(connection, postVaaTransaction, [], 0.75, 1, true);
output.push(
await signSendAndConfirmTransaction(
connection,
Expand Down
Loading