Skip to content

Commit

Permalink
feat!: allow to set initial members during user group creation (#974)
Browse files Browse the repository at this point in the history
## Description

This PR adds the `initial_members` field to `MsgCreateUserGroup` to allow users to specify the initial set of users that should be included into the group when creating it. This is particularly useful to clients to reduce the number of transactions to be done when creating a user group. 

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html)
- [x] included the necessary unit and integration [tests](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
  • Loading branch information
RiccardoM authored Jul 25, 2022
1 parent 95711e2 commit ffd6e13
Show file tree
Hide file tree
Showing 31 changed files with 650 additions and 512 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: feat
module: x/subspaces
pull_request: 974
description: Added `initial_members` field to `MsgCreateUserGroup` to allow setting
initial group members
backward_compatible: false
date: 2022-07-22T06:48:59.416978528Z
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ COSMOS_URL = https://raw.githubusercontent.com/cosmos/cosmos-sdk/v0.45.4/prot
COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/master
CONFIO_URL = https://raw.githubusercontent.com/confio/ics23/v0.6.3
IBC_URL = https://raw.githubusercontent.com/cosmos/ibc-go/v3.1.0/proto/ibc
EVMOS_URL = https://raw.githubusercontent.com/evmos/ethermint/v0.17.1/proto/ethermint/
ETHERMINT_URL = https://raw.githubusercontent.com/evmos/ethermint/v0.17.1/proto/ethermint/

TM_CRYPTO_TYPES = third_party/proto/tendermint/crypto
TM_ABCI_TYPES = third_party/proto/tendermint/abci
Expand All @@ -377,7 +377,7 @@ GOGO_PROTO_TYPES = third_party/proto/gogoproto
COSMOS_TYPES = third_party/proto/cosmos
COSMOS_PROTO_TYPES = third_party/proto/cosmos_proto
CONFIO_TYPES = third_party/proto/confio
EVMOS_TYPES = third_party/proto/evmos
ETHERMINT_TYPES = third_party/proto/ethermint

proto-update-deps:
@mkdir -p $(COSMOS_TYPES)/base/query/v1beta1
Expand All @@ -395,8 +395,8 @@ proto-update-deps:
@mkdir -p $(IBC_TYPES)/core/client/v1
@curl -sSL $(IBC_URL)/core/client/v1/client.proto > $(IBC_TYPES)/core/client/v1/client.proto

@mkdir -p $(EVMOS_TYPES)/crypto/v1/ethsecp256k1
@curl -sSL $(EVMOS_URL)crypto/v1/ethsecp256k1/keys.proto > $(EVMOS_TYPES)/crypto/v1/ethsecp256k1/keys.proto
@mkdir -p $(ETHERMINT_TYPES)/crypto/v1/ethsecp256k1
@curl -sSL $(ETHERMINT_URL)crypto/v1/ethsecp256k1/keys.proto > $(ETHERMINT_TYPES)/crypto/v1/ethsecp256k1/keys.proto

@mkdir -p $(COSMOS_TYPES)/tx/signing/v1beta1
@curl -sSL $(COSMOS_URL)/tx/signing/v1beta1/signing.proto > $(COSMOS_TYPES)/tx/signing/v1beta1/signing.proto
Expand Down
2 changes: 1 addition & 1 deletion client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"url": "./tmp-swagger-gen/desmos/relationships/v1/query.swagger.json"
},
{
"url": "./tmp-swagger-gen/desmos/subspaces/v2/query.swagger.json"
"url": "./tmp-swagger-gen/desmos/subspaces/v3/query.swagger.json"
},
{
"url": "./tmp-swagger-gen/desmos/posts/v2/query.swagger.json",
Expand Down
44 changes: 22 additions & 22 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4963,7 +4963,7 @@ paths:
format: boolean
tags:
- Query
/desmos/subspaces/v2/subspaces:
/desmos/subspaces/v3/subspaces:
get:
summary: Subspaces queries all the subspaces inside Desmos
operationId: Subspaces
Expand Down Expand Up @@ -5122,7 +5122,7 @@ paths:
format: boolean
tags:
- Query
'/desmos/subspaces/v2/subspaces/{subspace_id}':
'/desmos/subspaces/v3/subspaces/{subspace_id}':
get:
summary: >-
Subspace queries all the information about the subspace with the given
Expand Down Expand Up @@ -5200,7 +5200,7 @@ paths:
format: uint64
tags:
- Query
'/desmos/subspaces/v2/subspaces/{subspace_id}/groups':
'/desmos/subspaces/v3/subspaces/{subspace_id}/groups':
get:
summary: >-
UserGroups queries all the groups that are present inside the subspace
Expand Down Expand Up @@ -5374,7 +5374,7 @@ paths:
format: boolean
tags:
- Query
'/desmos/subspaces/v2/subspaces/{subspace_id}/groups/{group_id}':
'/desmos/subspaces/v3/subspaces/{subspace_id}/groups/{group_id}':
get:
summary: |-
UserGroup queries the user group having the given id inside the specific
Expand Down Expand Up @@ -5459,7 +5459,7 @@ paths:
format: int64
tags:
- Query
'/desmos/subspaces/v2/subspaces/{subspace_id}/groups/{group_id}/members':
'/desmos/subspaces/v3/subspaces/{subspace_id}/groups/{group_id}/members':
get:
summary: UserGroupMembers queries all the members of a given user group
operationId: UserGroupMembers
Expand Down Expand Up @@ -5598,7 +5598,7 @@ paths:
format: boolean
tags:
- Query
'/desmos/subspaces/v2/subspaces/{subspace_id}/permissions/{user}':
'/desmos/subspaces/v3/subspaces/{subspace_id}/permissions/{user}':
get:
summary: UserPermissions queries the permissions for the given user
operationId: UserPermissions
Expand Down Expand Up @@ -5696,7 +5696,7 @@ paths:
format: int64
tags:
- Query
'/desmos/subspaces/v2/{subspace_id}/sections':
'/desmos/subspaces/v3/{subspace_id}/sections':
get:
summary: Sections allows to query for the sections of a specific subspace
operationId: Sections
Expand Down Expand Up @@ -5849,7 +5849,7 @@ paths:
format: boolean
tags:
- Query
'/desmos/subspaces/v2/{subspace_id}/sections/{section_id}':
'/desmos/subspaces/v3/{subspace_id}/sections/{section_id}':
get:
summary: Section queries all the information about the section with the given id
operationId: Section
Expand Down Expand Up @@ -16205,7 +16205,7 @@ definitions:
Blocked

user.
desmos.subspaces.v2.PermissionDetail:
desmos.subspaces.v3.PermissionDetail:
type: object
properties:
subspace_id:
Expand Down Expand Up @@ -16242,7 +16242,7 @@ definitions:
type: string
title: Permissions set to the group
title: PermissionDetail contains the details data of a permission
desmos.subspaces.v2.PermissionDetail.Group:
desmos.subspaces.v3.PermissionDetail.Group:
type: object
properties:
group_id:
Expand All @@ -16255,7 +16255,7 @@ definitions:
type: string
title: Permissions set to the group
title: Group is a permission that has been set to a user group
desmos.subspaces.v2.PermissionDetail.User:
desmos.subspaces.v3.PermissionDetail.User:
type: object
properties:
user:
Expand All @@ -16267,7 +16267,7 @@ definitions:
type: string
title: Permissions set to the user
title: User is a permission that has been set to a specific user
desmos.subspaces.v2.QuerySectionResponse:
desmos.subspaces.v3.QuerySectionResponse:
type: object
properties:
section:
Expand All @@ -16293,7 +16293,7 @@ definitions:
title: (optional) Description of the section
title: Section contains the data of a single subspace section
title: QuerySectionResponse is the response type for Query/Section RPC method
desmos.subspaces.v2.QuerySectionsResponse:
desmos.subspaces.v3.QuerySectionsResponse:
type: object
properties:
sections:
Expand Down Expand Up @@ -16346,7 +16346,7 @@ definitions:
PageResponse page = 2;
}
title: QuerySectionsResponse is the response type for Query/Sections RPC method
desmos.subspaces.v2.QuerySubspaceResponse:
desmos.subspaces.v3.QuerySubspaceResponse:
type: object
properties:
subspace:
Expand Down Expand Up @@ -16381,7 +16381,7 @@ definitions:
title: the creation time of the subspace
title: Subspace contains all the data of a Desmos subspace
title: QuerySubspaceResponse is the response type for the Query/Subspace method
desmos.subspaces.v2.QuerySubspacesResponse:
desmos.subspaces.v3.QuerySubspacesResponse:
type: object
properties:
subspaces:
Expand Down Expand Up @@ -16445,7 +16445,7 @@ definitions:
title: |-
QuerySubspacesResponse is the response type for the Query/Subspaces RPC
method
desmos.subspaces.v2.QueryUserGroupMembersResponse:
desmos.subspaces.v3.QueryUserGroupMembersResponse:
type: object
properties:
members:
Expand Down Expand Up @@ -16480,7 +16480,7 @@ definitions:
title: |-
QueryUserGroupMembersResponse is the response type for the
Query/UserGroupMembers RPC method
desmos.subspaces.v2.QueryUserGroupResponse:
desmos.subspaces.v3.QueryUserGroupResponse:
type: object
properties:
group:
Expand Down Expand Up @@ -16515,7 +16515,7 @@ definitions:
title: |-
QueryUserGroupResponse is the response type for the Query/UserGroup RPC
method
desmos.subspaces.v2.QueryUserGroupsResponse:
desmos.subspaces.v3.QueryUserGroupsResponse:
type: object
properties:
groups:
Expand Down Expand Up @@ -16577,7 +16577,7 @@ definitions:
title: |-
QueryUserGroupsResponse is the response type for the Query/UserGroups RPC
method
desmos.subspaces.v2.QueryUserPermissionsResponse:
desmos.subspaces.v3.QueryUserPermissionsResponse:
type: object
properties:
permissions:
Expand Down Expand Up @@ -16626,7 +16626,7 @@ definitions:
title: |-
QueryUserPermissionsRequest is the response type for the
Query/UserPermissions method
desmos.subspaces.v2.Section:
desmos.subspaces.v3.Section:
type: object
properties:
subspace_id:
Expand All @@ -16648,7 +16648,7 @@ definitions:
type: string
title: (optional) Description of the section
title: Section contains the data of a single subspace section
desmos.subspaces.v2.Subspace:
desmos.subspaces.v3.Subspace:
type: object
properties:
id:
Expand Down Expand Up @@ -16679,7 +16679,7 @@ definitions:
format: date-time
title: the creation time of the subspace
title: Subspace contains all the data of a Desmos subspace
desmos.subspaces.v2.UserGroup:
desmos.subspaces.v3.UserGroup:
type: object
properties:
subspace_id:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
syntax = "proto3";
package desmos.subspaces.v2.authz;
package desmos.subspaces.v3.authz;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
syntax = "proto3";
package desmos.subspaces.v2;
package desmos.subspaces.v3;

import "gogoproto/gogo.proto";
import "desmos/subspaces/v2/models.proto";
import "desmos/subspaces/v3/models.proto";

option go_package = "github.com/desmos-labs/desmos/v4/x/subspaces/types";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
syntax = "proto3";
package desmos.subspaces.v2;
package desmos.subspaces.v3;

import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
syntax = "proto3";
package desmos.subspaces.v2;
package desmos.subspaces.v3;

import "gogoproto/gogo.proto";
import "desmos/subspaces/v2/models.proto";
import "desmos/subspaces/v3/models.proto";

option go_package = "github.com/desmos-labs/desmos/v4/x/subspaces/types";

Expand Down Expand Up @@ -256,8 +256,12 @@ message MsgCreateUserGroup {
repeated string default_permissions = 5
[ (gogoproto.moretags) = "yaml:\"default_permissions\"" ];

// Initial members to be put inside the group
repeated string initial_members = 6
[ (gogoproto.moretags) = "yaml:\"initial_members\"" ];

// Creator of the group
string creator = 6 [ (gogoproto.moretags) = "yaml:\"creator\"" ];
string creator = 7 [ (gogoproto.moretags) = "yaml:\"creator\"" ];
}

// MsgCreateUserGroupResponse defines the Msg/CreateUserGroup response type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
syntax = "proto3";
package desmos.subspaces.v2;
package desmos.subspaces.v3;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";

