Fix: guardian set (#1459)

* Decrease compute budget

* Go

* fix
This commit is contained in:
guibescos 2024-04-16 14:36:24 +01:00 committed by GitHub
parent 70c2c8ec4b
commit d9c85d8f9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 1 deletions

View File

@ -39,6 +39,7 @@ import {
buildEncodedVaaCreateInstruction,
buildWriteEncodedVaaWithSplitInstructions,
getGuardianSetIndex,
overrideGuardianSet,
trimSignatures,
} from "./vaa";
import {
@ -446,6 +447,7 @@ export class PythSolanaReceiver {
encodedVaaAddress: PublicKey;
closeInstructions: InstructionWithEphemeralSigners[];
}> {
vaa = overrideGuardianSet(vaa); // Short term fix Wormhole officially server guardian set 4 vaas
const postInstructions: InstructionWithEphemeralSigners[] = [];
const closeInstructions: InstructionWithEphemeralSigners[] = [];
const encodedVaaKeypair = new Keypair();

View File

@ -13,7 +13,7 @@ export const POST_UPDATE_COMPUTE_BUDGET = 35000;
/**
* A hard-coded budget for the compute units required for the `updatePriceFeed` instruction in the Pyth Push Oracle program.
*/
export const UPDATE_PRICE_FEED_COMPUTE_BUDGET = 190000;
export const UPDATE_PRICE_FEED_COMPUTE_BUDGET = 55000;
/**
* A hard-coded budget for the compute units required for the `initEncodedVaa` instruction in the Wormhole program.
*/

View File

@ -52,6 +52,18 @@ export function trimSignatures(
return trimmedVaa;
}
export const PREVIOUS_GUARDIAN_SET_INDEX = 4;
export const CURRENT_GUARDIAN_SET_INDEX = 4;
export function overrideGuardianSet(vaa: Buffer): Buffer {
let guardianSetIndex = getGuardianSetIndex(vaa);
if (guardianSetIndex <= 3) {
vaa.writeUint32BE(CURRENT_GUARDIAN_SET_INDEX, 1);
}
return vaa;
}
/**
* The start of the VAA bytes in an encoded VAA account. Before this offset, the account contains a header.
*/