-
Notifications
You must be signed in to change notification settings - Fork 391
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: create a x/gov tutorial #1217
Conversation
Co-authored-by: Xavier Leprêtre <xavierlepretre@users.noreply.github.com>
beafefa
to
fa7e7f6
Compare
Co-authored-by: Xavier Leprêtre <xavierlepretre@users.noreply.github.com>
tutorials/understanding-gov/index.md
Outdated
$ simd query gov proposal 1 --output json | jq .status | ||
``` | ||
|
||
This is because the governance proposal weight the votes given the amount of token staked. Alice had staked tokens, while Bob had no token staked. So Bob's vote was not took into consideration in the tally of the result. |
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.
This is because the governance proposal weight the votes given the amount of token staked. Alice had staked tokens, while Bob had no token staked. So Bob's vote was not took into consideration in the tally of the result. | |
This is because the governance proposal weights each vote by the amount of tokens staked. Alice owns staked tokens, while Bob has no staked tokens. So Bob's vote was not taken into consideration in the tally of the result. |
Do you want to put a word about what Alice can do with her staked tokens after voting? In particular if the voting period is longer than the unstaking period?
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.
I'm not sure what you mean by this.
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.
- Alice votes Yes with 1 million ATOM.
- Alice unstakes her million ATOM and waits 3 weeks.
- Alice sends her million to Bob.
- Bob votes Yes with 1 million ATOM.
This should not be allowed. It was possible because the voting period was longer than the unsticking period.
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.
I get it! However, this is a non issue because the vote weight is calculated at vote tally. So only Bob's vote will be counted in that case (if he staked).
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.
Mmh, I don't like O(n) actions in blockchain 🤣
Are you sure there is nothing like intermediate tally, and when unstaking, your vote is updated on all proposals?
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.
Yeah, that is why tally takes some time (and sometimes there are no blocks for x seconds due to that): https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/keeper/tally.go#L37-L73
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.
Lol
Co-authored-by: Xavier Leprêtre <xavierlepretre@users.noreply.github.com>
Co-authored-by: Xavier Leprêtre <xavierlepretre@users.noreply.github.com>
Thank you very much again @xavierlepretre for all the great feedback! |
Co-authored-by: Xavier Leprêtre <xavierlepretre@users.noreply.github.com>
Closes #1135. Requires cosmos/cosmos-sdk#13304 to be merged.