From 18c079df4ec6a342e0f1cc364589f857b387c782 Mon Sep 17 00:00:00 2001 From: Tejas Badadare Date: Mon, 21 Jul 2025 10:00:55 -0700 Subject: [PATCH 1/2] feat(governance,xc_admin): add fogo testnet --- .../remote_executor/programs/remote-executor/Cargo.toml | 7 ++++--- .../remote-executor/src/state/governance_payload.rs | 4 ++++ .../programs/remote-executor/src/state/posted_vaa.rs | 1 + governance/xc_admin/packages/xc_admin_common/src/chains.ts | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/governance/remote_executor/programs/remote-executor/Cargo.toml b/governance/remote_executor/programs/remote-executor/Cargo.toml index 900299be31..d212422856 100644 --- a/governance/remote_executor/programs/remote-executor/Cargo.toml +++ b/governance/remote_executor/programs/remote-executor/Cargo.toml @@ -30,13 +30,14 @@ sonic_testnet = [] atlas_testnet = [] mantis_mainnet = [] sonic_mainnet = [] +fogo_testnet = [] [dependencies] -anchor-lang = {version = "0.30.1", features = ["init-if-needed"]} -wormhole-solana = { git = "https://github.com/guibescos/wormhole-solana", rev="f14b3b54c1e37e1aaf8c2ac2a5e236832ffdb3c2"} +anchor-lang = { version = "0.30.1", features = ["init-if-needed"] } +wormhole-solana = { git = "https://github.com/guibescos/wormhole-solana", rev = "f14b3b54c1e37e1aaf8c2ac2a5e236832ffdb3c2" } wormhole-sdk = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1" } -serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1"} +serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1" } boolinator = "2.4.0" [dev-dependencies] diff --git a/governance/remote_executor/programs/remote-executor/src/state/governance_payload.rs b/governance/remote_executor/programs/remote-executor/src/state/governance_payload.rs index ec74f34fa3..963e36aa25 100644 --- a/governance/remote_executor/programs/remote-executor/src/state/governance_payload.rs +++ b/governance/remote_executor/programs/remote-executor/src/state/governance_payload.rs @@ -19,6 +19,7 @@ pub const CHAIN_ID_ARRAY: &[(&str, u16)] = &[ ("atlas_testnet", 40007), ("mantis_mainnet", 40008), ("sonic_mainnet", 40009), + ("fogo_testnet", 40010), ]; #[cfg(any(feature = "pythnet", feature = "pythtest"))] @@ -51,6 +52,9 @@ pub const CHAIN_ID: u16 = 40008; #[cfg(feature = "sonic_mainnet")] pub const CHAIN_ID: u16 = 40009; +#[cfg(feature = "fogo_testnet")] +pub const CHAIN_ID: u16 = 40010; + #[derive(AnchorDeserialize, AnchorSerialize, Debug, PartialEq, Eq)] pub struct ExecutorPayload { pub header: GovernanceHeader, diff --git a/governance/remote_executor/programs/remote-executor/src/state/posted_vaa.rs b/governance/remote_executor/programs/remote-executor/src/state/posted_vaa.rs index 02747af01d..c987c1dadd 100644 --- a/governance/remote_executor/programs/remote-executor/src/state/posted_vaa.rs +++ b/governance/remote_executor/programs/remote-executor/src/state/posted_vaa.rs @@ -26,6 +26,7 @@ impl Owner for AnchorVaa { feature = "atlas_testnet", feature = "mantis_mainnet", feature = "sonic_mainnet", + feature = "fogo_testnet", ))] fn owner() -> Pubkey { Pubkey::from_str("HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ").unwrap() diff --git a/governance/xc_admin/packages/xc_admin_common/src/chains.ts b/governance/xc_admin/packages/xc_admin_common/src/chains.ts index 70439d8042..147e15d061 100644 --- a/governance/xc_admin/packages/xc_admin_common/src/chains.ts +++ b/governance/xc_admin/packages/xc_admin_common/src/chains.ts @@ -33,6 +33,7 @@ export const RECEIVER_CHAINS = { atlas_testnet: 40007, mantis_mainnet: 40008, sonic_mainnet: 40009, + fogo_testnet: 40010, cronos: 60001, kcc: 60002, From 22fe03f7e8d62833c7b4900a7c6004d037c3473d Mon Sep 17 00:00:00 2001 From: Tejas Badadare Date: Mon, 21 Jul 2025 12:08:18 -0700 Subject: [PATCH 2/2] fix(pyth_solana_receiver): improve VAA split handling --- .../sdk/js/pyth_solana_receiver/package.json | 2 +- .../sdk/js/pyth_solana_receiver/src/vaa.ts | 62 ++++++++++--------- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/target_chains/solana/sdk/js/pyth_solana_receiver/package.json b/target_chains/solana/sdk/js/pyth_solana_receiver/package.json index 7f32568be0..8f4e4bf2a2 100644 --- a/target_chains/solana/sdk/js/pyth_solana_receiver/package.json +++ b/target_chains/solana/sdk/js/pyth_solana_receiver/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/pyth-solana-receiver", - "version": "0.10.1", + "version": "0.10.2", "description": "Pyth solana receiver SDK", "homepage": "https://pyth.network", "main": "lib/index.js", diff --git a/target_chains/solana/sdk/js/pyth_solana_receiver/src/vaa.ts b/target_chains/solana/sdk/js/pyth_solana_receiver/src/vaa.ts index da4eb7ccce..bad88f630c 100644 --- a/target_chains/solana/sdk/js/pyth_solana_receiver/src/vaa.ts +++ b/target_chains/solana/sdk/js/pyth_solana_receiver/src/vaa.ts @@ -133,35 +133,39 @@ async function generateVaaInstructionGroups( // Second write and verify instructions const writeSecondPartAndVerifyInstructions: InstructionWithEphemeralSigners[] = - [ - { - instruction: await wormhole.methods - .writeEncodedVaa({ - index: VAA_SPLIT_INDEX, - data: vaa.subarray(VAA_SPLIT_INDEX), - }) - .accounts({ - draftVaa: encodedVaaKeypair.publicKey, - }) - .instruction(), - signers: [], - computeUnits: WRITE_ENCODED_VAA_COMPUTE_BUDGET, - }, - { - instruction: await wormhole.methods - .verifyEncodedVaaV1() - .accounts({ - guardianSet: getGuardianSetPda( - getGuardianSetIndex(vaa), - wormhole.programId, - ), - draftVaa: encodedVaaKeypair.publicKey, - }) - .instruction(), - signers: [], - computeUnits: VERIFY_ENCODED_VAA_COMPUTE_BUDGET, - }, - ]; + []; + + // The second write instruction is only needed if there are more bytes past the split index in the VAA + if (vaa.length > VAA_SPLIT_INDEX) { + writeSecondPartAndVerifyInstructions.push({ + instruction: await wormhole.methods + .writeEncodedVaa({ + index: VAA_SPLIT_INDEX, + data: vaa.subarray(VAA_SPLIT_INDEX), + }) + .accounts({ + draftVaa: encodedVaaKeypair.publicKey, + }) + .instruction(), + signers: [], + computeUnits: WRITE_ENCODED_VAA_COMPUTE_BUDGET, + }); + } + + writeSecondPartAndVerifyInstructions.push({ + instruction: await wormhole.methods + .verifyEncodedVaaV1() + .accounts({ + guardianSet: getGuardianSetPda( + getGuardianSetIndex(vaa), + wormhole.programId, + ), + draftVaa: encodedVaaKeypair.publicKey, + }) + .instruction(), + signers: [], + computeUnits: VERIFY_ENCODED_VAA_COMPUTE_BUDGET, + }); // Close instructions const closeInstructions: InstructionWithEphemeralSigners[] = [