github.com/nebulouslabs/sia@v1.3.7/modules/renter/contractor/consts.go (about)

     1  package contractor
     2  
     3  import (
     4  	"github.com/NebulousLabs/Sia/build"
     5  	"github.com/NebulousLabs/Sia/modules"
     6  	"github.com/NebulousLabs/Sia/types"
     7  )
     8  
     9  // Constants related to contract formation parameters.
    10  var (
    11  	// consecutiveRenewalsBeforeReplacement is the number of times a contract
    12  	// attempt to be renewed before it is marked as !goodForRenew.
    13  	consecutiveRenewalsBeforeReplacement = build.Select(build.Var{
    14  		Dev:      types.BlockHeight(12),
    15  		Standard: types.BlockHeight(12), // ~2h
    16  		Testing:  types.BlockHeight(12),
    17  	}).(types.BlockHeight)
    18  
    19  	// fileContractMinimumFunding is the lowest percentage of an allowace (on a
    20  	// per-contract basis) that is allowed to go into funding a contract. If the
    21  	// allowance is 100 SC per contract (5,000 SC total for 50 contracts, or
    22  	// 2,000 SC total for 20 contracts, etc.), then the minimum amount of funds
    23  	// that a contract would be allowed to have is fileContractMinimumFunding *
    24  	// 100SC.
    25  	fileContractMinimumFunding = float64(0.15)
    26  
    27  	// minContractFundRenewalThreshold defines the ratio of remaining funds to
    28  	// total contract cost below which the contractor will prematurely renew a
    29  	// contract.
    30  	minContractFundRenewalThreshold = float64(0.03) // 3%
    31  
    32  	// randomHostsBufferForScore defines how many extra hosts are queried when trying
    33  	// to figure out an appropriate minimum score for the hosts that we have.
    34  	randomHostsBufferForScore = build.Select(build.Var{
    35  		Dev:      2,
    36  		Standard: 10,
    37  		Testing:  1,
    38  	}).(int)
    39  )
    40  
    41  // Constants related to the safety values for when the contractor is forming
    42  // contracts.
    43  var (
    44  	maxCollateral    = types.SiacoinPrecision.Mul64(1e3) // 1k SC
    45  	maxDownloadPrice = maxStoragePrice.Mul64(3 * 4320)
    46  	maxStoragePrice  = build.Select(build.Var{
    47  		Dev:      types.SiacoinPrecision.Mul64(30e4).Div(modules.BlockBytesPerMonthTerabyte), // 1 order of magnitude greater
    48  		Standard: types.SiacoinPrecision.Mul64(30e3).Div(modules.BlockBytesPerMonthTerabyte), // 30k SC / TB / Month
    49  		Testing:  types.SiacoinPrecision.Mul64(30e5).Div(modules.BlockBytesPerMonthTerabyte), // 2 orders of magnitude greater
    50  	}).(types.Currency)
    51  	maxUploadPrice = build.Select(build.Var{
    52  		Dev:      maxStoragePrice.Mul64(30 * 4320),  // 1 order of magnitude greater
    53  		Standard: maxStoragePrice.Mul64(3 * 4320),   // 3 months of storage
    54  		Testing:  maxStoragePrice.Mul64(300 * 4320), // 2 orders of magnitude greater
    55  	}).(types.Currency)
    56  
    57  	// scoreLeeway defines the factor by which a host can miss the goal score
    58  	// for a set of hosts. To determine the goal score, a new set of hosts is
    59  	// queried from the hostdb and the lowest scoring among them is selected.
    60  	// That score is then divided by scoreLeeway to get the minimum score that a
    61  	// host is allowed to have before being marked as !GoodForUpload.
    62  	scoreLeeway = types.NewCurrency64(100)
    63  )