fix: Update "Group Account" naming to "Group Policy" in group module (#10865)
## Description Closes: #10565 Rename mentions of "group account" (in proto files, code, docs, etc.) to "group policy" in group module. --- ### 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... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] 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)
This commit is contained in:
parent
074c95bdbf
commit
28541e7ca3
|
@ -20,18 +20,18 @@ message EventUpdateGroup {
|
|||
uint64 group_id = 1;
|
||||
}
|
||||
|
||||
// EventCreateGroupAccount is an event emitted when a group account is created.
|
||||
message EventCreateGroupAccount {
|
||||
// EventCreateGroupPolicy is an event emitted when a group policy is created.
|
||||
message EventCreateGroupPolicy {
|
||||
|
||||
// address is the address of the group account.
|
||||
// address is the account address of the group policy.
|
||||
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
;
|
||||
}
|
||||
|
||||
// EventUpdateGroupAccount is an event emitted when a group account is updated.
|
||||
message EventUpdateGroupAccount {
|
||||
// EventUpdateGroupPolicy is an event emitted when a group policy is updated.
|
||||
message EventUpdateGroupPolicy {
|
||||
|
||||
// address is the address of the group account.
|
||||
// address is the account address of the group policy.
|
||||
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
;
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ service Query {
|
|||
option (google.api.http).get = "/cosmos/group/v1beta1/group_info/{group_id}";
|
||||
};
|
||||
|
||||
// GroupAccountInfo queries group account info based on group account address.
|
||||
rpc GroupAccountInfo(QueryGroupAccountInfoRequest) returns (QueryGroupAccountInfoResponse) {
|
||||
option (google.api.http).get = "/cosmos/group/v1beta1/group_account_info/{address}";
|
||||
// GroupPolicyInfo queries group policy info based on account address of group policy.
|
||||
rpc GroupPolicyInfo(QueryGroupPolicyInfoRequest) returns (QueryGroupPolicyInfoResponse) {
|
||||
option (google.api.http).get = "/cosmos/group/v1beta1/group_policy_info/{address}";
|
||||
};
|
||||
|
||||
// GroupMembers queries members of a group
|
||||
|
@ -32,14 +32,14 @@ service Query {
|
|||
option (google.api.http).get = "/cosmos/group/v1beta1/groups_by_admin/{admin}";
|
||||
};
|
||||
|
||||
// GroupAccountsByGroup queries group accounts by group id.
|
||||
rpc GroupAccountsByGroup(QueryGroupAccountsByGroupRequest) returns (QueryGroupAccountsByGroupResponse) {
|
||||
option (google.api.http).get = "/cosmos/group/v1beta1/group_accounts_by_group/{group_id}";
|
||||
// GroupPoliciesByGroup queries group policies by group id.
|
||||
rpc GroupPoliciesByGroup(QueryGroupPoliciesByGroupRequest) returns (QueryGroupPoliciesByGroupResponse) {
|
||||
option (google.api.http).get = "/cosmos/group/v1beta1/group_policies_by_group/{group_id}";
|
||||
};
|
||||
|
||||
// GroupsByAdmin queries group accounts by admin address.
|
||||
rpc GroupAccountsByAdmin(QueryGroupAccountsByAdminRequest) returns (QueryGroupAccountsByAdminResponse) {
|
||||
option (google.api.http).get = "/cosmos/group/v1beta1/group_accounts_by_admin/{admin}";
|
||||
// GroupsByAdmin queries group policies by admin address.
|
||||
rpc GroupPoliciesByAdmin(QueryGroupPoliciesByAdminRequest) returns (QueryGroupPoliciesByAdminResponse) {
|
||||
option (google.api.http).get = "/cosmos/group/v1beta1/group_policies_by_admin/{admin}";
|
||||
};
|
||||
|
||||
// Proposal queries a proposal based on proposal id.
|
||||
|
@ -47,9 +47,9 @@ service Query {
|
|||
option (google.api.http).get = "/cosmos/group/v1beta1/proposal/{proposal_id}";
|
||||
};
|
||||
|
||||
// ProposalsByGroupAccount queries proposals based on group account address.
|
||||
rpc ProposalsByGroupAccount(QueryProposalsByGroupAccountRequest) returns (QueryProposalsByGroupAccountResponse) {
|
||||
option (google.api.http).get = "/cosmos/group/v1beta1/proposals_by_group_account/{address}";
|
||||
// ProposalsByGroupPolicy queries proposals based on account address of group policy.
|
||||
rpc ProposalsByGroupPolicy(QueryProposalsByGroupPolicyRequest) returns (QueryProposalsByGroupPolicyResponse) {
|
||||
option (google.api.http).get = "/cosmos/group/v1beta1/proposals_by_group_policy/{address}";
|
||||
};
|
||||
|
||||
// VoteByProposalVoter queries a vote by proposal id and voter.
|
||||
|
@ -87,18 +87,18 @@ message QueryGroupInfoResponse {
|
|||
GroupInfo info = 1;
|
||||
}
|
||||
|
||||
// QueryGroupAccountInfoRequest is the Query/GroupAccountInfo request type.
|
||||
message QueryGroupAccountInfoRequest {
|
||||
// QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type.
|
||||
message QueryGroupPolicyInfoRequest {
|
||||
|
||||
// address is the account address of the group account.
|
||||
// address is the account address of the group policy.
|
||||
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
}
|
||||
|
||||
// QueryGroupAccountInfoResponse is the Query/GroupAccountInfo response type.
|
||||
message QueryGroupAccountInfoResponse {
|
||||
// QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type.
|
||||
message QueryGroupPolicyInfoResponse {
|
||||
|
||||
// info is the GroupAccountInfo for the group account.
|
||||
GroupAccountInfo info = 1;
|
||||
// info is the GroupPolicyInfo for the group policy.
|
||||
GroupPolicyInfo info = 1;
|
||||
}
|
||||
|
||||
// QueryGroupMembersRequest is the Query/GroupMembers request type.
|
||||
|
@ -141,41 +141,41 @@ message QueryGroupsByAdminResponse {
|
|||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryGroupAccountsByGroupRequest is the Query/GroupAccountsByGroup request type.
|
||||
message QueryGroupAccountsByGroupRequest {
|
||||
// QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type.
|
||||
message QueryGroupPoliciesByGroupRequest {
|
||||
|
||||
// group_id is the unique ID of the group account's group.
|
||||
// group_id is the unique ID of the group policy's group.
|
||||
uint64 group_id = 1;
|
||||
|
||||
// pagination defines an optional pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 2;
|
||||
}
|
||||
|
||||
// QueryGroupAccountsByGroupResponse is the Query/GroupAccountsByGroup response type.
|
||||
message QueryGroupAccountsByGroupResponse {
|
||||
// QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type.
|
||||
message QueryGroupPoliciesByGroupResponse {
|
||||
|
||||
// group_accounts are the group accounts info associated with the provided group.
|
||||
repeated GroupAccountInfo group_accounts = 1;
|
||||
// group_policies are the group policies info associated with the provided group.
|
||||
repeated GroupPolicyInfo group_policies = 1;
|
||||
|
||||
// pagination defines the pagination in the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryGroupAccountsByAdminRequest is the Query/GroupAccountsByAdmin request type.
|
||||
message QueryGroupAccountsByAdminRequest {
|
||||
// QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin request type.
|
||||
message QueryGroupPoliciesByAdminRequest {
|
||||
|
||||
// admin is the admin address of the group account.
|
||||
// admin is the admin address of the group policy.
|
||||
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// pagination defines an optional pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 2;
|
||||
}
|
||||
|
||||
// QueryGroupAccountsByAdminResponse is the Query/GroupAccountsByAdmin response type.
|
||||
message QueryGroupAccountsByAdminResponse {
|
||||
// QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type.
|
||||
message QueryGroupPoliciesByAdminResponse {
|
||||
|
||||
// group_accounts are the group accounts info with provided admin.
|
||||
repeated GroupAccountInfo group_accounts = 1;
|
||||
// group_policies are the group policies info with provided admin.
|
||||
repeated GroupPolicyInfo group_policies = 1;
|
||||
|
||||
// pagination defines the pagination in the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
|
@ -195,20 +195,20 @@ message QueryProposalResponse {
|
|||
Proposal proposal = 1;
|
||||
}
|
||||
|
||||
// QueryProposalsByGroupAccountRequest is the Query/ProposalByGroupAccount request type.
|
||||
message QueryProposalsByGroupAccountRequest {
|
||||
// QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy request type.
|
||||
message QueryProposalsByGroupPolicyRequest {
|
||||
|
||||
// address is the group account address related to proposals.
|
||||
// address is the account address of the group policy related to proposals.
|
||||
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// pagination defines an optional pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 2;
|
||||
}
|
||||
|
||||
// QueryProposalsByGroupAccountResponse is the Query/ProposalByGroupAccount response type.
|
||||
message QueryProposalsByGroupAccountResponse {
|
||||
// QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type.
|
||||
message QueryProposalsByGroupPolicyResponse {
|
||||
|
||||
// proposals are the proposals with given group account.
|
||||
// proposals are the proposals with given group policy.
|
||||
repeated Proposal proposals = 1;
|
||||
|
||||
// pagination defines the pagination in the response.
|
||||
|
|
|
@ -24,18 +24,18 @@ service Msg {
|
|||
// UpdateGroupMetadata updates the group metadata with given group id and admin address.
|
||||
rpc UpdateGroupMetadata(MsgUpdateGroupMetadata) returns (MsgUpdateGroupMetadataResponse);
|
||||
|
||||
// CreateGroupAccount creates a new group account using given DecisionPolicy.
|
||||
rpc CreateGroupAccount(MsgCreateGroupAccount) returns (MsgCreateGroupAccountResponse);
|
||||
// CreateGroupPolicy creates a new group policy using given DecisionPolicy.
|
||||
rpc CreateGroupPolicy(MsgCreateGroupPolicy) returns (MsgCreateGroupPolicyResponse);
|
||||
|
||||
// UpdateGroupAccountAdmin updates a group account admin.
|
||||
rpc UpdateGroupAccountAdmin(MsgUpdateGroupAccountAdmin) returns (MsgUpdateGroupAccountAdminResponse);
|
||||
// UpdateGroupPolicyAdmin updates a group policy admin.
|
||||
rpc UpdateGroupPolicyAdmin(MsgUpdateGroupPolicyAdmin) returns (MsgUpdateGroupPolicyAdminResponse);
|
||||
|
||||
// UpdateGroupAccountDecisionPolicy allows a group account decision policy to be updated.
|
||||
rpc UpdateGroupAccountDecisionPolicy(MsgUpdateGroupAccountDecisionPolicy)
|
||||
returns (MsgUpdateGroupAccountDecisionPolicyResponse);
|
||||
// UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated.
|
||||
rpc UpdateGroupPolicyDecisionPolicy(MsgUpdateGroupPolicyDecisionPolicy)
|
||||
returns (MsgUpdateGroupPolicyDecisionPolicyResponse);
|
||||
|
||||
// UpdateGroupAccountMetadata updates a group account metadata.
|
||||
rpc UpdateGroupAccountMetadata(MsgUpdateGroupAccountMetadata) returns (MsgUpdateGroupAccountMetadataResponse);
|
||||
// UpdateGroupPolicyMetadata updates a group policy metadata.
|
||||
rpc UpdateGroupPolicyMetadata(MsgUpdateGroupPolicyMetadata) returns (MsgUpdateGroupPolicyMetadataResponse);
|
||||
|
||||
// CreateProposal submits a new proposal.
|
||||
rpc CreateProposal(MsgCreateProposal) returns (MsgCreateProposalResponse);
|
||||
|
@ -121,11 +121,11 @@ message MsgUpdateGroupMetadata {
|
|||
message MsgUpdateGroupMetadataResponse {}
|
||||
|
||||
//
|
||||
// Group Accounts
|
||||
// Group Policies
|
||||
//
|
||||
|
||||
// MsgCreateGroupAccount is the Msg/CreateGroupAccount request type.
|
||||
message MsgCreateGroupAccount {
|
||||
// MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type.
|
||||
message MsgCreateGroupPolicy {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// admin is the account address of the group admin.
|
||||
|
@ -134,68 +134,68 @@ message MsgCreateGroupAccount {
|
|||
// group_id is the unique ID of the group.
|
||||
uint64 group_id = 2;
|
||||
|
||||
// metadata is any arbitrary metadata to attached to the group account.
|
||||
// metadata is any arbitrary metadata attached to the group policy.
|
||||
bytes metadata = 3;
|
||||
|
||||
// decision_policy specifies the group account's decision policy.
|
||||
// decision_policy specifies the group policy's decision policy.
|
||||
google.protobuf.Any decision_policy = 4 [(cosmos_proto.accepts_interface) = "DecisionPolicy"];
|
||||
}
|
||||
|
||||
// MsgCreateGroupAccountResponse is the Msg/CreateGroupAccount response type.
|
||||
message MsgCreateGroupAccountResponse {
|
||||
// MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type.
|
||||
message MsgCreateGroupPolicyResponse {
|
||||
|
||||
// address is the account address of the newly created group account.
|
||||
// address is the account address of the newly created group policy.
|
||||
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
}
|
||||
|
||||
// MsgUpdateGroupAccountAdmin is the Msg/UpdateGroupAccountAdmin request type.
|
||||
message MsgUpdateGroupAccountAdmin {
|
||||
// MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type.
|
||||
message MsgUpdateGroupPolicyAdmin {
|
||||
|
||||
// admin is the account address of the group admin.
|
||||
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// address is the group account address.
|
||||
// address is the account address of the group policy.
|
||||
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// new_admin is the new group account admin.
|
||||
// new_admin is the new group policy admin.
|
||||
string new_admin = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
}
|
||||
|
||||
// MsgUpdateGroupAccountAdminResponse is the Msg/UpdateGroupAccountAdmin response type.
|
||||
message MsgUpdateGroupAccountAdminResponse {}
|
||||
// MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type.
|
||||
message MsgUpdateGroupPolicyAdminResponse {}
|
||||
|
||||
// MsgUpdateGroupAccountDecisionPolicy is the Msg/UpdateGroupAccountDecisionPolicy request type.
|
||||
message MsgUpdateGroupAccountDecisionPolicy {
|
||||
// MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type.
|
||||
message MsgUpdateGroupPolicyDecisionPolicy {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// admin is the account address of the group admin.
|
||||
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// address is the group account address.
|
||||
// address is the account address of group policy.
|
||||
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// decision_policy is the updated group account decision policy.
|
||||
// decision_policy is the updated group policy's decision policy.
|
||||
google.protobuf.Any decision_policy = 3 [(cosmos_proto.accepts_interface) = "DecisionPolicy"];
|
||||
}
|
||||
|
||||
// MsgUpdateGroupAccountDecisionPolicyResponse is the Msg/UpdateGroupAccountDecisionPolicy response type.
|
||||
message MsgUpdateGroupAccountDecisionPolicyResponse {}
|
||||
// MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type.
|
||||
message MsgUpdateGroupPolicyDecisionPolicyResponse {}
|
||||
|
||||
// MsgUpdateGroupAccountMetadata is the Msg/UpdateGroupAccountMetadata request type.
|
||||
message MsgUpdateGroupAccountMetadata {
|
||||
// MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type.
|
||||
message MsgUpdateGroupPolicyMetadata {
|
||||
|
||||
// admin is the account address of the group admin.
|
||||
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// address is the group account address.
|
||||
// address is the account address of group policy.
|
||||
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// metadata is the updated group account metadata.
|
||||
// metadata is the updated group policy metadata.
|
||||
bytes metadata = 3;
|
||||
}
|
||||
|
||||
// MsgUpdateGroupAccountMetadataResponse is the Msg/UpdateGroupAccountMetadata response type.
|
||||
message MsgUpdateGroupAccountMetadataResponse {}
|
||||
// MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type.
|
||||
message MsgUpdateGroupPolicyMetadataResponse {}
|
||||
|
||||
//
|
||||
// Proposals and Voting
|
||||
|
@ -219,7 +219,7 @@ enum Exec {
|
|||
message MsgCreateProposal {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// address is the group account address.
|
||||
// address is the account address of group policy.
|
||||
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// proposers are the account addresses of the proposers.
|
||||
|
|
|
@ -98,12 +98,12 @@ message GroupMember {
|
|||
Member member = 2;
|
||||
}
|
||||
|
||||
// GroupAccountInfo represents the high-level on-chain information for a group account.
|
||||
message GroupAccountInfo {
|
||||
// GroupPolicyInfo represents the high-level on-chain information for a group policy.
|
||||
message GroupPolicyInfo {
|
||||
option (gogoproto.equal) = true;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// address is the group account address.
|
||||
// address is the account address of group policy.
|
||||
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// group_id is the unique ID of the group.
|
||||
|
@ -112,19 +112,19 @@ message GroupAccountInfo {
|
|||
// admin is the account address of the group admin.
|
||||
string admin = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// metadata is any arbitrary metadata to attached to the group account.
|
||||
// metadata is any arbitrary metadata to attached to the group policy.
|
||||
bytes metadata = 4;
|
||||
|
||||
// version is used to track changes to a group's GroupAccountInfo structure that
|
||||
// version is used to track changes to a group's GroupPolicyInfo structure that
|
||||
// would create a different result on a running proposal.
|
||||
uint64 version = 5;
|
||||
|
||||
// decision_policy specifies the group account's decision policy.
|
||||
// decision_policy specifies the group policy's decision policy.
|
||||
google.protobuf.Any decision_policy = 6 [(cosmos_proto.accepts_interface) = "DecisionPolicy"];
|
||||
}
|
||||
|
||||
// Proposal defines a group proposal. Any member of a group can submit a proposal
|
||||
// for a group account to decide upon.
|
||||
// for a group policy to decide upon.
|
||||
// A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal
|
||||
// passes as well as some optional metadata associated with the proposal.
|
||||
message Proposal {
|
||||
|
@ -133,7 +133,7 @@ message Proposal {
|
|||
// proposal_id is the unique id of the proposal.
|
||||
uint64 proposal_id = 1;
|
||||
|
||||
// address is the group account address.
|
||||
// address is the account address of group policy.
|
||||
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// metadata is any arbitrary metadata to attached to the proposal.
|
||||
|
@ -149,9 +149,9 @@ message Proposal {
|
|||
// When group membership is changed, existing proposals from previous group versions will become invalid.
|
||||
uint64 group_version = 6;
|
||||
|
||||
// group_account_version tracks the version of the group account that this proposal corresponds to.
|
||||
// group_policy_version tracks the version of the group policy that this proposal corresponds to.
|
||||
// When a decision policy is changed, existing proposals from previous policy versions will become invalid.
|
||||
uint64 group_account_version = 7;
|
||||
uint64 group_policy_version = 7;
|
||||
|
||||
// Status defines proposal statuses.
|
||||
enum Status {
|
||||
|
|
|
@ -21,13 +21,13 @@ func QueryCmd(name string) *cobra.Command {
|
|||
|
||||
queryCmd.AddCommand(
|
||||
QueryGroupInfoCmd(),
|
||||
QueryGroupAccountInfoCmd(),
|
||||
QueryGroupPolicyInfoCmd(),
|
||||
QueryGroupMembersCmd(),
|
||||
QueryGroupsByAdminCmd(),
|
||||
QueryGroupAccountsByGroupCmd(),
|
||||
QueryGroupAccountsByAdminCmd(),
|
||||
QueryGroupPoliciesByGroupCmd(),
|
||||
QueryGroupPoliciesByAdminCmd(),
|
||||
QueryProposalCmd(),
|
||||
QueryProposalsByGroupAccountCmd(),
|
||||
QueryProposalsByGroupPolicyCmd(),
|
||||
QueryVoteByProposalVoterCmd(),
|
||||
QueryVotesByProposalCmd(),
|
||||
QueryVotesByVoterCmd(),
|
||||
|
@ -101,11 +101,11 @@ func QueryGroupInfoCmd() *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
// QueryGroupAccountInfoCmd creates a CLI command for Query/GroupAccountInfo.
|
||||
func QueryGroupAccountInfoCmd() *cobra.Command {
|
||||
// QueryGroupPolicyInfoCmd creates a CLI command for Query/GroupPolicyInfo.
|
||||
func QueryGroupPolicyInfoCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "group-account-info [group-account]",
|
||||
Short: "Query for group account info by group account address",
|
||||
Use: "group-policy-info [group-policy-account]",
|
||||
Short: "Query for group policy info by account address of group policy",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
|
@ -115,7 +115,7 @@ func QueryGroupAccountInfoCmd() *cobra.Command {
|
|||
|
||||
queryClient := group.NewQueryClient(clientCtx)
|
||||
|
||||
res, err := queryClient.GroupAccountInfo(cmd.Context(), &group.QueryGroupAccountInfoRequest{
|
||||
res, err := queryClient.GroupPolicyInfo(cmd.Context(), &group.QueryGroupPolicyInfoRequest{
|
||||
Address: args[0],
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -208,11 +208,11 @@ func QueryGroupsByAdminCmd() *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
// QueryGroupAccountsByGroupCmd creates a CLI command for Query/GroupAccountsByGroup.
|
||||
func QueryGroupAccountsByGroupCmd() *cobra.Command {
|
||||
// QueryGroupPoliciesByGroupCmd creates a CLI command for Query/GroupPoliciesByGroup.
|
||||
func QueryGroupPoliciesByGroupCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "group-accounts-by-group [group-id]",
|
||||
Short: "Query for group accounts by group id with pagination flags",
|
||||
Use: "group-policies-by-group [group-id]",
|
||||
Short: "Query for group policies by group id with pagination flags",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
|
@ -232,7 +232,7 @@ func QueryGroupAccountsByGroupCmd() *cobra.Command {
|
|||
|
||||
queryClient := group.NewQueryClient(clientCtx)
|
||||
|
||||
res, err := queryClient.GroupAccountsByGroup(cmd.Context(), &group.QueryGroupAccountsByGroupRequest{
|
||||
res, err := queryClient.GroupPoliciesByGroup(cmd.Context(), &group.QueryGroupPoliciesByGroupRequest{
|
||||
GroupId: groupID,
|
||||
Pagination: pageReq,
|
||||
})
|
||||
|
@ -249,11 +249,11 @@ func QueryGroupAccountsByGroupCmd() *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
// QueryGroupAccountsByAdminCmd creates a CLI command for Query/GroupAccountsByAdmin.
|
||||
func QueryGroupAccountsByAdminCmd() *cobra.Command {
|
||||
// QueryGroupPoliciesByAdminCmd creates a CLI command for Query/GroupPoliciesByAdmin.
|
||||
func QueryGroupPoliciesByAdminCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "group-accounts-by-admin [admin]",
|
||||
Short: "Query for group accounts by admin account address with pagination flags",
|
||||
Use: "group-policies-by-admin [admin]",
|
||||
Short: "Query for group policies by admin account address with pagination flags",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
|
@ -268,7 +268,7 @@ func QueryGroupAccountsByAdminCmd() *cobra.Command {
|
|||
|
||||
queryClient := group.NewQueryClient(clientCtx)
|
||||
|
||||
res, err := queryClient.GroupAccountsByAdmin(cmd.Context(), &group.QueryGroupAccountsByAdminRequest{
|
||||
res, err := queryClient.GroupPoliciesByAdmin(cmd.Context(), &group.QueryGroupPoliciesByAdminRequest{
|
||||
Admin: args[0],
|
||||
Pagination: pageReq,
|
||||
})
|
||||
|
@ -320,11 +320,11 @@ func QueryProposalCmd() *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
// QueryProposalsByGroupAccountCmd creates a CLI command for Query/ProposalsByGroupAccount.
|
||||
func QueryProposalsByGroupAccountCmd() *cobra.Command {
|
||||
// QueryProposalsByGroupPolicyCmd creates a CLI command for Query/ProposalsByGroupPolicy.
|
||||
func QueryProposalsByGroupPolicyCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "proposals-by-group-account [group-account]",
|
||||
Short: "Query for proposals by group account address with pagination flags",
|
||||
Use: "proposals-by-group-policy [group-policy-account]",
|
||||
Short: "Query for proposals by account address of group policy with pagination flags",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
|
@ -339,7 +339,7 @@ func QueryProposalsByGroupAccountCmd() *cobra.Command {
|
|||
|
||||
queryClient := group.NewQueryClient(clientCtx)
|
||||
|
||||
res, err := queryClient.ProposalsByGroupAccount(cmd.Context(), &group.QueryProposalsByGroupAccountRequest{
|
||||
res, err := queryClient.ProposalsByGroupPolicy(cmd.Context(), &group.QueryProposalsByGroupPolicyRequest{
|
||||
Address: args[0],
|
||||
Pagination: pageReq,
|
||||
})
|
||||
|
|
|
@ -38,10 +38,10 @@ func TxCmd(name string) *cobra.Command {
|
|||
MsgUpdateGroupAdminCmd(),
|
||||
MsgUpdateGroupMetadataCmd(),
|
||||
MsgUpdateGroupMembersCmd(),
|
||||
MsgCreateGroupAccountCmd(),
|
||||
MsgUpdateGroupAccountAdminCmd(),
|
||||
MsgUpdateGroupAccountDecisionPolicyCmd(),
|
||||
MsgUpdateGroupAccountMetadataCmd(),
|
||||
MsgCreateGroupPolicyCmd(),
|
||||
MsgUpdateGroupPolicyAdminCmd(),
|
||||
MsgUpdateGroupPolicyDecisionPolicyCmd(),
|
||||
MsgUpdateGroupPolicyMetadataCmd(),
|
||||
MsgCreateProposalCmd(),
|
||||
MsgVoteCmd(),
|
||||
MsgExecCmd(),
|
||||
|
@ -284,20 +284,20 @@ func MsgUpdateGroupMetadataCmd() *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
// MsgCreateGroupAccountCmd creates a CLI command for Msg/CreateGroupAccount.
|
||||
func MsgCreateGroupAccountCmd() *cobra.Command {
|
||||
// MsgCreateGroupPolicyCmd creates a CLI command for Msg/CreateGroupPolicy.
|
||||
func MsgCreateGroupPolicyCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "create-group-account [admin] [group-id] [metadata] [decision-policy]",
|
||||
Short: "Create a group account which is an account " +
|
||||
Use: "create-group-policy [admin] [group-id] [metadata] [decision-policy]",
|
||||
Short: "Create a group policy which is an account " +
|
||||
"associated with a group and a decision policy. " +
|
||||
"Note, the '--from' flag is " +
|
||||
"ignored as it is implied from [admin].",
|
||||
Long: strings.TrimSpace(
|
||||
fmt.Sprintf(`Create a group account which is an account associated with a group and a decision policy.
|
||||
fmt.Sprintf(`Create a group policy which is an account associated with a group and a decision policy.
|
||||
Note, the '--from' flag is ignored as it is implied from [admin].
|
||||
|
||||
Example:
|
||||
$ %s tx group create-group-account [admin] [group-id] [metadata] \
|
||||
$ %s tx group create-group-policy [admin] [group-id] [metadata] \
|
||||
'{"@type":"/cosmos.group.v1beta1.ThresholdDecisionPolicy", "threshold":"1", "timeout":"1s"}'
|
||||
`,
|
||||
version.AppName,
|
||||
|
@ -330,7 +330,7 @@ $ %s tx group create-group-account [admin] [group-id] [metadata] \
|
|||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "metadata is malformed, proper base64 string is required")
|
||||
}
|
||||
|
||||
msg, err := group.NewMsgCreateGroupAccount(
|
||||
msg, err := group.NewMsgCreateGroupPolicy(
|
||||
clientCtx.GetFromAddress(),
|
||||
groupID,
|
||||
b,
|
||||
|
@ -352,11 +352,11 @@ $ %s tx group create-group-account [admin] [group-id] [metadata] \
|
|||
return cmd
|
||||
}
|
||||
|
||||
// MsgUpdateGroupAccountAdminCmd creates a CLI command for Msg/UpdateGroupAccountAdmin.
|
||||
func MsgUpdateGroupAccountAdminCmd() *cobra.Command {
|
||||
// MsgUpdateGroupPolicyAdminCmd creates a CLI command for Msg/UpdateGroupPolicyAdmin.
|
||||
func MsgUpdateGroupPolicyAdminCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "update-group-account-admin [admin] [group-account] [new-admin]",
|
||||
Short: "Update a group account admin",
|
||||
Use: "update-group-policy-admin [admin] [group-policy-account] [new-admin]",
|
||||
Short: "Update a group policy admin",
|
||||
Args: cobra.ExactArgs(3),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
err := cmd.Flags().Set(flags.FlagFrom, args[0])
|
||||
|
@ -369,7 +369,7 @@ func MsgUpdateGroupAccountAdminCmd() *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
msg := &group.MsgUpdateGroupAccountAdmin{
|
||||
msg := &group.MsgUpdateGroupPolicyAdmin{
|
||||
Admin: clientCtx.GetFromAddress().String(),
|
||||
Address: args[1],
|
||||
NewAdmin: args[2],
|
||||
|
@ -387,11 +387,11 @@ func MsgUpdateGroupAccountAdminCmd() *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
// MsgUpdateGroupAccountDecisionPolicyCmd creates a CLI command for Msg/UpdateGroupAccountDecisionPolicy.
|
||||
func MsgUpdateGroupAccountDecisionPolicyCmd() *cobra.Command {
|
||||
// MsgUpdateGroupPolicyDecisionPolicyCmd creates a CLI command for Msg/UpdateGroupPolicyDecisionPolicy.
|
||||
func MsgUpdateGroupPolicyDecisionPolicyCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "update-group-account-policy [admin] [group-account] [decision-policy]",
|
||||
Short: "Update a group account decision policy",
|
||||
Use: "update-group-account-policy [admin] [group-policy-account] [decision-policy]",
|
||||
Short: "Update a group policy's decision policy",
|
||||
Args: cobra.ExactArgs(3),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
err := cmd.Flags().Set(flags.FlagFrom, args[0])
|
||||
|
@ -414,7 +414,7 @@ func MsgUpdateGroupAccountDecisionPolicyCmd() *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
msg, err := group.NewMsgUpdateGroupAccountDecisionPolicyRequest(
|
||||
msg, err := group.NewMsgUpdateGroupPolicyDecisionPolicyRequest(
|
||||
clientCtx.GetFromAddress(),
|
||||
accountAddress,
|
||||
policy,
|
||||
|
@ -436,11 +436,11 @@ func MsgUpdateGroupAccountDecisionPolicyCmd() *cobra.Command {
|
|||
return cmd
|
||||
}
|
||||
|
||||
// MsgUpdateGroupAccountMetadataCmd creates a CLI command for Msg/MsgUpdateGroupAccountMetadata.
|
||||
func MsgUpdateGroupAccountMetadataCmd() *cobra.Command {
|
||||
// MsgUpdateGroupPolicyMetadataCmd creates a CLI command for Msg/MsgUpdateGroupPolicyMetadata.
|
||||
func MsgUpdateGroupPolicyMetadataCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "update-group-account-metadata [admin] [group-account] [new-metadata]",
|
||||
Short: "Update a group account metadata",
|
||||
Use: "update-group-policy-metadata [admin] [group-policy-account] [new-metadata]",
|
||||
Short: "Update a group policy metadata",
|
||||
Args: cobra.ExactArgs(3),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
err := cmd.Flags().Set(flags.FlagFrom, args[0])
|
||||
|
@ -458,7 +458,7 @@ func MsgUpdateGroupAccountMetadataCmd() *cobra.Command {
|
|||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "metadata is malformed, proper base64 string is required")
|
||||
}
|
||||
|
||||
msg := &group.MsgUpdateGroupAccountMetadata{
|
||||
msg := &group.MsgUpdateGroupPolicyMetadata{
|
||||
Admin: clientCtx.GetFromAddress().String(),
|
||||
Address: args[1],
|
||||
Metadata: b,
|
||||
|
@ -479,12 +479,12 @@ func MsgUpdateGroupAccountMetadataCmd() *cobra.Command {
|
|||
// MsgCreateProposalCmd creates a CLI command for Msg/CreateProposal.
|
||||
func MsgCreateProposalCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "create-proposal [group-account] [proposer[,proposer]*] [msg_tx_json_file] [metadata]",
|
||||
Use: "create-proposal [group-policy-account] [proposer[,proposer]*] [msg_tx_json_file] [metadata]",
|
||||
Short: "Submit a new proposal",
|
||||
Long: `Submit a new proposal.
|
||||
|
||||
Parameters:
|
||||
group-account: address of the group account
|
||||
group-policy-account: account address of the group policy
|
||||
proposer: comma separated (no spaces) list of proposer account addresses. Example: "addr1,addr2"
|
||||
Metadata: metadata for the proposal
|
||||
msg_tx_json_file: path to json file with messages that will be executed if the proposal is accepted.
|
||||
|
|
|
@ -280,7 +280,7 @@ func (s *IntegrationTestSuite) TestQueryGroupsByAdmin() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestQueryGroupAccountInfo() {
|
||||
func (s *IntegrationTestSuite) TestQueryGroupPolicyInfo() {
|
||||
val := s.network.Validators[0]
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
|
@ -292,15 +292,15 @@ func (s *IntegrationTestSuite) TestQueryGroupAccountInfo() {
|
|||
expectedCode uint32
|
||||
}{
|
||||
{
|
||||
"group account not found",
|
||||
"group policy not found",
|
||||
[]string{val.Address.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
"not found: invalid request",
|
||||
0,
|
||||
},
|
||||
{
|
||||
"group account found",
|
||||
[]string{s.groupAccounts[0].Address, fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
"group policy found",
|
||||
[]string{s.groupPolicies[0].Address, fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
"",
|
||||
0,
|
||||
|
@ -311,7 +311,7 @@ func (s *IntegrationTestSuite) TestQueryGroupAccountInfo() {
|
|||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := client.QueryGroupAccountInfoCmd()
|
||||
cmd := client.QueryGroupPolicyInfoCmd()
|
||||
|
||||
out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
|
@ -319,20 +319,20 @@ func (s *IntegrationTestSuite) TestQueryGroupAccountInfo() {
|
|||
} else {
|
||||
s.Require().NoError(err, out.String())
|
||||
|
||||
var g group.GroupAccountInfo
|
||||
var g group.GroupPolicyInfo
|
||||
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &g))
|
||||
s.Require().Equal(s.groupAccounts[0].GroupId, g.GroupId)
|
||||
s.Require().Equal(s.groupAccounts[0].Address, g.Address)
|
||||
s.Require().Equal(s.groupAccounts[0].Admin, g.Admin)
|
||||
s.Require().Equal(s.groupAccounts[0].Metadata, g.Metadata)
|
||||
s.Require().Equal(s.groupAccounts[0].Version, g.Version)
|
||||
s.Require().Equal(s.groupAccounts[0].GetDecisionPolicy(), g.GetDecisionPolicy())
|
||||
s.Require().Equal(s.groupPolicies[0].GroupId, g.GroupId)
|
||||
s.Require().Equal(s.groupPolicies[0].Address, g.Address)
|
||||
s.Require().Equal(s.groupPolicies[0].Admin, g.Admin)
|
||||
s.Require().Equal(s.groupPolicies[0].Metadata, g.Metadata)
|
||||
s.Require().Equal(s.groupPolicies[0].Version, g.Version)
|
||||
s.Require().Equal(s.groupPolicies[0].GetDecisionPolicy(), g.GetDecisionPolicy())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestQueryGroupAccountsByGroup() {
|
||||
func (s *IntegrationTestSuite) TestQueryGroupPoliciesByGroup() {
|
||||
val := s.network.Validators[0]
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
|
@ -342,7 +342,7 @@ func (s *IntegrationTestSuite) TestQueryGroupAccountsByGroup() {
|
|||
expectErr bool
|
||||
expectErrMsg string
|
||||
expectedCode uint32
|
||||
expectGroupAccounts []*group.GroupAccountInfo
|
||||
expectGroupPolicies []*group.GroupPolicyInfo
|
||||
}{
|
||||
{
|
||||
"invalid group id",
|
||||
|
@ -350,28 +350,28 @@ func (s *IntegrationTestSuite) TestQueryGroupAccountsByGroup() {
|
|||
true,
|
||||
"strconv.ParseUint: parsing \"\": invalid syntax",
|
||||
0,
|
||||
[]*group.GroupAccountInfo{},
|
||||
[]*group.GroupPolicyInfo{},
|
||||
},
|
||||
{
|
||||
"no group account",
|
||||
"no group policy",
|
||||
[]string{"12345", fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
"",
|
||||
0,
|
||||
[]*group.GroupAccountInfo{},
|
||||
[]*group.GroupPolicyInfo{},
|
||||
},
|
||||
{
|
||||
"found group accounts",
|
||||
"found group policies",
|
||||
[]string{strconv.FormatUint(s.group.GroupId, 10), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
"",
|
||||
0,
|
||||
[]*group.GroupAccountInfo{
|
||||
s.groupAccounts[0],
|
||||
s.groupAccounts[1],
|
||||
s.groupAccounts[2],
|
||||
s.groupAccounts[3],
|
||||
s.groupAccounts[4],
|
||||
[]*group.GroupPolicyInfo{
|
||||
s.groupPolicies[0],
|
||||
s.groupPolicies[1],
|
||||
s.groupPolicies[2],
|
||||
s.groupPolicies[3],
|
||||
s.groupPolicies[4],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ func (s *IntegrationTestSuite) TestQueryGroupAccountsByGroup() {
|
|||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := client.QueryGroupAccountsByGroupCmd()
|
||||
cmd := client.QueryGroupPoliciesByGroupCmd()
|
||||
|
||||
out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
|
@ -388,22 +388,22 @@ func (s *IntegrationTestSuite) TestQueryGroupAccountsByGroup() {
|
|||
} else {
|
||||
s.Require().NoError(err, out.String())
|
||||
|
||||
var res group.QueryGroupAccountsByGroupResponse
|
||||
var res group.QueryGroupPoliciesByGroupResponse
|
||||
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res))
|
||||
s.Require().Equal(len(res.GroupAccounts), len(tc.expectGroupAccounts))
|
||||
for i := range res.GroupAccounts {
|
||||
s.Require().Equal(res.GroupAccounts[i].GroupId, tc.expectGroupAccounts[i].GroupId)
|
||||
s.Require().Equal(res.GroupAccounts[i].Metadata, tc.expectGroupAccounts[i].Metadata)
|
||||
s.Require().Equal(res.GroupAccounts[i].Version, tc.expectGroupAccounts[i].Version)
|
||||
s.Require().Equal(res.GroupAccounts[i].Admin, tc.expectGroupAccounts[i].Admin)
|
||||
s.Require().Equal(res.GroupAccounts[i].GetDecisionPolicy(), tc.expectGroupAccounts[i].GetDecisionPolicy())
|
||||
s.Require().Equal(len(res.GroupPolicies), len(tc.expectGroupPolicies))
|
||||
for i := range res.GroupPolicies {
|
||||
s.Require().Equal(res.GroupPolicies[i].GroupId, tc.expectGroupPolicies[i].GroupId)
|
||||
s.Require().Equal(res.GroupPolicies[i].Metadata, tc.expectGroupPolicies[i].Metadata)
|
||||
s.Require().Equal(res.GroupPolicies[i].Version, tc.expectGroupPolicies[i].Version)
|
||||
s.Require().Equal(res.GroupPolicies[i].Admin, tc.expectGroupPolicies[i].Admin)
|
||||
s.Require().Equal(res.GroupPolicies[i].GetDecisionPolicy(), tc.expectGroupPolicies[i].GetDecisionPolicy())
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestQueryGroupAccountsByAdmin() {
|
||||
func (s *IntegrationTestSuite) TestQueryGroupPoliciesByAdmin() {
|
||||
val := s.network.Validators[0]
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
|
@ -413,7 +413,7 @@ func (s *IntegrationTestSuite) TestQueryGroupAccountsByAdmin() {
|
|||
expectErr bool
|
||||
expectErrMsg string
|
||||
expectedCode uint32
|
||||
expectGroupAccounts []*group.GroupAccountInfo
|
||||
expectGroupPolicies []*group.GroupPolicyInfo
|
||||
}{
|
||||
{
|
||||
"invalid admin address",
|
||||
|
@ -421,28 +421,28 @@ func (s *IntegrationTestSuite) TestQueryGroupAccountsByAdmin() {
|
|||
true,
|
||||
"decoding bech32 failed: invalid bech32 string",
|
||||
0,
|
||||
[]*group.GroupAccountInfo{},
|
||||
[]*group.GroupPolicyInfo{},
|
||||
},
|
||||
{
|
||||
"no group account",
|
||||
"no group policy",
|
||||
[]string{s.network.Validators[1].Address.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
"",
|
||||
0,
|
||||
[]*group.GroupAccountInfo{},
|
||||
[]*group.GroupPolicyInfo{},
|
||||
},
|
||||
{
|
||||
"found group accounts",
|
||||
"found group policies",
|
||||
[]string{val.Address.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
"",
|
||||
0,
|
||||
[]*group.GroupAccountInfo{
|
||||
s.groupAccounts[0],
|
||||
s.groupAccounts[1],
|
||||
s.groupAccounts[2],
|
||||
s.groupAccounts[3],
|
||||
s.groupAccounts[4],
|
||||
[]*group.GroupPolicyInfo{
|
||||
s.groupPolicies[0],
|
||||
s.groupPolicies[1],
|
||||
s.groupPolicies[2],
|
||||
s.groupPolicies[3],
|
||||
s.groupPolicies[4],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ func (s *IntegrationTestSuite) TestQueryGroupAccountsByAdmin() {
|
|||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := client.QueryGroupAccountsByAdminCmd()
|
||||
cmd := client.QueryGroupPoliciesByAdminCmd()
|
||||
|
||||
out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
|
@ -459,15 +459,15 @@ func (s *IntegrationTestSuite) TestQueryGroupAccountsByAdmin() {
|
|||
} else {
|
||||
s.Require().NoError(err, out.String())
|
||||
|
||||
var res group.QueryGroupAccountsByAdminResponse
|
||||
var res group.QueryGroupPoliciesByAdminResponse
|
||||
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res))
|
||||
s.Require().Equal(len(res.GroupAccounts), len(tc.expectGroupAccounts))
|
||||
for i := range res.GroupAccounts {
|
||||
s.Require().Equal(res.GroupAccounts[i].GroupId, tc.expectGroupAccounts[i].GroupId)
|
||||
s.Require().Equal(res.GroupAccounts[i].Metadata, tc.expectGroupAccounts[i].Metadata)
|
||||
s.Require().Equal(res.GroupAccounts[i].Version, tc.expectGroupAccounts[i].Version)
|
||||
s.Require().Equal(res.GroupAccounts[i].Admin, tc.expectGroupAccounts[i].Admin)
|
||||
s.Require().Equal(res.GroupAccounts[i].GetDecisionPolicy(), tc.expectGroupAccounts[i].GetDecisionPolicy())
|
||||
s.Require().Equal(len(res.GroupPolicies), len(tc.expectGroupPolicies))
|
||||
for i := range res.GroupPolicies {
|
||||
s.Require().Equal(res.GroupPolicies[i].GroupId, tc.expectGroupPolicies[i].GroupId)
|
||||
s.Require().Equal(res.GroupPolicies[i].Metadata, tc.expectGroupPolicies[i].Metadata)
|
||||
s.Require().Equal(res.GroupPolicies[i].Version, tc.expectGroupPolicies[i].Version)
|
||||
s.Require().Equal(res.GroupPolicies[i].Admin, tc.expectGroupPolicies[i].Admin)
|
||||
s.Require().Equal(res.GroupPolicies[i].GetDecisionPolicy(), tc.expectGroupPolicies[i].GetDecisionPolicy())
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -517,7 +517,7 @@ func (s *IntegrationTestSuite) TestQueryProposal() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestQueryProposalsByGroupAccount() {
|
||||
func (s *IntegrationTestSuite) TestQueryProposalsByGroupPolicy() {
|
||||
val := s.network.Validators[0]
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
|
@ -530,7 +530,7 @@ func (s *IntegrationTestSuite) TestQueryProposalsByGroupAccount() {
|
|||
expectProposals []*group.Proposal
|
||||
}{
|
||||
{
|
||||
"invalid group account address",
|
||||
"invalid group policy address",
|
||||
[]string{"invalid"},
|
||||
true,
|
||||
"decoding bech32 failed: invalid bech32 string",
|
||||
|
@ -538,7 +538,7 @@ func (s *IntegrationTestSuite) TestQueryProposalsByGroupAccount() {
|
|||
[]*group.Proposal{},
|
||||
},
|
||||
{
|
||||
"no group account",
|
||||
"no group policy",
|
||||
[]string{s.network.Validators[1].Address.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
"",
|
||||
|
@ -547,7 +547,7 @@ func (s *IntegrationTestSuite) TestQueryProposalsByGroupAccount() {
|
|||
},
|
||||
{
|
||||
"found proposals",
|
||||
[]string{s.groupAccounts[0].Address, fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
[]string{s.groupPolicies[0].Address, fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
"",
|
||||
0,
|
||||
|
@ -561,7 +561,7 @@ func (s *IntegrationTestSuite) TestQueryProposalsByGroupAccount() {
|
|||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := client.QueryProposalsByGroupAccountCmd()
|
||||
cmd := client.QueryProposalsByGroupPolicyCmd()
|
||||
|
||||
out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
|
@ -569,7 +569,7 @@ func (s *IntegrationTestSuite) TestQueryProposalsByGroupAccount() {
|
|||
} else {
|
||||
s.Require().NoError(err, out.String())
|
||||
|
||||
var res group.QueryProposalsByGroupAccountResponse
|
||||
var res group.QueryProposalsByGroupPolicyResponse
|
||||
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), &res))
|
||||
s.Require().Equal(len(res.Proposals), len(tc.expectProposals))
|
||||
for i := range res.Proposals {
|
||||
|
@ -708,7 +708,7 @@ func (s *IntegrationTestSuite) TestQueryVotesByVoter() {
|
|||
},
|
||||
{
|
||||
"no votes",
|
||||
[]string{s.groupAccounts[0].Address, fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
[]string{s.groupPolicies[0].Address, fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
true,
|
||||
"",
|
||||
0,
|
||||
|
|
|
@ -28,7 +28,7 @@ type IntegrationTestSuite struct {
|
|||
network *network.Network
|
||||
|
||||
group *group.GroupInfo
|
||||
groupAccounts []*group.GroupAccountInfo
|
||||
groupPolicies []*group.GroupPolicyInfo
|
||||
proposal *group.Proposal
|
||||
vote *group.Vote
|
||||
}
|
||||
|
@ -100,13 +100,13 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
|||
|
||||
s.group = &group.GroupInfo{GroupId: 1, Admin: val.Address.String(), Metadata: []byte{1}, TotalWeight: "3", Version: 1}
|
||||
|
||||
// create 5 group accounts
|
||||
// create 5 group policies
|
||||
for i := 0; i < 5; i++ {
|
||||
threshold := i + 1
|
||||
if threshold > 3 {
|
||||
threshold = 3
|
||||
}
|
||||
out, err = cli.ExecTestCLICmd(val.ClientCtx, client.MsgCreateGroupAccountCmd(),
|
||||
out, err = cli.ExecTestCLICmd(val.ClientCtx, client.MsgCreateGroupPolicyCmd(),
|
||||
append(
|
||||
[]string{
|
||||
val.Address.String(),
|
||||
|
@ -121,21 +121,21 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
|||
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txResp), out.String())
|
||||
s.Require().Equal(uint32(0), txResp.Code, out.String())
|
||||
|
||||
out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryGroupAccountsByGroupCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)})
|
||||
out, err = cli.ExecTestCLICmd(val.ClientCtx, client.QueryGroupPoliciesByGroupCmd(), []string{"1", fmt.Sprintf("--%s=json", tmcli.OutputFlag)})
|
||||
s.Require().NoError(err, out.String())
|
||||
}
|
||||
|
||||
var res group.QueryGroupAccountsByGroupResponse
|
||||
var res group.QueryGroupPoliciesByGroupResponse
|
||||
s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &res))
|
||||
s.Require().Equal(len(res.GroupAccounts), 5)
|
||||
s.groupAccounts = res.GroupAccounts
|
||||
s.Require().Equal(len(res.GroupPolicies), 5)
|
||||
s.groupPolicies = res.GroupPolicies
|
||||
|
||||
// create a proposal
|
||||
validTxFileName := getTxSendFileName(s, s.groupAccounts[0].Address, val.Address.String())
|
||||
validTxFileName := getTxSendFileName(s, s.groupPolicies[0].Address, val.Address.String())
|
||||
out, err = cli.ExecTestCLICmd(val.ClientCtx, client.MsgCreateProposalCmd(),
|
||||
append(
|
||||
[]string{
|
||||
s.groupAccounts[0].Address,
|
||||
s.groupPolicies[0].Address,
|
||||
val.Address.String(),
|
||||
validTxFileName,
|
||||
"",
|
||||
|
@ -565,7 +565,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() {
|
|||
"address": "%s",
|
||||
"weight": "1",
|
||||
"metadata": "%s"
|
||||
}]}`, val.Address.String(), validMetadata, s.groupAccounts[0].Address, validMetadata)).Name()
|
||||
}]}`, val.Address.String(), validMetadata, s.groupPolicies[0].Address, validMetadata)).Name()
|
||||
|
||||
invalidMembersMetadata := fmt.Sprintf(`{"members": [{
|
||||
"address": "%s",
|
||||
|
@ -607,7 +607,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() {
|
|||
"address": "%s",
|
||||
"weight": "2",
|
||||
"metadata": "%s"
|
||||
}]}`, s.groupAccounts[0].Address, validMetadata)).Name(),
|
||||
}]}`, s.groupPolicies[0].Address, validMetadata)).Name(),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON),
|
||||
},
|
||||
commonFlags...,
|
||||
|
@ -669,7 +669,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestTxCreateGroupAccount() {
|
||||
func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
|
||||
val := s.network.Validators[0]
|
||||
wrongAdmin := s.network.Validators[1].Address
|
||||
clientCtx := val.ClientCtx
|
||||
|
@ -751,7 +751,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupAccount() {
|
|||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"group account metadata: limit exceeded",
|
||||
"group policy metadata: limit exceeded",
|
||||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
|
@ -777,7 +777,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupAccount() {
|
|||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := client.MsgCreateGroupAccountCmd()
|
||||
cmd := client.MsgCreateGroupPolicyCmd()
|
||||
|
||||
out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
|
@ -793,11 +793,11 @@ func (s *IntegrationTestSuite) TestTxCreateGroupAccount() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestTxUpdateGroupAccountAdmin() {
|
||||
func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyAdmin() {
|
||||
val := s.network.Validators[0]
|
||||
newAdmin := s.network.Validators[1].Address
|
||||
clientCtx := val.ClientCtx
|
||||
groupAccount := s.groupAccounts[3]
|
||||
groupPolicy := s.groupPolicies[3]
|
||||
|
||||
var commonFlags = []string{
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
|
@ -817,8 +817,8 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountAdmin() {
|
|||
"correct data",
|
||||
append(
|
||||
[]string{
|
||||
groupAccount.Admin,
|
||||
groupAccount.Address,
|
||||
groupPolicy.Admin,
|
||||
groupPolicy.Address,
|
||||
newAdmin.String(),
|
||||
},
|
||||
commonFlags...,
|
||||
|
@ -832,8 +832,8 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountAdmin() {
|
|||
"with amino-json",
|
||||
append(
|
||||
[]string{
|
||||
groupAccount.Admin,
|
||||
s.groupAccounts[4].Address,
|
||||
groupPolicy.Admin,
|
||||
s.groupPolicies[4].Address,
|
||||
newAdmin.String(),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON),
|
||||
},
|
||||
|
@ -849,7 +849,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountAdmin() {
|
|||
append(
|
||||
[]string{
|
||||
newAdmin.String(),
|
||||
groupAccount.Address,
|
||||
groupPolicy.Address,
|
||||
newAdmin.String(),
|
||||
},
|
||||
commonFlags...,
|
||||
|
@ -860,17 +860,17 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountAdmin() {
|
|||
0,
|
||||
},
|
||||
{
|
||||
"wrong group account",
|
||||
"wrong group policy",
|
||||
append(
|
||||
[]string{
|
||||
groupAccount.Admin,
|
||||
groupPolicy.Admin,
|
||||
newAdmin.String(),
|
||||
newAdmin.String(),
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"load group account: not found",
|
||||
"load group policy: not found",
|
||||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
|
@ -880,7 +880,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountAdmin() {
|
|||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := client.MsgUpdateGroupAccountAdminCmd()
|
||||
cmd := client.MsgUpdateGroupPolicyAdminCmd()
|
||||
|
||||
out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
|
@ -896,11 +896,11 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountAdmin() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestTxUpdateGroupAccountDecisionPolicy() {
|
||||
func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() {
|
||||
val := s.network.Validators[0]
|
||||
newAdmin := s.network.Validators[1].Address
|
||||
clientCtx := val.ClientCtx
|
||||
groupAccount := s.groupAccounts[2]
|
||||
groupPolicy := s.groupPolicies[2]
|
||||
|
||||
var commonFlags = []string{
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
|
@ -920,8 +920,8 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountDecisionPolicy() {
|
|||
"correct data",
|
||||
append(
|
||||
[]string{
|
||||
groupAccount.Admin,
|
||||
groupAccount.Address,
|
||||
groupPolicy.Admin,
|
||||
groupPolicy.Address,
|
||||
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"40000s\"}",
|
||||
},
|
||||
commonFlags...,
|
||||
|
@ -935,8 +935,8 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountDecisionPolicy() {
|
|||
"with amino-json",
|
||||
append(
|
||||
[]string{
|
||||
groupAccount.Admin,
|
||||
groupAccount.Address,
|
||||
groupPolicy.Admin,
|
||||
groupPolicy.Address,
|
||||
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"50000s\"}",
|
||||
fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON),
|
||||
},
|
||||
|
@ -952,7 +952,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountDecisionPolicy() {
|
|||
append(
|
||||
[]string{
|
||||
newAdmin.String(),
|
||||
groupAccount.Address,
|
||||
groupPolicy.Address,
|
||||
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"1s\"}",
|
||||
},
|
||||
commonFlags...,
|
||||
|
@ -963,17 +963,17 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountDecisionPolicy() {
|
|||
0,
|
||||
},
|
||||
{
|
||||
"wrong group account",
|
||||
"wrong group policy",
|
||||
append(
|
||||
[]string{
|
||||
groupAccount.Admin,
|
||||
groupPolicy.Admin,
|
||||
newAdmin.String(),
|
||||
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"1s\"}",
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"load group account: not found",
|
||||
"load group policy: not found",
|
||||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
|
@ -983,7 +983,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountDecisionPolicy() {
|
|||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := client.MsgUpdateGroupAccountDecisionPolicyCmd()
|
||||
cmd := client.MsgUpdateGroupPolicyDecisionPolicyCmd()
|
||||
|
||||
out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
|
@ -999,11 +999,11 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountDecisionPolicy() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestTxUpdateGroupAccountMetadata() {
|
||||
func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyMetadata() {
|
||||
val := s.network.Validators[0]
|
||||
newAdmin := s.network.Validators[1].Address
|
||||
clientCtx := val.ClientCtx
|
||||
groupAccount := s.groupAccounts[2]
|
||||
groupPolicy := s.groupPolicies[2]
|
||||
|
||||
var commonFlags = []string{
|
||||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
|
||||
|
@ -1023,8 +1023,8 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountMetadata() {
|
|||
"correct data",
|
||||
append(
|
||||
[]string{
|
||||
groupAccount.Admin,
|
||||
groupAccount.Address,
|
||||
groupPolicy.Admin,
|
||||
groupPolicy.Address,
|
||||
validMetadata,
|
||||
},
|
||||
commonFlags...,
|
||||
|
@ -1038,8 +1038,8 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountMetadata() {
|
|||
"with amino-json",
|
||||
append(
|
||||
[]string{
|
||||
groupAccount.Admin,
|
||||
groupAccount.Address,
|
||||
groupPolicy.Admin,
|
||||
groupPolicy.Address,
|
||||
validMetadata,
|
||||
fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON),
|
||||
},
|
||||
|
@ -1054,14 +1054,14 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountMetadata() {
|
|||
"long metadata",
|
||||
append(
|
||||
[]string{
|
||||
groupAccount.Admin,
|
||||
groupAccount.Address,
|
||||
groupPolicy.Admin,
|
||||
groupPolicy.Address,
|
||||
strings.Repeat("a", 500),
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"group account metadata: limit exceeded",
|
||||
"group policy metadata: limit exceeded",
|
||||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
|
@ -1070,7 +1070,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountMetadata() {
|
|||
append(
|
||||
[]string{
|
||||
newAdmin.String(),
|
||||
groupAccount.Address,
|
||||
groupPolicy.Address,
|
||||
validMetadata,
|
||||
},
|
||||
commonFlags...,
|
||||
|
@ -1081,17 +1081,17 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountMetadata() {
|
|||
0,
|
||||
},
|
||||
{
|
||||
"wrong group account",
|
||||
"wrong group policy",
|
||||
append(
|
||||
[]string{
|
||||
groupAccount.Admin,
|
||||
groupPolicy.Admin,
|
||||
newAdmin.String(),
|
||||
validMetadata,
|
||||
},
|
||||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"load group account: not found",
|
||||
"load group policy: not found",
|
||||
&sdk.TxResponse{},
|
||||
0,
|
||||
},
|
||||
|
@ -1101,7 +1101,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountMetadata() {
|
|||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := client.MsgUpdateGroupAccountMetadataCmd()
|
||||
cmd := client.MsgUpdateGroupPolicyMetadataCmd()
|
||||
|
||||
out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
|
@ -1127,9 +1127,9 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
|
||||
}
|
||||
|
||||
validTxFileName := getTxSendFileName(s, s.groupAccounts[0].Address, val.Address.String())
|
||||
unauthzTxFileName := getTxSendFileName(s, val.Address.String(), s.groupAccounts[0].Address)
|
||||
validTxFileName2 := getTxSendFileName(s, s.groupAccounts[3].Address, val.Address.String())
|
||||
validTxFileName := getTxSendFileName(s, s.groupPolicies[0].Address, val.Address.String())
|
||||
unauthzTxFileName := getTxSendFileName(s, val.Address.String(), s.groupPolicies[0].Address)
|
||||
validTxFileName2 := getTxSendFileName(s, s.groupPolicies[3].Address, val.Address.String())
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
|
@ -1143,7 +1143,7 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
"correct data",
|
||||
append(
|
||||
[]string{
|
||||
s.groupAccounts[0].Address,
|
||||
s.groupPolicies[0].Address,
|
||||
val.Address.String(),
|
||||
validTxFileName,
|
||||
"",
|
||||
|
@ -1160,7 +1160,7 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
"with try exec",
|
||||
append(
|
||||
[]string{
|
||||
s.groupAccounts[0].Address,
|
||||
s.groupPolicies[0].Address,
|
||||
val.Address.String(),
|
||||
validTxFileName,
|
||||
"",
|
||||
|
@ -1178,7 +1178,7 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
"with try exec, not enough yes votes for proposal to pass",
|
||||
append(
|
||||
[]string{
|
||||
s.groupAccounts[3].Address,
|
||||
s.groupPolicies[3].Address,
|
||||
val.Address.String(),
|
||||
validTxFileName2,
|
||||
"",
|
||||
|
@ -1196,7 +1196,7 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
"with amino-json",
|
||||
append(
|
||||
[]string{
|
||||
s.groupAccounts[0].Address,
|
||||
s.groupPolicies[0].Address,
|
||||
val.Address.String(),
|
||||
validTxFileName,
|
||||
"",
|
||||
|
@ -1214,7 +1214,7 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
"metadata too long",
|
||||
append(
|
||||
[]string{
|
||||
s.groupAccounts[0].Address,
|
||||
s.groupPolicies[0].Address,
|
||||
val.Address.String(),
|
||||
validTxFileName,
|
||||
"AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ==",
|
||||
|
@ -1231,7 +1231,7 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
"unauthorized msg",
|
||||
append(
|
||||
[]string{
|
||||
s.groupAccounts[0].Address,
|
||||
s.groupPolicies[0].Address,
|
||||
val.Address.String(),
|
||||
unauthzTxFileName,
|
||||
"",
|
||||
|
@ -1240,7 +1240,7 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"msg does not have group account authorization: unauthorized",
|
||||
"msg does not have group policy authorization: unauthorized",
|
||||
nil,
|
||||
0,
|
||||
},
|
||||
|
@ -1248,7 +1248,7 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
"invalid proposers",
|
||||
append(
|
||||
[]string{
|
||||
s.groupAccounts[0].Address,
|
||||
s.groupPolicies[0].Address,
|
||||
"invalid",
|
||||
validTxFileName,
|
||||
"",
|
||||
|
@ -1262,7 +1262,7 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
0,
|
||||
},
|
||||
{
|
||||
"invalid group account",
|
||||
"invalid group policy",
|
||||
append(
|
||||
[]string{
|
||||
"invalid",
|
||||
|
@ -1274,12 +1274,12 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"group account: decoding bech32 failed",
|
||||
"group policy: decoding bech32 failed",
|
||||
nil,
|
||||
0,
|
||||
},
|
||||
{
|
||||
"no group account",
|
||||
"no group policy",
|
||||
append(
|
||||
[]string{
|
||||
val.Address.String(),
|
||||
|
@ -1291,7 +1291,7 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() {
|
|||
commonFlags...,
|
||||
),
|
||||
true,
|
||||
"group account: not found",
|
||||
"group policy: not found",
|
||||
nil,
|
||||
0,
|
||||
},
|
||||
|
@ -1327,12 +1327,12 @@ func (s *IntegrationTestSuite) TestTxVote() {
|
|||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
|
||||
}
|
||||
|
||||
validTxFileName := getTxSendFileName(s, s.groupAccounts[1].Address, val.Address.String())
|
||||
validTxFileName := getTxSendFileName(s, s.groupPolicies[1].Address, val.Address.String())
|
||||
for i := 0; i < 2; i++ {
|
||||
out, err := cli.ExecTestCLICmd(val.ClientCtx, client.MsgCreateProposalCmd(),
|
||||
append(
|
||||
[]string{
|
||||
s.groupAccounts[1].Address,
|
||||
s.groupPolicies[1].Address,
|
||||
val.Address.String(),
|
||||
validTxFileName,
|
||||
"",
|
||||
|
@ -1517,11 +1517,11 @@ func (s *IntegrationTestSuite) TestTxExec() {
|
|||
|
||||
// create proposals and vote
|
||||
for i := 3; i <= 4; i++ {
|
||||
validTxFileName := getTxSendFileName(s, s.groupAccounts[0].Address, val.Address.String())
|
||||
validTxFileName := getTxSendFileName(s, s.groupPolicies[0].Address, val.Address.String())
|
||||
out, err := cli.ExecTestCLICmd(val.ClientCtx, client.MsgCreateProposalCmd(),
|
||||
append(
|
||||
[]string{
|
||||
s.groupAccounts[0].Address,
|
||||
s.groupPolicies[0].Address,
|
||||
val.Address.String(),
|
||||
validTxFileName,
|
||||
"",
|
||||
|
|
|
@ -17,10 +17,10 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
|||
cdc.RegisterConcrete(&MsgUpdateGroupMembers{}, "cosmos-sdk/MsgUpdateGroupMembers", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateGroupAdmin{}, "cosmos-sdk/MsgUpdateGroupAdmin", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateGroupMetadata{}, "cosmos-sdk/MsgUpdateGroupMetadata", nil)
|
||||
cdc.RegisterConcrete(&MsgCreateGroupAccount{}, "cosmos-sdk/MsgCreateGroupAccount", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateGroupAccountAdmin{}, "cosmos-sdk/MsgUpdateGroupAccountAdmin", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateGroupAccountDecisionPolicy{}, "cosmos-sdk/MsgUpdateGroupAccountDecisionPolicy", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateGroupAccountMetadata{}, "cosmos-sdk/MsgUpdateGroupAccountMetadata", nil)
|
||||
cdc.RegisterConcrete(&MsgCreateGroupPolicy{}, "cosmos-sdk/MsgCreateGroupPolicy", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateGroupPolicyAdmin{}, "cosmos-sdk/MsgUpdateGroupPolicyAdmin", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateGroupPolicyDecisionPolicy{}, "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicy", nil)
|
||||
cdc.RegisterConcrete(&MsgUpdateGroupPolicyMetadata{}, "cosmos-sdk/MsgUpdateGroupPolicyMetadata", nil)
|
||||
cdc.RegisterConcrete(&MsgCreateProposal{}, "cosmos-sdk/group/MsgCreateProposal", nil)
|
||||
cdc.RegisterConcrete(&MsgVote{}, "cosmos-sdk/group/MsgVote", nil)
|
||||
cdc.RegisterConcrete(&MsgExec{}, "cosmos-sdk/group/MsgExec", nil)
|
||||
|
@ -32,10 +32,10 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
|
|||
&MsgUpdateGroupMembers{},
|
||||
&MsgUpdateGroupAdmin{},
|
||||
&MsgUpdateGroupMetadata{},
|
||||
&MsgCreateGroupAccount{},
|
||||
&MsgUpdateGroupAccountAdmin{},
|
||||
&MsgUpdateGroupAccountDecisionPolicy{},
|
||||
&MsgUpdateGroupAccountMetadata{},
|
||||
&MsgCreateGroupPolicy{},
|
||||
&MsgUpdateGroupPolicyAdmin{},
|
||||
&MsgUpdateGroupPolicyDecisionPolicy{},
|
||||
&MsgUpdateGroupPolicyMetadata{},
|
||||
&MsgCreateProposal{},
|
||||
&MsgVote{},
|
||||
&MsgExec{},
|
||||
|
|
|
@ -115,24 +115,24 @@ func (m *EventUpdateGroup) GetGroupId() uint64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
// EventCreateGroupAccount is an event emitted when a group account is created.
|
||||
type EventCreateGroupAccount struct {
|
||||
// address is the address of the group account.
|
||||
// EventCreateGroupPolicy is an event emitted when a group policy is created.
|
||||
type EventCreateGroupPolicy struct {
|
||||
// address is the account address of the group policy.
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *EventCreateGroupAccount) Reset() { *m = EventCreateGroupAccount{} }
|
||||
func (m *EventCreateGroupAccount) String() string { return proto.CompactTextString(m) }
|
||||
func (*EventCreateGroupAccount) ProtoMessage() {}
|
||||
func (*EventCreateGroupAccount) Descriptor() ([]byte, []int) {
|
||||
func (m *EventCreateGroupPolicy) Reset() { *m = EventCreateGroupPolicy{} }
|
||||
func (m *EventCreateGroupPolicy) String() string { return proto.CompactTextString(m) }
|
||||
func (*EventCreateGroupPolicy) ProtoMessage() {}
|
||||
func (*EventCreateGroupPolicy) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_7879e051fb126fc0, []int{2}
|
||||
}
|
||||
func (m *EventCreateGroupAccount) XXX_Unmarshal(b []byte) error {
|
||||
func (m *EventCreateGroupPolicy) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *EventCreateGroupAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
func (m *EventCreateGroupPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_EventCreateGroupAccount.Marshal(b, m, deterministic)
|
||||
return xxx_messageInfo_EventCreateGroupPolicy.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
|
@ -142,43 +142,43 @@ func (m *EventCreateGroupAccount) XXX_Marshal(b []byte, deterministic bool) ([]b
|
|||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *EventCreateGroupAccount) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_EventCreateGroupAccount.Merge(m, src)
|
||||
func (m *EventCreateGroupPolicy) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_EventCreateGroupPolicy.Merge(m, src)
|
||||
}
|
||||
func (m *EventCreateGroupAccount) XXX_Size() int {
|
||||
func (m *EventCreateGroupPolicy) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *EventCreateGroupAccount) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_EventCreateGroupAccount.DiscardUnknown(m)
|
||||
func (m *EventCreateGroupPolicy) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_EventCreateGroupPolicy.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_EventCreateGroupAccount proto.InternalMessageInfo
|
||||
var xxx_messageInfo_EventCreateGroupPolicy proto.InternalMessageInfo
|
||||
|
||||
func (m *EventCreateGroupAccount) GetAddress() string {
|
||||
func (m *EventCreateGroupPolicy) GetAddress() string {
|
||||
if m != nil {
|
||||
return m.Address
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// EventUpdateGroupAccount is an event emitted when a group account is updated.
|
||||
type EventUpdateGroupAccount struct {
|
||||
// address is the address of the group account.
|
||||
// EventUpdateGroupPolicy is an event emitted when a group policy is updated.
|
||||
type EventUpdateGroupPolicy struct {
|
||||
// address is the account address of the group policy.
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *EventUpdateGroupAccount) Reset() { *m = EventUpdateGroupAccount{} }
|
||||
func (m *EventUpdateGroupAccount) String() string { return proto.CompactTextString(m) }
|
||||
func (*EventUpdateGroupAccount) ProtoMessage() {}
|
||||
func (*EventUpdateGroupAccount) Descriptor() ([]byte, []int) {
|
||||
func (m *EventUpdateGroupPolicy) Reset() { *m = EventUpdateGroupPolicy{} }
|
||||
func (m *EventUpdateGroupPolicy) String() string { return proto.CompactTextString(m) }
|
||||
func (*EventUpdateGroupPolicy) ProtoMessage() {}
|
||||
func (*EventUpdateGroupPolicy) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_7879e051fb126fc0, []int{3}
|
||||
}
|
||||
func (m *EventUpdateGroupAccount) XXX_Unmarshal(b []byte) error {
|
||||
func (m *EventUpdateGroupPolicy) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *EventUpdateGroupAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
func (m *EventUpdateGroupPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_EventUpdateGroupAccount.Marshal(b, m, deterministic)
|
||||
return xxx_messageInfo_EventUpdateGroupPolicy.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
|
@ -188,19 +188,19 @@ func (m *EventUpdateGroupAccount) XXX_Marshal(b []byte, deterministic bool) ([]b
|
|||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *EventUpdateGroupAccount) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_EventUpdateGroupAccount.Merge(m, src)
|
||||
func (m *EventUpdateGroupPolicy) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_EventUpdateGroupPolicy.Merge(m, src)
|
||||
}
|
||||
func (m *EventUpdateGroupAccount) XXX_Size() int {
|
||||
func (m *EventUpdateGroupPolicy) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *EventUpdateGroupAccount) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_EventUpdateGroupAccount.DiscardUnknown(m)
|
||||
func (m *EventUpdateGroupPolicy) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_EventUpdateGroupPolicy.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_EventUpdateGroupAccount proto.InternalMessageInfo
|
||||
var xxx_messageInfo_EventUpdateGroupPolicy proto.InternalMessageInfo
|
||||
|
||||
func (m *EventUpdateGroupAccount) GetAddress() string {
|
||||
func (m *EventUpdateGroupPolicy) GetAddress() string {
|
||||
if m != nil {
|
||||
return m.Address
|
||||
}
|
||||
|
@ -348,8 +348,8 @@ func (m *EventExec) GetProposalId() uint64 {
|
|||
func init() {
|
||||
proto.RegisterType((*EventCreateGroup)(nil), "cosmos.group.v1beta1.EventCreateGroup")
|
||||
proto.RegisterType((*EventUpdateGroup)(nil), "cosmos.group.v1beta1.EventUpdateGroup")
|
||||
proto.RegisterType((*EventCreateGroupAccount)(nil), "cosmos.group.v1beta1.EventCreateGroupAccount")
|
||||
proto.RegisterType((*EventUpdateGroupAccount)(nil), "cosmos.group.v1beta1.EventUpdateGroupAccount")
|
||||
proto.RegisterType((*EventCreateGroupPolicy)(nil), "cosmos.group.v1beta1.EventCreateGroupPolicy")
|
||||
proto.RegisterType((*EventUpdateGroupPolicy)(nil), "cosmos.group.v1beta1.EventUpdateGroupPolicy")
|
||||
proto.RegisterType((*EventCreateProposal)(nil), "cosmos.group.v1beta1.EventCreateProposal")
|
||||
proto.RegisterType((*EventVote)(nil), "cosmos.group.v1beta1.EventVote")
|
||||
proto.RegisterType((*EventExec)(nil), "cosmos.group.v1beta1.EventExec")
|
||||
|
@ -358,7 +358,7 @@ func init() {
|
|||
func init() { proto.RegisterFile("cosmos/group/v1beta1/events.proto", fileDescriptor_7879e051fb126fc0) }
|
||||
|
||||
var fileDescriptor_7879e051fb126fc0 = []byte{
|
||||
// 281 bytes of a gzipped FileDescriptorProto
|
||||
// 280 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xce, 0x2f, 0xce,
|
||||
0xcd, 0x2f, 0xd6, 0x4f, 0x2f, 0xca, 0x2f, 0x2d, 0xd0, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34,
|
||||
0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81,
|
||||
|
@ -366,17 +366,17 @@ var fileDescriptor_7879e051fb126fc0 = []byte{
|
|||
0x95, 0x80, 0x39, 0x4a, 0xba, 0x5c, 0x02, 0xae, 0x20, 0x03, 0x9c, 0x8b, 0x52, 0x13, 0x4b, 0x52,
|
||||
0xdd, 0x41, 0xda, 0x84, 0x24, 0xb9, 0x38, 0xc0, 0xfa, 0xe3, 0x33, 0x53, 0x24, 0x18, 0x15, 0x18,
|
||||
0x35, 0x58, 0x82, 0xd8, 0xc1, 0x7c, 0xcf, 0x14, 0xb8, 0xf2, 0xd0, 0x82, 0x14, 0x62, 0x94, 0xfb,
|
||||
0x72, 0x89, 0xa3, 0x9b, 0xee, 0x98, 0x9c, 0x9c, 0x5f, 0x9a, 0x57, 0x22, 0x64, 0xc4, 0xc5, 0x9e,
|
||||
0x98, 0x92, 0x52, 0x94, 0x5a, 0x5c, 0x0c, 0xd6, 0xc4, 0xe9, 0x24, 0x71, 0x69, 0x8b, 0x2e, 0xcc,
|
||||
0xf9, 0x8e, 0x10, 0x99, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0xf4, 0x20, 0x98, 0x42, 0xb8, 0x71, 0x48,
|
||||
0xb6, 0x53, 0x62, 0x9c, 0x19, 0x97, 0x30, 0x92, 0xeb, 0x02, 0x8a, 0xf2, 0x0b, 0xf2, 0x8b, 0x13,
|
||||
0x73, 0x84, 0xe4, 0xb9, 0xb8, 0x0b, 0xa0, 0x6c, 0x84, 0x97, 0xb8, 0x60, 0x42, 0x9e, 0x29, 0x4a,
|
||||
0x3a, 0x5c, 0x9c, 0x60, 0x7d, 0x61, 0xf9, 0x25, 0xa9, 0xc4, 0xab, 0x76, 0xad, 0x48, 0x4d, 0x26,
|
||||
0xa8, 0xda, 0xc9, 0xee, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63,
|
||||
0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x54, 0xd2,
|
||||
0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xa1, 0x51, 0x08, 0xa5, 0x74, 0x8b, 0x53,
|
||||
0xb2, 0xf5, 0x2b, 0x20, 0xa9, 0x22, 0x89, 0x0d, 0x1c, 0xad, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff,
|
||||
0xff, 0x90, 0x54, 0xa1, 0x1a, 0x2c, 0x02, 0x00, 0x00,
|
||||
0x70, 0x89, 0xa1, 0x9b, 0x1e, 0x90, 0x9f, 0x93, 0x99, 0x5c, 0x29, 0x64, 0xc4, 0xc5, 0x9e, 0x98,
|
||||
0x92, 0x52, 0x94, 0x5a, 0x5c, 0x0c, 0xd6, 0xc3, 0xe9, 0x24, 0x71, 0x69, 0x8b, 0x2e, 0xcc, 0xf5,
|
||||
0x8e, 0x10, 0x99, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0xf4, 0x20, 0x98, 0x42, 0xb8, 0x69, 0x48, 0x96,
|
||||
0x53, 0x60, 0x9a, 0x19, 0x97, 0x30, 0x92, 0xdb, 0x02, 0x8a, 0xf2, 0x0b, 0xf2, 0x8b, 0x13, 0x73,
|
||||
0x84, 0xe4, 0xb9, 0xb8, 0x0b, 0xa0, 0x6c, 0x84, 0x87, 0xb8, 0x60, 0x42, 0x9e, 0x29, 0x4a, 0x3a,
|
||||
0x5c, 0x9c, 0x60, 0x7d, 0x61, 0xf9, 0x25, 0xa9, 0xc4, 0xab, 0x76, 0xad, 0x48, 0x4d, 0x26, 0xa8,
|
||||
0xda, 0xc9, 0xee, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c,
|
||||
0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x54, 0xd2, 0x33,
|
||||
0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xa1, 0x11, 0x08, 0xa5, 0x74, 0x8b, 0x53, 0xb2,
|
||||
0xf5, 0x2b, 0x20, 0x69, 0x22, 0x89, 0x0d, 0x1c, 0xa9, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff,
|
||||
0x78, 0x22, 0x27, 0x30, 0x2a, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *EventCreateGroup) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -435,7 +435,7 @@ func (m *EventUpdateGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *EventCreateGroupAccount) Marshal() (dAtA []byte, err error) {
|
||||
func (m *EventCreateGroupPolicy) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
|
@ -445,12 +445,12 @@ func (m *EventCreateGroupAccount) Marshal() (dAtA []byte, err error) {
|
|||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *EventCreateGroupAccount) MarshalTo(dAtA []byte) (int, error) {
|
||||
func (m *EventCreateGroupPolicy) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *EventCreateGroupAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
func (m *EventCreateGroupPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
|
@ -465,7 +465,7 @@ func (m *EventCreateGroupAccount) MarshalToSizedBuffer(dAtA []byte) (int, error)
|
|||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *EventUpdateGroupAccount) Marshal() (dAtA []byte, err error) {
|
||||
func (m *EventUpdateGroupPolicy) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
|
@ -475,12 +475,12 @@ func (m *EventUpdateGroupAccount) Marshal() (dAtA []byte, err error) {
|
|||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *EventUpdateGroupAccount) MarshalTo(dAtA []byte) (int, error) {
|
||||
func (m *EventUpdateGroupPolicy) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *EventUpdateGroupAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
func (m *EventUpdateGroupPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
|
@ -614,7 +614,7 @@ func (m *EventUpdateGroup) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *EventCreateGroupAccount) Size() (n int) {
|
||||
func (m *EventCreateGroupPolicy) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ func (m *EventCreateGroupAccount) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *EventUpdateGroupAccount) Size() (n int) {
|
||||
func (m *EventUpdateGroupPolicy) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
|
@ -820,7 +820,7 @@ func (m *EventUpdateGroup) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *EventCreateGroupAccount) Unmarshal(dAtA []byte) error {
|
||||
func (m *EventCreateGroupPolicy) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
|
@ -843,10 +843,10 @@ func (m *EventCreateGroupAccount) Unmarshal(dAtA []byte) error {
|
|||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: EventCreateGroupAccount: wiretype end group for non-group")
|
||||
return fmt.Errorf("proto: EventCreateGroupPolicy: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: EventCreateGroupAccount: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return fmt.Errorf("proto: EventCreateGroupPolicy: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
|
@ -902,7 +902,7 @@ func (m *EventCreateGroupAccount) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *EventUpdateGroupAccount) Unmarshal(dAtA []byte) error {
|
||||
func (m *EventUpdateGroupPolicy) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
|
@ -925,10 +925,10 @@ func (m *EventUpdateGroupAccount) Unmarshal(dAtA []byte) error {
|
|||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: EventUpdateGroupAccount: wiretype end group for non-group")
|
||||
return fmt.Errorf("proto: EventUpdateGroupPolicy: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: EventUpdateGroupAccount: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return fmt.Errorf("proto: EventUpdateGroupPolicy: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
|
|
|
@ -2,6 +2,7 @@ package keeper
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
|
@ -31,19 +32,19 @@ func (q Keeper) getGroupInfo(ctx sdk.Context, id uint64) (group.GroupInfo, error
|
|||
return obj, err
|
||||
}
|
||||
|
||||
func (q Keeper) GroupAccountInfo(goCtx context.Context, request *group.QueryGroupAccountInfoRequest) (*group.QueryGroupAccountInfoResponse, error) {
|
||||
func (q Keeper) GroupPolicyInfo(goCtx context.Context, request *group.QueryGroupPolicyInfoRequest) (*group.QueryGroupPolicyInfoResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
groupAccountInfo, err := q.getGroupAccountInfo(ctx, request.Address)
|
||||
groupPolicyInfo, err := q.getGroupPolicyInfo(ctx, request.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &group.QueryGroupAccountInfoResponse{Info: &groupAccountInfo}, nil
|
||||
return &group.QueryGroupPolicyInfoResponse{Info: &groupPolicyInfo}, nil
|
||||
}
|
||||
|
||||
func (q Keeper) getGroupAccountInfo(ctx sdk.Context, accountAddress string) (group.GroupAccountInfo, error) {
|
||||
var obj group.GroupAccountInfo
|
||||
return obj, q.groupAccountTable.GetOne(ctx.KVStore(q.key), orm.PrimaryKey(&group.GroupAccountInfo{Address: accountAddress}), &obj)
|
||||
func (q Keeper) getGroupPolicyInfo(ctx sdk.Context, accountAddress string) (group.GroupPolicyInfo, error) {
|
||||
var obj group.GroupPolicyInfo
|
||||
return obj, q.groupPolicyTable.GetOne(ctx.KVStore(q.key), orm.PrimaryKey(&group.GroupPolicyInfo{Address: accountAddress}), &obj)
|
||||
}
|
||||
|
||||
func (q Keeper) GroupMembers(goCtx context.Context, request *group.QueryGroupMembersRequest) (*group.QueryGroupMembersResponse, error) {
|
||||
|
@ -97,55 +98,55 @@ func (q Keeper) getGroupsByAdmin(ctx sdk.Context, admin sdk.AccAddress, pageRequ
|
|||
return q.groupByAdminIndex.GetPaginated(ctx.KVStore(q.key), admin.Bytes(), pageRequest)
|
||||
}
|
||||
|
||||
func (q Keeper) GroupAccountsByGroup(goCtx context.Context, request *group.QueryGroupAccountsByGroupRequest) (*group.QueryGroupAccountsByGroupResponse, error) {
|
||||
func (q Keeper) GroupPoliciesByGroup(goCtx context.Context, request *group.QueryGroupPoliciesByGroupRequest) (*group.QueryGroupPoliciesByGroupResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
groupID := request.GroupId
|
||||
it, err := q.getGroupAccountsByGroup(ctx, groupID, request.Pagination)
|
||||
it, err := q.getGroupPoliciesByGroup(ctx, groupID, request.Pagination)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var accounts []*group.GroupAccountInfo
|
||||
var accounts []*group.GroupPolicyInfo
|
||||
pageRes, err := orm.Paginate(it, request.Pagination, &accounts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &group.QueryGroupAccountsByGroupResponse{
|
||||
GroupAccounts: accounts,
|
||||
return &group.QueryGroupPoliciesByGroupResponse{
|
||||
GroupPolicies: accounts,
|
||||
Pagination: pageRes,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (q Keeper) getGroupAccountsByGroup(ctx sdk.Context, id uint64, pageRequest *query.PageRequest) (orm.Iterator, error) {
|
||||
return q.groupAccountByGroupIndex.GetPaginated(ctx.KVStore(q.key), id, pageRequest)
|
||||
func (q Keeper) getGroupPoliciesByGroup(ctx sdk.Context, id uint64, pageRequest *query.PageRequest) (orm.Iterator, error) {
|
||||
return q.groupPolicyByGroupIndex.GetPaginated(ctx.KVStore(q.key), id, pageRequest)
|
||||
}
|
||||
|
||||
func (q Keeper) GroupAccountsByAdmin(goCtx context.Context, request *group.QueryGroupAccountsByAdminRequest) (*group.QueryGroupAccountsByAdminResponse, error) {
|
||||
func (q Keeper) GroupPoliciesByAdmin(goCtx context.Context, request *group.QueryGroupPoliciesByAdminRequest) (*group.QueryGroupPoliciesByAdminResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
addr, err := sdk.AccAddressFromBech32(request.Admin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
it, err := q.getGroupAccountsByAdmin(ctx, addr, request.Pagination)
|
||||
it, err := q.getGroupPoliciesByAdmin(ctx, addr, request.Pagination)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var accounts []*group.GroupAccountInfo
|
||||
var accounts []*group.GroupPolicyInfo
|
||||
pageRes, err := orm.Paginate(it, request.Pagination, &accounts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &group.QueryGroupAccountsByAdminResponse{
|
||||
GroupAccounts: accounts,
|
||||
return &group.QueryGroupPoliciesByAdminResponse{
|
||||
GroupPolicies: accounts,
|
||||
Pagination: pageRes,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (q Keeper) getGroupAccountsByAdmin(ctx sdk.Context, admin sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) {
|
||||
return q.groupAccountByAdminIndex.GetPaginated(ctx.KVStore(q.key), admin.Bytes(), pageRequest)
|
||||
func (q Keeper) getGroupPoliciesByAdmin(ctx sdk.Context, admin sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) {
|
||||
return q.groupPolicyByAdminIndex.GetPaginated(ctx.KVStore(q.key), admin.Bytes(), pageRequest)
|
||||
}
|
||||
|
||||
func (q Keeper) Proposal(goCtx context.Context, request *group.QueryProposalRequest) (*group.QueryProposalResponse, error) {
|
||||
|
@ -159,13 +160,13 @@ func (q Keeper) Proposal(goCtx context.Context, request *group.QueryProposalRequ
|
|||
return &group.QueryProposalResponse{Proposal: &proposal}, nil
|
||||
}
|
||||
|
||||
func (q Keeper) ProposalsByGroupAccount(goCtx context.Context, request *group.QueryProposalsByGroupAccountRequest) (*group.QueryProposalsByGroupAccountResponse, error) {
|
||||
func (q Keeper) ProposalsByGroupPolicy(goCtx context.Context, request *group.QueryProposalsByGroupPolicyRequest) (*group.QueryProposalsByGroupPolicyResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
addr, err := sdk.AccAddressFromBech32(request.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
it, err := q.getProposalsByGroupAccount(ctx, addr, request.Pagination)
|
||||
it, err := q.getProposalsByGroupPolicy(ctx, addr, request.Pagination)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -176,14 +177,14 @@ func (q Keeper) ProposalsByGroupAccount(goCtx context.Context, request *group.Qu
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return &group.QueryProposalsByGroupAccountResponse{
|
||||
return &group.QueryProposalsByGroupPolicyResponse{
|
||||
Proposals: proposals,
|
||||
Pagination: pageRes,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (q Keeper) getProposalsByGroupAccount(ctx sdk.Context, account sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) {
|
||||
return q.proposalByGroupAccountIndex.GetPaginated(ctx.KVStore(q.key), account.Bytes(), pageRequest)
|
||||
func (q Keeper) getProposalsByGroupPolicy(ctx sdk.Context, account sdk.AccAddress, pageRequest *query.PageRequest) (orm.Iterator, error) {
|
||||
return q.proposalByGroupPolicyIndex.GetPaginated(ctx.KVStore(q.key), account.Bytes(), pageRequest)
|
||||
}
|
||||
|
||||
func (q Keeper) getProposal(ctx sdk.Context, proposalID uint64) (group.Proposal, error) {
|
||||
|
|
|
@ -22,7 +22,7 @@ func TestQueryGroupsByMember(t *testing.T) {
|
|||
|
||||
addrs := simapp.AddTestAddrsIncremental(app, ctx, 6, sdk.NewInt(30000000))
|
||||
|
||||
// Initial group, group account and balance setup
|
||||
// Initial group, group policy and balance setup
|
||||
members := []group.Member{
|
||||
{Address: addrs[2].String(), Weight: "1"}, {Address: addrs[3].String(), Weight: "2"},
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ func TestQueryGroupsByMember(t *testing.T) {
|
|||
Members: members,
|
||||
Metadata: nil,
|
||||
})
|
||||
require.NoError(t,err)
|
||||
require.NoError(t, err)
|
||||
|
||||
members = []group.Member{
|
||||
{Address: addrs[3].String(), Weight: "1"}, {Address: addrs[4].String(), Weight: "2"},
|
||||
|
@ -41,26 +41,26 @@ func TestQueryGroupsByMember(t *testing.T) {
|
|||
Members: members,
|
||||
Metadata: nil,
|
||||
})
|
||||
require.NoError(t,err)
|
||||
require.NoError(t, err)
|
||||
|
||||
// not part of any group
|
||||
resp, err := queryClient.GroupsByMember(context.Background(), &group.QueryGroupsByMemberRequest{
|
||||
Address: addrs[5].String(),
|
||||
})
|
||||
require.NoError(t,err)
|
||||
require.Len(t, resp.Groups,0)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, resp.Groups, 0)
|
||||
|
||||
// expect one group
|
||||
resp, err = queryClient.GroupsByMember(context.Background(), &group.QueryGroupsByMemberRequest{
|
||||
Address: addrs[4].String(),
|
||||
})
|
||||
require.NoError(t,err)
|
||||
require.Len(t, resp.Groups,1)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, resp.Groups, 1)
|
||||
|
||||
// expect two groups
|
||||
resp, err = queryClient.GroupsByMember(context.Background(), &group.QueryGroupsByMemberRequest{
|
||||
Address: addrs[3].String(),
|
||||
})
|
||||
require.NoError(t,err)
|
||||
require.Len(t, resp.Groups,2)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, resp.Groups, 2)
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ func GroupTotalWeightInvariant(keeper Keeper) sdk.Invariant {
|
|||
// TallyVotesSumInvariant checks that proposal VoteState must correspond to the vote choice.
|
||||
func TallyVotesSumInvariant(keeper Keeper) sdk.Invariant {
|
||||
return func(ctx sdk.Context) (string, bool) {
|
||||
msg, broken := TallyVotesSumInvariantHelper(ctx, keeper.key, keeper.groupTable, keeper.proposalTable, keeper.groupMemberTable, keeper.voteByProposalIndex, keeper.groupAccountTable)
|
||||
msg, broken := TallyVotesSumInvariantHelper(ctx, keeper.key, keeper.groupTable, keeper.proposalTable, keeper.groupMemberTable, keeper.voteByProposalIndex, keeper.groupPolicyTable)
|
||||
return sdk.FormatInvariant(group.ModuleName, votesSumInvariant, msg), broken
|
||||
}
|
||||
}
|
||||
|
@ -200,13 +200,13 @@ func GroupTotalWeightInvariantHelper(ctx sdk.Context, key storetypes.StoreKey, g
|
|||
return msg, broken
|
||||
}
|
||||
|
||||
func TallyVotesSumInvariantHelper(ctx sdk.Context, key storetypes.StoreKey, groupTable orm.AutoUInt64Table, proposalTable orm.AutoUInt64Table, groupMemberTable orm.PrimaryKeyTable, voteByProposalIndex orm.Index, groupAccountTable orm.PrimaryKeyTable) (string, bool) {
|
||||
func TallyVotesSumInvariantHelper(ctx sdk.Context, key storetypes.StoreKey, groupTable orm.AutoUInt64Table, proposalTable orm.AutoUInt64Table, groupMemberTable orm.PrimaryKeyTable, voteByProposalIndex orm.Index, groupPolicyTable orm.PrimaryKeyTable) (string, bool) {
|
||||
var msg string
|
||||
var broken bool
|
||||
|
||||
var groupInfo group.GroupInfo
|
||||
var proposal group.Proposal
|
||||
var groupAcc group.GroupAccountInfo
|
||||
var groupPolicy group.GroupPolicyInfo
|
||||
var groupMem group.GroupMember
|
||||
var vote group.Vote
|
||||
|
||||
|
@ -251,20 +251,20 @@ func TallyVotesSumInvariantHelper(ctx sdk.Context, key storetypes.StoreKey, grou
|
|||
break
|
||||
}
|
||||
|
||||
err = groupAccountTable.GetOne(ctx.KVStore(key), orm.PrimaryKey(&group.GroupAccountInfo{Address: proposal.Address}), &groupAcc)
|
||||
err = groupPolicyTable.GetOne(ctx.KVStore(key), orm.PrimaryKey(&group.GroupPolicyInfo{Address: proposal.Address}), &groupPolicy)
|
||||
if err != nil {
|
||||
msg += fmt.Sprintf("group account not found for address: %s\n%v\n", proposal.Address, err)
|
||||
msg += fmt.Sprintf("group policy not found for address: %s\n%v\n", proposal.Address, err)
|
||||
return msg, broken
|
||||
}
|
||||
|
||||
if proposal.GroupAccountVersion != groupAcc.Version {
|
||||
msg += fmt.Sprintf("group account with address %s was modified\n", groupAcc.Address)
|
||||
if proposal.GroupPolicyVersion != groupPolicy.Version {
|
||||
msg += fmt.Sprintf("group policy with address %s was modified\n", groupPolicy.Address)
|
||||
return msg, broken
|
||||
}
|
||||
|
||||
_, err = groupTable.GetOne(ctx.KVStore(key), groupAcc.GroupId, &groupInfo)
|
||||
_, err = groupTable.GetOne(ctx.KVStore(key), groupPolicy.GroupId, &groupInfo)
|
||||
if err != nil {
|
||||
msg += fmt.Sprintf("group info not found for group id %d\n%v\n", groupAcc.GroupId, err)
|
||||
msg += fmt.Sprintf("group info not found for group id %d\n%v\n", groupPolicy.GroupId, err)
|
||||
return msg, broken
|
||||
}
|
||||
|
||||
|
@ -286,9 +286,9 @@ func TallyVotesSumInvariantHelper(ctx sdk.Context, key storetypes.StoreKey, grou
|
|||
break
|
||||
}
|
||||
|
||||
err = groupMemberTable.GetOne(ctx.KVStore(key), orm.PrimaryKey(&group.GroupMember{GroupId: groupAcc.GroupId, Member: &group.Member{Address: vote.Voter}}), &groupMem)
|
||||
err = groupMemberTable.GetOne(ctx.KVStore(key), orm.PrimaryKey(&group.GroupMember{GroupId: groupPolicy.GroupId, Member: &group.Member{Address: vote.Voter}}), &groupMem)
|
||||
if err != nil {
|
||||
msg += fmt.Sprintf("group member not found with group ID %d and group member %s\n%v\n", groupAcc.GroupId, vote.Voter, err)
|
||||
msg += fmt.Sprintf("group member not found with group ID %d and group member %s\n%v\n", groupPolicy.GroupId, vote.Voter, err)
|
||||
return msg, broken
|
||||
}
|
||||
|
||||
|
|
|
@ -72,146 +72,146 @@ func (s *invariantTestSuite) TestTallyVotesInvariant() {
|
|||
}{
|
||||
"invariant not broken": {
|
||||
prevProposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: prevCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "1", NoCount: "0", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: prevCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: prevCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "1", NoCount: "0", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: prevCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
|
||||
curProposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr2.String(),
|
||||
Proposers: []string{addr2.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "2", NoCount: "0", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr2.String(),
|
||||
Proposers: []string{addr2.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "2", NoCount: "0", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
},
|
||||
"current block yes vote count must be greater than previous block yes vote count": {
|
||||
prevProposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: prevCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "2", NoCount: "0", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: prevCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: prevCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "2", NoCount: "0", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: prevCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
curProposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr2.String(),
|
||||
Proposers: []string{addr2.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "1", NoCount: "0", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr2.String(),
|
||||
Proposers: []string{addr2.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "1", NoCount: "0", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
expBroken: true,
|
||||
},
|
||||
"current block no vote count must be greater than previous block no vote count": {
|
||||
prevProposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: prevCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "2", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: prevCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: prevCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "2", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: prevCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
curProposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr2.String(),
|
||||
Proposers: []string{addr2.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "1", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr2.String(),
|
||||
Proposers: []string{addr2.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "1", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
expBroken: true,
|
||||
},
|
||||
"current block abstain vote count must be greater than previous block abstain vote count": {
|
||||
prevProposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: prevCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "0", AbstainCount: "2", VetoCount: "0"},
|
||||
Timeout: prevCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: prevCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "0", AbstainCount: "2", VetoCount: "0"},
|
||||
Timeout: prevCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
curProposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr2.String(),
|
||||
Proposers: []string{addr2.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "0", AbstainCount: "1", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr2.String(),
|
||||
Proposers: []string{addr2.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "0", AbstainCount: "1", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
expBroken: true,
|
||||
},
|
||||
"current block veto vote count must be greater than previous block veto vote count": {
|
||||
prevProposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: prevCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "0", AbstainCount: "0", VetoCount: "2"},
|
||||
Timeout: prevCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: prevCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "0", AbstainCount: "0", VetoCount: "2"},
|
||||
Timeout: prevCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
curProposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr2.String(),
|
||||
Proposers: []string{addr2.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "0", AbstainCount: "0", VetoCount: "1"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr2.String(),
|
||||
Proposers: []string{addr2.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "0", NoCount: "0", AbstainCount: "0", VetoCount: "1"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
expBroken: true,
|
||||
},
|
||||
|
@ -341,8 +341,8 @@ func (s *invariantTestSuite) TestTallyVotesSumInvariant() {
|
|||
groupTable, err := orm.NewAutoUInt64Table([2]byte{keeper.GroupTablePrefix}, keeper.GroupTableSeqPrefix, &group.GroupInfo{}, cdc)
|
||||
s.Require().NoError(err)
|
||||
|
||||
// Group Account Table
|
||||
groupAccountTable, err := orm.NewPrimaryKeyTable([2]byte{keeper.GroupAccountTablePrefix}, &group.GroupAccountInfo{}, cdc)
|
||||
// Group Policy Table
|
||||
groupPolicyTable, err := orm.NewPrimaryKeyTable([2]byte{keeper.GroupPolicyTablePrefix}, &group.GroupPolicyInfo{}, cdc)
|
||||
s.Require().NoError(err)
|
||||
|
||||
// Group Member Table
|
||||
|
@ -368,7 +368,7 @@ func (s *invariantTestSuite) TestTallyVotesSumInvariant() {
|
|||
|
||||
specs := map[string]struct {
|
||||
groupsInfo *group.GroupInfo
|
||||
groupAcc *group.GroupAccountInfo
|
||||
groupPolicy *group.GroupPolicyInfo
|
||||
groupMembers []*group.GroupMember
|
||||
proposal *group.Proposal
|
||||
votes []*group.Vote
|
||||
|
@ -381,7 +381,7 @@ func (s *invariantTestSuite) TestTallyVotesSumInvariant() {
|
|||
Version: 1,
|
||||
TotalWeight: "7",
|
||||
},
|
||||
groupAcc: &group.GroupAccountInfo{
|
||||
groupPolicy: &group.GroupPolicyInfo{
|
||||
Address: addr1.String(),
|
||||
GroupId: 1,
|
||||
Admin: adminAddr.String(),
|
||||
|
@ -404,17 +404,17 @@ func (s *invariantTestSuite) TestTallyVotesSumInvariant() {
|
|||
},
|
||||
},
|
||||
proposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "4", NoCount: "3", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "4", NoCount: "3", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
votes: []*group.Vote{
|
||||
{
|
||||
|
@ -439,7 +439,7 @@ func (s *invariantTestSuite) TestTallyVotesSumInvariant() {
|
|||
Version: 1,
|
||||
TotalWeight: "5",
|
||||
},
|
||||
groupAcc: &group.GroupAccountInfo{
|
||||
groupPolicy: &group.GroupPolicyInfo{
|
||||
Address: addr1.String(),
|
||||
GroupId: 1,
|
||||
Admin: adminAddr.String(),
|
||||
|
@ -462,17 +462,17 @@ func (s *invariantTestSuite) TestTallyVotesSumInvariant() {
|
|||
},
|
||||
},
|
||||
proposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "6", NoCount: "0", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "6", NoCount: "0", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
votes: []*group.Vote{
|
||||
{
|
||||
|
@ -497,7 +497,7 @@ func (s *invariantTestSuite) TestTallyVotesSumInvariant() {
|
|||
Version: 1,
|
||||
TotalWeight: "7",
|
||||
},
|
||||
groupAcc: &group.GroupAccountInfo{
|
||||
groupPolicy: &group.GroupPolicyInfo{
|
||||
Address: addr1.String(),
|
||||
GroupId: 1,
|
||||
Admin: adminAddr.String(),
|
||||
|
@ -520,17 +520,17 @@ func (s *invariantTestSuite) TestTallyVotesSumInvariant() {
|
|||
},
|
||||
},
|
||||
proposal: &group.Proposal{
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupAccountVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "4", NoCount: "3", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
ProposalId: 1,
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr1.String()},
|
||||
SubmittedAt: curCtx.BlockTime(),
|
||||
GroupVersion: 1,
|
||||
GroupPolicyVersion: 1,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
VoteState: group.Tally{YesCount: "4", NoCount: "3", AbstainCount: "0", VetoCount: "0"},
|
||||
Timeout: curCtx.BlockTime().Add(time.Second * 600),
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
votes: []*group.Vote{
|
||||
{
|
||||
|
@ -554,16 +554,16 @@ func (s *invariantTestSuite) TestTallyVotesSumInvariant() {
|
|||
cacheCurCtx, _ := curCtx.CacheContext()
|
||||
groupsInfo := spec.groupsInfo
|
||||
proposal := spec.proposal
|
||||
groupAcc := spec.groupAcc
|
||||
groupPolicy := spec.groupPolicy
|
||||
groupMembers := spec.groupMembers
|
||||
votes := spec.votes
|
||||
|
||||
_, err := groupTable.Create(cacheCurCtx.KVStore(key), groupsInfo)
|
||||
s.Require().NoError(err)
|
||||
|
||||
err = groupAcc.SetDecisionPolicy(group.NewThresholdDecisionPolicy("1", time.Second))
|
||||
err = groupPolicy.SetDecisionPolicy(group.NewThresholdDecisionPolicy("1", time.Second))
|
||||
s.Require().NoError(err)
|
||||
err = groupAccountTable.Create(cacheCurCtx.KVStore(key), groupAcc)
|
||||
err = groupPolicyTable.Create(cacheCurCtx.KVStore(key), groupPolicy)
|
||||
s.Require().NoError(err)
|
||||
|
||||
for i := 0; i < len(groupMembers); i++ {
|
||||
|
@ -579,7 +579,7 @@ func (s *invariantTestSuite) TestTallyVotesSumInvariant() {
|
|||
s.Require().NoError(err)
|
||||
}
|
||||
|
||||
_, broken := keeper.TallyVotesSumInvariantHelper(cacheCurCtx, key, *groupTable, *proposalTable, *groupMemberTable, voteByProposalIndex, *groupAccountTable)
|
||||
_, broken := keeper.TallyVotesSumInvariantHelper(cacheCurCtx, key, *groupTable, *proposalTable, *groupMemberTable, voteByProposalIndex, *groupPolicyTable)
|
||||
s.Require().Equal(spec.expBroken, broken)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,17 +24,17 @@ const (
|
|||
GroupMemberByGroupIndexPrefix byte = 0x11
|
||||
GroupMemberByMemberIndexPrefix byte = 0x12
|
||||
|
||||
// Group Account Table
|
||||
GroupAccountTablePrefix byte = 0x20
|
||||
GroupAccountTableSeqPrefix byte = 0x21
|
||||
GroupAccountByGroupIndexPrefix byte = 0x22
|
||||
GroupAccountByAdminIndexPrefix byte = 0x23
|
||||
// Group Policy Table
|
||||
GroupPolicyTablePrefix byte = 0x20
|
||||
GroupPolicyTableSeqPrefix byte = 0x21
|
||||
GroupPolicyByGroupIndexPrefix byte = 0x22
|
||||
GroupPolicyByAdminIndexPrefix byte = 0x23
|
||||
|
||||
// Proposal Table
|
||||
ProposalTablePrefix byte = 0x30
|
||||
ProposalTableSeqPrefix byte = 0x31
|
||||
ProposalByGroupAccountIndexPrefix byte = 0x32
|
||||
ProposalByProposerIndexPrefix byte = 0x33
|
||||
ProposalTablePrefix byte = 0x30
|
||||
ProposalTableSeqPrefix byte = 0x31
|
||||
ProposalByGroupPolicyIndexPrefix byte = 0x32
|
||||
ProposalByProposerIndexPrefix byte = 0x33
|
||||
|
||||
// Vote Table
|
||||
VoteTablePrefix byte = 0x40
|
||||
|
@ -56,16 +56,16 @@ type Keeper struct {
|
|||
groupMemberByGroupIndex orm.Index
|
||||
groupMemberByMemberIndex orm.Index
|
||||
|
||||
// Group Account Table
|
||||
groupAccountSeq orm.Sequence
|
||||
groupAccountTable orm.PrimaryKeyTable
|
||||
groupAccountByGroupIndex orm.Index
|
||||
groupAccountByAdminIndex orm.Index
|
||||
// Group Policy Table
|
||||
groupPolicySeq orm.Sequence
|
||||
groupPolicyTable orm.PrimaryKeyTable
|
||||
groupPolicyByGroupIndex orm.Index
|
||||
groupPolicyByAdminIndex orm.Index
|
||||
|
||||
// Proposal Table
|
||||
proposalTable orm.AutoUInt64Table
|
||||
proposalByGroupAccountIndex orm.Index
|
||||
proposalByProposerIndex orm.Index
|
||||
proposalTable orm.AutoUInt64Table
|
||||
proposalByGroupPolicyIndex orm.Index
|
||||
proposalByProposerIndex orm.Index
|
||||
|
||||
// Vote Table
|
||||
voteTable orm.PrimaryKeyTable
|
||||
|
@ -123,20 +123,20 @@ func NewKeeper(storeKey storetypes.StoreKey, cdc codec.Codec, router *authmiddle
|
|||
}
|
||||
k.groupMemberTable = *groupMemberTable
|
||||
|
||||
// Group Account Table
|
||||
k.groupAccountSeq = orm.NewSequence(GroupAccountTableSeqPrefix)
|
||||
groupAccountTable, err := orm.NewPrimaryKeyTable([2]byte{GroupAccountTablePrefix}, &group.GroupAccountInfo{}, cdc)
|
||||
// Group Policy Table
|
||||
k.groupPolicySeq = orm.NewSequence(GroupPolicyTableSeqPrefix)
|
||||
groupPolicyTable, err := orm.NewPrimaryKeyTable([2]byte{GroupPolicyTablePrefix}, &group.GroupPolicyInfo{}, cdc)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
k.groupAccountByGroupIndex, err = orm.NewIndex(groupAccountTable, GroupAccountByGroupIndexPrefix, func(value interface{}) ([]interface{}, error) {
|
||||
return []interface{}{value.(*group.GroupAccountInfo).GroupId}, nil
|
||||
}, group.GroupAccountInfo{}.GroupId)
|
||||
k.groupPolicyByGroupIndex, err = orm.NewIndex(groupPolicyTable, GroupPolicyByGroupIndexPrefix, func(value interface{}) ([]interface{}, error) {
|
||||
return []interface{}{value.(*group.GroupPolicyInfo).GroupId}, nil
|
||||
}, group.GroupPolicyInfo{}.GroupId)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
k.groupAccountByAdminIndex, err = orm.NewIndex(groupAccountTable, GroupAccountByAdminIndexPrefix, func(value interface{}) ([]interface{}, error) {
|
||||
admin := value.(*group.GroupAccountInfo).Admin
|
||||
k.groupPolicyByAdminIndex, err = orm.NewIndex(groupPolicyTable, GroupPolicyByAdminIndexPrefix, func(value interface{}) ([]interface{}, error) {
|
||||
admin := value.(*group.GroupPolicyInfo).Admin
|
||||
addr, err := sdk.AccAddressFromBech32(admin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -146,14 +146,14 @@ func NewKeeper(storeKey storetypes.StoreKey, cdc codec.Codec, router *authmiddle
|
|||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
k.groupAccountTable = *groupAccountTable
|
||||
k.groupPolicyTable = *groupPolicyTable
|
||||
|
||||
// Proposal Table
|
||||
proposalTable, err := orm.NewAutoUInt64Table([2]byte{ProposalTablePrefix}, ProposalTableSeqPrefix, &group.Proposal{}, cdc)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
k.proposalByGroupAccountIndex, err = orm.NewIndex(proposalTable, ProposalByGroupAccountIndexPrefix, func(value interface{}) ([]interface{}, error) {
|
||||
k.proposalByGroupPolicyIndex, err = orm.NewIndex(proposalTable, ProposalByGroupPolicyIndexPrefix, func(value interface{}) ([]interface{}, error) {
|
||||
account := value.(*group.Proposal).Address
|
||||
addr, err := sdk.AccAddressFromBech32(account)
|
||||
if err != nil {
|
||||
|
|
|
@ -24,14 +24,14 @@ import (
|
|||
type TestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
app *simapp.SimApp
|
||||
sdkCtx sdk.Context
|
||||
ctx context.Context
|
||||
addrs []sdk.AccAddress
|
||||
groupID uint64
|
||||
groupAccountAddr sdk.AccAddress
|
||||
keeper keeper.Keeper
|
||||
blockTime time.Time
|
||||
app *simapp.SimApp
|
||||
sdkCtx sdk.Context
|
||||
ctx context.Context
|
||||
addrs []sdk.AccAddress
|
||||
groupID uint64
|
||||
groupPolicyAddr sdk.AccAddress
|
||||
keeper keeper.Keeper
|
||||
blockTime time.Time
|
||||
}
|
||||
|
||||
func (s *TestSuite) SetupTest() {
|
||||
|
@ -47,7 +47,7 @@ func (s *TestSuite) SetupTest() {
|
|||
s.keeper = s.app.GroupKeeper
|
||||
s.addrs = simapp.AddTestAddrsIncremental(app, ctx, 6, sdk.NewInt(30000000))
|
||||
|
||||
// Initial group, group account and balance setup
|
||||
// Initial group, group policy and balance setup
|
||||
members := []group.Member{
|
||||
{Address: s.addrs[4].String(), Weight: "1"}, {Address: s.addrs[1].String(), Weight: "2"},
|
||||
}
|
||||
|
@ -63,19 +63,19 @@ func (s *TestSuite) SetupTest() {
|
|||
"2",
|
||||
time.Second,
|
||||
)
|
||||
accountReq := &group.MsgCreateGroupAccount{
|
||||
policyReq := &group.MsgCreateGroupPolicy{
|
||||
Admin: s.addrs[0].String(),
|
||||
GroupId: s.groupID,
|
||||
Metadata: nil,
|
||||
}
|
||||
err = accountReq.SetDecisionPolicy(policy)
|
||||
err = policyReq.SetDecisionPolicy(policy)
|
||||
s.Require().NoError(err)
|
||||
accountRes, err := s.keeper.CreateGroupAccount(s.ctx, accountReq)
|
||||
policyRes, err := s.keeper.CreateGroupPolicy(s.ctx, policyReq)
|
||||
s.Require().NoError(err)
|
||||
addr, err := sdk.AccAddressFromBech32(accountRes.Address)
|
||||
addr, err := sdk.AccAddressFromBech32(policyRes.Address)
|
||||
s.Require().NoError(err)
|
||||
s.groupAccountAddr = addr
|
||||
s.Require().NoError(testutil.FundAccount(s.app.BankKeeper, s.sdkCtx, s.groupAccountAddr, sdk.Coins{sdk.NewInt64Coin("test", 10000)}))
|
||||
s.groupPolicyAddr = addr
|
||||
s.Require().NoError(testutil.FundAccount(s.app.BankKeeper, s.sdkCtx, s.groupPolicyAddr, sdk.Coins{sdk.NewInt64Coin("test", 10000)}))
|
||||
}
|
||||
|
||||
func TestKeeperTestSuite(t *testing.T) {
|
||||
|
@ -684,7 +684,7 @@ func (s *TestSuite) TestUpdateGroupMembers() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestCreateGroupAccount() {
|
||||
func (s *TestSuite) TestCreateGroupPolicy() {
|
||||
addrs := s.addrs
|
||||
addr1 := addrs[0]
|
||||
addr4 := addrs[3]
|
||||
|
@ -698,12 +698,12 @@ func (s *TestSuite) TestCreateGroupAccount() {
|
|||
myGroupID := groupRes.GroupId
|
||||
|
||||
specs := map[string]struct {
|
||||
req *group.MsgCreateGroupAccount
|
||||
req *group.MsgCreateGroupPolicy
|
||||
policy group.DecisionPolicy
|
||||
expErr bool
|
||||
}{
|
||||
"all good": {
|
||||
req: &group.MsgCreateGroupAccount{
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
Admin: addr1.String(),
|
||||
Metadata: nil,
|
||||
GroupId: myGroupID,
|
||||
|
@ -714,7 +714,7 @@ func (s *TestSuite) TestCreateGroupAccount() {
|
|||
),
|
||||
},
|
||||
"decision policy threshold > total group weight": {
|
||||
req: &group.MsgCreateGroupAccount{
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
Admin: addr1.String(),
|
||||
Metadata: nil,
|
||||
GroupId: myGroupID,
|
||||
|
@ -725,7 +725,7 @@ func (s *TestSuite) TestCreateGroupAccount() {
|
|||
),
|
||||
},
|
||||
"group id does not exists": {
|
||||
req: &group.MsgCreateGroupAccount{
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
Admin: addr1.String(),
|
||||
Metadata: nil,
|
||||
GroupId: 9999,
|
||||
|
@ -737,7 +737,7 @@ func (s *TestSuite) TestCreateGroupAccount() {
|
|||
expErr: true,
|
||||
},
|
||||
"admin not group admin": {
|
||||
req: &group.MsgCreateGroupAccount{
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
Admin: addr4.String(),
|
||||
Metadata: nil,
|
||||
GroupId: myGroupID,
|
||||
|
@ -749,7 +749,7 @@ func (s *TestSuite) TestCreateGroupAccount() {
|
|||
expErr: true,
|
||||
},
|
||||
"metadata too long": {
|
||||
req: &group.MsgCreateGroupAccount{
|
||||
req: &group.MsgCreateGroupPolicy{
|
||||
Admin: addr1.String(),
|
||||
Metadata: []byte(strings.Repeat("a", 256)),
|
||||
GroupId: myGroupID,
|
||||
|
@ -767,7 +767,7 @@ func (s *TestSuite) TestCreateGroupAccount() {
|
|||
err := spec.req.SetDecisionPolicy(spec.policy)
|
||||
s.Require().NoError(err)
|
||||
|
||||
res, err := s.keeper.CreateGroupAccount(s.ctx, spec.req)
|
||||
res, err := s.keeper.CreateGroupPolicy(s.ctx, spec.req)
|
||||
if spec.expErr {
|
||||
s.Require().Error(err)
|
||||
return
|
||||
|
@ -776,43 +776,43 @@ func (s *TestSuite) TestCreateGroupAccount() {
|
|||
addr := res.Address
|
||||
|
||||
// then all data persisted
|
||||
groupAccountRes, err := s.keeper.GroupAccountInfo(s.ctx, &group.QueryGroupAccountInfoRequest{Address: addr})
|
||||
groupPolicyRes, err := s.keeper.GroupPolicyInfo(s.ctx, &group.QueryGroupPolicyInfoRequest{Address: addr})
|
||||
s.Require().NoError(err)
|
||||
|
||||
groupAccount := groupAccountRes.Info
|
||||
s.Assert().Equal(addr, groupAccount.Address)
|
||||
s.Assert().Equal(myGroupID, groupAccount.GroupId)
|
||||
s.Assert().Equal(spec.req.Admin, groupAccount.Admin)
|
||||
s.Assert().Equal(spec.req.Metadata, groupAccount.Metadata)
|
||||
s.Assert().Equal(uint64(1), groupAccount.Version)
|
||||
s.Assert().Equal(spec.policy.(*group.ThresholdDecisionPolicy), groupAccount.GetDecisionPolicy())
|
||||
groupPolicy := groupPolicyRes.Info
|
||||
s.Assert().Equal(addr, groupPolicy.Address)
|
||||
s.Assert().Equal(myGroupID, groupPolicy.GroupId)
|
||||
s.Assert().Equal(spec.req.Admin, groupPolicy.Admin)
|
||||
s.Assert().Equal(spec.req.Metadata, groupPolicy.Metadata)
|
||||
s.Assert().Equal(uint64(1), groupPolicy.Version)
|
||||
s.Assert().Equal(spec.policy.(*group.ThresholdDecisionPolicy), groupPolicy.GetDecisionPolicy())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestUpdateGroupAccountAdmin() {
|
||||
func (s *TestSuite) TestUpdateGroupPolicyAdmin() {
|
||||
addrs := s.addrs
|
||||
addr1 := addrs[0]
|
||||
addr2 := addrs[1]
|
||||
addr5 := addrs[4]
|
||||
|
||||
admin, newAdmin := addr1, addr2
|
||||
groupAccountAddr, myGroupID, policy := createGroupAndGroupAccount(admin, s)
|
||||
groupPolicyAddr, myGroupID, policy := createGroupAndGroupPolicy(admin, s)
|
||||
|
||||
specs := map[string]struct {
|
||||
req *group.MsgUpdateGroupAccountAdmin
|
||||
expGroupAccount *group.GroupAccountInfo
|
||||
expErr bool
|
||||
req *group.MsgUpdateGroupPolicyAdmin
|
||||
expGroupPolicy *group.GroupPolicyInfo
|
||||
expErr bool
|
||||
}{
|
||||
"with wrong admin": {
|
||||
req: &group.MsgUpdateGroupAccountAdmin{
|
||||
req: &group.MsgUpdateGroupPolicyAdmin{
|
||||
Admin: addr5.String(),
|
||||
Address: groupAccountAddr,
|
||||
Address: groupPolicyAddr,
|
||||
NewAdmin: newAdmin.String(),
|
||||
},
|
||||
expGroupAccount: &group.GroupAccountInfo{
|
||||
expGroupPolicy: &group.GroupPolicyInfo{
|
||||
Admin: admin.String(),
|
||||
Address: groupAccountAddr,
|
||||
Address: groupPolicyAddr,
|
||||
GroupId: myGroupID,
|
||||
Metadata: nil,
|
||||
Version: 2,
|
||||
|
@ -820,15 +820,15 @@ func (s *TestSuite) TestUpdateGroupAccountAdmin() {
|
|||
},
|
||||
expErr: true,
|
||||
},
|
||||
"with wrong group account": {
|
||||
req: &group.MsgUpdateGroupAccountAdmin{
|
||||
"with wrong group policy": {
|
||||
req: &group.MsgUpdateGroupPolicyAdmin{
|
||||
Admin: admin.String(),
|
||||
Address: addr5.String(),
|
||||
NewAdmin: newAdmin.String(),
|
||||
},
|
||||
expGroupAccount: &group.GroupAccountInfo{
|
||||
expGroupPolicy: &group.GroupPolicyInfo{
|
||||
Admin: admin.String(),
|
||||
Address: groupAccountAddr,
|
||||
Address: groupPolicyAddr,
|
||||
GroupId: myGroupID,
|
||||
Metadata: nil,
|
||||
Version: 2,
|
||||
|
@ -837,14 +837,14 @@ func (s *TestSuite) TestUpdateGroupAccountAdmin() {
|
|||
expErr: true,
|
||||
},
|
||||
"correct data": {
|
||||
req: &group.MsgUpdateGroupAccountAdmin{
|
||||
req: &group.MsgUpdateGroupPolicyAdmin{
|
||||
Admin: admin.String(),
|
||||
Address: groupAccountAddr,
|
||||
Address: groupPolicyAddr,
|
||||
NewAdmin: newAdmin.String(),
|
||||
},
|
||||
expGroupAccount: &group.GroupAccountInfo{
|
||||
expGroupPolicy: &group.GroupPolicyInfo{
|
||||
Admin: newAdmin.String(),
|
||||
Address: groupAccountAddr,
|
||||
Address: groupPolicyAddr,
|
||||
GroupId: myGroupID,
|
||||
Metadata: nil,
|
||||
Version: 2,
|
||||
|
@ -855,74 +855,74 @@ func (s *TestSuite) TestUpdateGroupAccountAdmin() {
|
|||
}
|
||||
for msg, spec := range specs {
|
||||
spec := spec
|
||||
err := spec.expGroupAccount.SetDecisionPolicy(policy)
|
||||
err := spec.expGroupPolicy.SetDecisionPolicy(policy)
|
||||
s.Require().NoError(err)
|
||||
|
||||
s.Run(msg, func() {
|
||||
_, err := s.keeper.UpdateGroupAccountAdmin(s.ctx, spec.req)
|
||||
_, err := s.keeper.UpdateGroupPolicyAdmin(s.ctx, spec.req)
|
||||
if spec.expErr {
|
||||
s.Require().Error(err)
|
||||
return
|
||||
}
|
||||
s.Require().NoError(err)
|
||||
res, err := s.keeper.GroupAccountInfo(s.ctx, &group.QueryGroupAccountInfoRequest{
|
||||
Address: groupAccountAddr,
|
||||
res, err := s.keeper.GroupPolicyInfo(s.ctx, &group.QueryGroupPolicyInfoRequest{
|
||||
Address: groupPolicyAddr,
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
s.Assert().Equal(spec.expGroupAccount, res.Info)
|
||||
s.Assert().Equal(spec.expGroupPolicy, res.Info)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestUpdateGroupAccountMetadata() {
|
||||
func (s *TestSuite) TestUpdateGroupPolicyMetadata() {
|
||||
addrs := s.addrs
|
||||
addr1 := addrs[0]
|
||||
addr5 := addrs[4]
|
||||
|
||||
admin := addr1
|
||||
groupAccountAddr, myGroupID, policy := createGroupAndGroupAccount(admin, s)
|
||||
groupPolicyAddr, myGroupID, policy := createGroupAndGroupPolicy(admin, s)
|
||||
|
||||
specs := map[string]struct {
|
||||
req *group.MsgUpdateGroupAccountMetadata
|
||||
expGroupAccount *group.GroupAccountInfo
|
||||
expErr bool
|
||||
req *group.MsgUpdateGroupPolicyMetadata
|
||||
expGroupPolicy *group.GroupPolicyInfo
|
||||
expErr bool
|
||||
}{
|
||||
"with wrong admin": {
|
||||
req: &group.MsgUpdateGroupAccountMetadata{
|
||||
req: &group.MsgUpdateGroupPolicyMetadata{
|
||||
Admin: addr5.String(),
|
||||
Address: groupAccountAddr,
|
||||
Address: groupPolicyAddr,
|
||||
Metadata: []byte("hello"),
|
||||
},
|
||||
expGroupAccount: &group.GroupAccountInfo{},
|
||||
expErr: true,
|
||||
expGroupPolicy: &group.GroupPolicyInfo{},
|
||||
expErr: true,
|
||||
},
|
||||
"with wrong group account": {
|
||||
req: &group.MsgUpdateGroupAccountMetadata{
|
||||
"with wrong group policy": {
|
||||
req: &group.MsgUpdateGroupPolicyMetadata{
|
||||
Admin: admin.String(),
|
||||
Address: addr5.String(),
|
||||
Metadata: []byte("hello"),
|
||||
},
|
||||
expGroupAccount: &group.GroupAccountInfo{},
|
||||
expErr: true,
|
||||
expGroupPolicy: &group.GroupPolicyInfo{},
|
||||
expErr: true,
|
||||
},
|
||||
"with comment too long": {
|
||||
req: &group.MsgUpdateGroupAccountMetadata{
|
||||
req: &group.MsgUpdateGroupPolicyMetadata{
|
||||
Admin: admin.String(),
|
||||
Address: addr5.String(),
|
||||
Metadata: []byte(strings.Repeat("a", 256)),
|
||||
},
|
||||
expGroupAccount: &group.GroupAccountInfo{},
|
||||
expErr: true,
|
||||
expGroupPolicy: &group.GroupPolicyInfo{},
|
||||
expErr: true,
|
||||
},
|
||||
"correct data": {
|
||||
req: &group.MsgUpdateGroupAccountMetadata{
|
||||
req: &group.MsgUpdateGroupPolicyMetadata{
|
||||
Admin: admin.String(),
|
||||
Address: groupAccountAddr,
|
||||
Address: groupPolicyAddr,
|
||||
Metadata: []byte("hello"),
|
||||
},
|
||||
expGroupAccount: &group.GroupAccountInfo{
|
||||
expGroupPolicy: &group.GroupPolicyInfo{
|
||||
Admin: admin.String(),
|
||||
Address: groupAccountAddr,
|
||||
Address: groupPolicyAddr,
|
||||
GroupId: myGroupID,
|
||||
Metadata: []byte("hello"),
|
||||
Version: 2,
|
||||
|
@ -933,69 +933,69 @@ func (s *TestSuite) TestUpdateGroupAccountMetadata() {
|
|||
}
|
||||
for msg, spec := range specs {
|
||||
spec := spec
|
||||
err := spec.expGroupAccount.SetDecisionPolicy(policy)
|
||||
err := spec.expGroupPolicy.SetDecisionPolicy(policy)
|
||||
s.Require().NoError(err)
|
||||
|
||||
s.Run(msg, func() {
|
||||
_, err := s.keeper.UpdateGroupAccountMetadata(s.ctx, spec.req)
|
||||
_, err := s.keeper.UpdateGroupPolicyMetadata(s.ctx, spec.req)
|
||||
if spec.expErr {
|
||||
s.Require().Error(err)
|
||||
return
|
||||
}
|
||||
s.Require().NoError(err)
|
||||
res, err := s.keeper.GroupAccountInfo(s.ctx, &group.QueryGroupAccountInfoRequest{
|
||||
Address: groupAccountAddr,
|
||||
res, err := s.keeper.GroupPolicyInfo(s.ctx, &group.QueryGroupPolicyInfoRequest{
|
||||
Address: groupPolicyAddr,
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
s.Assert().Equal(spec.expGroupAccount, res.Info)
|
||||
s.Assert().Equal(spec.expGroupPolicy, res.Info)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestUpdateGroupAccountDecisionPolicy() {
|
||||
func (s *TestSuite) TestUpdateGroupPolicyDecisionPolicy() {
|
||||
addrs := s.addrs
|
||||
addr1 := addrs[0]
|
||||
addr5 := addrs[4]
|
||||
|
||||
admin := addr1
|
||||
groupAccountAddr, myGroupID, policy := createGroupAndGroupAccount(admin, s)
|
||||
groupPolicyAddr, myGroupID, policy := createGroupAndGroupPolicy(admin, s)
|
||||
|
||||
specs := map[string]struct {
|
||||
req *group.MsgUpdateGroupAccountDecisionPolicy
|
||||
policy group.DecisionPolicy
|
||||
expGroupAccount *group.GroupAccountInfo
|
||||
expErr bool
|
||||
req *group.MsgUpdateGroupPolicyDecisionPolicy
|
||||
policy group.DecisionPolicy
|
||||
expGroupPolicy *group.GroupPolicyInfo
|
||||
expErr bool
|
||||
}{
|
||||
"with wrong admin": {
|
||||
req: &group.MsgUpdateGroupAccountDecisionPolicy{
|
||||
req: &group.MsgUpdateGroupPolicyDecisionPolicy{
|
||||
Admin: addr5.String(),
|
||||
Address: groupAccountAddr,
|
||||
Address: groupPolicyAddr,
|
||||
},
|
||||
policy: policy,
|
||||
expGroupAccount: &group.GroupAccountInfo{},
|
||||
expErr: true,
|
||||
policy: policy,
|
||||
expGroupPolicy: &group.GroupPolicyInfo{},
|
||||
expErr: true,
|
||||
},
|
||||
"with wrong group account": {
|
||||
req: &group.MsgUpdateGroupAccountDecisionPolicy{
|
||||
"with wrong group policy": {
|
||||
req: &group.MsgUpdateGroupPolicyDecisionPolicy{
|
||||
Admin: admin.String(),
|
||||
Address: addr5.String(),
|
||||
},
|
||||
policy: policy,
|
||||
expGroupAccount: &group.GroupAccountInfo{},
|
||||
expErr: true,
|
||||
policy: policy,
|
||||
expGroupPolicy: &group.GroupPolicyInfo{},
|
||||
expErr: true,
|
||||
},
|
||||
"correct data": {
|
||||
req: &group.MsgUpdateGroupAccountDecisionPolicy{
|
||||
req: &group.MsgUpdateGroupPolicyDecisionPolicy{
|
||||
Admin: admin.String(),
|
||||
Address: groupAccountAddr,
|
||||
Address: groupPolicyAddr,
|
||||
},
|
||||
policy: group.NewThresholdDecisionPolicy(
|
||||
"2",
|
||||
time.Duration(2)*time.Second,
|
||||
),
|
||||
expGroupAccount: &group.GroupAccountInfo{
|
||||
expGroupPolicy: &group.GroupPolicyInfo{
|
||||
Admin: admin.String(),
|
||||
Address: groupAccountAddr,
|
||||
Address: groupPolicyAddr,
|
||||
GroupId: myGroupID,
|
||||
Metadata: nil,
|
||||
Version: 2,
|
||||
|
@ -1006,29 +1006,29 @@ func (s *TestSuite) TestUpdateGroupAccountDecisionPolicy() {
|
|||
}
|
||||
for msg, spec := range specs {
|
||||
spec := spec
|
||||
err := spec.expGroupAccount.SetDecisionPolicy(spec.policy)
|
||||
err := spec.expGroupPolicy.SetDecisionPolicy(spec.policy)
|
||||
s.Require().NoError(err)
|
||||
|
||||
err = spec.req.SetDecisionPolicy(spec.policy)
|
||||
s.Require().NoError(err)
|
||||
|
||||
s.Run(msg, func() {
|
||||
_, err := s.keeper.UpdateGroupAccountDecisionPolicy(s.ctx, spec.req)
|
||||
_, err := s.keeper.UpdateGroupPolicyDecisionPolicy(s.ctx, spec.req)
|
||||
if spec.expErr {
|
||||
s.Require().Error(err)
|
||||
return
|
||||
}
|
||||
s.Require().NoError(err)
|
||||
res, err := s.keeper.GroupAccountInfo(s.ctx, &group.QueryGroupAccountInfoRequest{
|
||||
Address: groupAccountAddr,
|
||||
res, err := s.keeper.GroupPolicyInfo(s.ctx, &group.QueryGroupPolicyInfoRequest{
|
||||
Address: groupPolicyAddr,
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
s.Assert().Equal(spec.expGroupAccount, res.Info)
|
||||
s.Assert().Equal(spec.expGroupPolicy, res.Info)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestGroupAccountsByAdminOrGroup() {
|
||||
func (s *TestSuite) TestGroupPoliciesByAdminOrGroup() {
|
||||
addrs := s.addrs
|
||||
addr2 := addrs[1]
|
||||
|
||||
|
@ -1053,19 +1053,19 @@ func (s *TestSuite) TestGroupAccountsByAdminOrGroup() {
|
|||
}
|
||||
|
||||
count := 2
|
||||
expectAccs := make([]*group.GroupAccountInfo, count)
|
||||
expectAccs := make([]*group.GroupPolicyInfo, count)
|
||||
for i := range expectAccs {
|
||||
req := &group.MsgCreateGroupAccount{
|
||||
req := &group.MsgCreateGroupPolicy{
|
||||
Admin: admin.String(),
|
||||
Metadata: nil,
|
||||
GroupId: myGroupID,
|
||||
}
|
||||
err := req.SetDecisionPolicy(policies[i])
|
||||
s.Require().NoError(err)
|
||||
res, err := s.keeper.CreateGroupAccount(s.ctx, req)
|
||||
res, err := s.keeper.CreateGroupPolicy(s.ctx, req)
|
||||
s.Require().NoError(err)
|
||||
|
||||
expectAcc := &group.GroupAccountInfo{
|
||||
expectAcc := &group.GroupPolicyInfo{
|
||||
Address: res.Address,
|
||||
Admin: admin.String(),
|
||||
Metadata: nil,
|
||||
|
@ -1078,40 +1078,40 @@ func (s *TestSuite) TestGroupAccountsByAdminOrGroup() {
|
|||
}
|
||||
sort.Slice(expectAccs, func(i, j int) bool { return expectAccs[i].Address < expectAccs[j].Address })
|
||||
|
||||
// query group account by group
|
||||
accountsByGroupRes, err := s.keeper.GroupAccountsByGroup(s.ctx, &group.QueryGroupAccountsByGroupRequest{
|
||||
// query group policy by group
|
||||
policiesByGroupRes, err := s.keeper.GroupPoliciesByGroup(s.ctx, &group.QueryGroupPoliciesByGroupRequest{
|
||||
GroupId: myGroupID,
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
accounts := accountsByGroupRes.GroupAccounts
|
||||
s.Require().Equal(len(accounts), count)
|
||||
// we reorder accounts by address to be able to compare them
|
||||
sort.Slice(accounts, func(i, j int) bool { return accounts[i].Address < accounts[j].Address })
|
||||
for i := range accounts {
|
||||
s.Assert().Equal(accounts[i].Address, expectAccs[i].Address)
|
||||
s.Assert().Equal(accounts[i].GroupId, expectAccs[i].GroupId)
|
||||
s.Assert().Equal(accounts[i].Admin, expectAccs[i].Admin)
|
||||
s.Assert().Equal(accounts[i].Metadata, expectAccs[i].Metadata)
|
||||
s.Assert().Equal(accounts[i].Version, expectAccs[i].Version)
|
||||
s.Assert().Equal(accounts[i].GetDecisionPolicy(), expectAccs[i].GetDecisionPolicy())
|
||||
policyAccs := policiesByGroupRes.GroupPolicies
|
||||
s.Require().Equal(len(policyAccs), count)
|
||||
// we reorder policyAccs by address to be able to compare them
|
||||
sort.Slice(policyAccs, func(i, j int) bool { return policyAccs[i].Address < policyAccs[j].Address })
|
||||
for i := range policyAccs {
|
||||
s.Assert().Equal(policyAccs[i].Address, expectAccs[i].Address)
|
||||
s.Assert().Equal(policyAccs[i].GroupId, expectAccs[i].GroupId)
|
||||
s.Assert().Equal(policyAccs[i].Admin, expectAccs[i].Admin)
|
||||
s.Assert().Equal(policyAccs[i].Metadata, expectAccs[i].Metadata)
|
||||
s.Assert().Equal(policyAccs[i].Version, expectAccs[i].Version)
|
||||
s.Assert().Equal(policyAccs[i].GetDecisionPolicy(), expectAccs[i].GetDecisionPolicy())
|
||||
}
|
||||
|
||||
// query group account by admin
|
||||
accountsByAdminRes, err := s.keeper.GroupAccountsByAdmin(s.ctx, &group.QueryGroupAccountsByAdminRequest{
|
||||
// query group policy by admin
|
||||
policiesByAdminRes, err := s.keeper.GroupPoliciesByAdmin(s.ctx, &group.QueryGroupPoliciesByAdminRequest{
|
||||
Admin: admin.String(),
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
accounts = accountsByAdminRes.GroupAccounts
|
||||
s.Require().Equal(len(accounts), count)
|
||||
// we reorder accounts by address to be able to compare them
|
||||
sort.Slice(accounts, func(i, j int) bool { return accounts[i].Address < accounts[j].Address })
|
||||
for i := range accounts {
|
||||
s.Assert().Equal(accounts[i].Address, expectAccs[i].Address)
|
||||
s.Assert().Equal(accounts[i].GroupId, expectAccs[i].GroupId)
|
||||
s.Assert().Equal(accounts[i].Admin, expectAccs[i].Admin)
|
||||
s.Assert().Equal(accounts[i].Metadata, expectAccs[i].Metadata)
|
||||
s.Assert().Equal(accounts[i].Version, expectAccs[i].Version)
|
||||
s.Assert().Equal(accounts[i].GetDecisionPolicy(), expectAccs[i].GetDecisionPolicy())
|
||||
policyAccs = policiesByAdminRes.GroupPolicies
|
||||
s.Require().Equal(len(policyAccs), count)
|
||||
// we reorder policyAccs by address to be able to compare them
|
||||
sort.Slice(policyAccs, func(i, j int) bool { return policyAccs[i].Address < policyAccs[j].Address })
|
||||
for i := range policyAccs {
|
||||
s.Assert().Equal(policyAccs[i].Address, expectAccs[i].Address)
|
||||
s.Assert().Equal(policyAccs[i].GroupId, expectAccs[i].GroupId)
|
||||
s.Assert().Equal(policyAccs[i].Admin, expectAccs[i].Admin)
|
||||
s.Assert().Equal(policyAccs[i].Metadata, expectAccs[i].Metadata)
|
||||
s.Assert().Equal(policyAccs[i].Version, expectAccs[i].Version)
|
||||
s.Assert().Equal(policyAccs[i].GetDecisionPolicy(), expectAccs[i].GetDecisionPolicy())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1123,15 +1123,15 @@ func (s *TestSuite) TestCreateProposal() {
|
|||
addr5 := addrs[4]
|
||||
|
||||
myGroupID := s.groupID
|
||||
accountAddr := s.groupAccountAddr
|
||||
accountAddr := s.groupPolicyAddr
|
||||
|
||||
msgSend := &banktypes.MsgSend{
|
||||
FromAddress: s.groupAccountAddr.String(),
|
||||
FromAddress: s.groupPolicyAddr.String(),
|
||||
ToAddress: addr2.String(),
|
||||
Amount: sdk.Coins{sdk.NewInt64Coin("test", 100)},
|
||||
}
|
||||
|
||||
accountReq := &group.MsgCreateGroupAccount{
|
||||
policyReq := &group.MsgCreateGroupPolicy{
|
||||
Admin: addr1.String(),
|
||||
GroupId: myGroupID,
|
||||
Metadata: nil,
|
||||
|
@ -1140,9 +1140,9 @@ func (s *TestSuite) TestCreateProposal() {
|
|||
"100",
|
||||
time.Second,
|
||||
)
|
||||
err := accountReq.SetDecisionPolicy(policy)
|
||||
err := policyReq.SetDecisionPolicy(policy)
|
||||
s.Require().NoError(err)
|
||||
bigThresholdRes, err := s.keeper.CreateGroupAccount(s.ctx, accountReq)
|
||||
bigThresholdRes, err := s.keeper.CreateGroupPolicy(s.ctx, policyReq)
|
||||
s.Require().NoError(err)
|
||||
bigThresholdAddr := bigThresholdRes.Address
|
||||
|
||||
|
@ -1194,7 +1194,7 @@ func (s *TestSuite) TestCreateProposal() {
|
|||
expErr: true,
|
||||
postRun: func(sdkCtx sdk.Context) {},
|
||||
},
|
||||
"group account required": {
|
||||
"group policy required": {
|
||||
req: &group.MsgCreateProposal{
|
||||
Metadata: nil,
|
||||
Proposers: []string{addr2.String()},
|
||||
|
@ -1202,7 +1202,7 @@ func (s *TestSuite) TestCreateProposal() {
|
|||
expErr: true,
|
||||
postRun: func(sdkCtx sdk.Context) {},
|
||||
},
|
||||
"existing group account required": {
|
||||
"existing group policy required": {
|
||||
req: &group.MsgCreateProposal{
|
||||
Address: addr1.String(),
|
||||
Proposers: []string{addr2.String()},
|
||||
|
@ -1243,7 +1243,7 @@ func (s *TestSuite) TestCreateProposal() {
|
|||
expErr: true,
|
||||
postRun: func(sdkCtx sdk.Context) {},
|
||||
},
|
||||
"reject msgs that are not authz by group account": {
|
||||
"reject msgs that are not authz by group policy": {
|
||||
req: &group.MsgCreateProposal{
|
||||
Address: accountAddr.String(),
|
||||
Metadata: nil,
|
||||
|
@ -1323,7 +1323,7 @@ func (s *TestSuite) TestCreateProposal() {
|
|||
s.Assert().Equal(spec.req.Proposers, proposal.Proposers)
|
||||
s.Assert().Equal(s.blockTime, proposal.SubmittedAt)
|
||||
s.Assert().Equal(uint64(1), proposal.GroupVersion)
|
||||
s.Assert().Equal(uint64(1), proposal.GroupAccountVersion)
|
||||
s.Assert().Equal(uint64(1), proposal.GroupPolicyVersion)
|
||||
s.Assert().Equal(spec.expProposal.Status, proposal.Status)
|
||||
s.Assert().Equal(spec.expProposal.Result, proposal.Result)
|
||||
s.Assert().Equal(spec.expProposal.VoteState, proposal.VoteState)
|
||||
|
@ -1364,21 +1364,21 @@ func (s *TestSuite) TestVote() {
|
|||
"2",
|
||||
time.Duration(2),
|
||||
)
|
||||
accountReq := &group.MsgCreateGroupAccount{
|
||||
policyReq := &group.MsgCreateGroupPolicy{
|
||||
Admin: addr1.String(),
|
||||
GroupId: myGroupID,
|
||||
Metadata: nil,
|
||||
}
|
||||
err = accountReq.SetDecisionPolicy(policy)
|
||||
err = policyReq.SetDecisionPolicy(policy)
|
||||
s.Require().NoError(err)
|
||||
accountRes, err := s.keeper.CreateGroupAccount(s.ctx, accountReq)
|
||||
policyRes, err := s.keeper.CreateGroupPolicy(s.ctx, policyReq)
|
||||
s.Require().NoError(err)
|
||||
accountAddr := accountRes.Address
|
||||
groupAccount, err := sdk.AccAddressFromBech32(accountAddr)
|
||||
accountAddr := policyRes.Address
|
||||
groupPolicy, err := sdk.AccAddressFromBech32(accountAddr)
|
||||
s.Require().NoError(err)
|
||||
s.Require().NotNil(groupAccount)
|
||||
s.Require().NotNil(groupPolicy)
|
||||
|
||||
s.Require().NoError(testutil.FundAccount(s.app.BankKeeper, s.sdkCtx, groupAccount, sdk.Coins{sdk.NewInt64Coin("test", 10000)}))
|
||||
s.Require().NoError(testutil.FundAccount(s.app.BankKeeper, s.sdkCtx, groupPolicy, sdk.Coins{sdk.NewInt64Coin("test", 10000)}))
|
||||
|
||||
req := &group.MsgCreateProposal{
|
||||
Address: accountAddr,
|
||||
|
@ -1397,8 +1397,8 @@ func (s *TestSuite) TestVote() {
|
|||
s.Require().NoError(err)
|
||||
myProposalID := proposalRes.ProposalId
|
||||
|
||||
// proposals by group account
|
||||
proposalsRes, err := s.keeper.ProposalsByGroupAccount(s.ctx, &group.QueryProposalsByGroupAccountRequest{
|
||||
// proposals by group policy
|
||||
proposalsRes, err := s.keeper.ProposalsByGroupPolicy(s.ctx, &group.QueryProposalsByGroupPolicyRequest{
|
||||
Address: accountAddr,
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
|
@ -1410,7 +1410,7 @@ func (s *TestSuite) TestVote() {
|
|||
s.Assert().Equal(s.blockTime, proposals[0].SubmittedAt)
|
||||
|
||||
s.Assert().Equal(uint64(1), proposals[0].GroupVersion)
|
||||
s.Assert().Equal(uint64(1), proposals[0].GroupAccountVersion)
|
||||
s.Assert().Equal(uint64(1), proposals[0].GroupPolicyVersion)
|
||||
s.Assert().Equal(group.ProposalStatusSubmitted, proposals[0].Status)
|
||||
s.Assert().Equal(group.ProposalResultUnfinalized, proposals[0].Result)
|
||||
s.Assert().Equal(group.Tally{
|
||||
|
@ -1465,7 +1465,7 @@ func (s *TestSuite) TestVote() {
|
|||
expResult: group.ProposalResultAccepted,
|
||||
expExecutorResult: group.ProposalExecutorResultSuccess,
|
||||
postRun: func(sdkCtx sdk.Context) {
|
||||
fromBalances := s.app.BankKeeper.GetAllBalances(sdkCtx, groupAccount)
|
||||
fromBalances := s.app.BankKeeper.GetAllBalances(sdkCtx, groupPolicy)
|
||||
s.Require().Contains(fromBalances, sdk.NewInt64Coin("test", 9900))
|
||||
toBalances := s.app.BankKeeper.GetAllBalances(sdkCtx, addr5)
|
||||
s.Require().Contains(toBalances, sdk.NewInt64Coin("test", 100))
|
||||
|
@ -1696,9 +1696,9 @@ func (s *TestSuite) TestVote() {
|
|||
Choice: group.Choice_CHOICE_NO,
|
||||
},
|
||||
doBefore: func(ctx context.Context) {
|
||||
m, err := group.NewMsgUpdateGroupAccountDecisionPolicyRequest(
|
||||
m, err := group.NewMsgUpdateGroupPolicyDecisionPolicyRequest(
|
||||
addr1,
|
||||
groupAccount,
|
||||
groupPolicy,
|
||||
&group.ThresholdDecisionPolicy{
|
||||
Threshold: "1",
|
||||
Timeout: time.Second,
|
||||
|
@ -1706,7 +1706,7 @@ func (s *TestSuite) TestVote() {
|
|||
)
|
||||
s.Require().NoError(err)
|
||||
|
||||
_, err = s.keeper.UpdateGroupAccountDecisionPolicy(ctx, m)
|
||||
_, err = s.keeper.UpdateGroupPolicyDecisionPolicy(ctx, m)
|
||||
s.Require().NoError(err)
|
||||
},
|
||||
expErr: true,
|
||||
|
@ -1797,12 +1797,12 @@ func (s *TestSuite) TestExecProposal() {
|
|||
addr2 := addrs[1]
|
||||
|
||||
msgSend1 := &banktypes.MsgSend{
|
||||
FromAddress: s.groupAccountAddr.String(),
|
||||
FromAddress: s.groupPolicyAddr.String(),
|
||||
ToAddress: addr2.String(),
|
||||
Amount: sdk.Coins{sdk.NewInt64Coin("test", 100)},
|
||||
}
|
||||
msgSend2 := &banktypes.MsgSend{
|
||||
FromAddress: s.groupAccountAddr.String(),
|
||||
FromAddress: s.groupPolicyAddr.String(),
|
||||
ToAddress: addr2.String(),
|
||||
Amount: sdk.Coins{sdk.NewInt64Coin("test", 10001)},
|
||||
}
|
||||
|
@ -1903,13 +1903,13 @@ func (s *TestSuite) TestExecProposal() {
|
|||
expProposalResult: group.ProposalResultUnfinalized,
|
||||
expExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
},
|
||||
"with group account modified before tally": {
|
||||
"with group policy modified before tally": {
|
||||
setupProposal: func(ctx context.Context) uint64 {
|
||||
myProposalID := createProposal(ctx, s, []sdk.Msg{msgSend1}, proposers)
|
||||
_, err := s.keeper.UpdateGroupAccountMetadata(ctx, &group.MsgUpdateGroupAccountMetadata{
|
||||
_, err := s.keeper.UpdateGroupPolicyMetadata(ctx, &group.MsgUpdateGroupPolicyMetadata{
|
||||
Admin: addr1.String(),
|
||||
Address: s.groupAccountAddr.String(),
|
||||
Metadata: []byte("group account modified before tally"),
|
||||
Address: s.groupPolicyAddr.String(),
|
||||
Metadata: []byte("group policy modified before tally"),
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
return myProposalID
|
||||
|
@ -1950,7 +1950,7 @@ func (s *TestSuite) TestExecProposal() {
|
|||
_, err := s.keeper.Exec(ctx, &group.MsgExec{Signer: addr1.String(), ProposalId: myProposalID})
|
||||
s.Require().NoError(err)
|
||||
sdkCtx := sdk.UnwrapSDKContext(ctx)
|
||||
s.Require().NoError(testutil.FundAccount(s.app.BankKeeper, sdkCtx, s.groupAccountAddr, sdk.Coins{sdk.NewInt64Coin("test", 10002)}))
|
||||
s.Require().NoError(testutil.FundAccount(s.app.BankKeeper, sdkCtx, s.groupPolicyAddr, sdk.Coins{sdk.NewInt64Coin("test", 10002)}))
|
||||
|
||||
return myProposalID
|
||||
},
|
||||
|
@ -1996,7 +1996,7 @@ func (s *TestSuite) TestExecProposal() {
|
|||
s.Assert().Equal(exp, got)
|
||||
|
||||
if spec.expBalance {
|
||||
fromBalances := s.app.BankKeeper.GetAllBalances(sdkCtx, s.groupAccountAddr)
|
||||
fromBalances := s.app.BankKeeper.GetAllBalances(sdkCtx, s.groupPolicyAddr)
|
||||
s.Require().Contains(fromBalances, spec.expFromBalances)
|
||||
toBalances := s.app.BankKeeper.GetAllBalances(sdkCtx, addr2)
|
||||
s.Require().Contains(toBalances, spec.expToBalances)
|
||||
|
@ -2009,7 +2009,7 @@ func createProposal(
|
|||
ctx context.Context, s *TestSuite, msgs []sdk.Msg,
|
||||
proposers []string) uint64 {
|
||||
proposalReq := &group.MsgCreateProposal{
|
||||
Address: s.groupAccountAddr.String(),
|
||||
Address: s.groupPolicyAddr.String(),
|
||||
Proposers: proposers,
|
||||
Metadata: nil,
|
||||
}
|
||||
|
@ -2036,7 +2036,7 @@ func createProposalAndVote(
|
|||
return myProposalID
|
||||
}
|
||||
|
||||
func createGroupAndGroupAccount(
|
||||
func createGroupAndGroupPolicy(
|
||||
admin sdk.AccAddress,
|
||||
s *TestSuite,
|
||||
) (string, uint64, group.DecisionPolicy) {
|
||||
|
@ -2048,7 +2048,7 @@ func createGroupAndGroupAccount(
|
|||
s.Require().NoError(err)
|
||||
|
||||
myGroupID := groupRes.GroupId
|
||||
groupAccount := &group.MsgCreateGroupAccount{
|
||||
groupPolicy := &group.MsgCreateGroupPolicy{
|
||||
Admin: admin.String(),
|
||||
GroupId: myGroupID,
|
||||
Metadata: nil,
|
||||
|
@ -2058,11 +2058,11 @@ func createGroupAndGroupAccount(
|
|||
"1",
|
||||
time.Second,
|
||||
)
|
||||
err = groupAccount.SetDecisionPolicy(policy)
|
||||
err = groupPolicy.SetDecisionPolicy(policy)
|
||||
s.Require().NoError(err)
|
||||
|
||||
groupAccountRes, err := s.keeper.CreateGroupAccount(s.ctx, groupAccount)
|
||||
groupPolicyRes, err := s.keeper.CreateGroupPolicy(s.ctx, groupPolicy)
|
||||
s.Require().NoError(err)
|
||||
|
||||
return groupAccountRes.Address, myGroupID, policy
|
||||
return groupPolicyRes.Address, myGroupID, policy
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ func (k Keeper) UpdateGroupMetadata(goCtx context.Context, req *group.MsgUpdateG
|
|||
return &group.MsgUpdateGroupMetadataResponse{}, nil
|
||||
}
|
||||
|
||||
func (k Keeper) CreateGroupAccount(goCtx context.Context, req *group.MsgCreateGroupAccount) (*group.MsgCreateGroupAccountResponse, error) {
|
||||
func (k Keeper) CreateGroupPolicy(goCtx context.Context, req *group.MsgCreateGroupPolicy) (*group.MsgCreateGroupPolicyResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
admin, err := sdk.AccAddressFromBech32(req.GetAdmin())
|
||||
if err != nil {
|
||||
|
@ -241,7 +241,7 @@ func (k Keeper) CreateGroupAccount(goCtx context.Context, req *group.MsgCreateGr
|
|||
groupID := req.GetGroupID()
|
||||
metadata := req.GetMetadata()
|
||||
|
||||
if err := assertMetadataLength(metadata, "group account metadata"); err != nil {
|
||||
if err := assertMetadataLength(metadata, "group policy metadata"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -253,20 +253,20 @@ func (k Keeper) CreateGroupAccount(goCtx context.Context, req *group.MsgCreateGr
|
|||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "group admin")
|
||||
}
|
||||
// Only current group admin is authorized to create a group account for this
|
||||
// Only current group admin is authorized to create a group policy for this
|
||||
if !groupAdmin.Equals(admin) {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "not group admin")
|
||||
}
|
||||
|
||||
// Generate group account address.
|
||||
// Generate account address of group policy.
|
||||
var accountAddr sdk.AccAddress
|
||||
// loop here in the rare case of a collision
|
||||
for {
|
||||
nextAccVal := k.groupAccountSeq.NextVal(ctx.KVStore(k.key))
|
||||
nextAccVal := k.groupPolicySeq.NextVal(ctx.KVStore(k.key))
|
||||
var buf = make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(buf, nextAccVal)
|
||||
|
||||
parentAcc := address.Module(group.ModuleName, []byte{GroupAccountTablePrefix})
|
||||
parentAcc := address.Module(group.ModuleName, []byte{GroupPolicyTablePrefix})
|
||||
accountAddr = address.Derive(parentAcc, buf)
|
||||
|
||||
if k.accKeeper.GetAccount(ctx, accountAddr) != nil {
|
||||
|
@ -284,7 +284,7 @@ func (k Keeper) CreateGroupAccount(goCtx context.Context, req *group.MsgCreateGr
|
|||
break
|
||||
}
|
||||
|
||||
groupAccount, err := group.NewGroupAccountInfo(
|
||||
groupPolicy, err := group.NewGroupPolicyInfo(
|
||||
accountAddr,
|
||||
groupID,
|
||||
admin,
|
||||
|
@ -296,83 +296,83 @@ func (k Keeper) CreateGroupAccount(goCtx context.Context, req *group.MsgCreateGr
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if err := k.groupAccountTable.Create(ctx.KVStore(k.key), &groupAccount); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "could not create group account")
|
||||
if err := k.groupPolicyTable.Create(ctx.KVStore(k.key), &groupPolicy); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "could not create group policy")
|
||||
}
|
||||
|
||||
err = ctx.EventManager().EmitTypedEvent(&group.EventCreateGroupAccount{Address: accountAddr.String()})
|
||||
err = ctx.EventManager().EmitTypedEvent(&group.EventCreateGroupPolicy{Address: accountAddr.String()})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &group.MsgCreateGroupAccountResponse{Address: accountAddr.String()}, nil
|
||||
return &group.MsgCreateGroupPolicyResponse{Address: accountAddr.String()}, nil
|
||||
}
|
||||
|
||||
func (k Keeper) UpdateGroupAccountAdmin(goCtx context.Context, req *group.MsgUpdateGroupAccountAdmin) (*group.MsgUpdateGroupAccountAdminResponse, error) {
|
||||
func (k Keeper) UpdateGroupPolicyAdmin(goCtx context.Context, req *group.MsgUpdateGroupPolicyAdmin) (*group.MsgUpdateGroupPolicyAdminResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
action := func(groupAccount *group.GroupAccountInfo) error {
|
||||
groupAccount.Admin = req.NewAdmin
|
||||
groupAccount.Version++
|
||||
return k.groupAccountTable.Update(ctx.KVStore(k.key), groupAccount)
|
||||
action := func(groupPolicy *group.GroupPolicyInfo) error {
|
||||
groupPolicy.Admin = req.NewAdmin
|
||||
groupPolicy.Version++
|
||||
return k.groupPolicyTable.Update(ctx.KVStore(k.key), groupPolicy)
|
||||
}
|
||||
|
||||
err := k.doUpdateGroupAccount(ctx, req.Address, req.Admin, action, "group account admin updated")
|
||||
err := k.doUpdateGroupPolicy(ctx, req.Address, req.Admin, action, "group policy admin updated")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &group.MsgUpdateGroupAccountAdminResponse{}, nil
|
||||
return &group.MsgUpdateGroupPolicyAdminResponse{}, nil
|
||||
}
|
||||
|
||||
func (k Keeper) UpdateGroupAccountDecisionPolicy(goCtx context.Context, req *group.MsgUpdateGroupAccountDecisionPolicy) (*group.MsgUpdateGroupAccountDecisionPolicyResponse, error) {
|
||||
func (k Keeper) UpdateGroupPolicyDecisionPolicy(goCtx context.Context, req *group.MsgUpdateGroupPolicyDecisionPolicy) (*group.MsgUpdateGroupPolicyDecisionPolicyResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
policy := req.GetDecisionPolicy()
|
||||
|
||||
action := func(groupAccount *group.GroupAccountInfo) error {
|
||||
err := groupAccount.SetDecisionPolicy(policy)
|
||||
action := func(groupPolicy *group.GroupPolicyInfo) error {
|
||||
err := groupPolicy.SetDecisionPolicy(policy)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
groupAccount.Version++
|
||||
return k.groupAccountTable.Update(ctx.KVStore(k.key), groupAccount)
|
||||
groupPolicy.Version++
|
||||
return k.groupPolicyTable.Update(ctx.KVStore(k.key), groupPolicy)
|
||||
}
|
||||
|
||||
err := k.doUpdateGroupAccount(ctx, req.Address, req.Admin, action, "group account decision policy updated")
|
||||
err := k.doUpdateGroupPolicy(ctx, req.Address, req.Admin, action, "group policy's decision policy updated")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &group.MsgUpdateGroupAccountDecisionPolicyResponse{}, nil
|
||||
return &group.MsgUpdateGroupPolicyDecisionPolicyResponse{}, nil
|
||||
}
|
||||
|
||||
func (k Keeper) UpdateGroupAccountMetadata(goCtx context.Context, req *group.MsgUpdateGroupAccountMetadata) (*group.MsgUpdateGroupAccountMetadataResponse, error) {
|
||||
func (k Keeper) UpdateGroupPolicyMetadata(goCtx context.Context, req *group.MsgUpdateGroupPolicyMetadata) (*group.MsgUpdateGroupPolicyMetadataResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
metadata := req.GetMetadata()
|
||||
|
||||
action := func(groupAccount *group.GroupAccountInfo) error {
|
||||
groupAccount.Metadata = metadata
|
||||
groupAccount.Version++
|
||||
return k.groupAccountTable.Update(ctx.KVStore(k.key), groupAccount)
|
||||
action := func(groupPolicy *group.GroupPolicyInfo) error {
|
||||
groupPolicy.Metadata = metadata
|
||||
groupPolicy.Version++
|
||||
return k.groupPolicyTable.Update(ctx.KVStore(k.key), groupPolicy)
|
||||
}
|
||||
|
||||
if err := assertMetadataLength(metadata, "group account metadata"); err != nil {
|
||||
if err := assertMetadataLength(metadata, "group policy metadata"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err := k.doUpdateGroupAccount(ctx, req.Address, req.Admin, action, "group account metadata updated")
|
||||
err := k.doUpdateGroupPolicy(ctx, req.Address, req.Admin, action, "group policy metadata updated")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &group.MsgUpdateGroupAccountMetadataResponse{}, nil
|
||||
return &group.MsgUpdateGroupPolicyMetadataResponse{}, nil
|
||||
}
|
||||
|
||||
func (k Keeper) CreateProposal(goCtx context.Context, req *group.MsgCreateProposal) (*group.MsgCreateProposalResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
accountAddress, err := sdk.AccAddressFromBech32(req.Address)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "request group account")
|
||||
return nil, sdkerrors.Wrap(err, "request account address of group policy")
|
||||
}
|
||||
metadata := req.Metadata
|
||||
proposers := req.Proposers
|
||||
|
@ -382,14 +382,14 @@ func (k Keeper) CreateProposal(goCtx context.Context, req *group.MsgCreatePropos
|
|||
return nil, err
|
||||
}
|
||||
|
||||
account, err := k.getGroupAccountInfo(ctx, req.Address)
|
||||
policyAcc, err := k.getGroupPolicyInfo(ctx, req.Address)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "load group account")
|
||||
return nil, sdkerrors.Wrap(err, "load group policy")
|
||||
}
|
||||
|
||||
g, err := k.getGroupInfo(ctx, account.GroupId)
|
||||
g, err := k.getGroupInfo(ctx, policyAcc.GroupId)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "get group by account")
|
||||
return nil, sdkerrors.Wrap(err, "get group by groupId of group policy")
|
||||
}
|
||||
|
||||
// Only members of the group can submit a new proposal.
|
||||
|
@ -399,12 +399,12 @@ func (k Keeper) CreateProposal(goCtx context.Context, req *group.MsgCreatePropos
|
|||
}
|
||||
}
|
||||
|
||||
// Check that if the messages require signers, they are all equal to the given group account.
|
||||
// Check that if the messages require signers, they are all equal to the given account address of group policy.
|
||||
if err := ensureMsgAuthZ(msgs, accountAddress); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
policy := account.GetDecisionPolicy()
|
||||
policy := policyAcc.GetDecisionPolicy()
|
||||
if policy == nil {
|
||||
return nil, sdkerrors.Wrap(errors.ErrEmpty, "nil policy")
|
||||
}
|
||||
|
@ -421,17 +421,17 @@ func (k Keeper) CreateProposal(goCtx context.Context, req *group.MsgCreatePropos
|
|||
window := timeout
|
||||
|
||||
m := &group.Proposal{
|
||||
ProposalId: k.proposalTable.Sequence().PeekNextVal(ctx.KVStore(k.key)),
|
||||
Address: req.Address,
|
||||
Metadata: metadata,
|
||||
Proposers: proposers,
|
||||
SubmittedAt: ctx.BlockTime(),
|
||||
GroupVersion: g.Version,
|
||||
GroupAccountVersion: account.Version,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
Timeout: ctx.BlockTime().Add(window),
|
||||
ProposalId: k.proposalTable.Sequence().PeekNextVal(ctx.KVStore(k.key)),
|
||||
Address: req.Address,
|
||||
Metadata: metadata,
|
||||
Proposers: proposers,
|
||||
SubmittedAt: ctx.BlockTime(),
|
||||
GroupVersion: g.Version,
|
||||
GroupPolicyVersion: policyAcc.Version,
|
||||
Result: group.ProposalResultUnfinalized,
|
||||
Status: group.ProposalStatusSubmitted,
|
||||
ExecutorResult: group.ProposalExecutorResultNotRun,
|
||||
Timeout: ctx.BlockTime().Add(window),
|
||||
VoteState: group.Tally{
|
||||
YesCount: "0",
|
||||
NoCount: "0",
|
||||
|
@ -471,7 +471,7 @@ func (k Keeper) CreateProposal(goCtx context.Context, req *group.MsgCreatePropos
|
|||
_, err = k.Exec(sdk.WrapSDKContext(ctx), &group.MsgExec{
|
||||
ProposalId: id,
|
||||
// We consider the first proposer as the MsgExecRequest signer
|
||||
// but that could be revisited (eg using the group account)
|
||||
// but that could be revisited (eg using the group policy)
|
||||
Signer: proposers[0],
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -512,18 +512,18 @@ func (k Keeper) Vote(goCtx context.Context, req *group.MsgVote) (*group.MsgVoteR
|
|||
return nil, sdkerrors.Wrap(errors.ErrExpired, "voting period has ended already")
|
||||
}
|
||||
|
||||
var accountInfo group.GroupAccountInfo
|
||||
var policyInfo group.GroupPolicyInfo
|
||||
|
||||
// Ensure that group account hasn't been modified since the proposal submission.
|
||||
if accountInfo, err = k.getGroupAccountInfo(ctx, proposal.Address); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "load group account")
|
||||
// Ensure that group policy hasn't been modified since the proposal submission.
|
||||
if policyInfo, err = k.getGroupPolicyInfo(ctx, proposal.Address); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "load group policy")
|
||||
}
|
||||
if proposal.GroupAccountVersion != accountInfo.Version {
|
||||
return nil, sdkerrors.Wrap(errors.ErrModified, "group account was modified")
|
||||
if proposal.GroupPolicyVersion != policyInfo.Version {
|
||||
return nil, sdkerrors.Wrap(errors.ErrModified, "group policy was modified")
|
||||
}
|
||||
|
||||
// Ensure that group hasn't been modified since the proposal submission.
|
||||
electorate, err := k.getGroupInfo(ctx, accountInfo.GroupId)
|
||||
electorate, err := k.getGroupInfo(ctx, policyInfo.GroupId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ func (k Keeper) Vote(goCtx context.Context, req *group.MsgVote) (*group.MsgVoteR
|
|||
}
|
||||
|
||||
// Run tally with new votes to close early.
|
||||
if err := doTally(ctx, &proposal, electorate, accountInfo); err != nil {
|
||||
if err := doTally(ctx, &proposal, electorate, policyInfo); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -582,9 +582,9 @@ func (k Keeper) Vote(goCtx context.Context, req *group.MsgVote) (*group.MsgVoteR
|
|||
return &group.MsgVoteResponse{}, nil
|
||||
}
|
||||
|
||||
// doTally updates the proposal status and tally if necessary based on the group account's decision policy.
|
||||
func doTally(ctx sdk.Context, p *group.Proposal, electorate group.GroupInfo, accountInfo group.GroupAccountInfo) error {
|
||||
policy := accountInfo.GetDecisionPolicy()
|
||||
// doTally updates the proposal status and tally if necessary based on the group policy's decision policy.
|
||||
func doTally(ctx sdk.Context, p *group.Proposal, electorate group.GroupInfo, policyInfo group.GroupPolicyInfo) error {
|
||||
policy := policyInfo.GetDecisionPolicy()
|
||||
pSubmittedAt, err := gogotypes.TimestampProto(p.SubmittedAt)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -620,9 +620,9 @@ func (k Keeper) Exec(goCtx context.Context, req *group.MsgExec) (*group.MsgExecR
|
|||
return nil, sdkerrors.Wrapf(errors.ErrInvalid, "not possible with proposal status %s", proposal.Status.String())
|
||||
}
|
||||
|
||||
var accountInfo group.GroupAccountInfo
|
||||
if accountInfo, err = k.getGroupAccountInfo(ctx, proposal.Address); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "load group account")
|
||||
var policyInfo group.GroupPolicyInfo
|
||||
if policyInfo, err = k.getGroupPolicyInfo(ctx, proposal.Address); err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "load group policy")
|
||||
}
|
||||
|
||||
storeUpdates := func() (*group.MsgExecResponse, error) {
|
||||
|
@ -633,14 +633,14 @@ func (k Keeper) Exec(goCtx context.Context, req *group.MsgExec) (*group.MsgExecR
|
|||
}
|
||||
|
||||
if proposal.Status == group.ProposalStatusSubmitted {
|
||||
// Ensure that group account hasn't been modified before tally.
|
||||
if proposal.GroupAccountVersion != accountInfo.Version {
|
||||
// Ensure that group policy hasn't been modified before tally.
|
||||
if proposal.GroupPolicyVersion != policyInfo.Version {
|
||||
proposal.Result = group.ProposalResultUnfinalized
|
||||
proposal.Status = group.ProposalStatusAborted
|
||||
return storeUpdates()
|
||||
}
|
||||
|
||||
electorate, err := k.getGroupInfo(ctx, accountInfo.GroupId)
|
||||
electorate, err := k.getGroupInfo(ctx, policyInfo.GroupId)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(err, "load group")
|
||||
}
|
||||
|
@ -651,7 +651,7 @@ func (k Keeper) Exec(goCtx context.Context, req *group.MsgExec) (*group.MsgExecR
|
|||
proposal.Status = group.ProposalStatusAborted
|
||||
return storeUpdates()
|
||||
}
|
||||
if err := doTally(ctx, &proposal, electorate, accountInfo); err != nil {
|
||||
if err := doTally(ctx, &proposal, electorate, policyInfo); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ func (k Keeper) Exec(goCtx context.Context, req *group.MsgExec) (*group.MsgExecR
|
|||
// Caching context so that we don't update the store in case of failure.
|
||||
ctx, flush := ctx.CacheContext()
|
||||
|
||||
addr, err := sdk.AccAddressFromBech32(accountInfo.Address)
|
||||
addr, err := sdk.AccAddressFromBech32(policyInfo.Address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -697,31 +697,31 @@ type authNGroupReq interface {
|
|||
}
|
||||
|
||||
type actionFn func(m *group.GroupInfo) error
|
||||
type groupAccountActionFn func(m *group.GroupAccountInfo) error
|
||||
type groupPolicyActionFn func(m *group.GroupPolicyInfo) error
|
||||
|
||||
// doUpdateGroupAccount first makes sure that the group account admin initiated the group account update,
|
||||
// before performing the group account update and emitting an event.
|
||||
func (k Keeper) doUpdateGroupAccount(ctx sdk.Context, groupAccount string, admin string, action groupAccountActionFn, note string) error {
|
||||
groupAccountInfo, err := k.getGroupAccountInfo(ctx, groupAccount)
|
||||
// doUpdateGroupPolicy first makes sure that the group policy admin initiated the group policy update,
|
||||
// before performing the group policy update and emitting an event.
|
||||
func (k Keeper) doUpdateGroupPolicy(ctx sdk.Context, groupPolicy string, admin string, action groupPolicyActionFn, note string) error {
|
||||
groupPolicyInfo, err := k.getGroupPolicyInfo(ctx, groupPolicy)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "load group account")
|
||||
return sdkerrors.Wrap(err, "load group policy")
|
||||
}
|
||||
|
||||
groupAccountAdmin, err := sdk.AccAddressFromBech32(admin)
|
||||
groupPolicyAdmin, err := sdk.AccAddressFromBech32(admin)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "group account admin")
|
||||
return sdkerrors.Wrap(err, "group policy admin")
|
||||
}
|
||||
|
||||
// Only current group account admin is authorized to update a group account.
|
||||
if groupAccountAdmin.String() != groupAccountInfo.Admin {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "not group account admin")
|
||||
// Only current group policy admin is authorized to update a group policy.
|
||||
if groupPolicyAdmin.String() != groupPolicyInfo.Admin {
|
||||
return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "not group policy admin")
|
||||
}
|
||||
|
||||
if err := action(&groupAccountInfo); err != nil {
|
||||
if err := action(&groupPolicyInfo); err != nil {
|
||||
return sdkerrors.Wrap(err, note)
|
||||
}
|
||||
|
||||
err = ctx.EventManager().EmitTypedEvent(&group.EventUpdateGroupAccount{Address: admin})
|
||||
err = ctx.EventManager().EmitTypedEvent(&group.EventUpdateGroupPolicy{Address: admin})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@ import (
|
|||
)
|
||||
|
||||
// doExecuteMsgs routes the messages to the registered handlers. Messages are limited to those that require no authZ or
|
||||
// by the group account only. Otherwise this gives access to other peoples accounts as the sdk ant handler is bypassed
|
||||
func (s Keeper) doExecuteMsgs(ctx sdk.Context, router *authmiddleware.MsgServiceRouter, proposal group.Proposal, groupAccount sdk.AccAddress) ([]sdk.Result, error) {
|
||||
// by the account of group policy only. Otherwise this gives access to other peoples accounts as the sdk ant handler is bypassed
|
||||
func (s Keeper) doExecuteMsgs(ctx sdk.Context, router *authmiddleware.MsgServiceRouter, proposal group.Proposal, groupPolicyAcc sdk.AccAddress) ([]sdk.Result, error) {
|
||||
msgs := proposal.GetMsgs()
|
||||
|
||||
results := make([]sdk.Result, len(msgs))
|
||||
if err := ensureMsgAuthZ(msgs, groupAccount); err != nil {
|
||||
if err := ensureMsgAuthZ(msgs, groupPolicyAcc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for i, msg := range msgs {
|
||||
|
@ -33,12 +33,12 @@ func (s Keeper) doExecuteMsgs(ctx sdk.Context, router *authmiddleware.MsgService
|
|||
return results, nil
|
||||
}
|
||||
|
||||
// ensureMsgAuthZ checks that if a message requires signers that all of them are equal to the given group account.
|
||||
func ensureMsgAuthZ(msgs []sdk.Msg, groupAccount sdk.AccAddress) error {
|
||||
// ensureMsgAuthZ checks that if a message requires signers that all of them are equal to the given account address of group policy.
|
||||
func ensureMsgAuthZ(msgs []sdk.Msg, groupPolicyAcc sdk.AccAddress) error {
|
||||
for i := range msgs {
|
||||
for _, acct := range msgs[i].GetSigners() {
|
||||
if !groupAccount.Equals(acct) {
|
||||
return errors.Wrap(errors.ErrUnauthorized, "msg does not have group account authorization")
|
||||
if !groupPolicyAcc.Equals(acct) {
|
||||
return errors.Wrap(errors.ErrUnauthorized, "msg does not have group policy authorization")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
122
x/group/msgs.go
122
x/group/msgs.go
|
@ -15,17 +15,17 @@ import (
|
|||
|
||||
// Group message types and routes
|
||||
const (
|
||||
TypeMsgCreateGroup = "create_group"
|
||||
TypeMsgUpdateGroupAdmin = "update_group_admin"
|
||||
TypeMsgUpdateGroupComment = "update_group_comment"
|
||||
TypeMsgUpdateGroupMembers = "update_group_members"
|
||||
TypeMsgCreateGroupAccount = "create_group_account"
|
||||
TypeMsgUpdateGroupAccountAdmin = "update_group_account_admin"
|
||||
TypeMsgUpdateGroupAccountDecisionPolicy = "update_group_account_decision_policy"
|
||||
TypeMsgUpdateGroupAccountComment = "update_group_account_comment"
|
||||
TypeMsgCreateProposal = "create_proposal"
|
||||
TypeMsgVote = "vote"
|
||||
TypeMsgExec = "exec"
|
||||
TypeMsgCreateGroup = "create_group"
|
||||
TypeMsgUpdateGroupAdmin = "update_group_admin"
|
||||
TypeMsgUpdateGroupComment = "update_group_comment"
|
||||
TypeMsgUpdateGroupMembers = "update_group_members"
|
||||
TypeMsgCreateGroupPolicy = "create_group_policy"
|
||||
TypeMsgUpdateGroupPolicyAdmin = "update_group_policy_admin"
|
||||
TypeMsgUpdateGroupPolicyDecisionPolicy = "update_group_policy_decision_policy"
|
||||
TypeMsgUpdateGroupPolicyComment = "update_group_policy_comment"
|
||||
TypeMsgCreateProposal = "create_proposal"
|
||||
TypeMsgVote = "vote"
|
||||
TypeMsgExec = "exec"
|
||||
)
|
||||
|
||||
var _ sdk.Msg = &MsgCreateGroup{}
|
||||
|
@ -226,23 +226,23 @@ func (m *MsgUpdateGroupMembers) GetGroupID() uint64 {
|
|||
return m.GroupId
|
||||
}
|
||||
|
||||
var _ sdk.Msg = &MsgCreateGroupAccount{}
|
||||
var _ sdk.Msg = &MsgCreateGroupPolicy{}
|
||||
|
||||
// Route Implements Msg.
|
||||
func (m MsgCreateGroupAccount) Route() string {
|
||||
func (m MsgCreateGroupPolicy) Route() string {
|
||||
return RouterKey
|
||||
}
|
||||
|
||||
// Type Implements Msg.
|
||||
func (m MsgCreateGroupAccount) Type() string { return TypeMsgCreateGroupAccount }
|
||||
func (m MsgCreateGroupPolicy) Type() string { return TypeMsgCreateGroupPolicy }
|
||||
|
||||
// GetSignBytes Implements Msg.
|
||||
func (m MsgCreateGroupAccount) GetSignBytes() []byte {
|
||||
func (m MsgCreateGroupPolicy) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
|
||||
}
|
||||
|
||||
// GetSigners returns the expected signers for a MsgCreateGroupAccount.
|
||||
func (m MsgCreateGroupAccount) GetSigners() []sdk.AccAddress {
|
||||
// GetSigners returns the expected signers for a MsgCreateGroupPolicy.
|
||||
func (m MsgCreateGroupPolicy) GetSigners() []sdk.AccAddress {
|
||||
admin, err := sdk.AccAddressFromBech32(m.Admin)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -251,7 +251,7 @@ func (m MsgCreateGroupAccount) GetSigners() []sdk.AccAddress {
|
|||
}
|
||||
|
||||
// ValidateBasic does a sanity check on the provided data
|
||||
func (m MsgCreateGroupAccount) ValidateBasic() error {
|
||||
func (m MsgCreateGroupPolicy) ValidateBasic() error {
|
||||
_, err := sdk.AccAddressFromBech32(m.Admin)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "admin")
|
||||
|
@ -271,23 +271,23 @@ func (m MsgCreateGroupAccount) ValidateBasic() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var _ sdk.Msg = &MsgUpdateGroupAccountAdmin{}
|
||||
var _ sdk.Msg = &MsgUpdateGroupPolicyAdmin{}
|
||||
|
||||
// Route Implements Msg.
|
||||
func (m MsgUpdateGroupAccountAdmin) Route() string {
|
||||
func (m MsgUpdateGroupPolicyAdmin) Route() string {
|
||||
return RouterKey
|
||||
}
|
||||
|
||||
// Type Implements Msg.
|
||||
func (m MsgUpdateGroupAccountAdmin) Type() string { return TypeMsgUpdateGroupAccountAdmin }
|
||||
func (m MsgUpdateGroupPolicyAdmin) Type() string { return TypeMsgUpdateGroupPolicyAdmin }
|
||||
|
||||
// GetSignBytes Implements Msg.
|
||||
func (m MsgUpdateGroupAccountAdmin) GetSignBytes() []byte {
|
||||
func (m MsgUpdateGroupPolicyAdmin) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
|
||||
}
|
||||
|
||||
// GetSigners returns the expected signers for a MsgUpdateGroupAccountAdmin.
|
||||
func (m MsgUpdateGroupAccountAdmin) GetSigners() []sdk.AccAddress {
|
||||
// GetSigners returns the expected signers for a MsgUpdateGroupPolicyAdmin.
|
||||
func (m MsgUpdateGroupPolicyAdmin) GetSigners() []sdk.AccAddress {
|
||||
admin, err := sdk.AccAddressFromBech32(m.Admin)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -296,7 +296,7 @@ func (m MsgUpdateGroupAccountAdmin) GetSigners() []sdk.AccAddress {
|
|||
}
|
||||
|
||||
// ValidateBasic does a sanity check on the provided data
|
||||
func (m MsgUpdateGroupAccountAdmin) ValidateBasic() error {
|
||||
func (m MsgUpdateGroupPolicyAdmin) ValidateBasic() error {
|
||||
admin, err := sdk.AccAddressFromBech32(m.Admin)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "admin")
|
||||
|
@ -309,7 +309,7 @@ func (m MsgUpdateGroupAccountAdmin) ValidateBasic() error {
|
|||
|
||||
_, err = sdk.AccAddressFromBech32(m.Address)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "group account")
|
||||
return sdkerrors.Wrap(err, "group policy")
|
||||
}
|
||||
|
||||
if admin.Equals(newAdmin) {
|
||||
|
@ -318,11 +318,11 @@ func (m MsgUpdateGroupAccountAdmin) ValidateBasic() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var _ sdk.Msg = &MsgUpdateGroupAccountDecisionPolicy{}
|
||||
var _ types.UnpackInterfacesMessage = MsgUpdateGroupAccountDecisionPolicy{}
|
||||
var _ sdk.Msg = &MsgUpdateGroupPolicyDecisionPolicy{}
|
||||
var _ types.UnpackInterfacesMessage = MsgUpdateGroupPolicyDecisionPolicy{}
|
||||
|
||||
func NewMsgUpdateGroupAccountDecisionPolicyRequest(admin sdk.AccAddress, address sdk.AccAddress, decisionPolicy DecisionPolicy) (*MsgUpdateGroupAccountDecisionPolicy, error) {
|
||||
m := &MsgUpdateGroupAccountDecisionPolicy{
|
||||
func NewMsgUpdateGroupPolicyDecisionPolicyRequest(admin sdk.AccAddress, address sdk.AccAddress, decisionPolicy DecisionPolicy) (*MsgUpdateGroupPolicyDecisionPolicy, error) {
|
||||
m := &MsgUpdateGroupPolicyDecisionPolicy{
|
||||
Admin: admin.String(),
|
||||
Address: address.String(),
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ func NewMsgUpdateGroupAccountDecisionPolicyRequest(admin sdk.AccAddress, address
|
|||
return m, nil
|
||||
}
|
||||
|
||||
func (m *MsgUpdateGroupAccountDecisionPolicy) SetDecisionPolicy(decisionPolicy DecisionPolicy) error {
|
||||
func (m *MsgUpdateGroupPolicyDecisionPolicy) SetDecisionPolicy(decisionPolicy DecisionPolicy) error {
|
||||
msg, ok := decisionPolicy.(proto.Message)
|
||||
if !ok {
|
||||
return fmt.Errorf("can't proto marshal %T", msg)
|
||||
|
@ -347,22 +347,22 @@ func (m *MsgUpdateGroupAccountDecisionPolicy) SetDecisionPolicy(decisionPolicy D
|
|||
}
|
||||
|
||||
// Route Implements Msg.
|
||||
func (m MsgUpdateGroupAccountDecisionPolicy) Route() string {
|
||||
func (m MsgUpdateGroupPolicyDecisionPolicy) Route() string {
|
||||
return RouterKey
|
||||
}
|
||||
|
||||
// Type Implements Msg.
|
||||
func (m MsgUpdateGroupAccountDecisionPolicy) Type() string {
|
||||
return TypeMsgUpdateGroupAccountDecisionPolicy
|
||||
func (m MsgUpdateGroupPolicyDecisionPolicy) Type() string {
|
||||
return TypeMsgUpdateGroupPolicyDecisionPolicy
|
||||
}
|
||||
|
||||
// GetSignBytes Implements Msg.
|
||||
func (m MsgUpdateGroupAccountDecisionPolicy) GetSignBytes() []byte {
|
||||
func (m MsgUpdateGroupPolicyDecisionPolicy) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
|
||||
}
|
||||
|
||||
// GetSigners returns the expected signers for a MsgUpdateGroupAccountDecisionPolicy.
|
||||
func (m MsgUpdateGroupAccountDecisionPolicy) GetSigners() []sdk.AccAddress {
|
||||
// GetSigners returns the expected signers for a MsgUpdateGroupPolicyDecisionPolicy.
|
||||
func (m MsgUpdateGroupPolicyDecisionPolicy) GetSigners() []sdk.AccAddress {
|
||||
admin, err := sdk.AccAddressFromBech32(m.Admin)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -371,7 +371,7 @@ func (m MsgUpdateGroupAccountDecisionPolicy) GetSigners() []sdk.AccAddress {
|
|||
}
|
||||
|
||||
// ValidateBasic does a sanity check on the provided data
|
||||
func (m MsgUpdateGroupAccountDecisionPolicy) ValidateBasic() error {
|
||||
func (m MsgUpdateGroupPolicyDecisionPolicy) ValidateBasic() error {
|
||||
_, err := sdk.AccAddressFromBech32(m.Admin)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "admin")
|
||||
|
@ -379,7 +379,7 @@ func (m MsgUpdateGroupAccountDecisionPolicy) ValidateBasic() error {
|
|||
|
||||
_, err = sdk.AccAddressFromBech32(m.Address)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "group account")
|
||||
return sdkerrors.Wrap(err, "group policy")
|
||||
}
|
||||
|
||||
policy := m.GetDecisionPolicy()
|
||||
|
@ -394,7 +394,7 @@ func (m MsgUpdateGroupAccountDecisionPolicy) ValidateBasic() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (m *MsgUpdateGroupAccountDecisionPolicy) GetDecisionPolicy() DecisionPolicy {
|
||||
func (m *MsgUpdateGroupPolicyDecisionPolicy) GetDecisionPolicy() DecisionPolicy {
|
||||
decisionPolicy, ok := m.DecisionPolicy.GetCachedValue().(DecisionPolicy)
|
||||
if !ok {
|
||||
return nil
|
||||
|
@ -403,28 +403,28 @@ func (m *MsgUpdateGroupAccountDecisionPolicy) GetDecisionPolicy() DecisionPolicy
|
|||
}
|
||||
|
||||
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
|
||||
func (m MsgUpdateGroupAccountDecisionPolicy) UnpackInterfaces(unpacker types.AnyUnpacker) error {
|
||||
func (m MsgUpdateGroupPolicyDecisionPolicy) UnpackInterfaces(unpacker types.AnyUnpacker) error {
|
||||
var decisionPolicy DecisionPolicy
|
||||
return unpacker.UnpackAny(m.DecisionPolicy, &decisionPolicy)
|
||||
}
|
||||
|
||||
var _ sdk.Msg = &MsgUpdateGroupAccountMetadata{}
|
||||
var _ sdk.Msg = &MsgUpdateGroupPolicyMetadata{}
|
||||
|
||||
// Route Implements Msg.
|
||||
func (m MsgUpdateGroupAccountMetadata) Route() string {
|
||||
func (m MsgUpdateGroupPolicyMetadata) Route() string {
|
||||
return RouterKey
|
||||
}
|
||||
|
||||
// Type Implements Msg.
|
||||
func (m MsgUpdateGroupAccountMetadata) Type() string { return TypeMsgUpdateGroupAccountComment }
|
||||
func (m MsgUpdateGroupPolicyMetadata) Type() string { return TypeMsgUpdateGroupPolicyComment }
|
||||
|
||||
// GetSignBytes Implements Msg.
|
||||
func (m MsgUpdateGroupAccountMetadata) GetSignBytes() []byte {
|
||||
func (m MsgUpdateGroupPolicyMetadata) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
|
||||
}
|
||||
|
||||
// GetSigners returns the expected signers for a MsgUpdateGroupAccountMetadata.
|
||||
func (m MsgUpdateGroupAccountMetadata) GetSigners() []sdk.AccAddress {
|
||||
// GetSigners returns the expected signers for a MsgUpdateGroupPolicyMetadata.
|
||||
func (m MsgUpdateGroupPolicyMetadata) GetSigners() []sdk.AccAddress {
|
||||
admin, err := sdk.AccAddressFromBech32(m.Admin)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -433,7 +433,7 @@ func (m MsgUpdateGroupAccountMetadata) GetSigners() []sdk.AccAddress {
|
|||
}
|
||||
|
||||
// ValidateBasic does a sanity check on the provided data
|
||||
func (m MsgUpdateGroupAccountMetadata) ValidateBasic() error {
|
||||
func (m MsgUpdateGroupPolicyMetadata) ValidateBasic() error {
|
||||
_, err := sdk.AccAddressFromBech32(m.Admin)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "admin")
|
||||
|
@ -441,18 +441,18 @@ func (m MsgUpdateGroupAccountMetadata) ValidateBasic() error {
|
|||
|
||||
_, err = sdk.AccAddressFromBech32(m.Address)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "group account")
|
||||
return sdkerrors.Wrap(err, "group policy")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ sdk.Msg = &MsgCreateGroupAccount{}
|
||||
var _ types.UnpackInterfacesMessage = MsgCreateGroupAccount{}
|
||||
var _ sdk.Msg = &MsgCreateGroupPolicy{}
|
||||
var _ types.UnpackInterfacesMessage = MsgCreateGroupPolicy{}
|
||||
|
||||
// NewMsgCreateGroupAccount creates a new MsgCreateGroupAccount.
|
||||
func NewMsgCreateGroupAccount(admin sdk.AccAddress, group uint64, metadata []byte, decisionPolicy DecisionPolicy) (*MsgCreateGroupAccount, error) {
|
||||
m := &MsgCreateGroupAccount{
|
||||
// NewMsgCreateGroupPolicy creates a new MsgCreateGroupPolicy.
|
||||
func NewMsgCreateGroupPolicy(admin sdk.AccAddress, group uint64, metadata []byte, decisionPolicy DecisionPolicy) (*MsgCreateGroupPolicy, error) {
|
||||
m := &MsgCreateGroupPolicy{
|
||||
Admin: admin.String(),
|
||||
GroupId: group,
|
||||
Metadata: metadata,
|
||||
|
@ -464,19 +464,19 @@ func NewMsgCreateGroupAccount(admin sdk.AccAddress, group uint64, metadata []byt
|
|||
return m, nil
|
||||
}
|
||||
|
||||
func (m *MsgCreateGroupAccount) GetAdmin() string {
|
||||
func (m *MsgCreateGroupPolicy) GetAdmin() string {
|
||||
return m.Admin
|
||||
}
|
||||
|
||||
func (m *MsgCreateGroupAccount) GetGroupID() uint64 {
|
||||
func (m *MsgCreateGroupPolicy) GetGroupID() uint64 {
|
||||
return m.GroupId
|
||||
}
|
||||
|
||||
func (m *MsgCreateGroupAccount) GetMetadata() []byte {
|
||||
func (m *MsgCreateGroupPolicy) GetMetadata() []byte {
|
||||
return m.Metadata
|
||||
}
|
||||
|
||||
func (m *MsgCreateGroupAccount) GetDecisionPolicy() DecisionPolicy {
|
||||
func (m *MsgCreateGroupPolicy) GetDecisionPolicy() DecisionPolicy {
|
||||
decisionPolicy, ok := m.DecisionPolicy.GetCachedValue().(DecisionPolicy)
|
||||
if !ok {
|
||||
return nil
|
||||
|
@ -484,7 +484,7 @@ func (m *MsgCreateGroupAccount) GetDecisionPolicy() DecisionPolicy {
|
|||
return decisionPolicy
|
||||
}
|
||||
|
||||
func (m *MsgCreateGroupAccount) SetDecisionPolicy(decisionPolicy DecisionPolicy) error {
|
||||
func (m *MsgCreateGroupPolicy) SetDecisionPolicy(decisionPolicy DecisionPolicy) error {
|
||||
msg, ok := decisionPolicy.(proto.Message)
|
||||
if !ok {
|
||||
return fmt.Errorf("can't proto marshal %T", msg)
|
||||
|
@ -498,7 +498,7 @@ func (m *MsgCreateGroupAccount) SetDecisionPolicy(decisionPolicy DecisionPolicy)
|
|||
}
|
||||
|
||||
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
|
||||
func (m MsgCreateGroupAccount) UnpackInterfaces(unpacker types.AnyUnpacker) error {
|
||||
func (m MsgCreateGroupPolicy) UnpackInterfaces(unpacker types.AnyUnpacker) error {
|
||||
var decisionPolicy DecisionPolicy
|
||||
return unpacker.UnpackAny(m.DecisionPolicy, &decisionPolicy)
|
||||
}
|
||||
|
@ -550,7 +550,7 @@ func (m MsgCreateProposal) GetSigners() []sdk.AccAddress {
|
|||
func (m MsgCreateProposal) ValidateBasic() error {
|
||||
_, err := sdk.AccAddressFromBech32(m.Address)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "group account")
|
||||
return sdkerrors.Wrap(err, "group policy")
|
||||
}
|
||||
|
||||
if len(m.Proposers) == 0 {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -85,8 +85,8 @@ func local_request_Query_GroupInfo_0(ctx context.Context, marshaler runtime.Mars
|
|||
|
||||
}
|
||||
|
||||
func request_Query_GroupAccountInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupAccountInfoRequest
|
||||
func request_Query_GroupPolicyInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupPolicyInfoRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
|
@ -107,13 +107,13 @@ func request_Query_GroupAccountInfo_0(ctx context.Context, marshaler runtime.Mar
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
msg, err := client.GroupAccountInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
msg, err := client.GroupPolicyInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_GroupAccountInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupAccountInfoRequest
|
||||
func local_request_Query_GroupPolicyInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupPolicyInfoRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
|
@ -134,7 +134,7 @@ func local_request_Query_GroupAccountInfo_0(ctx context.Context, marshaler runti
|
|||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
|
||||
}
|
||||
|
||||
msg, err := server.GroupAccountInfo(ctx, &protoReq)
|
||||
msg, err := server.GroupPolicyInfo(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
@ -284,11 +284,11 @@ func local_request_Query_GroupsByAdmin_0(ctx context.Context, marshaler runtime.
|
|||
}
|
||||
|
||||
var (
|
||||
filter_Query_GroupAccountsByGroup_0 = &utilities.DoubleArray{Encoding: map[string]int{"group_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
filter_Query_GroupPoliciesByGroup_0 = &utilities.DoubleArray{Encoding: map[string]int{"group_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
)
|
||||
|
||||
func request_Query_GroupAccountsByGroup_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupAccountsByGroupRequest
|
||||
func request_Query_GroupPoliciesByGroup_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupPoliciesByGroupRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
|
@ -312,17 +312,17 @@ func request_Query_GroupAccountsByGroup_0(ctx context.Context, marshaler runtime
|
|||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GroupAccountsByGroup_0); err != nil {
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GroupPoliciesByGroup_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.GroupAccountsByGroup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
msg, err := client.GroupPoliciesByGroup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_GroupAccountsByGroup_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupAccountsByGroupRequest
|
||||
func local_request_Query_GroupPoliciesByGroup_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupPoliciesByGroupRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
|
@ -346,21 +346,21 @@ func local_request_Query_GroupAccountsByGroup_0(ctx context.Context, marshaler r
|
|||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GroupAccountsByGroup_0); err != nil {
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GroupPoliciesByGroup_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.GroupAccountsByGroup(ctx, &protoReq)
|
||||
msg, err := server.GroupPoliciesByGroup(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_GroupAccountsByAdmin_0 = &utilities.DoubleArray{Encoding: map[string]int{"admin": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
filter_Query_GroupPoliciesByAdmin_0 = &utilities.DoubleArray{Encoding: map[string]int{"admin": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
)
|
||||
|
||||
func request_Query_GroupAccountsByAdmin_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupAccountsByAdminRequest
|
||||
func request_Query_GroupPoliciesByAdmin_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupPoliciesByAdminRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
|
@ -384,17 +384,17 @@ func request_Query_GroupAccountsByAdmin_0(ctx context.Context, marshaler runtime
|
|||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GroupAccountsByAdmin_0); err != nil {
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GroupPoliciesByAdmin_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.GroupAccountsByAdmin(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
msg, err := client.GroupPoliciesByAdmin(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_GroupAccountsByAdmin_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupAccountsByAdminRequest
|
||||
func local_request_Query_GroupPoliciesByAdmin_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryGroupPoliciesByAdminRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
|
@ -418,11 +418,11 @@ func local_request_Query_GroupAccountsByAdmin_0(ctx context.Context, marshaler r
|
|||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GroupAccountsByAdmin_0); err != nil {
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GroupPoliciesByAdmin_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.GroupAccountsByAdmin(ctx, &protoReq)
|
||||
msg, err := server.GroupPoliciesByAdmin(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
@ -482,11 +482,11 @@ func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marsh
|
|||
}
|
||||
|
||||
var (
|
||||
filter_Query_ProposalsByGroupAccount_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
filter_Query_ProposalsByGroupPolicy_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
)
|
||||
|
||||
func request_Query_ProposalsByGroupAccount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryProposalsByGroupAccountRequest
|
||||
func request_Query_ProposalsByGroupPolicy_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryProposalsByGroupPolicyRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
|
@ -510,17 +510,17 @@ func request_Query_ProposalsByGroupAccount_0(ctx context.Context, marshaler runt
|
|||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ProposalsByGroupAccount_0); err != nil {
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ProposalsByGroupPolicy_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.ProposalsByGroupAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
msg, err := client.ProposalsByGroupPolicy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_ProposalsByGroupAccount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryProposalsByGroupAccountRequest
|
||||
func local_request_Query_ProposalsByGroupPolicy_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryProposalsByGroupPolicyRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
|
@ -544,11 +544,11 @@ func local_request_Query_ProposalsByGroupAccount_0(ctx context.Context, marshale
|
|||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ProposalsByGroupAccount_0); err != nil {
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ProposalsByGroupPolicy_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.ProposalsByGroupAccount(ctx, &protoReq)
|
||||
msg, err := server.ProposalsByGroupPolicy(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
@ -871,7 +871,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_GroupAccountInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
mux.Handle("GET", pattern_Query_GroupPolicyInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
|
@ -880,14 +880,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_GroupAccountInfo_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
resp, md, err := local_request_Query_GroupPolicyInfo_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_GroupAccountInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
forward_Query_GroupPolicyInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
|
@ -931,7 +931,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_GroupAccountsByGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
mux.Handle("GET", pattern_Query_GroupPoliciesByGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
|
@ -940,18 +940,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_GroupAccountsByGroup_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
resp, md, err := local_request_Query_GroupPoliciesByGroup_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_GroupAccountsByGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
forward_Query_GroupPoliciesByGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_GroupAccountsByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
mux.Handle("GET", pattern_Query_GroupPoliciesByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
|
@ -960,14 +960,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_GroupAccountsByAdmin_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
resp, md, err := local_request_Query_GroupPoliciesByAdmin_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_GroupAccountsByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
forward_Query_GroupPoliciesByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
|
@ -991,7 +991,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ProposalsByGroupAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
mux.Handle("GET", pattern_Query_ProposalsByGroupPolicy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
|
@ -1000,14 +1000,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_ProposalsByGroupAccount_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
resp, md, err := local_request_Query_ProposalsByGroupPolicy_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_ProposalsByGroupAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
forward_Query_ProposalsByGroupPolicy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
|
@ -1152,7 +1152,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_GroupAccountInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
mux.Handle("GET", pattern_Query_GroupPolicyInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
|
@ -1161,14 +1161,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_GroupAccountInfo_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
resp, md, err := request_Query_GroupPolicyInfo_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_GroupAccountInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
forward_Query_GroupPolicyInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
|
@ -1212,7 +1212,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_GroupAccountsByGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
mux.Handle("GET", pattern_Query_GroupPoliciesByGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
|
@ -1221,18 +1221,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_GroupAccountsByGroup_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
resp, md, err := request_Query_GroupPoliciesByGroup_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_GroupAccountsByGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
forward_Query_GroupPoliciesByGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_GroupAccountsByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
mux.Handle("GET", pattern_Query_GroupPoliciesByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
|
@ -1241,14 +1241,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_GroupAccountsByAdmin_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
resp, md, err := request_Query_GroupPoliciesByAdmin_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_GroupAccountsByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
forward_Query_GroupPoliciesByAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
|
@ -1272,7 +1272,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ProposalsByGroupAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
mux.Handle("GET", pattern_Query_ProposalsByGroupPolicy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
|
@ -1281,14 +1281,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_ProposalsByGroupAccount_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
resp, md, err := request_Query_ProposalsByGroupPolicy_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_ProposalsByGroupAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
forward_Query_ProposalsByGroupPolicy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
|
@ -1378,19 +1378,19 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||
var (
|
||||
pattern_Query_GroupInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "group_info", "group_id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_GroupAccountInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "group_account_info", "address"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
pattern_Query_GroupPolicyInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "group_policy_info", "address"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_GroupMembers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "group_members", "group_id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_GroupsByAdmin_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "groups_by_admin", "admin"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_GroupAccountsByGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "group_accounts_by_group", "group_id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
pattern_Query_GroupPoliciesByGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "group_policies_by_group", "group_id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_GroupAccountsByAdmin_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "group_accounts_by_admin", "admin"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
pattern_Query_GroupPoliciesByAdmin_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "group_policies_by_admin", "admin"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_Proposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "proposal", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_ProposalsByGroupAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "proposals_by_group_account", "address"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
pattern_Query_ProposalsByGroupPolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "proposals_by_group_policy", "address"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_VoteByProposalVoter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "group", "v1beta1", "vote_by_proposal_voter", "proposal_id", "voter"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
|
@ -1404,19 +1404,19 @@ var (
|
|||
var (
|
||||
forward_Query_GroupInfo_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_GroupAccountInfo_0 = runtime.ForwardResponseMessage
|
||||
forward_Query_GroupPolicyInfo_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_GroupMembers_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_GroupsByAdmin_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_GroupAccountsByGroup_0 = runtime.ForwardResponseMessage
|
||||
forward_Query_GroupPoliciesByGroup_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_GroupAccountsByAdmin_0 = runtime.ForwardResponseMessage
|
||||
forward_Query_GroupPoliciesByAdmin_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Proposal_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_ProposalsByGroupAccount_0 = runtime.ForwardResponseMessage
|
||||
forward_Query_ProposalsByGroupPolicy_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_VoteByProposalVoter_0 = runtime.ForwardResponseMessage
|
||||
|
||||
|
|
|
@ -10,17 +10,17 @@ A group is simply an aggregation of accounts with associated weights. It is not
|
|||
an account and doesn't have a balance. It doesn't in and of itself have any
|
||||
sort of voting or decision weight. It does have an "administrator" which has
|
||||
the ability to add, remove and update members in the group. Note that a
|
||||
group account could be an administrator of a group.
|
||||
group policy account could be an administrator of a group.
|
||||
|
||||
## Group Account
|
||||
## Group Policy
|
||||
|
||||
A group account is an account associated with a group and a decision policy.
|
||||
Group accounts are abstracted from groups because a single group may have
|
||||
A group policy is an account associated with a group and a decision policy.
|
||||
Group policies are abstracted from groups because a single group may have
|
||||
multiple decision policies for different types of actions. Managing group
|
||||
membership separately from decision policies results in the least overhead
|
||||
and keeps membership consistent across different policies. The pattern that
|
||||
is recommended is to have a single master group account for a given group,
|
||||
and then to create separate group accounts with different decision policies
|
||||
is recommended is to have a single master group policy for a given group,
|
||||
and then to create separate group policies with different decision policies
|
||||
and delegate the desired permissions from the master account to
|
||||
those "sub-accounts" using the `x/authz` module.
|
||||
|
||||
|
@ -43,7 +43,7 @@ this decision policy, abstain and veto are simply treated as no's.
|
|||
|
||||
## Proposal
|
||||
|
||||
Any member of a group can submit a proposal for a group account to decide upon.
|
||||
Any member of a group can submit a proposal for a group policy account to decide upon.
|
||||
A proposal consists of a set of messages that will be executed if the proposal
|
||||
passes as well as any metadata associated with the proposal.
|
||||
|
||||
|
@ -69,6 +69,6 @@ could be executed later on.
|
|||
### Changing Group Membership
|
||||
|
||||
In the current implementation, changing a group's membership (adding or removing members or changing their weight)
|
||||
will cause all existing proposals for group accounts linked to this group
|
||||
will cause all existing proposals for group policy accounts linked to this group
|
||||
to be invalidated. They will simply fail if someone calls `Msg/Exec` and will
|
||||
eventually be garbage collected.
|
|
@ -41,28 +41,28 @@ The `groupMemberTable` is a primary key table and its `PrimaryKey` is given by
|
|||
`groupMemberByMemberIndex` allows to retrieve group members by member address:
|
||||
`0x12 | len([]byte(member.Address)) | []byte(member.Address) | PrimaryKey -> []byte()`.
|
||||
|
||||
## Group Account Table
|
||||
## Group Policy Table
|
||||
|
||||
The `groupAccountTable` stores `GroupAccountInfo`: `0x20 | len([]byte(Address)) | []byte(Address) -> ProtocolBuffer(GroupAccountInfo)`.
|
||||
The `groupPolicyTable` stores `GroupPolicyInfo`: `0x20 | len([]byte(Address)) | []byte(Address) -> ProtocolBuffer(GroupPolicyInfo)`.
|
||||
|
||||
The `groupAccountTable` is a primary key table and its `PrimaryKey` is given by
|
||||
The `groupPolicyTable` is a primary key table and its `PrimaryKey` is given by
|
||||
`len([]byte(Address)) | []byte(Address)` which is used by the following indexes.
|
||||
|
||||
### groupAccountSeq
|
||||
### groupPolicySeq
|
||||
|
||||
The value of `groupAccountSeq` is incremented when creating a new group account and is used to generate the new group account `Address`:
|
||||
The value of `groupPolicySeq` is incremented when creating a new group policy and is used to generate the new group policy account `Address`:
|
||||
`0x21 | 0x1 -> BigEndian`.
|
||||
|
||||
The second `0x1` corresponds to the ORM `sequenceStorageKey`.
|
||||
|
||||
### groupAccountByGroupIndex
|
||||
### groupPolicyByGroupIndex
|
||||
|
||||
`groupAccountByGroupIndex` allows to retrieve group accounts by group id:
|
||||
`groupPolicyByGroupIndex` allows to retrieve group policies by group id:
|
||||
`0x22 | BigEndian(GroupId) | PrimaryKey -> []byte()`.
|
||||
|
||||
### groupAccountByAdminIndex
|
||||
### groupPolicyByAdminIndex
|
||||
|
||||
`groupAccountByAdminIndex` allows to retrieve group accounts by admin address:
|
||||
`groupPolicyByAdminIndex` allows to retrieve group policies by admin address:
|
||||
`0x23 | len([]byte(Address)) | []byte(Address) | PrimaryKey -> []byte()`.
|
||||
|
||||
## Proposal Table
|
||||
|
@ -75,9 +75,9 @@ The value of `proposalSeq` is incremented when creating a new proposal and corre
|
|||
|
||||
The second `0x1` corresponds to the ORM `sequenceStorageKey`.
|
||||
|
||||
### proposalByGroupAccountIndex
|
||||
### proposalByGroupPolicyIndex
|
||||
|
||||
`proposalByGroupAccountIndex` allows to retrieve proposals by group account address:
|
||||
`proposalByGroupPolicyIndex` allows to retrieve proposals by group policy account address:
|
||||
`0x32 | len([]byte(account.Address)) | []byte(account.Address) | BigEndian(ProposalId) -> []byte()`.
|
||||
|
||||
### proposalByProposerIndex
|
||||
|
|
|
@ -40,33 +40,33 @@ It's expecting to fail if:
|
|||
- new metadata length is greater than some `MaxMetadataLength`.
|
||||
- the signer is not the admin of the group.
|
||||
|
||||
## Msg/CreateGroupAccount
|
||||
## Msg/CreateGroupPolicy
|
||||
|
||||
A new group account can be created with the `MsgCreateGroupAccount`, which has an admin address, a group id, a decision policy and some optional metadata bytes.
|
||||
A new group policy can be created with the `MsgCreateGroupPolicy`, which has an admin address, a group id, a decision policy and some optional metadata bytes.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/6f58963e7f6ce820e9b33f02f06f7b96f6d2e347/proto/cosmos/group/v1beta1/tx.proto#L121-L142
|
||||
|
||||
It's expecting to fail if metadata length is greater than some `MaxMetadataLength`.
|
||||
|
||||
## Msg/UpdateGroupAccountAdmin
|
||||
## Msg/UpdateGroupPolicyAdmin
|
||||
|
||||
The `UpdateGroupAccountAdmin` can be used to update a group account admin.
|
||||
The `UpdateGroupPolicyAdmin` can be used to update a group policy admin.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/6f58963e7f6ce820e9b33f02f06f7b96f6d2e347/proto/cosmos/group/v1beta1/tx.proto#L151-L162
|
||||
|
||||
It's expecting to fail if the signer is not the admin of the group account.
|
||||
It's expecting to fail if the signer is not the admin of the group policy.
|
||||
|
||||
## Msg/UpdateGroupAccountDecisionPolicy
|
||||
## Msg/UpdateGroupPolicyDecisionPolicy
|
||||
|
||||
The `UpdateGroupAccountDecisionPolicy` can be used to update a decision policy.
|
||||
The `UpdateGroupPolicyDecisionPolicy` can be used to update a decision policy.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/6f58963e7f6ce820e9b33f02f06f7b96f6d2e347/proto/cosmos/group/v1beta1/tx.proto#L167-L179
|
||||
|
||||
It's expecting to fail if the signer is not the admin of the group account.
|
||||
It's expecting to fail if the signer is not the admin of the group policy.
|
||||
|
||||
## Msg/UpdateGroupAccountMetadata
|
||||
## Msg/UpdateGroupPolicyMetadata
|
||||
|
||||
The `UpdateGroupAccountMetadata` can be used to update a group account metadata.
|
||||
The `UpdateGroupPolicyMetadata` can be used to update a group policy metadata.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/6f58963e7f6ce820e9b33f02f06f7b96f6d2e347/proto/cosmos/group/v1beta1/tx.proto#L184-L195
|
||||
|
||||
|
@ -76,7 +76,7 @@ It's expecting to fail if:
|
|||
|
||||
## Msg/CreateProposal
|
||||
|
||||
A new group account can be created with the `MsgCreateProposal`, which has a group account address, a list of proposers addresses, a list of messages to execute if the proposal is accepted and some optional metadata bytes.
|
||||
A new proposal can be created with the `MsgCreateProposal`, which has a group policy account address, a list of proposers addresses, a list of messages to execute if the proposal is accepted and some optional metadata bytes.
|
||||
An optional `Exec` value can be provided to try to execute the proposal immediately after proposal creation. Proposers signatures are considered as yes votes in this case.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/6f58963e7f6ce820e9b33f02f06f7b96f6d2e347/proto/cosmos/group/v1beta1/tx.proto#L218-L239
|
||||
|
@ -100,7 +100,7 @@ A proposal can be executed with the `MsgExec`.
|
|||
|
||||
The messages that are part of this proposal won't be executed if:
|
||||
- the group has been modified before tally.
|
||||
- the group account has been modified before tally.
|
||||
- the group policy has been modified before tally.
|
||||
- the proposal has not been accepted.
|
||||
- the proposal status is not closed.
|
||||
- the proposal has already been successfully executed.
|
|
@ -20,19 +20,19 @@ The group module emits the following events:
|
|||
| message | action | /cosmos.group.v1beta1.Msg/UpdateGroup{Admin\|Metadata\|Members} |
|
||||
| cosmos.group.v1beta1.EventUpdateGroup | group_id | {groupId} |
|
||||
|
||||
## EventCreateGroupAccount
|
||||
## EventCreateGroupPolicy
|
||||
|
||||
| Type | Attribute Key | Attribute Value |
|
||||
|----------------------------------------------|---------------|----------------------------------------------|
|
||||
| message | action | /cosmos.group.v1beta1.Msg/CreateGroupAccount |
|
||||
| cosmos.group.v1beta1.EventCreateGroupAccount | address | {groupAccountAddress} |
|
||||
| message | action | /cosmos.group.v1beta1.Msg/CreateGroupPolicy |
|
||||
| cosmos.group.v1beta1.EventCreateGroupPolicy | address | {groupPolicyAddress} |
|
||||
|
||||
## EventUpdateGroupAccount
|
||||
## EventUpdateGroupPolicy
|
||||
|
||||
| Type | Attribute Key | Attribute Value |
|
||||
|----------------------------------------------|---------------|-------------------------------------------------------------------------------|
|
||||
| message | action | /cosmos.group.v1beta1.Msg/UpdateGroupAccount{Admin\|Metadata\|DecisionPolicy} |
|
||||
| cosmos.group.v1beta1.EventUpdateGroupAccount | address | {groupAccountAddress} |
|
||||
| message | action | /cosmos.group.v1beta1.Msg/UpdateGroupPolicy{Admin\|Metadata\|DecisionPolicy} |
|
||||
| cosmos.group.v1beta1.EventUpdateGroupPolicy | address | {groupPolicyAddress} |
|
||||
|
||||
## EventCreateProposal
|
||||
|
||||
|
|
|
@ -40,18 +40,18 @@ total_weight: "3"
|
|||
version: "1"
|
||||
```
|
||||
|
||||
#### group-account-info
|
||||
#### group-policy-info
|
||||
|
||||
The `group-account-info` command allows users to query for group account info by group account address.
|
||||
The `group-policy-info` command allows users to query for group policy info by account address of group policy .
|
||||
|
||||
```bash
|
||||
simd query group group-account-info [group-account] [flags]
|
||||
simd query group group-policy-info [group-policy-account] [flags]
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
simd query group group-account-info cosmos1..
|
||||
simd query group group-policy-info cosmos1..
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
@ -134,24 +134,24 @@ pagination:
|
|||
total: "2"
|
||||
```
|
||||
|
||||
#### group-accounts-by-group
|
||||
#### group-policies-by-group
|
||||
|
||||
The `group-accounts-by-group` command allows users to query for group accounts by group id with pagination flags.
|
||||
The `group-policies-by-group` command allows users to query for group policies by group id with pagination flags.
|
||||
|
||||
```bash
|
||||
simd query group group-accounts-by-group [group-id] [flags]
|
||||
simd query group group-policies-by-group [group-id] [flags]
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
simd query group group-accounts-by-group 1
|
||||
simd query group group-policies-by-group 1
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
||||
```bash
|
||||
group_accounts:
|
||||
group_policies:
|
||||
- address: cosmos1..
|
||||
admin: cosmos1..
|
||||
decision_policy:
|
||||
|
@ -175,24 +175,24 @@ pagination:
|
|||
total: "2"
|
||||
```
|
||||
|
||||
#### group-accounts-by-admin
|
||||
#### group-policies-by-admin
|
||||
|
||||
The `group-accounts-by-admin` command allows users to query for group accounts by admin account address with pagination flags.
|
||||
The `group-policies-by-admin` command allows users to query for group policies by admin account address with pagination flags.
|
||||
|
||||
```bash
|
||||
simd query group group-accounts-by-admin [admin] [flags]
|
||||
simd query group group-policies-by-admin [admin] [flags]
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
simd query group group-accounts-by-admin cosmos1..
|
||||
simd query group group-policies-by-admin cosmos1..
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
||||
```bash
|
||||
group_accounts:
|
||||
group_policies:
|
||||
- address: cosmos1..
|
||||
admin: cosmos1..
|
||||
decision_policy:
|
||||
|
@ -236,7 +236,7 @@ Example Output:
|
|||
proposal:
|
||||
address: cosmos1..
|
||||
executor_result: EXECUTOR_RESULT_NOT_RUN
|
||||
group_account_version: "1"
|
||||
group_policy_version: "1"
|
||||
group_version: "1"
|
||||
metadata: AQ==
|
||||
msgs:
|
||||
|
@ -260,18 +260,18 @@ proposal:
|
|||
yes_count: "0"
|
||||
```
|
||||
|
||||
#### proposals-by-group-account
|
||||
#### proposals-by-group-policy
|
||||
|
||||
The `proposals-by-group-account` command allows users to query for proposals by group account address with pagination flags.
|
||||
The `proposals-by-group-policy` command allows users to query for proposals by account address of group policy with pagination flags.
|
||||
|
||||
```bash
|
||||
simd query group proposals-by-group-account [group-account] [flags]
|
||||
simd query group proposals-by-group-policy [group-policy-account] [flags]
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
simd query group proposals-by-group-account cosmos1..
|
||||
simd query group proposals-by-group-policy cosmos1..
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
@ -283,7 +283,7 @@ pagination:
|
|||
proposals:
|
||||
- address: cosmos1..
|
||||
executor_result: EXECUTOR_RESULT_NOT_RUN
|
||||
group_account_version: "1"
|
||||
group_policy_version: "1"
|
||||
group_version: "1"
|
||||
metadata: AQ==
|
||||
msgs:
|
||||
|
@ -453,54 +453,54 @@ Example:
|
|||
simd tx group update-group-metadata cosmos1.. 1 "AQ=="
|
||||
```
|
||||
|
||||
#### create-group-account
|
||||
#### create-group-policy
|
||||
|
||||
The `create-group-account` command allows users to create a group account which is an account associated with a group and a decision policy.
|
||||
The `create-group-policy` command allows users to create a group policy which is an account associated with a group and a decision policy.
|
||||
|
||||
```bash
|
||||
simd tx group create-group-account [admin] [group-id] [metadata] [decision-policy] [flags]
|
||||
simd tx group create-group-policy [admin] [group-id] [metadata] [decision-policy] [flags]
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
simd tx group create-group-account cosmos1.. 1 "AQ==" '{"@type":"/cosmos.group.v1beta1.ThresholdDecisionPolicy", "threshold":"1", "timeout":"600s"}'
|
||||
simd tx group create-group-policy cosmos1.. 1 "AQ==" '{"@type":"/cosmos.group.v1beta1.ThresholdDecisionPolicy", "threshold":"1", "timeout":"600s"}'
|
||||
```
|
||||
|
||||
#### update-group-account-admin
|
||||
#### update-group-policy-admin
|
||||
|
||||
The `update-group-account-admin` command allows users to update a group account admin.
|
||||
The `update-group-policy-admin` command allows users to update a group policy admin.
|
||||
|
||||
```bash
|
||||
simd tx group update-group-account-admin [admin] [group-account] [new-admin] [flags]
|
||||
simd tx group update-group-policy-admin [admin] [group-policy-account] [new-admin] [flags]
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
simd tx group update-group-account-admin cosmos1.. cosmos1.. cosmos1..
|
||||
simd tx group update-group-policy-admin cosmos1.. cosmos1.. cosmos1..
|
||||
```
|
||||
|
||||
#### update-group-account-metadata
|
||||
#### update-group-policy-metadata
|
||||
|
||||
The `update-group-account-metadata` command allows users to update a group account metadata.
|
||||
The `update-group-policy-metadata` command allows users to update a group policy metadata.
|
||||
|
||||
```bash
|
||||
simd tx group update-group-account-metadata [admin] [group-account] [new-metadata] [flags]
|
||||
simd tx group update-group-policy-metadata [admin] [group-policy-account] [new-metadata] [flags]
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
simd tx group update-group-account-metadata cosmos1.. cosmos1.. "AQ=="
|
||||
simd tx group update-group-policy-metadata cosmos1.. cosmos1.. "AQ=="
|
||||
```
|
||||
|
||||
#### update-group-account-policy
|
||||
|
||||
The `update-group-account-policy` command allows users to update a group account decision policy.
|
||||
The `update-group-account-policy` command allows users to update a group policy's decision policy.
|
||||
|
||||
```bash
|
||||
simd tx group update-group-account-policy [admin] [group-account] [decision-policy] [flags]
|
||||
simd tx group update-group-account-policy [admin] [group-policy-account] [decision-policy] [flags]
|
||||
```
|
||||
|
||||
Example:
|
||||
|
@ -514,7 +514,7 @@ simd tx group update-group-account-policy cosmos1.. cosmos1.. '{"@type":"/cosmos
|
|||
The `create-proposal` command allows users to submit a new proposal.
|
||||
|
||||
```bash
|
||||
simd tx group create-proposal [group-account] [proposer[,proposer]*] [msg_tx_json_file] [metadata] [flags]
|
||||
simd tx group create-proposal [group-policy-account] [proposer[,proposer]*] [msg_tx_json_file] [metadata] [flags]
|
||||
```
|
||||
|
||||
Example:
|
||||
|
@ -584,19 +584,19 @@ Example Output:
|
|||
}
|
||||
```
|
||||
|
||||
### GroupAccountInfo
|
||||
### GroupPolicyInfo
|
||||
|
||||
The `GroupAccountInfo` endpoint allows users to query for group account info by group account address.
|
||||
The `GroupPolicyInfo` endpoint allows users to query for group policy info by account address of group policy.
|
||||
|
||||
```bash
|
||||
cosmos.group.v1beta1.Query/GroupAccountInfo
|
||||
cosmos.group.v1beta1.Query/GroupPolicyInfo
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
grpcurl -plaintext \
|
||||
-d '{"address":"cosmos1.."}' localhost:9090 cosmos.group.v1beta1.Query/GroupAccountInfo
|
||||
-d '{"address":"cosmos1.."}' localhost:9090 cosmos.group.v1beta1.Query/GroupPolicyInfo
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
@ -695,26 +695,26 @@ Example Output:
|
|||
}
|
||||
```
|
||||
|
||||
### GroupAccountsByGroup
|
||||
### GroupPolicysByGroup
|
||||
|
||||
The `GroupAccountsByGroup` endpoint allows users to query for group accounts by group id with pagination flags.
|
||||
The `GroupPolicysByGroup` endpoint allows users to query for group policies by group id with pagination flags.
|
||||
|
||||
```bash
|
||||
cosmos.group.v1beta1.Query/GroupAccountsByGroup
|
||||
cosmos.group.v1beta1.Query/GroupPolicysByGroup
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
grpcurl -plaintext \
|
||||
-d '{"group_id":"1"}' localhost:9090 cosmos.group.v1beta1.Query/GroupAccountsByGroup
|
||||
-d '{"group_id":"1"}' localhost:9090 cosmos.group.v1beta1.Query/GroupPolicysByGroup
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
||||
```bash
|
||||
{
|
||||
"groupAccounts": [
|
||||
"GroupPolicys": [
|
||||
{
|
||||
"address": "cosmos1..",
|
||||
"groupId": "1",
|
||||
|
@ -736,26 +736,26 @@ Example Output:
|
|||
}
|
||||
```
|
||||
|
||||
### GroupAccountsByAdmin
|
||||
### GroupPolicysByAdmin
|
||||
|
||||
The `GroupAccountsByAdmin` endpoint allows users to query for group accounts by admin account address with pagination flags.
|
||||
The `GroupPolicysByAdmin` endpoint allows users to query for group policies by admin account address with pagination flags.
|
||||
|
||||
```bash
|
||||
cosmos.group.v1beta1.Query/GroupAccountsByAdmin
|
||||
cosmos.group.v1beta1.Query/GroupPolicysByAdmin
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
grpcurl -plaintext \
|
||||
-d '{"admin":"cosmos1.."}' localhost:9090 cosmos.group.v1beta1.Query/GroupAccountsByAdmin
|
||||
-d '{"admin":"cosmos1.."}' localhost:9090 cosmos.group.v1beta1.Query/GroupPolicysByAdmin
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
||||
```bash
|
||||
{
|
||||
"groupAccounts": [
|
||||
"GroupPolicys": [
|
||||
{
|
||||
"address": "cosmos1..",
|
||||
"groupId": "1",
|
||||
|
@ -804,7 +804,7 @@ Example Output:
|
|||
],
|
||||
"submittedAt": "2021-12-17T07:06:26.310638964Z",
|
||||
"groupVersion": "1",
|
||||
"groupAccountVersion": "1",
|
||||
"GroupPolicyVersion": "1",
|
||||
"status": "STATUS_SUBMITTED",
|
||||
"result": "RESULT_UNFINALIZED",
|
||||
"voteState": {
|
||||
|
@ -822,19 +822,19 @@ Example Output:
|
|||
}
|
||||
```
|
||||
|
||||
### ProposalsByGroupAccount
|
||||
### ProposalsByGroupPolicy
|
||||
|
||||
The `ProposalsByGroupAccount` endpoint allows users to query for proposals by group account address with pagination flags.
|
||||
The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with pagination flags.
|
||||
|
||||
```bash
|
||||
cosmos.group.v1beta1.Query/ProposalsByGroupAccount
|
||||
cosmos.group.v1beta1.Query/ProposalsByGroupPolicy
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
grpcurl -plaintext \
|
||||
-d '{"address":"cosmos1.."}' localhost:9090 cosmos.group.v1beta1.Query/ProposalsByGroupAccount
|
||||
-d '{"address":"cosmos1.."}' localhost:9090 cosmos.group.v1beta1.Query/ProposalsByGroupPolicy
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
@ -850,7 +850,7 @@ Example Output:
|
|||
],
|
||||
"submittedAt": "2021-12-17T08:03:27.099649352Z",
|
||||
"groupVersion": "1",
|
||||
"groupAccountVersion": "1",
|
||||
"GroupPolicyVersion": "1",
|
||||
"status": "STATUS_CLOSED",
|
||||
"result": "RESULT_ACCEPTED",
|
||||
"voteState": {
|
||||
|
@ -998,18 +998,18 @@ Example Output:
|
|||
}
|
||||
```
|
||||
|
||||
### GroupAccountInfo
|
||||
### GroupPolicyInfo
|
||||
|
||||
The `GroupAccountInfo` endpoint allows users to query for group account info by group account address.
|
||||
The `GroupPolicyInfo` endpoint allows users to query for group policy info by account address of group policy.
|
||||
|
||||
```bash
|
||||
/cosmos/group/v1beta1/group_account_info/{address}
|
||||
/cosmos/group/v1beta1/group_policy_info/{address}
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
curl localhost:1317/cosmos/group/v1beta1/group_account_info/cosmos1..
|
||||
curl localhost:1317/cosmos/group/v1beta1/group_policy_info/cosmos1..
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
@ -1114,25 +1114,25 @@ Example Output:
|
|||
}
|
||||
```
|
||||
|
||||
### GroupAccountsByGroup
|
||||
### GroupPolicysByGroup
|
||||
|
||||
The `GroupAccountsByGroup` endpoint allows users to query for group accounts by group id with pagination flags.
|
||||
The `GroupPolicysByGroup` endpoint allows users to query for group policies by group id with pagination flags.
|
||||
|
||||
```bash
|
||||
/cosmos/group/v1beta1/group_accounts_by_group/{group_id}
|
||||
/cosmos/group/v1beta1/group_policies_by_group/{group_id}
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
curl localhost:1317/cosmos/group/v1beta1/group_accounts_by_group/1
|
||||
curl localhost:1317/cosmos/group/v1beta1/group_policies_by_group/1
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
||||
```bash
|
||||
{
|
||||
"group_accounts": [
|
||||
"group_policies": [
|
||||
{
|
||||
"address": "cosmos1..",
|
||||
"group_id": "1",
|
||||
|
@ -1165,25 +1165,25 @@ Example Output:
|
|||
}
|
||||
```
|
||||
|
||||
### GroupAccountsByAdmin
|
||||
### GroupPolicysByAdmin
|
||||
|
||||
The `GroupAccountsByAdmin` endpoint allows users to query for group accounts by admin account address with pagination flags.
|
||||
The `GroupPolicysByAdmin` endpoint allows users to query for group policies by admin account address with pagination flags.
|
||||
|
||||
```bash
|
||||
/cosmos/group/v1beta1/group_accounts_by_admin/{admin}
|
||||
/cosmos/group/v1beta1/group_policies_by_admin/{admin}
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
curl localhost:1317/cosmos/group/v1beta1/group_accounts_by_admin/cosmos1..
|
||||
curl localhost:1317/cosmos/group/v1beta1/group_policies_by_admin/cosmos1..
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
||||
```bash
|
||||
{
|
||||
"group_accounts": [
|
||||
"group_policies": [
|
||||
{
|
||||
"address": "cosmos1..",
|
||||
"group_id": "1",
|
||||
|
@ -1242,7 +1242,7 @@ Example Output:
|
|||
],
|
||||
"submitted_at": "2021-12-17T07:06:26.310638964Z",
|
||||
"group_version": "1",
|
||||
"group_account_version": "1",
|
||||
"group_policy_version": "1",
|
||||
"status": "STATUS_SUBMITTED",
|
||||
"result": "RESULT_UNFINALIZED",
|
||||
"vote_state": {
|
||||
|
@ -1270,18 +1270,18 @@ Example Output:
|
|||
}
|
||||
```
|
||||
|
||||
### ProposalsByGroupAccount
|
||||
### ProposalsByGroupPolicy
|
||||
|
||||
The `ProposalsByGroupAccount` endpoint allows users to query for proposals by group account address with pagination flags.
|
||||
The `ProposalsByGroupPolicy` endpoint allows users to query for proposals by account address of group policy with pagination flags.
|
||||
|
||||
```bash
|
||||
/cosmos/group/v1beta1/proposals_by_group_account/{address}
|
||||
/cosmos/group/v1beta1/proposals_by_group_policy/{address}
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
curl localhost:1317/cosmos/group/v1beta1/proposals_by_group_account/cosmos1..
|
||||
curl localhost:1317/cosmos/group/v1beta1/proposals_by_group_policy/cosmos1..
|
||||
```
|
||||
|
||||
Example Output:
|
||||
|
@ -1298,7 +1298,7 @@ Example Output:
|
|||
],
|
||||
"submitted_at": "2021-12-17T08:03:27.099649352Z",
|
||||
"group_version": "1",
|
||||
"group_account_version": "1",
|
||||
"group_policy_version": "1",
|
||||
"status": "STATUS_CLOSED",
|
||||
"result": "RESULT_ACCEPTED",
|
||||
"vote_state": {
|
||||
|
|
660
x/group/tx.pb.go
660
x/group/tx.pb.go
File diff suppressed because it is too large
Load Diff
|
@ -118,12 +118,12 @@ func (p *ThresholdDecisionPolicy) Validate(g GroupInfo) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var _ orm.Validateable = GroupAccountInfo{}
|
||||
var _ orm.Validateable = GroupPolicyInfo{}
|
||||
|
||||
// NewGroupAccountInfo creates a new GroupAccountInfo instance
|
||||
func NewGroupAccountInfo(address sdk.AccAddress, group uint64, admin sdk.AccAddress, metadata []byte,
|
||||
version uint64, decisionPolicy DecisionPolicy) (GroupAccountInfo, error) {
|
||||
p := GroupAccountInfo{
|
||||
// NewGroupPolicyInfo creates a new GroupPolicyInfo instance
|
||||
func NewGroupPolicyInfo(address sdk.AccAddress, group uint64, admin sdk.AccAddress, metadata []byte,
|
||||
version uint64, decisionPolicy DecisionPolicy) (GroupPolicyInfo, error) {
|
||||
p := GroupPolicyInfo{
|
||||
Address: address.String(),
|
||||
GroupId: group,
|
||||
Admin: admin.String(),
|
||||
|
@ -133,13 +133,13 @@ func NewGroupAccountInfo(address sdk.AccAddress, group uint64, admin sdk.AccAddr
|
|||
|
||||
err := p.SetDecisionPolicy(decisionPolicy)
|
||||
if err != nil {
|
||||
return GroupAccountInfo{}, err
|
||||
return GroupPolicyInfo{}, err
|
||||
}
|
||||
|
||||
return p, nil
|
||||
}
|
||||
|
||||
func (g *GroupAccountInfo) SetDecisionPolicy(decisionPolicy DecisionPolicy) error {
|
||||
func (g *GroupPolicyInfo) SetDecisionPolicy(decisionPolicy DecisionPolicy) error {
|
||||
msg, ok := decisionPolicy.(proto.Message)
|
||||
if !ok {
|
||||
return fmt.Errorf("can't proto marshal %T", msg)
|
||||
|
@ -152,7 +152,7 @@ func (g *GroupAccountInfo) SetDecisionPolicy(decisionPolicy DecisionPolicy) erro
|
|||
return nil
|
||||
}
|
||||
|
||||
func (g GroupAccountInfo) GetDecisionPolicy() DecisionPolicy {
|
||||
func (g GroupPolicyInfo) GetDecisionPolicy() DecisionPolicy {
|
||||
decisionPolicy, ok := g.DecisionPolicy.GetCachedValue().(DecisionPolicy)
|
||||
if !ok {
|
||||
return nil
|
||||
|
@ -161,12 +161,12 @@ func (g GroupAccountInfo) GetDecisionPolicy() DecisionPolicy {
|
|||
}
|
||||
|
||||
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
|
||||
func (g GroupAccountInfo) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
func (g GroupPolicyInfo) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
var decisionPolicy DecisionPolicy
|
||||
return unpacker.UnpackAny(g.DecisionPolicy, &decisionPolicy)
|
||||
}
|
||||
|
||||
func (g GroupAccountInfo) PrimaryKeyFields() []interface{} {
|
||||
func (g GroupPolicyInfo) PrimaryKeyFields() []interface{} {
|
||||
addr, err := sdk.AccAddressFromBech32(g.Address)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -174,7 +174,7 @@ func (g GroupAccountInfo) PrimaryKeyFields() []interface{} {
|
|||
return []interface{}{addr.Bytes()}
|
||||
}
|
||||
|
||||
func (g GroupAccountInfo) ValidateBasic() error {
|
||||
func (g GroupPolicyInfo) ValidateBasic() error {
|
||||
_, err := sdk.AccAddressFromBech32(g.Admin)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "admin")
|
||||
|
@ -182,7 +182,7 @@ func (g GroupAccountInfo) ValidateBasic() error {
|
|||
|
||||
_, err = sdk.AccAddressFromBech32(g.Address)
|
||||
if err != nil {
|
||||
return sdkerrors.Wrap(err, "group account")
|
||||
return sdkerrors.Wrap(err, "group policy")
|
||||
}
|
||||
|
||||
if g.GroupId == 0 {
|
||||
|
@ -232,16 +232,16 @@ func (v Vote) PrimaryKeyFields() []interface{} {
|
|||
}
|
||||
|
||||
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
|
||||
func (q QueryGroupAccountsByGroupResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
return unpackGroupAccounts(unpacker, q.GroupAccounts)
|
||||
func (q QueryGroupPoliciesByGroupResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
return unpackGroupPolicies(unpacker, q.GroupPolicies)
|
||||
}
|
||||
|
||||
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
|
||||
func (q QueryGroupAccountsByAdminResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
return unpackGroupAccounts(unpacker, q.GroupAccounts)
|
||||
func (q QueryGroupPoliciesByAdminResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
return unpackGroupPolicies(unpacker, q.GroupPolicies)
|
||||
}
|
||||
|
||||
func unpackGroupAccounts(unpacker codectypes.AnyUnpacker, accs []*GroupAccountInfo) error {
|
||||
func unpackGroupPolicies(unpacker codectypes.AnyUnpacker, accs []*GroupPolicyInfo) error {
|
||||
for _, g := range accs {
|
||||
err := g.UnpackInterfaces(unpacker)
|
||||
if err != nil {
|
||||
|
|
|
@ -486,35 +486,35 @@ func (m *GroupMember) GetMember() *Member {
|
|||
return nil
|
||||
}
|
||||
|
||||
// GroupAccountInfo represents the high-level on-chain information for a group account.
|
||||
type GroupAccountInfo struct {
|
||||
// address is the group account address.
|
||||
// GroupPolicyInfo represents the high-level on-chain information for a group policy.
|
||||
type GroupPolicyInfo struct {
|
||||
// address is the account address of group policy.
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
|
||||
// group_id is the unique ID of the group.
|
||||
GroupId uint64 `protobuf:"varint,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
|
||||
// admin is the account address of the group admin.
|
||||
Admin string `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"`
|
||||
// metadata is any arbitrary metadata to attached to the group account.
|
||||
// metadata is any arbitrary metadata to attached to the group policy.
|
||||
Metadata []byte `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
// version is used to track changes to a group's GroupAccountInfo structure that
|
||||
// version is used to track changes to a group's GroupPolicyInfo structure that
|
||||
// would create a different result on a running proposal.
|
||||
Version uint64 `protobuf:"varint,5,opt,name=version,proto3" json:"version,omitempty"`
|
||||
// decision_policy specifies the group account's decision policy.
|
||||
// decision_policy specifies the group policy's decision policy.
|
||||
DecisionPolicy *types.Any `protobuf:"bytes,6,opt,name=decision_policy,json=decisionPolicy,proto3" json:"decision_policy,omitempty"`
|
||||
}
|
||||
|
||||
func (m *GroupAccountInfo) Reset() { *m = GroupAccountInfo{} }
|
||||
func (m *GroupAccountInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*GroupAccountInfo) ProtoMessage() {}
|
||||
func (*GroupAccountInfo) Descriptor() ([]byte, []int) {
|
||||
func (m *GroupPolicyInfo) Reset() { *m = GroupPolicyInfo{} }
|
||||
func (m *GroupPolicyInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*GroupPolicyInfo) ProtoMessage() {}
|
||||
func (*GroupPolicyInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e091dfce5c49c8b6, []int{5}
|
||||
}
|
||||
func (m *GroupAccountInfo) XXX_Unmarshal(b []byte) error {
|
||||
func (m *GroupPolicyInfo) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *GroupAccountInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
func (m *GroupPolicyInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_GroupAccountInfo.Marshal(b, m, deterministic)
|
||||
return xxx_messageInfo_GroupPolicyInfo.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
|
@ -524,26 +524,26 @@ func (m *GroupAccountInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, er
|
|||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *GroupAccountInfo) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GroupAccountInfo.Merge(m, src)
|
||||
func (m *GroupPolicyInfo) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GroupPolicyInfo.Merge(m, src)
|
||||
}
|
||||
func (m *GroupAccountInfo) XXX_Size() int {
|
||||
func (m *GroupPolicyInfo) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *GroupAccountInfo) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GroupAccountInfo.DiscardUnknown(m)
|
||||
func (m *GroupPolicyInfo) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GroupPolicyInfo.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GroupAccountInfo proto.InternalMessageInfo
|
||||
var xxx_messageInfo_GroupPolicyInfo proto.InternalMessageInfo
|
||||
|
||||
// Proposal defines a group proposal. Any member of a group can submit a proposal
|
||||
// for a group account to decide upon.
|
||||
// for a group policy to decide upon.
|
||||
// A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal
|
||||
// passes as well as some optional metadata associated with the proposal.
|
||||
type Proposal struct {
|
||||
// proposal_id is the unique id of the proposal.
|
||||
ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
|
||||
// address is the group account address.
|
||||
// address is the account address of group policy.
|
||||
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
|
||||
// metadata is any arbitrary metadata to attached to the proposal.
|
||||
Metadata []byte `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
|
@ -554,9 +554,9 @@ type Proposal struct {
|
|||
// group_version tracks the version of the group that this proposal corresponds to.
|
||||
// When group membership is changed, existing proposals from previous group versions will become invalid.
|
||||
GroupVersion uint64 `protobuf:"varint,6,opt,name=group_version,json=groupVersion,proto3" json:"group_version,omitempty"`
|
||||
// group_account_version tracks the version of the group account that this proposal corresponds to.
|
||||
// group_policy_version tracks the version of the group policy that this proposal corresponds to.
|
||||
// When a decision policy is changed, existing proposals from previous policy versions will become invalid.
|
||||
GroupAccountVersion uint64 `protobuf:"varint,7,opt,name=group_account_version,json=groupAccountVersion,proto3" json:"group_account_version,omitempty"`
|
||||
GroupPolicyVersion uint64 `protobuf:"varint,7,opt,name=group_policy_version,json=groupPolicyVersion,proto3" json:"group_policy_version,omitempty"`
|
||||
// Status represents the high level position in the life cycle of the proposal. Initial value is Submitted.
|
||||
Status Proposal_Status `protobuf:"varint,8,opt,name=status,proto3,enum=cosmos.group.v1beta1.Proposal_Status" json:"status,omitempty"`
|
||||
// result is the final result based on the votes and election rule. Initial value is unfinalized.
|
||||
|
@ -744,7 +744,7 @@ func init() {
|
|||
proto.RegisterType((*ThresholdDecisionPolicy)(nil), "cosmos.group.v1beta1.ThresholdDecisionPolicy")
|
||||
proto.RegisterType((*GroupInfo)(nil), "cosmos.group.v1beta1.GroupInfo")
|
||||
proto.RegisterType((*GroupMember)(nil), "cosmos.group.v1beta1.GroupMember")
|
||||
proto.RegisterType((*GroupAccountInfo)(nil), "cosmos.group.v1beta1.GroupAccountInfo")
|
||||
proto.RegisterType((*GroupPolicyInfo)(nil), "cosmos.group.v1beta1.GroupPolicyInfo")
|
||||
proto.RegisterType((*Proposal)(nil), "cosmos.group.v1beta1.Proposal")
|
||||
proto.RegisterType((*Tally)(nil), "cosmos.group.v1beta1.Tally")
|
||||
proto.RegisterType((*Vote)(nil), "cosmos.group.v1beta1.Vote")
|
||||
|
@ -753,98 +753,97 @@ func init() {
|
|||
func init() { proto.RegisterFile("cosmos/group/v1beta1/types.proto", fileDescriptor_e091dfce5c49c8b6) }
|
||||
|
||||
var fileDescriptor_e091dfce5c49c8b6 = []byte{
|
||||
// 1285 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6f, 0x1b, 0xc5,
|
||||
0x17, 0xf7, 0xda, 0x8e, 0x7f, 0x3c, 0x27, 0x8e, 0x35, 0xdf, 0xb4, 0x75, 0x9c, 0xd6, 0xd9, 0xba,
|
||||
0x5f, 0xa4, 0x08, 0x14, 0x5b, 0x09, 0x3f, 0x0e, 0x15, 0xad, 0xb0, 0x37, 0x9b, 0x62, 0x94, 0xda,
|
||||
0x61, 0x77, 0x1d, 0xa0, 0x07, 0xac, 0xf5, 0xee, 0xd4, 0x59, 0xb0, 0x77, 0xac, 0xdd, 0xd9, 0x50,
|
||||
0xf3, 0x17, 0x14, 0x9f, 0x7a, 0x84, 0x83, 0xa5, 0x4a, 0x70, 0xe1, 0xc4, 0xa5, 0x7f, 0x44, 0xc5,
|
||||
0xa9, 0xe2, 0x84, 0x38, 0x00, 0x6a, 0x2f, 0x9c, 0xf9, 0x0b, 0xd0, 0xce, 0xcc, 0x36, 0x71, 0xeb,
|
||||
0xba, 0x2d, 0xe2, 0xe4, 0x7d, 0xf3, 0x3e, 0x9f, 0x79, 0xef, 0x7d, 0xe6, 0xcd, 0x0f, 0x83, 0x6c,
|
||||
0x11, 0x7f, 0x48, 0xfc, 0x5a, 0xdf, 0x23, 0xc1, 0xa8, 0x76, 0xb2, 0xd3, 0xc3, 0xd4, 0xdc, 0xa9,
|
||||
0xd1, 0xf1, 0x08, 0xfb, 0xd5, 0x91, 0x47, 0x28, 0x41, 0x6b, 0x1c, 0x51, 0x65, 0x88, 0xaa, 0x40,
|
||||
0x94, 0xd6, 0xfa, 0xa4, 0x4f, 0x18, 0xa0, 0x16, 0x7e, 0x71, 0x6c, 0xa9, 0xdc, 0x27, 0xa4, 0x3f,
|
||||
0xc0, 0x35, 0x66, 0xf5, 0x82, 0xdb, 0x35, 0x3b, 0xf0, 0x4c, 0xea, 0x10, 0x57, 0xf8, 0x37, 0x9f,
|
||||
0xf5, 0x53, 0x67, 0x88, 0x7d, 0x6a, 0x0e, 0x47, 0x02, 0xb0, 0xce, 0x83, 0x75, 0xf9, 0xcc, 0x22,
|
||||
0xb2, 0x70, 0x3d, 0xcb, 0x35, 0xdd, 0x31, 0x77, 0x55, 0x46, 0x90, 0xba, 0x89, 0x87, 0x3d, 0xec,
|
||||
0xa1, 0x5d, 0x48, 0x9b, 0xb6, 0xed, 0x61, 0xdf, 0x2f, 0x4a, 0xb2, 0xb4, 0x95, 0x6d, 0x14, 0x7f,
|
||||
0x79, 0xb0, 0x1d, 0x55, 0x50, 0xe7, 0x1e, 0x9d, 0x7a, 0x8e, 0xdb, 0xd7, 0x22, 0x20, 0x3a, 0x0f,
|
||||
0xa9, 0xaf, 0xb0, 0xd3, 0x3f, 0xa6, 0xc5, 0x78, 0x48, 0xd1, 0x84, 0x85, 0x4a, 0x90, 0x19, 0x62,
|
||||
0x6a, 0xda, 0x26, 0x35, 0x8b, 0x09, 0x59, 0xda, 0x5a, 0xd6, 0x9e, 0xda, 0x95, 0x1b, 0x90, 0xe6,
|
||||
0x11, 0x7d, 0xf4, 0x3e, 0xa4, 0x87, 0xfc, 0xb3, 0x28, 0xc9, 0x89, 0xad, 0xdc, 0xee, 0xc5, 0xea,
|
||||
0x3c, 0xc5, 0xaa, 0x1c, 0xdf, 0x48, 0x3e, 0xfc, 0x7d, 0x33, 0xa6, 0x45, 0x94, 0xca, 0x44, 0x82,
|
||||
0x0b, 0xc6, 0xb1, 0x87, 0xfd, 0x63, 0x32, 0xb0, 0xf7, 0xb0, 0xe5, 0xf8, 0x0e, 0x71, 0x0f, 0xc9,
|
||||
0xc0, 0xb1, 0xc6, 0xe8, 0x22, 0x64, 0x69, 0xe4, 0xe2, 0xe5, 0x68, 0xa7, 0x03, 0xe8, 0x1a, 0xa4,
|
||||
0x43, 0xf5, 0x48, 0xc0, 0xf3, 0xce, 0xed, 0xae, 0x57, 0xb9, 0x42, 0xd5, 0x48, 0xa1, 0xea, 0x9e,
|
||||
0x50, 0xbf, 0x91, 0x09, 0x83, 0x7e, 0xfb, 0xc7, 0xa6, 0xa4, 0x45, 0x9c, 0xab, 0xe8, 0xe7, 0x07,
|
||||
0xdb, 0xf9, 0xd9, 0x80, 0x95, 0x9f, 0x24, 0xc8, 0xde, 0x08, 0x93, 0x6e, 0xba, 0xb7, 0x09, 0x5a,
|
||||
0x87, 0x0c, 0xab, 0xa0, 0xeb, 0xf0, 0xe8, 0x49, 0x2d, 0xcd, 0xec, 0xa6, 0x8d, 0xaa, 0xb0, 0x64,
|
||||
0xda, 0x43, 0xc7, 0xe5, 0x8a, 0x2d, 0x10, 0x99, 0xc3, 0x16, 0x49, 0x89, 0x8a, 0x90, 0x3e, 0xc1,
|
||||
0x5e, 0x98, 0x45, 0x31, 0xc9, 0xa3, 0x08, 0x13, 0x5d, 0x86, 0x65, 0x4a, 0xa8, 0x39, 0xe8, 0x8a,
|
||||
0xe5, 0x59, 0x62, 0x12, 0xe4, 0xd8, 0xd8, 0x27, 0x6c, 0xa8, 0xf2, 0x39, 0xe4, 0x58, 0xc2, 0x62,
|
||||
0xf9, 0x17, 0xa4, 0xfc, 0x0e, 0xa4, 0xb8, 0xe6, 0x42, 0xad, 0x85, 0xab, 0xa4, 0x09, 0x6c, 0xe5,
|
||||
0x87, 0x38, 0x14, 0x58, 0x80, 0xba, 0x65, 0x91, 0xc0, 0xa5, 0x4c, 0x98, 0x7f, 0xd3, 0x64, 0x67,
|
||||
0x33, 0x8b, 0xbf, 0x40, 0xcc, 0xc4, 0xeb, 0x8b, 0x99, 0x7c, 0xb1, 0x98, 0x4b, 0xb3, 0x62, 0x7e,
|
||||
0x0c, 0xab, 0xb6, 0x58, 0xed, 0xee, 0x88, 0x2d, 0x77, 0x31, 0xc5, 0x84, 0x58, 0x7b, 0xae, 0x6d,
|
||||
0xea, 0xee, 0xb8, 0x31, 0xa7, 0x3d, 0xb4, 0xbc, 0x3d, 0x63, 0x5f, 0xcd, 0xdc, 0xbd, 0xbf, 0x19,
|
||||
0xfb, 0xeb, 0xfe, 0xa6, 0x54, 0xf9, 0x31, 0x07, 0x99, 0x43, 0x8f, 0x8c, 0x88, 0x6f, 0x0e, 0xd0,
|
||||
0x26, 0xe4, 0x46, 0xe2, 0xfb, 0x74, 0x1d, 0x20, 0x1a, 0x6a, 0xda, 0x67, 0xf5, 0x8b, 0xbf, 0xaa,
|
||||
0x7e, 0x8b, 0x3a, 0xe8, 0x3d, 0xc8, 0xf2, 0xd9, 0xc3, 0x3d, 0x98, 0x94, 0x13, 0x0b, 0x67, 0x3c,
|
||||
0x85, 0xa2, 0x1b, 0xb0, 0xec, 0x07, 0xbd, 0xa1, 0x43, 0x29, 0xb6, 0xbb, 0x26, 0xef, 0xaf, 0xdc,
|
||||
0x6e, 0xe9, 0x39, 0x3d, 0x8c, 0xe8, 0x90, 0xe2, 0xfb, 0xe8, 0x5e, 0xb8, 0x8f, 0x72, 0x4f, 0x99,
|
||||
0x75, 0x8a, 0xae, 0xc0, 0x0a, 0x5f, 0xdc, 0x48, 0xfb, 0x14, 0xab, 0x79, 0x99, 0x0d, 0x1e, 0x89,
|
||||
0x05, 0xd8, 0x85, 0x73, 0x1c, 0x64, 0xf2, 0x56, 0x7a, 0x0a, 0x4e, 0x33, 0xf0, 0xff, 0xfa, 0x67,
|
||||
0xda, 0x2c, 0xe2, 0x5c, 0x83, 0x94, 0x4f, 0x4d, 0x1a, 0xf8, 0xc5, 0x8c, 0x2c, 0x6d, 0xe5, 0x77,
|
||||
0xdf, 0x98, 0xdf, 0xb4, 0x91, 0xf4, 0x55, 0x9d, 0x81, 0x35, 0x41, 0x0a, 0xe9, 0x1e, 0xf6, 0x83,
|
||||
0x01, 0x2d, 0x66, 0x5f, 0x89, 0xae, 0x31, 0xb0, 0x26, 0x48, 0xe8, 0x03, 0x80, 0x13, 0x42, 0x71,
|
||||
0x37, 0x9c, 0x0d, 0x17, 0x81, 0xa9, 0xb3, 0x31, 0x7f, 0x0a, 0xc3, 0x1c, 0x0c, 0xc6, 0xe2, 0x6c,
|
||||
0xcb, 0x86, 0xa4, 0x30, 0x13, 0x8c, 0xae, 0x9f, 0x9e, 0x51, 0xb9, 0xd7, 0x10, 0x37, 0x22, 0xa1,
|
||||
0x23, 0x58, 0xc5, 0x77, 0xb0, 0x15, 0x50, 0xe2, 0x75, 0x45, 0x25, 0xcb, 0xac, 0x92, 0xed, 0x97,
|
||||
0x54, 0xa2, 0x0a, 0x96, 0xa8, 0x28, 0x8f, 0x67, 0x6c, 0xb4, 0x05, 0xc9, 0xa1, 0xdf, 0xf7, 0x8b,
|
||||
0x2b, 0xec, 0xc0, 0x9e, 0xbb, 0x03, 0x34, 0x86, 0xa8, 0x3c, 0x92, 0x20, 0xc5, 0x55, 0x45, 0x3b,
|
||||
0x80, 0x74, 0xa3, 0x6e, 0x74, 0xf4, 0x6e, 0xa7, 0xa5, 0x1f, 0xaa, 0x4a, 0x73, 0xbf, 0xa9, 0xee,
|
||||
0x15, 0x62, 0xa5, 0xf5, 0xc9, 0x54, 0x3e, 0x17, 0x45, 0xe6, 0xd8, 0xa6, 0x7b, 0x62, 0x0e, 0x1c,
|
||||
0x1b, 0xed, 0x40, 0x41, 0x50, 0xf4, 0x4e, 0xe3, 0x66, 0xd3, 0x30, 0xd4, 0xbd, 0x82, 0x54, 0xda,
|
||||
0x98, 0x4c, 0xe5, 0x0b, 0xb3, 0x04, 0x3d, 0xea, 0x26, 0xf4, 0x16, 0xac, 0x08, 0x8a, 0x72, 0xd0,
|
||||
0xd6, 0xd5, 0xbd, 0x42, 0xbc, 0x54, 0x9c, 0x4c, 0xe5, 0xb5, 0x59, 0xbc, 0x32, 0x20, 0x3e, 0xb6,
|
||||
0xd1, 0x36, 0xe4, 0x05, 0xb8, 0xde, 0x68, 0x6b, 0xe1, 0xec, 0x89, 0x79, 0xe9, 0xd4, 0x7b, 0xc4,
|
||||
0xa3, 0xd8, 0x2e, 0x25, 0xef, 0x7e, 0x5f, 0x8e, 0x55, 0x7e, 0x93, 0x20, 0x25, 0x74, 0xd8, 0x01,
|
||||
0xa4, 0xa9, 0x7a, 0xe7, 0xc0, 0x58, 0x54, 0x12, 0xc7, 0x46, 0x25, 0xbd, 0x7b, 0x86, 0xb2, 0xdf,
|
||||
0x6c, 0xd5, 0x0f, 0x9a, 0xb7, 0x58, 0x51, 0x97, 0x26, 0x53, 0x79, 0x7d, 0x96, 0xd2, 0x71, 0x6f,
|
||||
0x3b, 0xae, 0x39, 0x70, 0xbe, 0xc6, 0x36, 0xaa, 0xc1, 0xaa, 0xa0, 0xd5, 0x15, 0x45, 0x3d, 0x34,
|
||||
0x58, 0x61, 0xa5, 0xc9, 0x54, 0x3e, 0x3f, 0xcb, 0xa9, 0x5b, 0x16, 0x1e, 0xd1, 0x19, 0x82, 0xa6,
|
||||
0x7e, 0xa4, 0x2a, 0xbc, 0xb6, 0x39, 0x04, 0x0d, 0x7f, 0x81, 0xad, 0xd3, 0xe2, 0xbe, 0x8b, 0x43,
|
||||
0x7e, 0x76, 0xf1, 0x51, 0x03, 0x36, 0xd4, 0x4f, 0x55, 0xa5, 0x63, 0xb4, 0xb5, 0xee, 0xdc, 0x6a,
|
||||
0x2f, 0x4f, 0xa6, 0xf2, 0xa5, 0x68, 0xd6, 0x59, 0x72, 0x54, 0xf5, 0x35, 0xb8, 0xf0, 0xec, 0x1c,
|
||||
0xad, 0xb6, 0xd1, 0xd5, 0x3a, 0xad, 0x82, 0x54, 0x92, 0x27, 0x53, 0xf9, 0xe2, 0x7c, 0x7e, 0x8b,
|
||||
0x50, 0x2d, 0x70, 0xd1, 0xf5, 0xe7, 0xe9, 0x7a, 0x47, 0x51, 0x54, 0x5d, 0x2f, 0xc4, 0x17, 0x85,
|
||||
0xd7, 0x03, 0xcb, 0x0a, 0x4f, 0xbf, 0x39, 0xfc, 0xfd, 0x7a, 0xf3, 0xa0, 0xa3, 0xa9, 0x85, 0xc4,
|
||||
0x22, 0xfe, 0xbe, 0xe9, 0x0c, 0x02, 0x0f, 0x73, 0x6d, 0xae, 0x26, 0xc3, 0xf3, 0xba, 0xf2, 0x8d,
|
||||
0x04, 0x4b, 0x6c, 0xbb, 0xa2, 0x0d, 0xc8, 0x8e, 0xb1, 0xdf, 0x65, 0x27, 0x8e, 0x78, 0x5f, 0x64,
|
||||
0xc6, 0xd8, 0x57, 0x42, 0x3b, 0xbc, 0xb0, 0x5c, 0x22, 0x7c, 0xfc, 0x5d, 0x94, 0x76, 0x09, 0x77,
|
||||
0x5d, 0x81, 0x15, 0xb3, 0xe7, 0x53, 0xd3, 0x71, 0x85, 0x9f, 0x5d, 0x5c, 0xda, 0xb2, 0x18, 0xe4,
|
||||
0xa0, 0x4b, 0x00, 0x27, 0x98, 0x46, 0x33, 0x24, 0xf9, 0xeb, 0x25, 0x1c, 0x61, 0x6e, 0x91, 0xcb,
|
||||
0xdf, 0x12, 0x24, 0x8f, 0x08, 0xc5, 0x2f, 0xbf, 0x33, 0xaa, 0xb0, 0x14, 0x1e, 0x2b, 0xde, 0xcb,
|
||||
0x5f, 0x1c, 0x0c, 0x16, 0x5e, 0xf7, 0xd6, 0x31, 0x71, 0x2c, 0xcc, 0x92, 0xcb, 0xbf, 0xe8, 0xba,
|
||||
0x57, 0x18, 0x46, 0x13, 0xd8, 0x85, 0x57, 0xeb, 0x7f, 0x75, 0x5b, 0xbc, 0x69, 0x43, 0x8a, 0x87,
|
||||
0x45, 0xe7, 0x01, 0x29, 0x1f, 0xb6, 0x9b, 0x8a, 0x3a, 0xdb, 0x90, 0x68, 0x05, 0xb2, 0x62, 0xbc,
|
||||
0xd5, 0x2e, 0x48, 0x28, 0x0f, 0x20, 0xcc, 0xcf, 0x54, 0xbd, 0x10, 0x47, 0x08, 0xf2, 0xc2, 0xae,
|
||||
0x37, 0x74, 0xa3, 0xde, 0x6c, 0x15, 0x12, 0x68, 0x15, 0x72, 0x62, 0xec, 0x48, 0x35, 0xda, 0x85,
|
||||
0x64, 0xe3, 0xfa, 0xc3, 0xc7, 0x65, 0xe9, 0xd1, 0xe3, 0xb2, 0xf4, 0xe7, 0xe3, 0xb2, 0x74, 0xef,
|
||||
0x49, 0x39, 0xf6, 0xe8, 0x49, 0x39, 0xf6, 0xeb, 0x93, 0x72, 0xec, 0xd6, 0xff, 0xfb, 0x0e, 0x3d,
|
||||
0x0e, 0x7a, 0x55, 0x8b, 0x0c, 0xc5, 0x0b, 0x5b, 0xfc, 0x6c, 0xfb, 0xf6, 0x97, 0xb5, 0x3b, 0xfc,
|
||||
0xaf, 0x40, 0x2f, 0xc5, 0x0a, 0x7a, 0xfb, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x88, 0x0e,
|
||||
0x45, 0x21, 0x0c, 0x00, 0x00,
|
||||
// 1278 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4d, 0x6f, 0x1b, 0x45,
|
||||
0x18, 0xf6, 0xda, 0x8e, 0x3f, 0x5e, 0x27, 0x8e, 0x35, 0x0a, 0xad, 0xe3, 0xb4, 0xce, 0xd6, 0x05,
|
||||
0x29, 0x02, 0xc5, 0x26, 0xe1, 0xe3, 0x50, 0xd1, 0x0a, 0x7b, 0xb3, 0x29, 0x46, 0xa9, 0x1d, 0x76,
|
||||
0xd7, 0x01, 0x7a, 0xc0, 0x5a, 0xef, 0x4e, 0x9d, 0x05, 0x7b, 0xc7, 0xda, 0x9d, 0x0d, 0x35, 0xbf,
|
||||
0xa0, 0xf8, 0xd4, 0x23, 0x1c, 0x2c, 0x55, 0xea, 0x81, 0x23, 0x97, 0xfe, 0x88, 0x8a, 0x53, 0xc5,
|
||||
0x09, 0x71, 0x00, 0xd4, 0x5e, 0x38, 0xf3, 0x0b, 0xd0, 0xce, 0xcc, 0x36, 0x75, 0xeb, 0x3a, 0x2d,
|
||||
0xe2, 0x14, 0xbf, 0xf3, 0x3e, 0xcf, 0xfb, 0xf1, 0xcc, 0xbb, 0x33, 0x13, 0x90, 0x2d, 0xe2, 0x0f,
|
||||
0x89, 0x5f, 0xeb, 0x7b, 0x24, 0x18, 0xd5, 0x4e, 0x76, 0x7a, 0x98, 0x9a, 0x3b, 0x35, 0x3a, 0x1e,
|
||||
0x61, 0xbf, 0x3a, 0xf2, 0x08, 0x25, 0x68, 0x8d, 0x23, 0xaa, 0x0c, 0x51, 0x15, 0x88, 0xd2, 0x5a,
|
||||
0x9f, 0xf4, 0x09, 0x03, 0xd4, 0xc2, 0x5f, 0x1c, 0x5b, 0x2a, 0xf7, 0x09, 0xe9, 0x0f, 0x70, 0x8d,
|
||||
0x59, 0xbd, 0xe0, 0x56, 0xcd, 0x0e, 0x3c, 0x93, 0x3a, 0xc4, 0x15, 0xfe, 0xcd, 0xe7, 0xfd, 0xd4,
|
||||
0x19, 0x62, 0x9f, 0x9a, 0xc3, 0x91, 0x00, 0xac, 0xf3, 0x64, 0x5d, 0x1e, 0x59, 0x64, 0x16, 0xae,
|
||||
0xe7, 0xb9, 0xa6, 0x3b, 0xe6, 0xae, 0xca, 0x08, 0x52, 0x37, 0xf0, 0xb0, 0x87, 0x3d, 0xb4, 0x0b,
|
||||
0x69, 0xd3, 0xb6, 0x3d, 0xec, 0xfb, 0x45, 0x49, 0x96, 0xb6, 0xb2, 0x8d, 0xe2, 0xaf, 0x0f, 0xb6,
|
||||
0xa3, 0x0e, 0xea, 0xdc, 0xa3, 0x53, 0xcf, 0x71, 0xfb, 0x5a, 0x04, 0x44, 0xe7, 0x20, 0xf5, 0x2d,
|
||||
0x76, 0xfa, 0xc7, 0xb4, 0x18, 0x0f, 0x29, 0x9a, 0xb0, 0x50, 0x09, 0x32, 0x43, 0x4c, 0x4d, 0xdb,
|
||||
0xa4, 0x66, 0x31, 0x21, 0x4b, 0x5b, 0xcb, 0xda, 0x53, 0xbb, 0x72, 0x1d, 0xd2, 0x3c, 0xa3, 0x8f,
|
||||
0x3e, 0x82, 0xf4, 0x90, 0xff, 0x2c, 0x4a, 0x72, 0x62, 0x2b, 0xb7, 0x7b, 0xa1, 0x3a, 0x4f, 0xb1,
|
||||
0x2a, 0xc7, 0x37, 0x92, 0x0f, 0xff, 0xd8, 0x8c, 0x69, 0x11, 0xa5, 0x32, 0x91, 0xe0, 0xbc, 0x71,
|
||||
0xec, 0x61, 0xff, 0x98, 0x0c, 0xec, 0x3d, 0x6c, 0x39, 0xbe, 0x43, 0xdc, 0x43, 0x32, 0x70, 0xac,
|
||||
0x31, 0xba, 0x00, 0x59, 0x1a, 0xb9, 0x78, 0x3b, 0xda, 0xe9, 0x02, 0xba, 0x0a, 0xe9, 0x50, 0x3d,
|
||||
0x12, 0xf0, 0xba, 0x73, 0xbb, 0xeb, 0x55, 0xae, 0x50, 0x35, 0x52, 0xa8, 0xba, 0x27, 0xd4, 0x6f,
|
||||
0x64, 0xc2, 0xa4, 0x3f, 0xfc, 0xb9, 0x29, 0x69, 0x11, 0xe7, 0x0a, 0xfa, 0xe5, 0xc1, 0x76, 0x7e,
|
||||
0x36, 0x61, 0xe5, 0x67, 0x09, 0xb2, 0xd7, 0xc3, 0xa2, 0x9b, 0xee, 0x2d, 0x82, 0xd6, 0x21, 0xc3,
|
||||
0x3a, 0xe8, 0x3a, 0x3c, 0x7b, 0x52, 0x4b, 0x33, 0xbb, 0x69, 0xa3, 0x2a, 0x2c, 0x99, 0xf6, 0xd0,
|
||||
0x71, 0xb9, 0x62, 0x0b, 0x44, 0xe6, 0xb0, 0x45, 0x52, 0xa2, 0x22, 0xa4, 0x4f, 0xb0, 0x17, 0x56,
|
||||
0x51, 0x4c, 0xf2, 0x2c, 0xc2, 0x44, 0x97, 0x60, 0x99, 0x12, 0x6a, 0x0e, 0xba, 0x62, 0x7b, 0x96,
|
||||
0x98, 0x04, 0x39, 0xb6, 0xf6, 0x39, 0x5b, 0xaa, 0x7c, 0x05, 0x39, 0x56, 0xb0, 0xd8, 0xfe, 0x05,
|
||||
0x25, 0xbf, 0x0f, 0x29, 0xae, 0xb9, 0x50, 0x6b, 0xe1, 0x2e, 0x69, 0x02, 0x5b, 0xb9, 0x1f, 0x87,
|
||||
0x55, 0x96, 0x80, 0x2b, 0xc4, 0x74, 0xf9, 0x2f, 0x33, 0xf6, 0x6c, 0x61, 0xf1, 0x97, 0x68, 0x99,
|
||||
0x78, 0x7d, 0x2d, 0x93, 0x2f, 0xd7, 0x72, 0x69, 0x56, 0xcb, 0xcf, 0x60, 0xd5, 0x16, 0x9b, 0xdd,
|
||||
0x1d, 0xb1, 0x5e, 0x8a, 0x29, 0xa6, 0xc3, 0xda, 0x0b, 0x53, 0x53, 0x77, 0xc7, 0x8d, 0x39, 0xd3,
|
||||
0xa1, 0xe5, 0xed, 0x19, 0xfb, 0x4a, 0xe6, 0xce, 0xbd, 0xcd, 0xd8, 0xdf, 0xf7, 0x36, 0xa5, 0xca,
|
||||
0x4f, 0x39, 0xc8, 0x1c, 0x7a, 0x64, 0x44, 0x7c, 0x73, 0x80, 0x36, 0x21, 0x37, 0x12, 0xbf, 0x4f,
|
||||
0xb7, 0x01, 0xa2, 0xa5, 0xa6, 0xfd, 0xac, 0x7e, 0xf1, 0x57, 0xd5, 0x6f, 0xd1, 0x00, 0x7d, 0x08,
|
||||
0x59, 0x1e, 0x3d, 0xfc, 0x04, 0x93, 0x72, 0x62, 0x61, 0xc4, 0x53, 0x28, 0xba, 0x0e, 0xcb, 0x7e,
|
||||
0xd0, 0x1b, 0x3a, 0x94, 0x62, 0xbb, 0x6b, 0xf2, 0xf1, 0xca, 0xed, 0x96, 0x5e, 0xd0, 0xc3, 0x88,
|
||||
0xce, 0x28, 0xfe, 0x19, 0xdd, 0x0d, 0x3f, 0xa3, 0xdc, 0x53, 0x66, 0x9d, 0xa2, 0xcb, 0xb0, 0xc2,
|
||||
0x37, 0x37, 0xd2, 0x3e, 0xc5, 0x7a, 0x5e, 0x66, 0x8b, 0x47, 0x62, 0x03, 0xde, 0x85, 0x35, 0x0e,
|
||||
0xe2, 0xea, 0x3f, 0xc5, 0xa6, 0x19, 0x16, 0xf5, 0x4f, 0x87, 0x2c, 0x62, 0x5c, 0x85, 0x94, 0x4f,
|
||||
0x4d, 0x1a, 0xf8, 0xc5, 0x8c, 0x2c, 0x6d, 0xe5, 0x77, 0xdf, 0x9a, 0x3f, 0xb1, 0x91, 0xf0, 0x55,
|
||||
0x9d, 0x81, 0x35, 0x41, 0x0a, 0xe9, 0x1e, 0xf6, 0x83, 0x01, 0x2d, 0x66, 0x5f, 0x89, 0xae, 0x31,
|
||||
0xb0, 0x26, 0x48, 0xe8, 0x63, 0x80, 0x13, 0x42, 0x71, 0x37, 0x8c, 0x86, 0x8b, 0xc0, 0xb4, 0xd9,
|
||||
0x98, 0x1f, 0xc2, 0x30, 0x07, 0x83, 0xb1, 0x38, 0xd8, 0xb2, 0x21, 0x29, 0xac, 0x04, 0xa3, 0x6b,
|
||||
0xa7, 0x07, 0x54, 0xee, 0x35, 0xa4, 0x8d, 0x48, 0xe8, 0x08, 0x56, 0xf1, 0x6d, 0x6c, 0x05, 0x94,
|
||||
0x78, 0x5d, 0xd1, 0xc9, 0x32, 0xeb, 0x64, 0xfb, 0x8c, 0x4e, 0x54, 0xc1, 0x12, 0x1d, 0xe5, 0xf1,
|
||||
0x8c, 0x8d, 0xb6, 0x20, 0x39, 0xf4, 0xfb, 0x7e, 0x71, 0x85, 0x9d, 0xd6, 0x73, 0xe7, 0x5f, 0x63,
|
||||
0x88, 0xca, 0x23, 0x09, 0x52, 0x5c, 0x55, 0xb4, 0x03, 0x48, 0x37, 0xea, 0x46, 0x47, 0xef, 0x76,
|
||||
0x5a, 0xfa, 0xa1, 0xaa, 0x34, 0xf7, 0x9b, 0xea, 0x5e, 0x21, 0x56, 0x5a, 0x9f, 0x4c, 0xe5, 0x37,
|
||||
0xa2, 0xcc, 0x1c, 0xdb, 0x74, 0x4f, 0xcc, 0x81, 0x63, 0xa3, 0x1d, 0x28, 0x08, 0x8a, 0xde, 0x69,
|
||||
0xdc, 0x68, 0x1a, 0x86, 0xba, 0x57, 0x90, 0x4a, 0x1b, 0x93, 0xa9, 0x7c, 0x7e, 0x96, 0xa0, 0x47,
|
||||
0xb3, 0x84, 0xde, 0x81, 0x15, 0x41, 0x51, 0x0e, 0xda, 0xba, 0xba, 0x57, 0x88, 0x97, 0x8a, 0x93,
|
||||
0xa9, 0xbc, 0x36, 0x8b, 0x57, 0x06, 0xc4, 0xc7, 0x36, 0xda, 0x86, 0xbc, 0x00, 0xd7, 0x1b, 0x6d,
|
||||
0x2d, 0x8c, 0x9e, 0x98, 0x57, 0x4e, 0xbd, 0x47, 0x3c, 0x8a, 0xed, 0x52, 0xf2, 0xce, 0xfd, 0x72,
|
||||
0xac, 0xf2, 0xbb, 0x04, 0x29, 0xa1, 0xc3, 0x0e, 0x20, 0x4d, 0xd5, 0x3b, 0x07, 0xc6, 0xa2, 0x96,
|
||||
0x38, 0x36, 0x6a, 0xe9, 0x83, 0x67, 0x28, 0xfb, 0xcd, 0x56, 0xfd, 0xa0, 0x79, 0x93, 0x35, 0x75,
|
||||
0x71, 0x32, 0x95, 0xd7, 0x67, 0x29, 0x1d, 0xf7, 0x96, 0xe3, 0x9a, 0x03, 0xe7, 0x3b, 0x6c, 0xa3,
|
||||
0x1a, 0xac, 0x0a, 0x5a, 0x5d, 0x51, 0xd4, 0x43, 0x83, 0x35, 0x56, 0x9a, 0x4c, 0xe5, 0x73, 0xb3,
|
||||
0x9c, 0xba, 0x65, 0xe1, 0x11, 0x9d, 0x21, 0x68, 0xea, 0xa7, 0xaa, 0xc2, 0x7b, 0x9b, 0x43, 0xd0,
|
||||
0xf0, 0xd7, 0xd8, 0x3a, 0x6d, 0xee, 0xc7, 0x38, 0xe4, 0x67, 0x37, 0x1f, 0x35, 0x60, 0x43, 0xfd,
|
||||
0x42, 0x55, 0x3a, 0x46, 0x5b, 0xeb, 0xce, 0xed, 0xf6, 0xd2, 0x64, 0x2a, 0x5f, 0x8c, 0xa2, 0xce,
|
||||
0x92, 0xa3, 0xae, 0xaf, 0xc2, 0xf9, 0xe7, 0x63, 0xb4, 0xda, 0x46, 0x57, 0xeb, 0xb4, 0x0a, 0x52,
|
||||
0x49, 0x9e, 0x4c, 0xe5, 0x0b, 0xf3, 0xf9, 0x2d, 0x42, 0xb5, 0xc0, 0x45, 0xd7, 0x5e, 0xa4, 0xeb,
|
||||
0x1d, 0x45, 0x51, 0x75, 0xbd, 0x10, 0x5f, 0x94, 0x5e, 0x0f, 0x2c, 0x2b, 0x3c, 0xfb, 0xe6, 0xf0,
|
||||
0xf7, 0xeb, 0xcd, 0x83, 0x8e, 0xa6, 0x16, 0x12, 0x8b, 0xf8, 0xfb, 0xa6, 0x33, 0x08, 0x3c, 0xcc,
|
||||
0xb5, 0xb9, 0x92, 0x0c, 0x4f, 0xeb, 0xca, 0xf7, 0x12, 0x2c, 0xb1, 0xcf, 0x15, 0x6d, 0x40, 0x76,
|
||||
0x8c, 0xfd, 0xae, 0x45, 0x02, 0x97, 0x8a, 0xc7, 0x45, 0x66, 0x8c, 0x7d, 0x25, 0xb4, 0xc3, 0xeb,
|
||||
0xca, 0x25, 0xc2, 0xc7, 0x1f, 0x45, 0x69, 0x97, 0x70, 0xd7, 0x65, 0x58, 0x31, 0x7b, 0x3e, 0x35,
|
||||
0x1d, 0x57, 0xf8, 0xd9, 0xb5, 0xa5, 0x2d, 0x8b, 0x45, 0x0e, 0xba, 0x08, 0x70, 0x82, 0x69, 0x14,
|
||||
0x21, 0xc9, 0x9f, 0x2e, 0xe1, 0x0a, 0x73, 0x8b, 0x5a, 0xfe, 0x91, 0x20, 0x79, 0x44, 0x28, 0x3e,
|
||||
0xfb, 0xc6, 0xa8, 0xc2, 0x52, 0x78, 0xac, 0x78, 0x67, 0x3f, 0x37, 0x18, 0x2c, 0xbc, 0xeb, 0xad,
|
||||
0x63, 0xe2, 0x58, 0x98, 0x15, 0x97, 0x7f, 0xd9, 0x5d, 0xaf, 0x30, 0x8c, 0x26, 0xb0, 0x0b, 0x2f,
|
||||
0xd6, 0xff, 0xeb, 0xae, 0x78, 0xdb, 0x86, 0x14, 0x4f, 0x8b, 0xce, 0x01, 0x52, 0x3e, 0x69, 0x37,
|
||||
0x15, 0x75, 0x76, 0x20, 0xd1, 0x0a, 0x64, 0xc5, 0x7a, 0xab, 0x5d, 0x90, 0x50, 0x1e, 0x40, 0x98,
|
||||
0x5f, 0xaa, 0x7a, 0x21, 0x8e, 0x10, 0xe4, 0x85, 0x5d, 0x6f, 0xe8, 0x46, 0xbd, 0xd9, 0x2a, 0x24,
|
||||
0xd0, 0x2a, 0xe4, 0xc4, 0xda, 0x91, 0x6a, 0xb4, 0x0b, 0xc9, 0xc6, 0xb5, 0x87, 0x8f, 0xcb, 0xd2,
|
||||
0xa3, 0xc7, 0x65, 0xe9, 0xaf, 0xc7, 0x65, 0xe9, 0xee, 0x93, 0x72, 0xec, 0xd1, 0x93, 0x72, 0xec,
|
||||
0xb7, 0x27, 0xe5, 0xd8, 0xcd, 0x37, 0xfb, 0x0e, 0x3d, 0x0e, 0x7a, 0x55, 0x8b, 0x0c, 0xc5, 0xf3,
|
||||
0x5a, 0xfc, 0xd9, 0xf6, 0xed, 0x6f, 0x6a, 0xb7, 0xf9, 0xff, 0x01, 0xbd, 0x14, 0x6b, 0xe8, 0xbd,
|
||||
0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x46, 0x84, 0xac, 0x3a, 0x1e, 0x0c, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *GroupAccountInfo) Equal(that interface{}) bool {
|
||||
func (this *GroupPolicyInfo) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*GroupAccountInfo)
|
||||
that1, ok := that.(*GroupPolicyInfo)
|
||||
if !ok {
|
||||
that2, ok := that.(GroupAccountInfo)
|
||||
that2, ok := that.(GroupPolicyInfo)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
|
@ -1089,7 +1088,7 @@ func (m *GroupMember) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *GroupAccountInfo) Marshal() (dAtA []byte, err error) {
|
||||
func (m *GroupPolicyInfo) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
|
@ -1099,12 +1098,12 @@ func (m *GroupAccountInfo) Marshal() (dAtA []byte, err error) {
|
|||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *GroupAccountInfo) MarshalTo(dAtA []byte) (int, error) {
|
||||
func (m *GroupPolicyInfo) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *GroupAccountInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
func (m *GroupPolicyInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
|
@ -1222,8 +1221,8 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
i--
|
||||
dAtA[i] = 0x40
|
||||
}
|
||||
if m.GroupAccountVersion != 0 {
|
||||
i = encodeVarintTypes(dAtA, i, uint64(m.GroupAccountVersion))
|
||||
if m.GroupPolicyVersion != 0 {
|
||||
i = encodeVarintTypes(dAtA, i, uint64(m.GroupPolicyVersion))
|
||||
i--
|
||||
dAtA[i] = 0x38
|
||||
}
|
||||
|
@ -1482,7 +1481,7 @@ func (m *GroupMember) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *GroupAccountInfo) Size() (n int) {
|
||||
func (m *GroupPolicyInfo) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
|
@ -1541,8 +1540,8 @@ func (m *Proposal) Size() (n int) {
|
|||
if m.GroupVersion != 0 {
|
||||
n += 1 + sovTypes(uint64(m.GroupVersion))
|
||||
}
|
||||
if m.GroupAccountVersion != 0 {
|
||||
n += 1 + sovTypes(uint64(m.GroupAccountVersion))
|
||||
if m.GroupPolicyVersion != 0 {
|
||||
n += 1 + sovTypes(uint64(m.GroupPolicyVersion))
|
||||
}
|
||||
if m.Status != 0 {
|
||||
n += 1 + sovTypes(uint64(m.Status))
|
||||
|
@ -2260,7 +2259,7 @@ func (m *GroupMember) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *GroupAccountInfo) Unmarshal(dAtA []byte) error {
|
||||
func (m *GroupPolicyInfo) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
|
@ -2283,10 +2282,10 @@ func (m *GroupAccountInfo) Unmarshal(dAtA []byte) error {
|
|||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: GroupAccountInfo: wiretype end group for non-group")
|
||||
return fmt.Errorf("proto: GroupPolicyInfo: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: GroupAccountInfo: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return fmt.Errorf("proto: GroupPolicyInfo: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
|
@ -2682,9 +2681,9 @@ func (m *Proposal) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
case 7:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field GroupAccountVersion", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field GroupPolicyVersion", wireType)
|
||||
}
|
||||
m.GroupAccountVersion = 0
|
||||
m.GroupPolicyVersion = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTypes
|
||||
|
@ -2694,7 +2693,7 @@ func (m *Proposal) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.GroupAccountVersion |= uint64(b&0x7F) << shift
|
||||
m.GroupPolicyVersion |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue