Skip to content

Commit

Permalink
use megabytes and megabits per second for network
Browse files Browse the repository at this point in the history
  • Loading branch information
shamsartem committed Jan 6, 2025
1 parent b276b16 commit 0605447
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions packages/cli/package/src/lib/chain/conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) };
Expand Down Expand Up @@ -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) };
Expand All @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? {
Expand Down

0 comments on commit 0605447

Please sign in to comment.