-
Notifications
You must be signed in to change notification settings - Fork 31
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
[R4R] update gov strategy #73
Conversation
45aa7c7
to
b6dcc27
Compare
f836568
to
f1d50bd
Compare
f1d50bd
to
f0e758d
Compare
There are some failed unit tests:
|
you are right, I just ran the build command. |
How about replace the validator iterator with the following code:
|
yeah, good catch |
cee7a70
to
d47acdd
Compare
cee7a70
to
1afab6b
Compare
As you lowered minimum deposit amount, there are some failed unit tests. Please fix them
|
My bad, just bring back the change, I will replace it in node repo as we did before. |
x/gov/client/cli/tx.go
Outdated
|
||
votingPeriod := time.Duration(proposal.VotingPeriod) * time.Second | ||
if votingPeriod > gov.MaxVotingPeriod { | ||
return errors.New(fmt.Sprintf("voting period should less than %d seconds", gov.MaxVotingPeriod/time.Second)) |
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.
should be less
x/gov/msgs.go
Outdated
@@ -67,7 +70,7 @@ func (msg MsgSubmitProposal) ValidateBasic() sdk.Error { | |||
if !validProposalType(msg.ProposalType) { | |||
return ErrInvalidProposalType(DefaultCodespace, msg.ProposalType) | |||
} | |||
if len(msg.Proposer) == 0 { | |||
if msg.Proposer.Empty() { |
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.
need to ensure the Proposer is exactly sdk.AddrLen
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.
no need to check whether Empty() or not
x/gov/msgs.go
Outdated
@@ -129,7 +135,7 @@ func (msg MsgDeposit) Type() string { return "deposit" } | |||
|
|||
// Implements Msg. | |||
func (msg MsgDeposit) ValidateBasic() sdk.Error { | |||
if len(msg.Depositer) == 0 { | |||
if msg.Depositer.Empty() { |
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.
ditto.
570ce59
to
f7125dc
Compare
x/gov/msgs.go
Outdated
@@ -67,7 +70,7 @@ func (msg MsgSubmitProposal) ValidateBasic() sdk.Error { | |||
if !validProposalType(msg.ProposalType) { | |||
return ErrInvalidProposalType(DefaultCodespace, msg.ProposalType) | |||
} | |||
if len(msg.Proposer) == 0 { | |||
if msg.Proposer.Empty() { |
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.
no need to check whether Empty() or not
* R4R: Add interface to remove validator (#91) * Add validator remove interface * add unit test * Fix failed unit test in gov and stake * Add proposal id checking in msg validate * Add validator consensus addr into proposal decription * Add remove validator command line interface * Add new proposal type to NormalizeProposalType * add validator consensus address checking * Rename consensus address flag name * refactor handler test import * Use json marshal to replace cdc marshal * Add automatic gov proposal when proposal id is zero * add deposit flag * Add routerCallRecord * Resolve comment, a tx only contains one msg * improve the validate logic for remove validator * refactor go import * remove necessary checking * stake: add fee addr for each validator * [R4R] update gov strategy (#73) * update gov strategy * refactor * revert change * [R4R] Add deposit address and do some refactor (#101) * add address for deposits * refactor * refactor * revert change * refactor * refactor * change proposals to publish * update deposit address
Description
Ref: https://github.com/binance-chain/docs-internal/wiki/Gov-strategy
Voting period
As for now, voting period of every proposal is the same, like 4 hours in testnet.
The drawback is the fixed voting period is not flexible. We can specify voting period in proposal, but we still need to control the duration, it should not be too long.
So we can set
MaxVotingPeriod
and specify voting period in proposal.Tally strategy
There are four types of votes:
Tally rules:
If there is no staked coins, the proposal fails
If there is no validator bond tokens, the proposal fails.
If there is not enough quorum of votes, the proposal fails
quorum is minimum percentage of total stake needed to vote for a result to be considered valid
If no one votes (everyone abstains), proposal fails
If more than 1/3 of voters veto, proposal fails
If more than 1/2 of non-abstaining voters vote Yes, proposal passes
If more than 1/2 of non-abstaining voters vote No, proposal fails
Disposition of deposits
Rejected
If votes reach the quorum, the deposits will be distributed to validator.
If votes do not reach the quorum, the deposits will be refunded.
Passed
Deposits will be returned.
Rationale
tell us why we need these changes...
Example
add an example CLI or API response...
Changes
Notable changes:
Preflight checks
make build
)make test
)make integration_test
)Already reviewed by
...
Related issues
... reference related issue #'s here ...