guibescos 2 سال پیش
والد
کامیت
7f54f4226b

+ 19 - 0
governance/xc_admin/packages/xc_admin_common/src/cluster.ts

@@ -27,3 +27,22 @@ export function getMultisigCluster(cluster: PythCluster): Cluster | "localnet" {
       return cluster;
   }
 }
+
+export function getMaximumNumberOfPublishers(cluster: PythCluster) {
+  switch (cluster) {
+    case "mainnet-beta":
+      return 32;
+    case "devnet":
+      return 32;
+    case "testnet":
+      return 32;
+    case "pythnet":
+      return 32;
+    case "pythtest-conformance":
+      return 64;
+    case "pythtest-crosschain":
+      return 64;
+    case "localnet":
+      return 32;
+  }
+}

+ 3 - 1
governance/xc_admin/packages/xc_admin_frontend/components/PermissionDepermissionKey.tsx

@@ -10,6 +10,7 @@ import axios from 'axios'
 import { Fragment, useContext, useEffect, useState } from 'react'
 import toast from 'react-hot-toast'
 import {
+  getMaximumNumberOfPublishers,
   getMultisigCluster,
   isRemoteCluster,
   mapKey,
@@ -144,7 +145,8 @@ const PermissionDepermissionKey = ({
           (selectedAssetType === 'All' ||
             product.metadata.asset_type === selectedAssetType) &&
           ((isPermission &&
-            product.priceAccounts[0].publishers.length < 32 &&
+            product.priceAccounts[0].publishers.length <
+              getMaximumNumberOfPublishers(cluster) &&
             !publisherExists) ||
             (!isPermission && publisherExists))
         ) {

+ 10 - 3
governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx

@@ -21,6 +21,7 @@ import {
   WORMHOLE_ADDRESS,
   PRICE_FEED_OPS_KEY,
   getMessageBufferAddressForPrice,
+  getMaximumNumberOfPublishers,
 } from 'xc_admin_common'
 import { ClusterContext } from '../../contexts/ClusterContext'
 import { useMultisigContext } from '../../contexts/MultisigContext'
@@ -263,10 +264,16 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
       }
     })
 
-    // check that no price account has more than 32 publishers
+    // check that no price account has more than the maximum number of publishers
     Object.keys(jsonParsed).forEach((symbol) => {
-      if (jsonParsed[symbol].priceAccounts[0].publishers.length > 32) {
-        toast.error(`${symbol} has more than 32 publishers.`)
+      const maximumNumberOfPublishers = getMaximumNumberOfPublishers(cluster)
+      if (
+        jsonParsed[symbol].priceAccounts[0].publishers.length >
+        maximumNumberOfPublishers
+      ) {
+        toast.error(
+          `${symbol} has more than ${maximumNumberOfPublishers} publishers.`
+        )
         isValid = false
       }
     })