Skip to content

Improve the Accuracy of Price Estimation

Matthew Sevey requested to merge siac-renter-prices into master

MERGE REQUEST

Changes to Work Flow
Originally if there was an error during the renter price estimation, zero values would be returned with no error. Now an error is returned from the price estimation method and displayed through the API. Additionally the price estimation method accepts an argument of an allowance which enables the users to submit an allowance and see the estimate associated with that allowance. If no allowance is submitted the allowance that is currently set for the renter will be used. And if the renter doesn't have an allowance some default allowance settings will be used.

PriceEstimation only checks for a completely empty allowance, otherwise it uses the allowance as provided. The renterPricesHandler checks the allowance more. Since an empty allowance can be submitted to PriceEstimation no default values are set for the allowance during the initial check for values. After the initial check, default values are set for host and renew window if the funds and period are set, since hosts and renew window are optional if the funds and period are set.

The price estimation also checks for contracts, and if the renter has active contracts the hosts associated with those contracts are used for the estimation. The last estimate is no longer cached, but the hosts used to make the estimate are cached. This allows the user to submit different allowances and see any changes in estimation but if the same allowance is submitted then the same estimate will be shown.

Lastly, the allowance used for the estimation is returned from PriceEstimation so that it is clear what settings were used for the price estimate. This means modules.Allowance was added to the RenterPricesGET struct.

Testing Updates
There is currently a test for the price estimation method. The only thing I can think of to expand on that test in order to capture these changes would be testing on the allowance returned to make sure the expected allowance was used. I'm not sure if that is value added to add those checks or if there is additional testing needed.

Modules and Packages Impacted
renter, node, cmd

Screen Shots
image

image

image

Closes #3172 (closed)

Edited by Matthew Sevey

Merge request reports