Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,12 @@ export function getConfig(params: CoreConfigParams): RawConfig {
products: parsed.productAccountKeys
.filter((key) => {
const keyStr = key.toBase58();
// Only include products that exist and haven't been processed yet
return productRawConfigs[keyStr] && !processedProducts.has(keyStr);
// Only include products that exist, have price accounts, and haven't been processed yet
return (
productRawConfigs[keyStr] &&
productRawConfigs[keyStr].priceAccounts.length > 0 &&
!processedProducts.has(keyStr)
);
})
.map((key) => {
const keyStr = key.toBase58();
Expand Down
31 changes: 26 additions & 5 deletions governance/xc_admin/packages/xc_admin_frontend/hooks/usePyth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,36 @@ export const usePyth = (): PythHookData => {
cluster: cluster as PythCluster,
})

// Verify all accounts were processed
const remainingAccounts = allPythAccounts.filter((account) => {
// Get all account pubkeys from the parsed config
const processedPubkeys = new Set<string>([
...parsedConfig.mappingAccounts.map((acc) => acc.address.toBase58()),
...parsedConfig.mappingAccounts.flatMap((mapping) =>
mapping.products.map((prod) => prod.address.toBase58())
),
...parsedConfig.mappingAccounts.flatMap((mapping) =>
mapping.products.flatMap((prod) =>
prod.priceAccounts.map((price) => price.address.toBase58())
)
),
])

// Find accounts that weren't included in the parsed config
const unprocessedAccounts = allPythAccounts.filter((account) => {
const base = parseBaseData(account.account.data)
return base && base.type !== AccountType.Test
// Skip permission accounts entirely
if (!base || base.type === AccountType.Permission) {
return false
}
return !processedPubkeys.has(account.pubkey.toBase58())
})

if (remainingAccounts.length > 0) {
if (unprocessedAccounts.length > 0) {
console.warn(
`${remainingAccounts.length} accounts were not processed`
`${unprocessedAccounts.length} accounts were not processed:`,
unprocessedAccounts.map((acc) => ({
pubkey: acc.pubkey.toBase58(),
type: parseBaseData(acc.account.data)?.type,
}))
)
}

Expand Down
Loading