-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Group module spec #5236
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5236 +/- ##
=======================================
Coverage 53.51% 53.51%
=======================================
Files 290 290
Lines 17770 17770
=======================================
Hits 9509 9509
Misses 7511 7511
Partials 750 750 |
Thanks @aaronc. tbh I don't think this belongs to the core modules. It should live in the https://github.com/cosmos/modules repo |
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:
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... |
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 /cc @ebuchman |
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.
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?
DecisionProtocol DecisionProtocol `json:"decision_protocol"` | ||
Admin sdk.AccAddress `json:"admin"` | ||
Group GroupID `json:"group"` | ||
NewAdmin sdk.AccAddress `json:"new_admin"` |
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.
Please define behavior if NewAdmin is unset (I assume don't change Admin).
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.
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.
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.
I agree
x/group/spec/group.md
Outdated
Admin sdk.AccAddress `json:"admin"` | ||
Group GroupID `json:"group"` | ||
NewAdmin sdk.AccAddress `json:"new_admin"` | ||
Description string `json:"description,omitempty"` |
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.
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)
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.
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.
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.
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
@@ -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)) |
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.
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.
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.
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
}
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.
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 |
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.
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.
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.
Yes, GroupAccount is a bit unwieldy but I also was unable to come up with a better name. I am open to proposals.
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.
I will give one when I have one.... wish I was good at naming
x/group/spec/group_account.md
Outdated
} | ||
``` | ||
|
||
*Returns:* a new auto-generated `sdk.AccAddress` for this group. |
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.
s/group./group account./
type MsgUpdateGroupAccount struct { | ||
Admin sdk.AccAddress `json:"admin"` | ||
GroupAccount sdk.AccAddress `json:"group_account"` | ||
NewAdmin sdk.AccAddress `json:"new_admin"` |
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.
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.
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.
I want to suggest two functionality to MsgUpdateGroupAccount
.
- There can be a
GroupAccount
withoutAdmin
- Members of the
GroupAccount
can vote forMsgUpdateGroupAccount
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?
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.
questions resolved. thank you @aaronc
@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. |
friendly PSA: please close this PR and move to |
bump @aaronc |
@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: