Reputation Voting - #644
Merged
Merged
Conversation
kronosapiens
force-pushed
the
feat/voting
branch
4 times, most recently
from
June 13, 2019 12:25
0f57fca to
7871a3a
Compare
kronosapiens
force-pushed
the
feat/voting
branch
13 times, most recently
from
June 21, 2019 08:42
c254d5b to
5dad7af
Compare
kronosapiens
force-pushed
the
feat/voting
branch
3 times, most recently
from
June 21, 2019 08:56
a223bbf to
eedc7ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #80
Closes #81
Closes #82
Closes #83
Closes #84
Closes #85
Closes #86
Closes #87
Closes #88
Closes #89
Depends on
#757,#760,#771,#845Implementation references:
https://blog.colony.io/towards-better-ethereum-voting-protocols-7e54cb5a0119/
https://blog.colony.io/token-weighted-voting-implementation-part-1-72f836b5423b/
https://blog.colony.io/token-weighted-voting-implementation-part-2-13e490fe1b8a/
Initially I started working on both reputation and token weighted voting, but token voting ended up requiring some more problem-solving w.r.t. managing vote secrets and communicating with the token locking contract, so in the spirit of hitting OKRs it's going to wait until QX.
Features
Design choices:
Actions are defined as
bytesarrays and invoked using thecallopcode pointed at the colony. An optionaltargetallows for transactions to be executed against any contract, not just the colony.Two classes of poll --
rootPollanddomainPoll. Root polls accept arbitrarybytes32which can be executed by the extensions -- the simpler and more powerful implementation, with the limitation what all polls go to the entirety of the colony. Domain polls, on the other hand, can be held at, you guessed it, any domain in the colony, and can executeauthDomain-ed functions only. Domain polls infer the "domain of action" by parsing thebytes32action directly -- leveraging our convenient convention that the first two arguments of any domain-level permissioned function is (permissionDomainId, childSkillIndex), which means we can uniquely infer the domain from the action. With the domain of action, we can check that the domain of vote is in the inheritance hierarchy.Escalation is implemented very simply as the requirement that new votes over the same variable have more "vote power" (total reputation) voting on it. Since (domain) reputation always aggregates up the tree, this has the nice property of allowing "escalation" to be either a re-vote in the original domain with higher turnout, or a vote in a parent domain, which by definition has more reputation in total. This requirement is restricted to votes on the
setExpenditureStatefunction, which is the general-purpose arbitration state change function (see Arbitration State Changes #760).Staking occurs using the new stake-management system (see Add support for stake management #757).
One thing I am quite happy about is how the rate/reveal flow eliminates the need for a
hasVotedmapping. A user can update their secret as many times as they want during the voting period, but since the secret can only be revealed once, there's no way to double-vote.Stakers can stake on both sides if they choose. It is unlikely they will, of course, but the point is that it is not explicitly restricted.
Winning stakers get their entire stake back, plus a proportion of the loser's stake. Losing stakers pay the voter fees, and then get a proportion of their stake back. The proportion is a function of how close the vote was (e.g. winning with 60% of the vote gets you 20% of the losing side's stake, 120 - 100 = 20).
Any unspent voter compensation is returned back to stakers proportional to their contribution.