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

Cw3 spec #90

Merged
merged 10 commits into from
Sep 15, 2020
Merged

Cw3 spec #90

merged 10 commits into from
Sep 15, 2020

Conversation

ethanfrey
Copy link
Member

Closes #79

Defines a spec we can implement for various voting contracts. Happy for reviews on this interface.

There are at least 3 different cases we want to cover in this spec:

  • K of N immutible multisig. One key proposes a set of messages, after K-1 others approve it, it can be executed with the multisig address.
  • K of N flexible, mutable multisig. Like above, but with multiple contracts. One contract stores the group, which is referenced from multiple multisig contracts (which in turn implement cw3). One cw3 contracts is able to update the group content (maybe needing 67% vote). Other cw3 contracts may hold tokens, staking rights, etc with various execution thresholds, all controlled by one group.

Maybe this can fit in as an extension of this interface:

  • Token weighted voting. People lock tokens in a contract for voting rights. There is a vote threshold to execute messages. The voting set is dynamic. We may also want to support clear YES/NO votes and quora not absolute thresholds

@ethanfrey ethanfrey added this to In progress in Contract development via automation Sep 15, 2020
@ethanfrey ethanfrey marked this pull request as draft September 15, 2020 12:23
@ethanfrey
Copy link
Member Author

@webmaster128 happy if you want to take an early look at the README and comment. I will be defining types for this.

@ethanfrey ethanfrey marked this pull request as ready for review September 15, 2020 13:04
Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

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

Some initial thoughs. But looks good overall

Many implementations will want to restrict who can propose.
Maybe only people in the voting set. Maybe there is some
deposit to be made along with the proposal. This is not
in the spec but left open to the implementation.
Copy link
Member

Choose a reason for hiding this comment

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

Above in

  • K of N immutible multisig. One key proposes a set of messages,
    after K-1 others approve it, it can be executed with the
    multisig address.

you assume that the Propose is the first approval. But I'd say it can be a valid case that the composer/proposer is not one of the signers but some type of moderator.

Copy link
Member Author

Choose a reason for hiding this comment

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

Should I specify that Propose does not include a yes vote from the sender if applicable?
Specify that it does only if the proposer is in the valid voter set?
Or leave it unspecified?

I'd like to specify this, as then wallets know if they need to propose and vote, or just propose.

Copy link
Member

Choose a reason for hiding this comment

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

I think it is clean to make propose and vote two messages. It would be nice if they could be sent in one tranaction, but then we can't rely on execution data. However, this would work with client-side generated IDs.

Copy link
Member Author

Choose a reason for hiding this comment

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

I defined it as the first in the README

packages/cw3/README.md Outdated Show resolved Hide resolved
packages/cw3/README.md Outdated Show resolved Hide resolved
packages/cw3/README.md Outdated Show resolved Hide resolved
export_schema(&schema_for!(ProposalResponse), &out_dir);
export_schema(&schema_for!(ProposalListResponse), &out_dir);
export_schema(&schema_for!(VoteResponse), &out_dir);
export_schema(&schema_for!(VoteListResponse), &out_dir);
Copy link
Member

Choose a reason for hiding this comment

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

All those schemas are only generated for T = Empty, so T cannot be used together with the schema files. If we want to stick with the custom T in CosmosMsg, I think we should remove the schemas here. Then only the implementations generate schemas, which either set T or actually use Empty.

(the same is true for the schemas in cosmwasm-std (packages/std/schema), which are kind of pointless)

Copy link
Member Author

Choose a reason for hiding this comment

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

These work for generic queriers that don't support custom messages, and are actually the basis of most generic clients.

I would expect some custom contracts to add more and then we have custom clients that know that, but those would be chain-specific naturally, and this is the only set of schemas that would work over all contracts and all chains.

packages/cw3/src/helpers.rs Show resolved Hide resolved
packages/cw3/src/helpers.rs Show resolved Hide resolved
packages/cw3/src/msg.rs Show resolved Hide resolved
@ethanfrey ethanfrey merged commit 4e28af8 into master Sep 15, 2020
Contract development automation moved this from In progress to Done Sep 15, 2020
@webmaster128 webmaster128 deleted the cw3-spec branch September 15, 2020 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Define cw3 spec for multisigs
2 participants