From 06054475fd40c7d1dfdf214436f787fe1d0cb3f7 Mon Sep 17 00:00:00 2001 From: Artsiom Shamsutdzinau Date: Mon, 6 Jan 2025 15:35:53 +0100 Subject: [PATCH] use megabytes and megabits per second for network --- packages/cli/package/src/lib/chain/conversions.ts | 13 +++++++------ .../src/lib/configs/project/provider/provider4.ts | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/cli/package/src/lib/chain/conversions.ts b/packages/cli/package/src/lib/chain/conversions.ts index acd92b115..2e4915395 100644 --- a/packages/cli/package/src/lib/chain/conversions.ts +++ b/packages/cli/package/src/lib/chain/conversions.ts @@ -102,8 +102,8 @@ export async function resourceSupplyFromConfigToChain( }; case "bandwidth": return { - supply: Math.round(supply / STORAGE_TO_BYTES), - supplyString: xbytes(supply), + supply: Math.round(supply / BANDWIDTH_TO_BYTES), + supplyString: `${xbytes(supply, { bits: true })}ps`, }; case "ip": return { supply, supplyString: numToStr(supply) }; @@ -132,10 +132,10 @@ export async function resourceSupplyFromChainToConfig( const storageSupply = supply * STORAGE_TO_BYTES; return { supply: storageSupply, supplyString: xbytes(storageSupply) }; case "bandwidth": - const bandwidthSupply = supply * STORAGE_TO_BYTES; + const bandwidthSupply = supply * BANDWIDTH_TO_BYTES; return { supply: bandwidthSupply, - supplyString: xbytes(bandwidthSupply), + supplyString: `${xbytes(bandwidthSupply, { bits: true })}ps`, }; case "ip": return { supply, supplyString: numToStr(supply) }; @@ -147,8 +147,9 @@ export async function resourceSupplyFromChainToConfig( } } -const STORAGE_TO_BYTES = 1_000_000_000; +const STORAGE_TO_BYTES = 1_000_000; // to megabytes +const BANDWIDTH_TO_BYTES = 125_000; // to megabits async function getRamToBytesFromChain() { - return Promise.resolve(1_000_000_000); + return Promise.resolve(1_000_000); } diff --git a/packages/cli/package/src/lib/configs/project/provider/provider4.ts b/packages/cli/package/src/lib/configs/project/provider/provider4.ts index 9e9d16526..4106cdfe8 100644 --- a/packages/cli/package/src/lib/configs/project/provider/provider4.ts +++ b/packages/cli/package/src/lib/configs/project/provider/provider4.ts @@ -776,7 +776,7 @@ export function defaultComputePeerConfig({ details: DEFAULT_STORAGE_DETAILS, }, ], - bandwidth: { name: BANDWIDTH_RESOURCE_NAME, supply: "1 Gb" }, + bandwidth: { name: BANDWIDTH_RESOURCE_NAME, supply: "1 Mb" }, ip: { name: IP_RESOURCE_NAME, ...(resources?.ip ?? {