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

feat: Add server implementation of Group module #10570

Merged
merged 70 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
32cb63a
remove Request suffix from Msg types
likhita-809 Oct 29, 2021
fe6a8d5
wip
likhita-809 Nov 8, 2021
246484e
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 8, 2021
e274069
wip
likhita-809 Nov 9, 2021
4203f24
wip
likhita-809 Nov 9, 2021
743520c
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 9, 2021
3f4179e
wip
likhita-809 Nov 9, 2021
acad315
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 17, 2021
be27cba
wip
likhita-809 Nov 18, 2021
71c2dee
run go mod tidy
likhita-809 Nov 18, 2021
a864359
small change
likhita-809 Nov 18, 2021
18794db
wip
likhita-809 Nov 22, 2021
3851900
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 22, 2021
36b07b3
wip
likhita-809 Nov 22, 2021
efb22ee
fix something
likhita-809 Nov 22, 2021
1edaf8c
wip
likhita-809 Nov 23, 2021
3d5c37d
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 23, 2021
87054b8
wip
likhita-809 Nov 23, 2021
164a153
wip
likhita-809 Nov 23, 2021
0f6028b
run go mod tidy
likhita-809 Nov 23, 2021
d4156a2
wip
likhita-809 Nov 23, 2021
c473327
wip
likhita-809 Nov 23, 2021
491ff91
fix tests
likhita-809 Nov 23, 2021
8bcbbf7
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 24, 2021
ec93341
add keeper tests
likhita-809 Nov 25, 2021
624726b
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 25, 2021
ac4e247
address comments
likhita-809 Nov 25, 2021
f8a74b6
use single MsgServiceRouter
likhita-809 Nov 25, 2021
308852e
address review comments
likhita-809 Nov 25, 2021
f5fdbea
fix something
likhita-809 Nov 25, 2021
2c405d3
Update import
blushi Nov 25, 2021
100c4f4
delete conditions.go file
likhita-809 Nov 25, 2021
977c94e
Merge branch 'likhita/group-server-implementation' of https://github.…
likhita-809 Nov 25, 2021
ca772c6
fix something
likhita-809 Nov 25, 2021
020e58f
add func to run TestSuite
likhita-809 Nov 25, 2021
140fbb8
Set accKeeper in group keeper
blushi Nov 25, 2021
abbe3ba
update keeper_test
likhita-809 Nov 25, 2021
8ed012a
Merge branch 'likhita/group-server-implementation' of https://github.…
likhita-809 Nov 25, 2021
bf9a57f
Fix timeout duration in test
blushi Nov 25, 2021
d11be84
Fix get group account
blushi Nov 25, 2021
edaa1c7
fix failed test case in keeper
likhita-809 Nov 26, 2021
177ac08
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into li…
likhita-809 Nov 26, 2021
50f3241
Fix some tests
blushi Nov 26, 2021
2c3a4c0
Merge branch 'likhita/group-server-implementation' of github.com:cosm…
blushi Nov 26, 2021
66db140
Rm unneeded set policy
blushi Nov 26, 2021
410e96d
Fix more tests related to ctx not being cached
blushi Nov 26, 2021
d76908e
Fix keeper_tests
blushi Nov 29, 2021
8c1f888
Rm derivation key
blushi Nov 29, 2021
334c667
Merge branch 'master' into likhita/group-server-implementation
blushi Nov 29, 2021
2f7f72c
proto-gen
blushi Nov 29, 2021
00b8cdb
go mod tidy
blushi Nov 29, 2021
10cefb7
Update proto wip
blushi Dec 1, 2021
1501297
Merge branch 'master' into likhita/group-server-implementation
blushi Dec 1, 2021
8a0f415
Fix tests
blushi Dec 1, 2021
52fad21
proto lint
blushi Dec 1, 2021
318d527
go mod tidy
blushi Dec 1, 2021
e2e26d0
Use existing TestMsg
blushi Dec 2, 2021
bdfa1f8
Merge branch 'master' into likhita/group-server-implementation
blushi Dec 2, 2021
12a2f32
go mod
blushi Dec 2, 2021
5422f59
Update x/group/keeper/msg_server.go
blushi Dec 2, 2021
6c8886d
Address review comments
blushi Dec 2, 2021
de9584d
Merge branch 'likhita/group-server-implementation' of github.com:cosm…
blushi Dec 2, 2021
b6442dc
tidy
blushi Dec 2, 2021
48c10a1
Merge branch 'master' into likhita/group-server-implementation
likhita-809 Dec 6, 2021
7cdeccc
Use BigEndian
blushi Dec 8, 2021
9bbcaba
Merge branch 'master' into likhita/group-server-implementation
blushi Dec 8, 2021
f911eda
Merge branch 'master' into likhita/group-server-implementation
blushi Dec 9, 2021
81dd664
Use derivation for group acc addr
blushi Dec 9, 2021
9f0b1e9
Merge branch 'master' into likhita/group-server-implementation
blushi Dec 10, 2021
f03ac5a
Rm sim
blushi Dec 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
271 changes: 200 additions & 71 deletions docs/core/proto-docs.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/cosmos/btcutil v1.0.4
github.com/cosmos/cosmos-proto v0.0.0-20211123144845-528f5002c9f8
github.com/cosmos/cosmos-sdk/db v0.0.0
github.com/cosmos/cosmos-sdk/x/group v0.0.0-00010101000000-000000000000
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/iavl v0.17.3
github.com/cosmos/ledger-cosmos-go v0.11.1
Expand Down Expand Up @@ -65,6 +66,7 @@ require (
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/cosmos/ledger-go v0.9.2 // indirect
github.com/danieljoos/wincred v1.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down Expand Up @@ -151,3 +153,5 @@ replace github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210
replace github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0

replace github.com/cosmos/cosmos-sdk/db => ./db

replace github.com/cosmos/cosmos-sdk/x/group => ./x/group
83 changes: 83 additions & 0 deletions go.sum

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions proto/cosmos/group/v1beta1/events.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
syntax = "proto3";

package cosmos.group.v1beta1;

import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/group";

// EventCreateGroup is an event emitted when a group is created.
message EventCreateGroup {

// group_id is the unique ID of the group.
uint64 group_id = 1;
}

// EventUpdateGroup is an event emitted when a group is updated.
message EventUpdateGroup {

// group_id is the unique ID of the group.
uint64 group_id = 1;
}

// EventCreateGroupAccount is an event emitted when a group account is created.
message EventCreateGroupAccount {

// address is the address of the group account.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];;
}

// EventUpdateGroupAccount is an event emitted when a group account is updated.
message EventUpdateGroupAccount {

// address is the address of the group account.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];;
}

// EventCreateProposal is an event emitted when a proposal is created.
message EventCreateProposal {

// proposal_id is the unique ID of the proposal.
uint64 proposal_id = 1;
}

// EventVote is an event emitted when a voter votes on a proposal.
message EventVote {

// proposal_id is the unique ID of the proposal.
uint64 proposal_id = 1;
}

// EventExec is an event emitted when a proposal is executed.
message EventExec {

// proposal_id is the unique ID of the proposal.
uint64 proposal_id = 1;
}

10 changes: 5 additions & 5 deletions proto/cosmos/group/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ message QueryGroupAccountInfoResponse {
GroupAccountInfo info = 1;
}

// QueryGroupMembersRequest is the Query/GroupMembersRequest request type.
// QueryGroupMembersRequest is the Query/GroupMembers request type.
message QueryGroupMembersRequest {

// group_id is the unique ID of the group.
Expand All @@ -93,7 +93,7 @@ message QueryGroupMembersResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryGroupsByAdminRequest is the Query/GroupsByAdminRequest request type.
// QueryGroupsByAdminRequest is the Query/GroupsByAdmin request type.
message QueryGroupsByAdminRequest {

// admin is the account address of a group's admin.
Expand Down Expand Up @@ -187,7 +187,7 @@ message QueryProposalsByGroupAccountResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter request type.
// QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type.
message QueryVoteByProposalVoterRequest {

// proposal_id is the unique ID of a proposal.
Expand All @@ -204,7 +204,7 @@ message QueryVoteByProposalVoterResponse {
Vote vote = 1;
}

// QueryVotesByProposalResponse is the Query/VotesByProposal request type.
// QueryVotesByProposalRequest is the Query/VotesByProposal request type.
message QueryVotesByProposalRequest {

// proposal_id is the unique ID of a proposal.
Expand All @@ -224,7 +224,7 @@ message QueryVotesByProposalResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryVotesByVoterResponse is the Query/VotesByVoter request type.
// QueryVotesByVoterRequest is the Query/VotesByVoter request type.
message QueryVotesByVoterRequest {
// voter is a proposal voter account address.
string voter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
Expand Down
66 changes: 33 additions & 33 deletions proto/cosmos/group/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,46 @@ import "cosmos/group/v1beta1/types.proto";
service Msg {

// CreateGroup creates a new group with an admin account address, a list of members and some optional metadata.
rpc CreateGroup(MsgCreateGroupRequest) returns (MsgCreateGroupResponse);
rpc CreateGroup(MsgCreateGroup) returns (MsgCreateGroupResponse);

// UpdateGroupMembers updates the group members with given group id and admin address.
rpc UpdateGroupMembers(MsgUpdateGroupMembersRequest) returns (MsgUpdateGroupMembersResponse);
rpc UpdateGroupMembers(MsgUpdateGroupMembers) returns (MsgUpdateGroupMembersResponse);

// UpdateGroupAdmin updates the group admin with given group id and previous admin address.
rpc UpdateGroupAdmin(MsgUpdateGroupAdminRequest) returns (MsgUpdateGroupAdminResponse);
rpc UpdateGroupAdmin(MsgUpdateGroupAdmin) returns (MsgUpdateGroupAdminResponse);

// UpdateGroupMetadata updates the group metadata with given group id and admin address.
rpc UpdateGroupMetadata(MsgUpdateGroupMetadataRequest) returns (MsgUpdateGroupMetadataResponse);
rpc UpdateGroupMetadata(MsgUpdateGroupMetadata) returns (MsgUpdateGroupMetadataResponse);

// CreateGroupAccount creates a new group account using given DecisionPolicy.
rpc CreateGroupAccount(MsgCreateGroupAccountRequest) returns (MsgCreateGroupAccountResponse);
rpc CreateGroupAccount(MsgCreateGroupAccount) returns (MsgCreateGroupAccountResponse);

// UpdateGroupAccountAdmin updates a group account admin.
rpc UpdateGroupAccountAdmin(MsgUpdateGroupAccountAdminRequest) returns (MsgUpdateGroupAccountAdminResponse);
rpc UpdateGroupAccountAdmin(MsgUpdateGroupAccountAdmin) returns (MsgUpdateGroupAccountAdminResponse);

// UpdateGroupAccountDecisionPolicy allows a group account decision policy to be updated.
rpc UpdateGroupAccountDecisionPolicy(MsgUpdateGroupAccountDecisionPolicyRequest)
rpc UpdateGroupAccountDecisionPolicy(MsgUpdateGroupAccountDecisionPolicy)
returns (MsgUpdateGroupAccountDecisionPolicyResponse);

// UpdateGroupAccountMetadata updates a group account metadata.
rpc UpdateGroupAccountMetadata(MsgUpdateGroupAccountMetadataRequest) returns (MsgUpdateGroupAccountMetadataResponse);
rpc UpdateGroupAccountMetadata(MsgUpdateGroupAccountMetadata) returns (MsgUpdateGroupAccountMetadataResponse);

// CreateProposal submits a new proposal.
rpc CreateProposal(MsgCreateProposalRequest) returns (MsgCreateProposalResponse);
rpc CreateProposal(MsgCreateProposal) returns (MsgCreateProposalResponse);

// Vote allows a voter to vote on a proposal.
rpc Vote(MsgVoteRequest) returns (MsgVoteResponse);
rpc Vote(MsgVote) returns (MsgVoteResponse);

// Exec executes a proposal.
rpc Exec(MsgExecRequest) returns (MsgExecResponse);
rpc Exec(MsgExec) returns (MsgExecResponse);
}

//
// Groups
//

// MsgCreateGroupRequest is the Msg/CreateGroup request type.
message MsgCreateGroupRequest {
// MsgCreateGroup is the Msg/CreateGroup request type.
message MsgCreateGroup {

// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
Expand All @@ -71,8 +71,8 @@ message MsgCreateGroupResponse {
uint64 group_id = 1;
}

// MsgUpdateGroupMembersRequest is the Msg/UpdateGroupMembers request type.
message MsgUpdateGroupMembersRequest {
// MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type.
message MsgUpdateGroupMembers {

// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
Expand All @@ -88,8 +88,8 @@ message MsgUpdateGroupMembersRequest {
// MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type.
message MsgUpdateGroupMembersResponse {}

// MsgUpdateGroupAdminRequest is the Msg/UpdateGroupAdmin request type.
message MsgUpdateGroupAdminRequest {
// MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type.
message MsgUpdateGroupAdmin {

// admin is the current account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
Expand All @@ -104,8 +104,8 @@ message MsgUpdateGroupAdminRequest {
// MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type.
message MsgUpdateGroupAdminResponse {}

// MsgUpdateGroupMetadataRequest is the Msg/UpdateGroupMetadata request type.
message MsgUpdateGroupMetadataRequest {
// MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type.
message MsgUpdateGroupMetadata {

// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
Expand All @@ -124,8 +124,8 @@ message MsgUpdateGroupMetadataResponse {}
// Group Accounts
//

// MsgCreateGroupAccountRequest is the Msg/CreateGroupAccount request type.
message MsgCreateGroupAccountRequest {
// MsgCreateGroupAccount is the Msg/CreateGroupAccount request type.
message MsgCreateGroupAccount {
option (gogoproto.goproto_getters) = false;

// admin is the account address of the group admin.
Expand All @@ -148,8 +148,8 @@ message MsgCreateGroupAccountResponse {
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// MsgUpdateGroupAccountAdminRequest is the Msg/UpdateGroupAccountAdmin request type.
message MsgUpdateGroupAccountAdminRequest {
// MsgUpdateGroupAccountAdmin is the Msg/UpdateGroupAccountAdmin request type.
message MsgUpdateGroupAccountAdmin {

// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
Expand All @@ -164,8 +164,8 @@ message MsgUpdateGroupAccountAdminRequest {
// MsgUpdateGroupAccountAdminResponse is the Msg/UpdateGroupAccountAdmin response type.
message MsgUpdateGroupAccountAdminResponse {}

// MsgUpdateGroupAccountDecisionPolicyRequest is the Msg/UpdateGroupAccountDecisionPolicy request type.
message MsgUpdateGroupAccountDecisionPolicyRequest {
// MsgUpdateGroupAccountDecisionPolicy is the Msg/UpdateGroupAccountDecisionPolicy request type.
message MsgUpdateGroupAccountDecisionPolicy {
option (gogoproto.goproto_getters) = false;

// admin is the account address of the group admin.
Expand All @@ -181,8 +181,8 @@ message MsgUpdateGroupAccountDecisionPolicyRequest {
// MsgUpdateGroupAccountDecisionPolicyResponse is the Msg/UpdateGroupAccountDecisionPolicy response type.
message MsgUpdateGroupAccountDecisionPolicyResponse {}

// MsgUpdateGroupAccountMetadataRequest is the Msg/UpdateGroupAccountMetadata request type.
message MsgUpdateGroupAccountMetadataRequest {
// MsgUpdateGroupAccountMetadata is the Msg/UpdateGroupAccountMetadata request type.
message MsgUpdateGroupAccountMetadata {

// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
Expand Down Expand Up @@ -215,8 +215,8 @@ enum Exec {
EXEC_TRY = 1;
}

// MsgCreateProposalRequest is the Msg/CreateProposal request type.
message MsgCreateProposalRequest {
// MsgCreateProposal is the Msg/CreateProposal request type.
message MsgCreateProposal {
option (gogoproto.goproto_getters) = false;

// address is the group account address.
Expand Down Expand Up @@ -245,8 +245,8 @@ message MsgCreateProposalResponse {
uint64 proposal_id = 1;
}

// MsgVoteRequest is the Msg/Vote request type.
message MsgVoteRequest {
// MsgVote is the Msg/Vote request type.
message MsgVote {

// proposal is the unique ID of the proposal.
uint64 proposal_id = 1;
Expand All @@ -267,8 +267,8 @@ message MsgVoteRequest {
// MsgVoteResponse is the Msg/Vote response type.
message MsgVoteResponse {}

// MsgExecRequest is the Msg/Exec request type.
message MsgExecRequest {
// MsgExec is the Msg/Exec request type.
message MsgExec {

// proposal is the unique ID of the proposal.
uint64 proposal_id = 1;
Expand Down
4 changes: 0 additions & 4 deletions proto/cosmos/group/v1beta1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ message GroupAccountInfo {

// decision_policy specifies the group account's decision policy.
google.protobuf.Any decision_policy = 6 [(cosmos_proto.accepts_interface) = "DecisionPolicy"];

// derivation_key is the "derivation" key of the group account,
// which is needed to derive the group root module key and execute proposals.
bytes derivation_key = 7;
}

// Proposal defines a group proposal. Any member of a group can submit a proposal
Expand Down
Loading