Преглед изворни кода

[Xc admin] upd permissions remote (#541)

* Checkpoint

* Format

* Checkpoint

* Cleanup

* Bring back Pythtestet
guibescos пре 2 година
родитељ
комит
2e63f9a2c4

+ 4 - 4
governance/xc-admin/packages/xc-admin-frontend/components/ClusterSwitch.tsx

@@ -50,10 +50,10 @@ const ClusterSwitch = ({ light }: { light?: boolean | null }) => {
       name: 'devnet',
     },
     // hide pythtest as its broken
-    // {
-    //   value: 'pythtest',
-    //   name: 'pythtest',
-    // },
+    {
+      value: 'pythtest',
+      name: 'pythtest',
+    },
   ]
 
   return (

+ 15 - 7
governance/xc-admin/packages/xc-admin-frontend/components/tabs/UpdatePermissions.tsx

@@ -20,6 +20,9 @@ import {
   proposeInstructions,
   getMultisigCluster,
   BPF_UPGRADABLE_LOADER,
+  isRemoteCluster,
+  WORMHOLE_ADDRESS,
+  mapKey,
 } from 'xc-admin-common'
 import { ClusterContext } from '../../contexts/ClusterContext'
 import { usePythContext } from '../../contexts/PythContext'
@@ -238,11 +241,16 @@ const UpdatePermissions = () => {
   }
 
   const handleSendProposalButtonClick = () => {
-    if (pythProgramClient && finalPubkeyChanges) {
+    if (pythProgramClient && finalPubkeyChanges && squads) {
       const programDataAccount = PublicKey.findProgramAddressSync(
         [pythProgramClient?.programId.toBuffer()],
         BPF_UPGRADABLE_LOADER
       )[0]
+      const multisigAuthority = squads.getAuthorityPDA(
+        UPGRADE_MULTISIG[getMultisigCluster(cluster)],
+        1
+      )
+
       pythProgramClient?.methods
         .updPermissions(
           new PublicKey(finalPubkeyChanges['Master Authority'].new),
@@ -250,22 +258,22 @@ const UpdatePermissions = () => {
           new PublicKey(finalPubkeyChanges['Security Authority'].new)
         )
         .accounts({
-          upgradeAuthority: squads?.getAuthorityPDA(
-            UPGRADE_MULTISIG[getMultisigCluster(cluster)],
-            1
-          ),
+          upgradeAuthority: isRemoteCluster(cluster)
+            ? mapKey(multisigAuthority)
+            : multisigAuthority,
           programDataAccount,
         })
         .instruction()
         .then(async (instruction) => {
-          if (!isMultisigLoading && squads) {
+          if (!isMultisigLoading) {
             setIsSendProposalButtonLoading(true)
             try {
               const proposalPubkey = await proposeInstructions(
                 squads,
                 UPGRADE_MULTISIG[getMultisigCluster(cluster)],
                 [instruction],
-                false
+                isRemoteCluster(cluster),
+                WORMHOLE_ADDRESS[getMultisigCluster(cluster)]
               )
               toast.success(
                 `Proposal sent! 🚀 Proposal Pubkey: ${proposalPubkey}`