Skip to content

Commit

Permalink
fix: hostd base and sector rpc prices being off by 10
Browse files Browse the repository at this point in the history
  • Loading branch information
iuri-gg authored and alexfreska committed Jan 16, 2024
1 parent 07134e6 commit 2300865
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 36 deletions.
5 changes: 5 additions & 0 deletions .changeset/great-flowers-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hostd': patch
---

Fixed an issue where the base RPC and sector access price calculation was off by 10.
8 changes: 4 additions & 4 deletions apps/hostd/contexts/config/transform.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ describe('data transforms', () => {
netAddress: 'tabo.zen.sia.tech:9882',
maxContractDuration: 25920,
contractPrice: '200000000000000000000000',
baseRPCPrice: '100000000000000000',
sectorAccessPrice: '100000000000000000',
baseRPCPrice: '1000000000000000000',
sectorAccessPrice: '1000000000000000000',
collateralMultiplier: 2,
maxCollateral: '1000000000000000000000000000',
storagePrice: '10526559048',
Expand Down Expand Up @@ -112,8 +112,8 @@ describe('data transforms', () => {
netAddress: 'tabo.zen.sia.tech:9882',
maxContractDuration: 25920,
contractPrice: '200000000000000000000000',
baseRPCPrice: '100000000000000000',
sectorAccessPrice: '100000000000000000',
baseRPCPrice: '1000000000000000000',
sectorAccessPrice: '1000000000000000000',
collateralMultiplier: 2,
maxCollateral: '1000000000000000000000000000',
storagePrice: '11574074074',
Expand Down
4 changes: 2 additions & 2 deletions apps/hostd/lib/humanUnits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ export function humanStoragePrice(val: BigNumber | string | number): BigNumber {

export const humanBaseRpcPriceSuffix = '/million'
export function humanBaseRpcPrice(val: BigNumber | string | number): BigNumber {
return new BigNumber(val).times(1e7) // per PRC to per million RPCs
return new BigNumber(val).times(1e6) // per RPC to per million RPCs
}

export const humanSectorAccessPriceSuffix = '/million'
export function humanSectorAccessPrice(
val: BigNumber | string | number
): BigNumber {
return new BigNumber(val).times(1e7) // per 1 access to per million access
return new BigNumber(val).times(1e6) // per 1 access to per million access
}

export const humanCollateralPriceSuffix = '/TB/month'
Expand Down
60 changes: 30 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2300865

Please sign in to comment.