-
Notifications
You must be signed in to change notification settings - Fork 21
feat(x/gov): change lazy dynamic deposit computation in favor of endblocker per-tick update #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(x/gov): change lazy dynamic deposit computation in favor of endblocker per-tick update #104
Conversation
lastMinDeposit, lastMinDepositTime := keeper.GetLastMinDeposit(ctx) | ||
if checkElapsedTime && ctx.BlockTime().Sub(lastMinDepositTime).Nanoseconds() < tick.Nanoseconds() { | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no additional case in the unit tests for this new condition, is it because it is already covered or is it a miss ?
lastMinInitialDeposit, lastMinInitialDepositTime := keeper.GetLastMinInitialDeposit(ctx) | ||
if checkElapsedTime && ctx.BlockTime().Sub(lastMinInitialDepositTime).Nanoseconds() < tick.Nanoseconds() { | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here
This PR should be closed in favor of #105 because it already changes the lazy computation. |
Closing in favor of #105 |
… and decreases only with time (#105) This PR is based on #104 Based on discussions, this is a revised model for the dynamic deposit that: - only performs deposit increases upon proposal activation (proposal deactivation does not trigger an update of the deposit), and - only perform time-dependent updates to decrease the deposit, and a decrease happens only if active proposals is less than the target, otherwise the time-based update has no effect. Plus, remove the sensitivity to the distance for increases. This PR should be merged only after #104 is (or in its stead). Moreover, if this PR is accepted, the partially overlapping PR #103 can be closed. --- Importantly, this PR does not yet update neither the `x/gov` README.md nor the Dynamic Deposit ADR to reflect these changes, so it needs to be done. --------- Co-authored-by: Thomas Bruyelle <thomas.bruyelle@tendermint.com>
As per the title.
It seems unnecessarily complex in hindsight to lazily compute the dynamic deposit.
If we assume per-tick updates aren't too frequent, it's better to do this then only once and limit to reading a single value for queries.
Moreover, since store updates just overwrite an existing value, even a per-block update should not be too expensive in practice.