Skip to content
This repository has been archived by the owner. It is now read-only.

Calculation for estimated storage is incorrect #775

Closed
mtlynch opened this issue Mar 22, 2018 · 2 comments
Closed

Calculation for estimated storage is incorrect #775

mtlynch opened this issue Mar 22, 2018 · 2 comments
Assignees
Labels

Comments

@mtlynch
Copy link

@mtlynch mtlynch commented Mar 22, 2018

Sia-UI estimates the storage capacity based on the allowance:

image

The calculation is here:

const estimate = new BigNumber(SiaAPI.siacoinsToHastings(action.funds)).dividedBy(response.storageterabytemonth).times(1e12)
yield put(actions.setStorageEstimate('~' + readableFilesize(estimate.toPrecision(1))))

This calculation is essentially:

[allowance] / [storage_per_tb_per_month]

This is incorrect as it neglects upload cost and contract fees. It also misuses the storage price as the price per TB per contract period when it is actually the price per TB per month. The actual calculation requires Sia-UI to solve for tb_count in this equation:

allowance = (storage_per_tb_per_month * tb_count * months_per_contract) +
  (upload_per_tb * tb_count) +
  (contract_fees)
@DavidVorick
Copy link
Member

@DavidVorick DavidVorick commented Jun 30, 2018

don't know how this slipped through for so many months, this is an easy fix. @eddiewang

@eddiewang
Copy link
Contributor

@eddiewang eddiewang commented Jul 2, 2018

Thanks for the equation @mtlynch - i went ahead and implemented that into PR #800. Feel free to give it a glance to see if it makes sense. From my testing, the numbers look right.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants