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

Group module spec #5236

Closed

Conversation

aaronc
Copy link
Member

@aaronc aaronc commented Oct 23, 2019

@alexanderbez @jackzampolin this is a placeholder for discussion of the proposed group module spec. This is almost identical to the proposal discussed in the gist and in the ICF grant (I had changed it but changed it back after discussing with @ethanfrey)

I have split this draft spec into three topical sections:

  • groups - the basis mechanics of aggregating groups of accounts
  • group accounts - the actual association of groups to accounts with a decision policy and a balance. Groups can have multiple accounts with different decision policies and the msg delegation feature can be used to assign different permissions to different accounts
  • proposals - the ability to open proposals and vote on them asynchronously. Note that this part is not required to be enabled for other group stuff to work! Groups can execute multisig transactions aggregated offline without proposals!

@codecov
Copy link

codecov bot commented Oct 23, 2019

Codecov Report

Merging #5236 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #5236   +/-   ##
=======================================
  Coverage   53.51%   53.51%           
=======================================
  Files         290      290           
  Lines       17770    17770           
=======================================
  Hits         9509     9509           
  Misses       7511     7511           
  Partials      750      750

@fedekunze
Copy link
Collaborator

Thanks @aaronc. tbh I don't think this belongs to the core modules. It should live in the https://github.com/cosmos/modules repo

@aaronc
Copy link
Member Author

aaronc commented Oct 24, 2019

Okay, good to know. I wonder if @alexanderbez and @jackzampolin have a similar opinion.

If that's the case, my next question is would a pared-down version of the group module be wanted in SDK core?

The simpliest version of this group module would be something that aggregates multiple keys as a multi-sig account with the main differences from the existing multi-sig accounts being:

  • the sdk.Address is not based on any keys address but generated (likely from an auto-increment integer)
  • signing keys and thresholds can be changed

My understanding is that there is desire for such much a module from the community - in particular, validators who want to have a master account not tied to a single unchangeable private key. As I recall @dlguddus was even proposing that there be support for migrating existing validator keys to this key group.

For projects like Regen, we want more full group support with proposals as in this spec and as originally proposed after the hackathon in the ICF grant, but maybe that's too much for the hub...

@alexanderbez
Copy link
Contributor

alexanderbez commented Oct 30, 2019

I believe work should continue on this spec and the module should start/resume implementation. However, I believe the module should (for now) exist in cosmos/modules where the regen team are owners. Feedback and collaboration should continue there when and where the SDK team's input is needed 👍

/cc @ebuchman

Copy link
Contributor

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

This is getting close, but I added a number of detail questions to refine this.

Also, I cannot comment but on spec/proposal.md line 58, you refer to Vote bool, but there is already a defined type Vote int. Why not use Vote Vote there?

x/group/spec/group.md Outdated Show resolved Hide resolved
DecisionProtocol DecisionProtocol `json:"decision_protocol"`
Admin sdk.AccAddress `json:"admin"`
Group GroupID `json:"group"`
NewAdmin sdk.AccAddress `json:"new_admin"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Please define behavior if NewAdmin is unset (I assume don't change Admin).

Copy link
Member Author

Choose a reason for hiding this comment

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

We can either make it a no-op like you're proposing or this would seal the group and make it impossible to change? Is that desirable? I think that would probably be unexpected behavior so for now I will define it as a no-op. If there is a use case for that, this could be a separate "seal group" message.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree

Admin sdk.AccAddress `json:"admin"`
Group GroupID `json:"group"`
NewAdmin sdk.AccAddress `json:"new_admin"`
Description string `json:"description,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.. I assume this is optional to change it? Maybe use *string to be clear there - otherwise there is no way to unset it.

It seems like this operation is supposed to be a patch, and to do so properly, we need to allow all values (including zero-value if legal) as well as "unset". In my experience with go-json, this is typically done by using pointer fields and checking for nil (which can be missing from json or explicitly set as null, either way, ignored)

Copy link
Member Author

Choose a reason for hiding this comment

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

An alternative to a single update message is to have a separate update message for each field, so MsgUpdateGroupDescription, MsgUpdateGroupAdmin, etc. Would that be preferable? For now I am changing the spec to your approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think separate messages is bad.

Either define POST behavior - overwrite current content with msg.
Or PUT - only include some fields, only update those that are include.

I assume PUT is desired, but this should be made explicit and consistent.

x/group/spec/group.md Outdated Show resolved Hide resolved
@@ -131,9 +67,8 @@ to authorize messages send back to the router.
```go
type GroupKeeper interface {
IterateGroupsByMember(member sdk.Address, fn func (group sdk.AccAddress) (stop bool))
IterateGroupsByOwner(member sdk.Address, fn func (group sdk.AccAddress) (stop bool))
IterateGroupsByAdmin(member sdk.Address, fn func (group sdk.AccAddress) (stop bool))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why return the group sdk.AccAddress? Which means you have to then query the group itself? Seems easier to pass group Group into the callback.

Also, I note you never defined the Group struct that is stored in the kvstore above.

Copy link
Member Author

Choose a reason for hiding this comment

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

This part was intentional. I didn't define a group struct because I don't want to return all members at once. See how it is in the changed spec and we can discuss if maybe there should be a GroupMetadata struct like this:

type GroupMetadata struct {
  Group GroupID
  TotalPower sdk.Int
  Description string
  Admin sdk.AccAddress
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh... Okay, then can you mark this in the spec as "not yet defined", but make sure some comment is there, not just an oversight.


## Messages

### `MsgCreateGroupAccount
Copy link
Contributor

Choose a reason for hiding this comment

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

This name is a bit unwieldy. I don't have a great alternative, but should be refined. Group makes clear sense and is what it says. GroupAccount is not clear.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, GroupAccount is a bit unwieldy but I also was unable to come up with a better name. I am open to proposals.

Copy link
Contributor

Choose a reason for hiding this comment

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

I will give one when I have one.... wish I was good at naming

}
```

*Returns:* a new auto-generated `sdk.AccAddress` for this group.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/group./group account./

type MsgUpdateGroupAccount struct {
Admin sdk.AccAddress `json:"admin"`
GroupAccount sdk.AccAddress `json:"group_account"`
NewAdmin sdk.AccAddress `json:"new_admin"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as above about omitted fields and zero-values - do we set to zero value, do we leave them unchanged? Both have issues, maybe consider pointers, even if a bit funny looking here, they render to the same json.

Copy link
Contributor

@Hyung-bharvest Hyung-bharvest Nov 26, 2019

Choose a reason for hiding this comment

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

I want to suggest two functionality to MsgUpdateGroupAccount.

  1. There can be a GroupAccount without Admin
  2. Members of the GroupAccount can vote for MsgUpdateGroupAccount

This way, we can create a GroupAccount which ownership is fully decentralized but modifiable.

Another question.
Why MsgUpdateGroupAccount does not have a field Members to be updated?

Copy link
Contributor

Choose a reason for hiding this comment

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

questions resolved. thank you @aaronc

@aaronc
Copy link
Member Author

aaronc commented Nov 6, 2019

@ethanfrey I update the spec based on your comments and responded with questions about things that I don't have a clear solution for. Let me know what you think.

@alexanderbez
Copy link
Contributor

friendly PSA: please close this PR and move to cosmos/modules.

@fedekunze
Copy link
Collaborator

bump @aaronc

@aaronc aaronc closed this Dec 2, 2019
@aaronc aaronc mentioned this pull request Oct 22, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants