Skip to content
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): burn deposit if no votes > BurnDepositNoThreshold #90

Open
wants to merge 12 commits into
base: giunatale/gov/dynamic-deposit
Choose a base branch
from

Conversation

tbruyelle
Copy link
Collaborator

BurnDepositNoThreshold has a default value of 0.8.

Copy link
Collaborator

@giunatale giunatale left a comment

Choose a reason for hiding this comment

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

Just one change I would suggest doing, but aside from that it looks good

Copy link
Collaborator

@giunatale giunatale left a comment

Choose a reason for hiding this comment

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

let's hold off from merging for now, but LGTM

@giunatale
Copy link
Collaborator

actually, looking at this again I think we made the same mistake in getQuorumAndThreshold and we can remove the error in Tally altogether because getQuorumAndThreshold should not return an error and use the Must APIs

@tbruyelle
Copy link
Collaborator Author

actually, looking at this again I think we made the same mistake in getQuorumAndThreshold and we can remove the error in Tally altogether because getQuorumAndThreshold should not return an error and use the Must APIs

Good catch, I converted all to MustNew* and so removed the returned error from getQuorumAndThreshold and from Tally function. 658af5d

Copy link
Collaborator

@giunatale giunatale left a comment

Choose a reason for hiding this comment

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

TY!

@@ -419,5 +423,16 @@ func (p Params) ValidateBasic() error {
return fmt.Errorf("minimum initial deposit decrease ratio too large: %s", minInitialDepositDecreaseRatio)
}

burnDepositNoThreshold, err := sdk.NewDecFromStr(p.BurnDepositNoThreshold)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to add a check for threshold, law and amendment threshold

so that the burnDepositNoThreshold > 1 - threshold (or the burn would happen with less than no votes to make a proposal fail, which makes no sense since the proposal would mean is passing)

the same check goes for law and amendment thresholds

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the proposal is passing, the burnDepositNoThreshold is not checked, so the burn would not happen anyway. But I will still do this burnDepositNoThreshold > 1 - threshold check so the condition is not tied to the order of code execution.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done here 3788dbb

if err != nil {
return fmt.Errorf("invalid burnDepositNoThreshold string: %w", err)
}
if !burnDepositNoThreshold.IsPositive() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would replace this check with the burnDepositNoThreshold > 1 - threshold && burnDepositNoThreshold > 1 - lawThreshold && && burnDepositNoThreshold > 1 - amendmentThreshold

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see 3788dbb

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