diff --git a/governance/xc_admin/packages/xc_admin_cli/README.md b/governance/xc_admin/packages/xc_admin_cli/README.md index 4a5ff4b3..4b9fdba6 100644 --- a/governance/xc_admin/packages/xc_admin_cli/README.md +++ b/governance/xc_admin/packages/xc_admin_cli/README.md @@ -28,6 +28,6 @@ To activate a transaction: ``` npm install npx lerna run build --scope "xc_admin_common" -npx ts-node src/index.ts activate -t -c -v -w -lda -ldc +npx ts-node src/index.ts activate -t -c -w -lda -ldc ``` diff --git a/governance/xc_admin/packages/xc_admin_common/package.json b/governance/xc_admin/packages/xc_admin_common/package.json index a6773648..303bd7d9 100644 --- a/governance/xc_admin/packages/xc_admin_common/package.json +++ b/governance/xc_admin/packages/xc_admin_common/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@certusone/wormhole-sdk": "^0.9.8", - "@pythnetwork/client": "^2.10.0", + "@pythnetwork/client": "^2.16.0", "@solana/buffer-layout": "^4.0.1", "@solana/web3.js": "^1.73.0", "@sqds/mesh": "^1.0.6", diff --git a/governance/xc_admin/packages/xc_admin_common/src/cluster.ts b/governance/xc_admin/packages/xc_admin_common/src/cluster.ts index 52f5b281..fb7d459b 100644 --- a/governance/xc_admin/packages/xc_admin_common/src/cluster.ts +++ b/governance/xc_admin/packages/xc_admin_common/src/cluster.ts @@ -5,7 +5,11 @@ import { Cluster } from "@solana/web3.js"; * Return whether the cluster is governed remotely or not. For example Pythnet is governed remotely by a mainnet multisig. */ export function isRemoteCluster(cluster: PythCluster) { - return cluster == "pythnet" || cluster == "pythtest"; + return ( + cluster == "pythnet" || + cluster == "pythtest-conformance" || + cluster == "pythtest-crosschain" + ); } /** @@ -15,25 +19,11 @@ export function getMultisigCluster(cluster: PythCluster): Cluster | "localnet" { switch (cluster) { case "pythnet": return "mainnet-beta"; - case "pythtest": + case "pythtest-conformance": + return "devnet"; + case "pythtest-crosschain": return "devnet"; default: return cluster; } } - -/** - * For cluster that are governed remotely (ex : Pythnet from Mainnet) return the network of the remote cluster - */ -export function getRemoteCluster( - cluster: PythCluster -): PythCluster | "localnet" { - switch (cluster) { - case "devnet": - return "pythtest"; - case "mainnet-beta": - return "pythnet"; - default: - return cluster; - } -} diff --git a/governance/xc_admin/packages/xc_admin_common/src/wormhole.ts b/governance/xc_admin/packages/xc_admin_common/src/wormhole.ts index 4655e4f4..d77de39d 100644 --- a/governance/xc_admin/packages/xc_admin_common/src/wormhole.ts +++ b/governance/xc_admin/packages/xc_admin_common/src/wormhole.ts @@ -3,7 +3,12 @@ import { PublicKey } from "@solana/web3.js"; export const WORMHOLE_ADDRESS: Record = { "mainnet-beta": new PublicKey("worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth"), - pythtest: new PublicKey("EUrRARh92Cdc54xrDn6qzaqjA77NRrCcfbr8kPwoTL4z"), + "pythtest-conformance": new PublicKey( + "EUrRARh92Cdc54xrDn6qzaqjA77NRrCcfbr8kPwoTL4z" + ), + "pythtest-crosschain": new PublicKey( + "EUrRARh92Cdc54xrDn6qzaqjA77NRrCcfbr8kPwoTL4z" + ), devnet: new PublicKey("3u8hJUVTA4jH1wYAyUur7FFZVQ8H635K3tSHHF4ssjQ5"), pythnet: new PublicKey("H3fxXJ86ADW2PNuDDmZJg6mzTtPxkYCpNuQUTgmJ7AjU"), localnet: new PublicKey("Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o"), @@ -13,7 +18,8 @@ export const WORMHOLE_ADDRESS: Record = { // Source : https://book.wormhole.com/reference/rpcnodes.html export const WORMHOLE_API_ENDPOINT: Record = { "mainnet-beta": "https://wormhole-v2-mainnet-api.certus.one", - pythtest: "https://wormhole-v2-testnet-api.certus.one", + "pythtest-conformance": "https://wormhole-v2-testnet-api.certus.one", + "pythtest-crosschain": "https://wormhole-v2-testnet-api.certus.one", devnet: "https://wormhole-v2-testnet-api.certus.one", pythnet: "https://wormhole-v2-mainnet-api.certus.one", localnet: undefined, diff --git a/governance/xc_admin/packages/xc_admin_frontend/components/ClusterSwitch.tsx b/governance/xc_admin/packages/xc_admin_frontend/components/ClusterSwitch.tsx index db068eba..279254ab 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/components/ClusterSwitch.tsx +++ b/governance/xc_admin/packages/xc_admin_frontend/components/ClusterSwitch.tsx @@ -49,10 +49,13 @@ const ClusterSwitch = ({ light }: { light?: boolean | null }) => { value: 'devnet', name: 'devnet', }, - // hide pythtest as its broken { - value: 'pythtest', - name: 'pythtest', + value: 'pythtest-conformance', + name: 'pythtest-conformance', + }, + { + value: 'pythtest-crosschain', + name: 'pythtest-crosschain', }, ] diff --git a/governance/xc_admin/packages/xc_admin_frontend/components/tabs/Proposals.tsx b/governance/xc_admin/packages/xc_admin_frontend/components/tabs/Proposals.tsx index fd554af8..d55e74d8 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/components/tabs/Proposals.tsx +++ b/governance/xc_admin/packages/xc_admin_frontend/components/tabs/Proposals.tsx @@ -16,7 +16,6 @@ import { ExecutePostedVaa, getMultisigCluster, getProposals, - getRemoteCluster, MultisigInstruction, MultisigParser, PRICE_FEED_MULTISIG, @@ -581,12 +580,7 @@ const Proposal = ({ className="flex justify-between" >
Target Chain
-
- {instruction.governanceAction.targetChainId === 'pythnet' && - getRemoteCluster(cluster) === 'pythtest' - ? 'pythtest' - : 'pythnet'} -
+
{cluster}
) : null} @@ -775,9 +769,8 @@ const Proposal = ({ {instruction.governanceAction instanceof ExecutePostedVaa ? instruction.governanceAction.instructions.map( (innerInstruction, index) => { - const multisigParser = MultisigParser.fromCluster( - getRemoteCluster(cluster) - ) + const multisigParser = + MultisigParser.fromCluster(cluster) const parsedInstruction = multisigParser.parseInstruction({ programId: innerInstruction.programId, @@ -1123,9 +1116,8 @@ const Proposals = ({ ix.name === 'postMessage' && ix.governanceAction instanceof ExecutePostedVaa && ix.governanceAction.instructions.every((remoteIx) => { - const innerMultisigParser = MultisigParser.fromCluster( - getRemoteCluster(cluster) - ) + const innerMultisigParser = + MultisigParser.fromCluster(cluster) const parsedRemoteInstruction = innerMultisigParser.parseInstruction({ programId: remoteIx.programId, diff --git a/governance/xc_admin/packages/xc_admin_frontend/hooks/useMultisig.ts b/governance/xc_admin/packages/xc_admin_frontend/hooks/useMultisig.ts index 9952e63f..6fb92990 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/hooks/useMultisig.ts +++ b/governance/xc_admin/packages/xc_admin_frontend/hooks/useMultisig.ts @@ -1,5 +1,6 @@ import { Wallet } from '@coral-xyz/anchor' import NodeWallet from '@coral-xyz/anchor/dist/cjs/nodewallet' +import { getPythProgramKeyForCluster } from '@pythnetwork/client' import { useAnchorWallet } from '@solana/wallet-adapter-react' import { AccountMeta, @@ -12,6 +13,7 @@ import SquadsMesh from '@sqds/mesh' import { MultisigAccount, TransactionAccount } from '@sqds/mesh/lib/types' import { useContext, useEffect, useState } from 'react' import { + ExecutePostedVaa, getManyProposalsInstructions, getMultisigCluster, getProposals, @@ -129,7 +131,6 @@ export const useMultisig = (wallet: Wallet): MultisigHookData => { ) try { if (cancelled) return - // DELETE THIS TRY CATCH ONCE THIS MULTISIG EXISTS EVERYWHERE setpriceFeedMultisigAccount( await readOnlySquads.getMultisig( PRICE_FEED_MULTISIG[getMultisigCluster(cluster)] @@ -149,7 +150,6 @@ export const useMultisig = (wallet: Wallet): MultisigHookData => { ) try { if (cancelled) return - // DELETE THIS TRY CATCH ONCE THIS MULTISIG EXISTS EVERYWHERE const sortedPriceFeedMultisigProposals = await getSortedProposals( readOnlySquads, PRICE_FEED_MULTISIG[getMultisigCluster(cluster)] @@ -178,7 +178,14 @@ export const useMultisig = (wallet: Wallet): MultisigHookData => { if ( isRemoteCluster(cluster) && ixs.length > 0 && - ixs.some((ix) => ix instanceof WormholeMultisigInstruction) + ixs.some( + (ix) => + ix instanceof WormholeMultisigInstruction && + ix.governanceAction instanceof ExecutePostedVaa && + ix.governanceAction.instructions.some((ix) => + ix.programId.equals(getPythProgramKeyForCluster(cluster)) + ) + ) ) { proposalsRes.push(sortedPriceFeedMultisigProposals[idx]) instructionsRes.push(ixs) diff --git a/governance/xc_admin/packages/xc_admin_frontend/utils/pythClusterApiUrl.ts b/governance/xc_admin/packages/xc_admin_frontend/utils/pythClusterApiUrl.ts index 42f5fe06..184cd9c0 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/utils/pythClusterApiUrl.ts +++ b/governance/xc_admin/packages/xc_admin_frontend/utils/pythClusterApiUrl.ts @@ -47,7 +47,17 @@ const CLUSTER_URLS: Record = { wsUrl: 'wss://api.testnet.solana.com/', }, ], - pythtest: [ + 'pythtest-conformance': [ + { + rpcUrl: 'http://pythtest.xyz.pyth.network', + wsUrl: 'ws://pythtest.xyz.pyth.network', + }, + { + rpcUrl: 'https://api.pythtest.pyth.network/', + wsUrl: 'wss://api.pythtest.pyth.network/', + }, + ], + 'pythtest-crosschain': [ { rpcUrl: 'http://pythtest.xyz.pyth.network', wsUrl: 'ws://pythtest.xyz.pyth.network', diff --git a/package-lock.json b/package-lock.json index ea22c4b7..cea2ef22 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1384,7 +1384,7 @@ "license": "ISC", "dependencies": { "@certusone/wormhole-sdk": "^0.9.8", - "@pythnetwork/client": "^2.10.0", + "@pythnetwork/client": "^2.16.0", "@solana/buffer-layout": "^4.0.1", "@solana/web3.js": "^1.73.0", "@sqds/mesh": "^1.0.6", @@ -11193,17 +11193,33 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "node_modules/@pythnetwork/client": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.15.0.tgz", - "integrity": "sha512-PTFI0ZWqbDiuiiB2Xx76ZU9PItHPIIQzsEqpbs0N9aumIeVXh6A1m/oZTZ7pRcG4jA9wROmA+GaYQU8UHzpjWA==", + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.16.0.tgz", + "integrity": "sha512-56mNi40k8NPWO5w9v8AcMH7R5tOq/pusGDwUbde9WVEV9Jr3Yuob06mywpjOPzVps8kyL18o45pipzoJbZhsZw==", "dependencies": { "@coral-xyz/anchor": "^0.26.0", + "@coral-xyz/borsh": "^0.26.0", "buffer": "^6.0.1" }, "peerDependencies": { "@solana/web3.js": "^1.30.2" } }, + "node_modules/@pythnetwork/client/node_modules/@coral-xyz/borsh": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.26.0.tgz", + "integrity": "sha512-uCZ0xus0CszQPHYfWAqKS5swS1UxvePu83oOF+TWpUkedsNlg6p2p4azxZNSSqwXb9uXMFgxhuMBX9r3Xoi0vQ==", + "dependencies": { + "bn.js": "^5.1.2", + "buffer-layout": "^1.2.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@solana/web3.js": "^1.68.0" + } + }, "node_modules/@pythnetwork/client/node_modules/buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", @@ -49988,7 +50004,7 @@ }, "target_chains/ethereum/sdk/js": { "name": "@pythnetwork/pyth-evm-js", - "version": "1.13.0", + "version": "1.14.0", "license": "Apache-2.0", "dependencies": { "@pythnetwork/price-service-client": "*", @@ -57892,14 +57908,24 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "@pythnetwork/client": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.15.0.tgz", - "integrity": "sha512-PTFI0ZWqbDiuiiB2Xx76ZU9PItHPIIQzsEqpbs0N9aumIeVXh6A1m/oZTZ7pRcG4jA9wROmA+GaYQU8UHzpjWA==", + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/client/-/client-2.16.0.tgz", + "integrity": "sha512-56mNi40k8NPWO5w9v8AcMH7R5tOq/pusGDwUbde9WVEV9Jr3Yuob06mywpjOPzVps8kyL18o45pipzoJbZhsZw==", "requires": { "@coral-xyz/anchor": "^0.26.0", + "@coral-xyz/borsh": "^0.26.0", "buffer": "^6.0.1" }, "dependencies": { + "@coral-xyz/borsh": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.26.0.tgz", + "integrity": "sha512-uCZ0xus0CszQPHYfWAqKS5swS1UxvePu83oOF+TWpUkedsNlg6p2p4azxZNSSqwXb9uXMFgxhuMBX9r3Xoi0vQ==", + "requires": { + "bn.js": "^5.1.2", + "buffer-layout": "^1.2.0" + } + }, "buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", @@ -91368,7 +91394,7 @@ "version": "file:governance/xc_admin/packages/xc_admin_common", "requires": { "@certusone/wormhole-sdk": "^0.9.8", - "@pythnetwork/client": "^2.10.0", + "@pythnetwork/client": "^2.16.0", "@solana/buffer-layout": "^4.0.1", "@solana/web3.js": "^1.73.0", "@sqds/mesh": "^1.0.6",