Skip to content

Commit 2e63f9a

Browse files
authored
[Xc admin] upd permissions remote (#541)
* Checkpoint * Format * Checkpoint * Cleanup * Bring back Pythtestet
1 parent 6fea30b commit 2e63f9a

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ const ClusterSwitch = ({ light }: { light?: boolean | null }) => {
5050
name: 'devnet',
5151
},
5252
// hide pythtest as its broken
53-
// {
54-
// value: 'pythtest',
55-
// name: 'pythtest',
56-
// },
53+
{
54+
value: 'pythtest',
55+
name: 'pythtest',
56+
},
5757
]
5858

5959
return (

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import {
2020
proposeInstructions,
2121
getMultisigCluster,
2222
BPF_UPGRADABLE_LOADER,
23+
isRemoteCluster,
24+
WORMHOLE_ADDRESS,
25+
mapKey,
2326
} from 'xc-admin-common'
2427
import { ClusterContext } from '../../contexts/ClusterContext'
2528
import { usePythContext } from '../../contexts/PythContext'
@@ -238,34 +241,39 @@ const UpdatePermissions = () => {
238241
}
239242

240243
const handleSendProposalButtonClick = () => {
241-
if (pythProgramClient && finalPubkeyChanges) {
244+
if (pythProgramClient && finalPubkeyChanges && squads) {
242245
const programDataAccount = PublicKey.findProgramAddressSync(
243246
[pythProgramClient?.programId.toBuffer()],
244247
BPF_UPGRADABLE_LOADER
245248
)[0]
249+
const multisigAuthority = squads.getAuthorityPDA(
250+
UPGRADE_MULTISIG[getMultisigCluster(cluster)],
251+
1
252+
)
253+
246254
pythProgramClient?.methods
247255
.updPermissions(
248256
new PublicKey(finalPubkeyChanges['Master Authority'].new),
249257
new PublicKey(finalPubkeyChanges['Data Curation Authority'].new),
250258
new PublicKey(finalPubkeyChanges['Security Authority'].new)
251259
)
252260
.accounts({
253-
upgradeAuthority: squads?.getAuthorityPDA(
254-
UPGRADE_MULTISIG[getMultisigCluster(cluster)],
255-
1
256-
),
261+
upgradeAuthority: isRemoteCluster(cluster)
262+
? mapKey(multisigAuthority)
263+
: multisigAuthority,
257264
programDataAccount,
258265
})
259266
.instruction()
260267
.then(async (instruction) => {
261-
if (!isMultisigLoading && squads) {
268+
if (!isMultisigLoading) {
262269
setIsSendProposalButtonLoading(true)
263270
try {
264271
const proposalPubkey = await proposeInstructions(
265272
squads,
266273
UPGRADE_MULTISIG[getMultisigCluster(cluster)],
267274
[instruction],
268-
false
275+
isRemoteCluster(cluster),
276+
WORMHOLE_ADDRESS[getMultisigCluster(cluster)]
269277
)
270278
toast.success(
271279
`Proposal sent! 🚀 Proposal Pubkey: ${proposalPubkey}`

0 commit comments

Comments
 (0)