NebulousLabs/Sia-UI

Calculation for estimated storage is incorrect

Closed this issue · 2 comments

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)

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

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.