该提案 (ADR 037) 旨在改进Cosmos的治理模块,允许Staker将其投票权分配到多个投票选项(例如,70%赞成,30%反对),以更好地代表不同利益相关者的意见,并为交易所等场景提供“投票权传递”机制。提案修改了投票结构,引入了MsgVoteWeighted
消息,并保持了向后兼容性。
Accepted (已接受)
This ADR defines a modification to the governance module that would allow a staker to split their votes into several voting options. For example, it could use 70% of its voting power to vote Yes and 30% of its voting power to vote No.
本 ADR 定义了对治理模块的修改,允许 staker 将其投票拆分为多个投票选项。例如,可以使用 70% 的投票权投赞成票,使用 30% 的投票权投反对票。
Currently, an address can cast a vote with only one options (Yes/No/Abstain/NoWithVeto) and use their full voting power behind that choice.
目前,一个地址只能投一个选项(Yes/No/Abstain/NoWithVeto),并使用其全部投票权支持该选项。
However, often times the entity owning that address might not be a single individual. For example, a company might have different stakeholders who want to vote differently, and so it makes sense to allow them to split their voting power. Another example use case is exchanges. Many centralized exchanges often stake a portion of their users' tokens in their custody. Currently, it is not possible for them to do "passthrough voting" and giving their users voting rights over their tokens. However, with this system, exchanges can poll their users for voting preferences, and then vote on-chain proportionally to the results of the poll.
但是,通常情况下,拥有该地址的实体可能不是单个人。例如,一家公司可能有不同的 stakeholder 想要以不同的方式投票,因此允许他们分配投票权是有意义的。另一个用例是交易所。许多中心化交易所通常会将一部分用户的 token 质押在他们的托管中。目前,他们无法进行“透传投票”,也无法赋予用户对其 token 的投票权。但是,有了这个系统,交易所可以征求用户的投票偏好,然后根据投票结果按比例在链上投票。
We modify the vote structs to be
我们修改投票结构体为:
type WeightedVoteOption struct {
Option string
Weight sdk.Dec
}
type Vote struct {
ProposalID int64
Voter sdk.Address
Options []WeightedVoteOption
}
And for backwards compatibility, we introduce MsgVoteWeighted
while keeping MsgVote
.
为了向后兼容,我们在保留 MsgVote
的同时引入 MsgVoteWeighted
。
type MsgVote struct {
ProposalID int64
Voter sdk.Address
Option Option
}
type MsgVoteWeighted struct {
ProposalID int64
Voter sdk.Address
Options []WeightedVoteOption
}
The ValidateBasic
of a MsgVoteWeighted
struct would require that
MsgVoteWeighted
结构体的 ValidateBasic
将要求:
The sum of all the Rates is equal to 1.0
No Option is repeated
所有 Rate 的总和等于 1.0
没有重复的 Option
The governance tally function will iterate over all the options in a vote and add to the tally the result of the voter's voting power * the rate for that option.
治理统计函数将迭代投票中的所有选项,并将投票人的投票权 * 该选项的 rate 的结果添加到统计中。
tally() {
results := map[types.VoteOption]sdk.Dec
for _, vote := range votes {
for i, weightedOption := range vote.Options {
results[weightedOption.Option] += getVotingPower(vote.voter) * weightedOption.Weight
}
}
}
The CLI command for creating a multi-option vote would be as such:
用于创建多选项投票的 CLI 命令如下:
simd tx gov vote 1 "yes=0.6,no=0.3,abstain=0.05,no_with_veto=0.05" --from mykey
To create a single-option vote a user can do either
要创建单选项投票,用户可以执行以下任一操作
simd tx gov vote 1 "yes=1" --from mykey
or
或者
simd tx gov vote 1 yes --from mykey
to maintain backwards compatibility.
以保持向后兼容性。
Previous VoteMsg types will remain the same and so clients will not have to update their procedure unless they want to support the WeightedVoteMsg feature.
之前的 VoteMsg 类型将保持不变,因此客户端不必更新他们的程序,除非他们想支持 WeightedVoteMsg 功能。
When querying a Vote struct from state, its structure will be different, and so clients wanting to display all voters and their respective votes will have to handle the new format and the fact that a single voter can have split votes.
从状态查询 Vote 结构时,它的结构将有所不同,因此想要显示所有投票者及其各自投票的客户端将必须处理新格式以及单个投票者可以拆分投票的事实。
The result of querying the tally function should have the same API for clients.
查询统计函数的结果应该对客户端具有相同的 API。
Can make the voting process more accurate for addresses representing multiple stakeholders, often some of the largest addresses.
可以使代表多个 stakeholder 的地址(通常是一些最大的地址)的投票过程更加准确。
Is more complex than simple voting, and so may be harder to explain to users. However, this is mostly mitigated because the feature is opt-in.
比简单的投票更复杂,因此可能更难向用户解释。但是,由于该功能是可选的,因此在很大程度上缓解了这个问题。
Relatively minor change to governance tally function.
对治理统计函数的相对较小的更改。
- 原文链接: github.com/cosmos/cosmos...
- 登链社区 AI 助手,为大家转译优秀英文文章,如有翻译不通的地方,还请包涵~
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!