Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix humanUnits for hostd using 1e7 for millions #466

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading