Skip to content

feat(x/gov): dynamic deposit increases only with proposal activation, and decreases only with time #105

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

Conversation

giunatale
Copy link
Collaborator

@giunatale giunatale commented Mar 24, 2025

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.

@tbruyelle
Copy link
Collaborator

Do you want to update the ADR in this PR or should we do it in a separate one ? I would rather see the change in this PR so everything is bundled.

@giunatale
Copy link
Collaborator Author

I would rather see the change in this PR so everything is bundled.

Yes I was thinking the same

In a naive implementation for time-based updates every $T$ time has elapsed (a *tick*) the current value of $n_t$ should be used to calculate $D_t$. Having the accurate $D_t$ available to query at all times is important to be able to correctly submit a proposal.
But in reality, all we need to know is when $n_t$ **actually** changed the last time (which happens when proposals enter or leave the active proposals queue, and in itself also trigger a `MinDeposit` update), and how much time has passed since then, anytime the $D_t$ value is requested.
In a naive implementation for time-based decreases every $T$ time has elapsed (a *tick*) the current value of $n_t$ should be used to calculate $D_t$. Having the accurate $D_t$ available to query at all times is important to be able to correctly submit a proposal.
But in reality, all we need to know is when $n_t$ **actually** changed the last time (which happens when proposals enters the active proposals queue, and in itself also trigger a `MinDeposit` increase), and how much time has passed since then, anytime the $D_t$ value is requested.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this optimization has been discarded right ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to remove it from the ADR though. The ADR just states it's possible, and present the mathematical relation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, I removed the section talking about it in the implementation.

giunatale and others added 3 commits March 28, 2025 10:16
…ottler.md

Co-authored-by: Thomas Bruyelle <thomas.bruyelle@tendermint.com>
…ottler.md

Co-authored-by: Thomas Bruyelle <thomas.bruyelle@tendermint.com>
State was not reinitialized between test cases, which was confusing for
some scenario and forced sometimes to reset things like the deposit
throttling.

The fix consists only of calling `suite.reset()` in
`KeeperTestSuite.SetupSubTest()`, the other changes removes any
correlation previously made by the test cases about this common state.
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label May 20, 2025
@tbruyelle tbruyelle removed the Stale label May 20, 2025
@giunatale giunatale merged commit 1bd8784 into giunatale/gov/dynamic-deposit May 29, 2025
14 checks passed
@giunatale giunatale deleted the giunatale/dynamic-deposit/time-independent-increase branch May 29, 2025 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants