Skip to content

Commit a55edf8

Browse files
authored
fix: check account belong to governance and account is active (#2725)
1 parent 0a388dd commit a55edf8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

governance/xc_admin/packages/xc_admin_cli/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ multisigCommand(
414414
voteAccounts.map((voteAccount: PublicKey) =>
415415
fetchStakeAccounts(
416416
new Connection(getPythClusterApiUrl(cluster)),
417+
authorizedPubkey,
417418
voteAccount,
418419
),
419420
),

governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/SolanaStakingMultisigInstruction.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export class SolanaStakingMultisigInstruction implements MultisigInstruction {
124124

125125
export async function fetchStakeAccounts(
126126
connection: Connection,
127+
staker: PublicKey,
127128
voterAccount: PublicKey,
128129
) {
129130
const stakeAccounts = await connection.getProgramAccounts(
@@ -137,12 +138,24 @@ export async function fetchStakeAccounts(
137138
bytes: bs58.encode(Buffer.from([2, 0, 0, 0])),
138139
},
139140
},
141+
{
142+
memcmp: {
143+
offset: 12,
144+
bytes: staker.toBase58(),
145+
},
146+
},
140147
{
141148
memcmp: {
142149
offset: 124,
143150
bytes: voterAccount.toBase58(),
144151
},
145152
},
153+
{
154+
memcmp: {
155+
offset: 172,
156+
bytes: bs58.encode(Buffer.from("ff".repeat(8), "hex")), // account is active
157+
},
158+
},
146159
],
147160
},
148161
);

0 commit comments

Comments
 (0)