From 9d0056bec6f153637ea5309451a655bdf3639864 Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp Date: Wed, 30 Aug 2023 21:09:48 -0400 Subject: [PATCH 1/4] fix unit bug for provider detail capacity --- api/src/providers/apiNodeProvider.ts | 2 +- deploy-web/src/components/providers/NetworkCapacity.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/providers/apiNodeProvider.ts b/api/src/providers/apiNodeProvider.ts index b2e0a78b6..c07e5941a 100644 --- a/api/src/providers/apiNodeProvider.ts +++ b/api/src/providers/apiNodeProvider.ts @@ -365,7 +365,7 @@ export async function getDeployment(owner: string, dseq: string) { status: x.lease.state, denom: deploymentDenom, monthlyCostAKT: round(monthlyUAKT / 1_000_000, 2), - // TODO Improve + // TODO Improve: Add USDC into calculation monthlyCostUSD: deploymentDenom === "uakt" ? (aktPrice ? round((monthlyUAKT / 1_000_000) * aktPrice, 2) : round(monthlyUAKT / 1_000_000, 2)) : null, cpuUnits: group.group_spec.resources.map((r) => parseInt(r.resources.cpu.units.val) * r.count).reduce((a, b) => a + b, 0), gpuUnits: group.group_spec.resources.map((r) => parseInt(r.resources.gpu?.units?.val) * r.count || 0).reduce((a, b) => a + b, 0), diff --git a/deploy-web/src/components/providers/NetworkCapacity.tsx b/deploy-web/src/components/providers/NetworkCapacity.tsx index 8790f271d..c389b1921 100644 --- a/deploy-web/src/components/providers/NetworkCapacity.tsx +++ b/deploy-web/src/components/providers/NetworkCapacity.tsx @@ -166,7 +166,7 @@ const NetworkCapacity: React.FunctionComponent = ({ Storage - {`${roundDecimal(_activeStorage.value, 2)} ${_activeStorage.unit}`} / {`${roundDecimal(_totalStorage.value, 2)} ${_activeStorage.unit}`} + {`${roundDecimal(_activeStorage.value, 2)} ${_activeStorage.unit}`} / {`${roundDecimal(_totalStorage.value, 2)} ${_totalStorage.unit}`} Date: Thu, 31 Aug 2023 07:57:25 -0400 Subject: [PATCH 2/4] update mainnet v1beta3 --- deploy-web/src/utils/constants.ts | 4 ++-- deploy-web/src/utils/deploymentData/index.ts | 4 ++-- deploy-web/src/utils/proto/index.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deploy-web/src/utils/constants.ts b/deploy-web/src/utils/constants.ts index 285061971..22823dc10 100644 --- a/deploy-web/src/utils/constants.ts +++ b/deploy-web/src/utils/constants.ts @@ -113,7 +113,7 @@ export function setNetworkVersion() { switch (_selectedNetworkId) { case mainnetId: - networkVersion = "v1beta2"; + networkVersion = "v1beta3"; selectedNetworkId = mainnetId; break; case testnetId: @@ -126,7 +126,7 @@ export function setNetworkVersion() { break; default: - networkVersion = "v1beta2"; + networkVersion = "v1beta3"; selectedNetworkId = mainnetId; break; } diff --git a/deploy-web/src/utils/deploymentData/index.ts b/deploy-web/src/utils/deploymentData/index.ts index 0e32c65f2..7ec2cbcb9 100644 --- a/deploy-web/src/utils/deploymentData/index.ts +++ b/deploy-web/src/utils/deploymentData/index.ts @@ -11,7 +11,7 @@ export function initDeploymentData() { switch (selectedNetworkId) { case mainnetId: - deploymentData = v1beta2; + deploymentData = v1beta3; break; case testnetId: deploymentData = v1beta3; @@ -21,7 +21,7 @@ export function initDeploymentData() { break; default: - deploymentData = v1beta2; + deploymentData = v1beta3; break; } } diff --git a/deploy-web/src/utils/proto/index.ts b/deploy-web/src/utils/proto/index.ts index 47b7d04d0..f1b4da686 100644 --- a/deploy-web/src/utils/proto/index.ts +++ b/deploy-web/src/utils/proto/index.ts @@ -9,7 +9,7 @@ export function initProtoTypes() { switch (selectedNetworkId) { case mainnetId: - protoTypes = v1beta2; + protoTypes = v1beta3; break; case testnetId: protoTypes = v1beta3; @@ -19,7 +19,7 @@ export function initProtoTypes() { break; default: - protoTypes = v1beta2; + protoTypes = v1beta3; break; } } From 3f56a279c3e8d38187e2d1e0b2786fb8f2ebfe17 Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp Date: Thu, 31 Aug 2023 08:27:35 -0400 Subject: [PATCH 3/4] removed if testnet --- .../src/components/dashboard/Dashboard.tsx | 63 +++++++++---------- .../components/providers/NetworkCapacity.tsx | 60 +++++++++--------- .../src/components/providers/ProviderList.tsx | 9 +-- .../components/providers/ProviderListRow.tsx | 49 +++++++-------- deploy-web/src/utils/constants.ts | 1 + 5 files changed, 83 insertions(+), 99 deletions(-) diff --git a/deploy-web/src/components/dashboard/Dashboard.tsx b/deploy-web/src/components/dashboard/Dashboard.tsx index 68d589452..9b4dc783d 100644 --- a/deploy-web/src/components/dashboard/Dashboard.tsx +++ b/deploy-web/src/components/dashboard/Dashboard.tsx @@ -27,7 +27,6 @@ import { uaktToAKT } from "@src/utils/priceUtils"; import { BlockRow } from "../blockchain/BlockRow"; import { TransactionRow } from "../blockchain/TransactionRow"; import { useSelectedNetwork } from "@src/utils/networks"; -import { testnetId } from "@src/utils/constants"; interface IDashboardProps { dashboardData: DashboardData; @@ -87,7 +86,7 @@ export const Dashboard: React.FunctionComponent = ({ dashboardD const capacityMemoryDiff = bytesToShrink(dashboardData.networkCapacityStats.now.memory - dashboardData.networkCapacityStats.compare.memory); const capacityStorageDiff = bytesToShrink(dashboardData.networkCapacityStats.now.storage - dashboardData.networkCapacityStats.compare.storage); const selectedNetwork = useSelectedNetwork(); - const statsGridWidth = selectedNetwork.id === testnetId ? 2.4 : 3; + const statsGridWidth = 2.4; return ( <> @@ -212,22 +211,20 @@ export const Dashboard: React.FunctionComponent = ({ dashboardD /> - {selectedNetwork.id === testnetId && ( - - - - GPU - - } - text="Graphics" - graphPath={UrlService.graph(SnapshotsUrlParam.graphics)} - diffNumber={dashboardData.now.activeGPU - dashboardData.compare.activeGPU} - diffPercent={percIncrease(dashboardData.compare.activeGPU, dashboardData.now.activeGPU)} - /> - - )} + + + + GPU + + } + text="Graphics" + graphPath={UrlService.graph(SnapshotsUrlParam.graphics)} + diffNumber={dashboardData.now.activeGPU - dashboardData.compare.activeGPU} + diffPercent={percIncrease(dashboardData.compare.activeGPU, dashboardData.now.activeGPU)} + /> + = ({ dashboardD /> - {selectedNetwork.id === testnetId && ( - - - - GPU - - } - text="Graphics" - graphPath={UrlService.providerGraph(ProviderSnapshotsUrlParam.gpu)} - diffNumber={dashboardData.networkCapacityStats.now.gpu - dashboardData.networkCapacityStats.compare.gpu} - diffPercent={percIncrease(dashboardData.networkCapacityStats.compare.gpu, dashboardData.networkCapacityStats.now.gpu)} - /> - - )} + + + + GPU + + } + text="Graphics" + graphPath={UrlService.providerGraph(ProviderSnapshotsUrlParam.gpu)} + diffNumber={dashboardData.networkCapacityStats.now.gpu - dashboardData.networkCapacityStats.compare.gpu} + diffPercent={percIncrease(dashboardData.networkCapacityStats.compare.gpu, dashboardData.networkCapacityStats.now.gpu)} + /> + = ({ const memoryData = useData(activeMemoryBytes, availableMemoryBytes); const storageData = useData(activeStorageBytes, availableStorageBytes); const pieTheme = usePieTheme(); - const selectedNetwork = useSelectedNetwork(); - const flexBasis = selectedNetwork.id === mainnetId ? "33.3333%" : "25%"; + const flexBasis = "25%"; const _getColor = bar => getColor(bar.id); @@ -97,36 +95,34 @@ const NetworkCapacity: React.FunctionComponent = ({ - {selectedNetwork.id === testnetId && ( - - - GPU - - - {Math.round(activeGPU + pendingGPU)} GPU / {Math.round(totalGPU)} GPU - - - `${roundDecimal(value, 2)} GPU`} - enableArcLinkLabels={false} - arcLabelsSkipAngle={10} - theme={pieTheme} - /> - + + + GPU + + + {Math.round(activeGPU + pendingGPU)} GPU / {Math.round(totalGPU)} GPU + + + `${roundDecimal(value, 2)} GPU`} + enableArcLinkLabels={false} + arcLabelsSkipAngle={10} + theme={pieTheme} + /> - )} + diff --git a/deploy-web/src/components/providers/ProviderList.tsx b/deploy-web/src/components/providers/ProviderList.tsx index c0fa32560..e86b8edda 100644 --- a/deploy-web/src/components/providers/ProviderList.tsx +++ b/deploy-web/src/components/providers/ProviderList.tsx @@ -4,7 +4,6 @@ import { MergedProvider } from "@src/types/provider"; import { CustomTableHeader } from "../shared/CustomTable"; import { ProviderListRow } from "./ProviderListRow"; import { useSelectedNetwork } from "@src/utils/networks"; -import { testnetId } from "@src/utils/constants"; const useStyles = makeStyles()(theme => ({})); @@ -36,11 +35,9 @@ export const ProviderList: React.FunctionComponent = ({ providers }) => { CPU - {selectedNetwork.id === testnetId && ( - - GPU - - )} + + GPU + Memory diff --git a/deploy-web/src/components/providers/ProviderListRow.tsx b/deploy-web/src/components/providers/ProviderListRow.tsx index 4526bfa5f..d2bbfcc86 100644 --- a/deploy-web/src/components/providers/ProviderListRow.tsx +++ b/deploy-web/src/components/providers/ProviderListRow.tsx @@ -15,7 +15,6 @@ import { UrlService } from "@src/utils/urlUtils"; import { FormattedNumber } from "react-intl"; import { Uptime } from "./Uptime"; import { useSelectedNetwork } from "@src/utils/networks"; -import { testnetId } from "@src/utils/constants"; const useStyles = makeStyles()(theme => ({ root: { @@ -38,16 +37,14 @@ export const ProviderListRow: React.FunctionComponent = ({ provider }) => const { classes } = useStyles(); const theme = useTheme(); const router = useRouter(); - const selectedNetwork = useSelectedNetwork(); const { favoriteProviders, updateFavoriteProviders } = useLocalNotes(); const isFavorite = favoriteProviders.some(x => provider.owner === x); const activeCPU = provider.isActive ? provider.activeStats.cpu / 1000 : 0; const pendingCPU = provider.isActive ? provider.pendingStats.cpu / 1000 : 0; const totalCPU = provider.isActive ? (provider.availableStats.cpu + provider.pendingStats.cpu + provider.activeStats.cpu) / 1000 : 0; - const activeGPU = provider.isActive && selectedNetwork.id === testnetId ? provider.activeStats.gpu : 0; - const pendingGPU = provider.isActive && selectedNetwork.id === testnetId ? provider.pendingStats.gpu : 0; - const totalGPU = - provider.isActive && selectedNetwork.id === testnetId ? provider.availableStats.gpu + provider.pendingStats.gpu + provider.activeStats.gpu : 0; + const activeGPU = provider.isActive && provider.activeStats.gpu; + const pendingGPU = provider.isActive && provider.pendingStats.gpu; + const totalGPU = provider.isActive && provider.availableStats.gpu + provider.pendingStats.gpu + provider.activeStats.gpu; const _activeMemory = provider.isActive ? bytesToShrink(provider.activeStats.memory + provider.pendingStats.memory) : null; const _totalMemory = provider.isActive ? bytesToShrink(provider.availableStats.memory + provider.pendingStats.memory + provider.activeStats.memory) : null; const _activeStorage = provider.isActive ? bytesToShrink(provider.activeStats.storage + provider.pendingStats.storage) : null; @@ -133,28 +130,26 @@ export const ProviderListRow: React.FunctionComponent = ({ provider }) => )} - {selectedNetwork.id === testnetId && ( - - {provider.isActive && ( - - {Math.round(activeGPU + pendingGPU)} / {Math.round(totalGPU)} GPU + + {provider.isActive && ( + + {Math.round(activeGPU + pendingGPU)} / {Math.round(totalGPU)} GPU + + } + > + + + {totalGPU > 0 && ( + + - } - > - - - {totalGPU > 0 && ( - - - - )} - - - )} - - )} + )} + + + )} + {provider.isActive && ( diff --git a/deploy-web/src/utils/constants.ts b/deploy-web/src/utils/constants.ts index 22823dc10..05817c713 100644 --- a/deploy-web/src/utils/constants.ts +++ b/deploy-web/src/utils/constants.ts @@ -36,6 +36,7 @@ export const auth0TokenNamespace = "https://cloudmos.io"; export const uAktDenom = "uakt"; // TODO Handle denom for mainnet/testnet/sandbox export const usdcIbcDenom = "ibc/12C6A0C374171B595A0A9E18B83FA09D295FB1F2D8C6DAA3AC28683471752D84"; +export const mainnetUsdcIdbDenom = "ibc/F8D2BEE806C3F969B256416B37FF6E7E0B927F372993114B8E0B9E57DC8CD327"; // Cloudmos fee export const feePercent = 3; From d344c02532b80161cdca30cae2e6e23719d1d132 Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp Date: Thu, 31 Aug 2023 09:11:54 -0400 Subject: [PATCH 4/4] fix manifest version check for update --- deploy-web/src/components/deploymentDetail/ManifestUpdate.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy-web/src/components/deploymentDetail/ManifestUpdate.tsx b/deploy-web/src/components/deploymentDetail/ManifestUpdate.tsx index f1ef9347c..f17d0d584 100644 --- a/deploy-web/src/components/deploymentDetail/ManifestUpdate.tsx +++ b/deploy-web/src/components/deploymentDetail/ManifestUpdate.tsx @@ -130,7 +130,7 @@ export function ManifestUpdate({ deployment, leases, closeManifestEditor }) { const mani = deploymentData.getManifest(doc, true); // If it's actual update, send a transaction, else just send the manifest - if (dd.version !== deployment.version) { + if (Buffer.from(dd.version).toString("base64") !== deployment.version) { const message = TransactionMessageData.getUpdateDeploymentMsg(dd); response = await signAndBroadcastTx([message]); } else {