Make consistent configurable constants that correspond to time intervals.
gkoumout opened this issue · 0 comments
Motivation
In the Lisk protocol, several modules expose configurable constants whose values corresponds to time intervals, such as the liveness period for sidechains (1 month) in interoperability module and the locking period for staking in PoS module. The way that the default values of those constants is defined should be consistent across all modules.
Current Specifications
For each of those constants, the value has been defined by deciding some duration (e.g., 1 month for PoS self-staking locking period) and then calculating manually a value, perhaps by introducing some rounding. This makes it much harder to parse the actual value and get intuition and perhaps it becomes error prone.
As an example, the self-staking locking period in PoS module is intended to be one month. The actual definition in the LIP is:
LOCKING_PERIOD_SELF_STAKING
| uint32 |260,000
| The [locking period][lip-0023#explicit-unlock-mechanism] for self-staked tokens.
Here it might be not so clear how this value has been obtained. There are multiple issues here:
- It is not clearly explained that the locking period is counted in terms of "number of blocks" and not in seconds.
- One day has exactly 24x360 = 8640 blocks. The actual value 260.000 is not a multiple of 8640. It has been obtained as
8640 x 30 = 259.200
and then applying arbitrarily some rounding to get the number 260.000
This makes quite arbitrary the way constants are defined, and makes hard to maintain a good intuition on the meaning of each value
Proposed Specifications
To achieve consistency throughout the modules, we propose the following improvements:
- For all configurable constants that correspond to time intervals, we clearly specify the measurement unit (seconds, blocks, etc.).
- In the specs, beyond the final value of the constant, we also specify the way it is extracted. An example is the
LIVENESS_LIMIT
constant in interoperability which is defined in LIP 0045 as30x24x3600
. - Since the notion of a "month" is not well defined (not all months have same duration), we rather use the notion of weeks. Therefore, constants that have intended value of a month, are switched to "4 weeks", i.e., 28 days.
Affected LIPs
0045, 0053, 0054, 0057, 0061, 0063, 0070 .