Component: Dynamic deposit (x/gov)
Description
The PR implements changes to the previously added dynamic deposit throttler, now making the deposit increasing time-dependent.
The minimum amount required for proposal submission is fetched through GetMinInitialDeposit
and the minimum amount for the proposal through GetMinDeposit
. Both of these helpers return the minimum amount required as stored in the keeper state instead of computing the value as invoked.
The minimum deposit values are updated in the keeper state dynamically through the UpdateMinDeposit
/ UpdateMinInitialDeposit
helpers. Both of these helpers implement the same logic for computation of the dynamic deposit amount. The updates happen both in the EndBlocker after dead/complete proposals are removed and when a new proposal is added.
It works as follows:
The last minimum deposit and deposit time is fetched through
GetLastMinDeposit
.If called by the EndBlocker, and the elapsed time is lower than the update period, the minimum deposit is not updated. This would result in no decrease in the minimum deposit if multiple proposals are removed in a single block or within the update period.
If called by the EndBlocker, and if the number of active proposals still exceed target proposals, the function returns without updating the minimum deposit. Otherwise, the alpha value is computed based on the decrease ratio and distance from the target active proposals to reduce the minimum deposit.
If called during proposal submission/deposit, and if the number of active proposals exceed target proposals, the alpha value is set to the
IncreaseRatio
fromMinDepositThrottler
params. Otherwise, no updates are made, leading to early return.The minimum deposit is increased/decreased by multiplying it with the alpha value computed previously.
The minimum deposit and update time is updated in the keeper state.