import "desmos/subspaces/v2/models.proto";
import "desmos/subspaces/v3/models.proto";

option go_package = "github.com/desmos-labs/desmos/v4/x/subspaces/types";

Expand All @@ -14,53 +14,53 @@ service Query {

// Subspaces queries all the subspaces inside Desmos
rpc Subspaces(QuerySubspacesRequest) returns (QuerySubspacesResponse) {
option (google.api.http).get = "/desmos/subspaces/v2/subspaces";
option (google.api.http).get = "/desmos/subspaces/v3/subspaces";
}

// Subspace queries all the information about the subspace with the given id
rpc Subspace(QuerySubspaceRequest) returns (QuerySubspaceResponse) {
option (google.api.http).get =
"/desmos/subspaces/v2/subspaces/{subspace_id}";
"/desmos/subspaces/v3/subspaces/{subspace_id}";
}

// Sections allows to query for the sections of a specific subspace
rpc Sections(QuerySectionsRequest) returns (QuerySectionsResponse) {
option (google.api.http).get =
"/desmos/subspaces/v2/{subspace_id}/sections";
"/desmos/subspaces/v3/{subspace_id}/sections";
}

// Section queries all the information about the section with the given id
rpc Section(QuerySectionRequest) returns (QuerySectionResponse) {
option (google.api.http).get =
"/desmos/subspaces/v2/{subspace_id}/sections/{section_id}";
"/desmos/subspaces/v3/{subspace_id}/sections/{section_id}";
}

// UserGroups queries all the groups that are present inside the subspace with
// the given id
rpc UserGroups(QueryUserGroupsRequest) returns (QueryUserGroupsResponse) {
option (google.api.http).get =
"/desmos/subspaces/v2/subspaces/{subspace_id}/groups";
"/desmos/subspaces/v3/subspaces/{subspace_id}/groups";
}

// UserGroup queries the user group having the given id inside the specific
// subspace
rpc UserGroup(QueryUserGroupRequest) returns (QueryUserGroupResponse) {
option (google.api.http).get =
"/desmos/subspaces/v2/subspaces/{subspace_id}/groups/{group_id}";
"/desmos/subspaces/v3/subspaces/{subspace_id}/groups/{group_id}";
}

// UserGroupMembers queries all the members of a given user group
rpc UserGroupMembers(QueryUserGroupMembersRequest)
returns (QueryUserGroupMembersResponse) {
option (google.api.http).get = "/desmos/subspaces/v2/subspaces/"
option (google.api.http).get = "/desmos/subspaces/v3/subspaces/"
"{subspace_id}/groups/{group_id}/members";
}

// UserPermissions queries the permissions for the given user
rpc UserPermissions(QueryUserPermissionsRequest)
returns (QueryUserPermissionsResponse) {
option (google.api.http).get =
"/desmos/subspaces/v2/subspaces/{subspace_id}/permissions/{user}";
"/desmos/subspaces/v3/subspaces/{subspace_id}/permissions/{user}";
}
}

Expand Down
Loading

0 comments on commit ffd6e13

Please sign in to comment.