feat: Add `MsgCreateGroupWithPolicy` to x/group (#10963)

## Description

Closes: #10655

This PR adds a new msg MsgCreateGroupWithPolicy
It has a boolean field GroupPolicyAsAdmin, if set to true, that would update also the admin of the newly created group and group policy to the group policy address itself

---

### 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:
likhita-809 2022-02-18 19:17:04 +05:30 committed by GitHub
parent fcd02d06e2
commit 20e17ea71a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 3699 additions and 461 deletions

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,8 @@ type MsgClient interface {
UpdateGroupMetadata(ctx context.Context, in *MsgUpdateGroupMetadata, opts ...grpc.CallOption) (*MsgUpdateGroupMetadataResponse, error)
// CreateGroupPolicy creates a new group policy using given DecisionPolicy.
CreateGroupPolicy(ctx context.Context, in *MsgCreateGroupPolicy, opts ...grpc.CallOption) (*MsgCreateGroupPolicyResponse, error)
// CreateGroupWithPolicy creates a new group with policy.
CreateGroupWithPolicy(ctx context.Context, in *MsgCreateGroupWithPolicy, opts ...grpc.CallOption) (*MsgCreateGroupWithPolicyResponse, error)
// UpdateGroupPolicyAdmin updates a group policy admin.
UpdateGroupPolicyAdmin(ctx context.Context, in *MsgUpdateGroupPolicyAdmin, opts ...grpc.CallOption) (*MsgUpdateGroupPolicyAdminResponse, error)
// UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated.
@ -101,6 +103,15 @@ func (c *msgClient) CreateGroupPolicy(ctx context.Context, in *MsgCreateGroupPol
return out, nil
}
func (c *msgClient) CreateGroupWithPolicy(ctx context.Context, in *MsgCreateGroupWithPolicy, opts ...grpc.CallOption) (*MsgCreateGroupWithPolicyResponse, error) {
out := new(MsgCreateGroupWithPolicyResponse)
err := c.cc.Invoke(ctx, "/cosmos.group.v1beta1.Msg/CreateGroupWithPolicy", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateGroupPolicyAdmin(ctx context.Context, in *MsgUpdateGroupPolicyAdmin, opts ...grpc.CallOption) (*MsgUpdateGroupPolicyAdminResponse, error) {
out := new(MsgUpdateGroupPolicyAdminResponse)
err := c.cc.Invoke(ctx, "/cosmos.group.v1beta1.Msg/UpdateGroupPolicyAdmin", in, out, opts...)
@ -178,6 +189,8 @@ type MsgServer interface {
UpdateGroupMetadata(context.Context, *MsgUpdateGroupMetadata) (*MsgUpdateGroupMetadataResponse, error)
// CreateGroupPolicy creates a new group policy using given DecisionPolicy.
CreateGroupPolicy(context.Context, *MsgCreateGroupPolicy) (*MsgCreateGroupPolicyResponse, error)
// CreateGroupWithPolicy creates a new group with policy.
CreateGroupWithPolicy(context.Context, *MsgCreateGroupWithPolicy) (*MsgCreateGroupWithPolicyResponse, error)
// UpdateGroupPolicyAdmin updates a group policy admin.
UpdateGroupPolicyAdmin(context.Context, *MsgUpdateGroupPolicyAdmin) (*MsgUpdateGroupPolicyAdminResponse, error)
// UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated.
@ -214,6 +227,9 @@ func (UnimplementedMsgServer) UpdateGroupMetadata(context.Context, *MsgUpdateGro
func (UnimplementedMsgServer) CreateGroupPolicy(context.Context, *MsgCreateGroupPolicy) (*MsgCreateGroupPolicyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateGroupPolicy not implemented")
}
func (UnimplementedMsgServer) CreateGroupWithPolicy(context.Context, *MsgCreateGroupWithPolicy) (*MsgCreateGroupWithPolicyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateGroupWithPolicy not implemented")
}
func (UnimplementedMsgServer) UpdateGroupPolicyAdmin(context.Context, *MsgUpdateGroupPolicyAdmin) (*MsgUpdateGroupPolicyAdminResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateGroupPolicyAdmin not implemented")
}
@ -338,6 +354,24 @@ func _Msg_CreateGroupPolicy_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
func _Msg_CreateGroupWithPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgCreateGroupWithPolicy)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).CreateGroupWithPolicy(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.group.v1beta1.Msg/CreateGroupWithPolicy",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).CreateGroupWithPolicy(ctx, req.(*MsgCreateGroupWithPolicy))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateGroupPolicyAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateGroupPolicyAdmin)
if err := dec(in); err != nil {
@ -491,6 +525,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "CreateGroupPolicy",
Handler: _Msg_CreateGroupPolicy_Handler,
},
{
MethodName: "CreateGroupWithPolicy",
Handler: _Msg_CreateGroupWithPolicy_Handler,
},
{
MethodName: "UpdateGroupPolicyAdmin",
Handler: _Msg_UpdateGroupPolicyAdmin_Handler,

View File

@ -29,6 +29,9 @@ service Msg {
// CreateGroupPolicy creates a new group policy using given DecisionPolicy.
rpc CreateGroupPolicy(MsgCreateGroupPolicy) returns (MsgCreateGroupPolicyResponse);
// CreateGroupWithPolicy creates a new group with policy.
rpc CreateGroupWithPolicy(MsgCreateGroupWithPolicy) returns (MsgCreateGroupWithPolicyResponse);
// UpdateGroupPolicyAdmin updates a group policy admin.
rpc UpdateGroupPolicyAdmin(MsgUpdateGroupPolicyAdmin) returns (MsgUpdateGroupPolicyAdminResponse);
@ -172,6 +175,39 @@ message MsgUpdateGroupPolicyAdmin {
string new_admin = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type.
message MsgCreateGroupWithPolicy {
option (gogoproto.goproto_getters) = false;
// admin is the account address of the group and group policy admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// members defines the group members.
repeated Member members = 2 [(gogoproto.nullable) = false];
// group_metadata is any arbitrary metadata attached to the group.
bytes group_metadata = 3;
// group_policy_metadata is any arbitrary metadata attached to the group policy.
bytes group_policy_metadata = 4;
// group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group and group policy admin.
bool group_policy_as_admin = 5;
// decision_policy specifies the group policy's decision policy.
google.protobuf.Any decision_policy = 6 [(cosmos_proto.accepts_interface) = "DecisionPolicy"];
}
// MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type.
message MsgCreateGroupWithPolicyResponse {
// group_id is the unique ID of the newly created group with policy.
uint64 group_id = 1;
// group_policy_address is the account address of the newly created group policy.
string group_policy_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type.
message MsgUpdateGroupPolicyAdminResponse {}

View File

@ -18,8 +18,9 @@ import (
)
const (
FlagExec = "exec"
ExecTry = "try"
FlagExec = "exec"
ExecTry = "try"
FlagGroupPolicyAsAdmin = "group-policy-as-admin"
)
// TxCmd returns a root CLI command handler for all x/group transaction commands.
@ -37,6 +38,7 @@ func TxCmd(name string) *cobra.Command {
MsgUpdateGroupAdminCmd(),
MsgUpdateGroupMetadataCmd(),
MsgUpdateGroupMembersCmd(),
MsgCreateGroupWithPolicyCmd(),
MsgCreateGroupPolicyCmd(),
MsgUpdateGroupPolicyAdminCmd(),
MsgUpdateGroupPolicyDecisionPolicyCmd(),
@ -283,6 +285,106 @@ func MsgUpdateGroupMetadataCmd() *cobra.Command {
return cmd
}
// MsgCreateGroupWithPolicyCmd creates a CLI command for Msg/CreateGroupWithPolicy.
func MsgCreateGroupWithPolicyCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "create-group-with-policy [admin] [group-metadata] [group-policy-metadata] [members-json-file] [decision-policy]",
Short: "Create a group with policy which is an aggregation " +
"of member accounts with associated weights, " +
"an administrator account and a decision policy. Note, the '--from' flag is " +
"ignored as it is implied from [admin].",
Long: strings.TrimSpace(
fmt.Sprintf(`Create a group with policy which is an aggregation of member accounts with associated weights,
an administrator account and decision policy. Note, the '--from' flag is ignored as it is implied from [admin].
Members accounts can be given through a members JSON file that contains an array of members.
If group-policy-as-admin flag is set to true, the admin of the newly created group and group policy is set with the group policy address itself.
Example:
$ %s tx group create-group-with-policy [admin] [group-metadata] [group-policy-metadata] [members-json-file] \
'{"@type":"/cosmos.group.v1beta1.ThresholdDecisionPolicy", "threshold":"1", "timeout":"1s"}'
where members.json contains:
{
"members": [
{
"address": "addr1",
"weight": "1",
"metadata": "some metadata"
},
{
"address": "addr2",
"weight": "1",
"metadata": "some metadata"
}
]
}
`,
version.AppName,
),
),
Args: cobra.MinimumNArgs(5),
RunE: func(cmd *cobra.Command, args []string) error {
err := cmd.Flags().Set(flags.FlagFrom, args[0])
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
groupPolicyAsAdmin, err := cmd.Flags().GetBool(FlagGroupPolicyAsAdmin)
if err != nil {
return err
}
members, err := parseMembers(clientCtx, args[3])
if err != nil {
return err
}
groupMetadata, err := base64.StdEncoding.DecodeString(args[1])
if err != nil {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "group metadata is malformed, proper base64 string is required")
}
groupPolicyMetadata, err := base64.StdEncoding.DecodeString(args[2])
if err != nil {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "group policy metadata is malformed, proper base64 string is required")
}
var policy group.DecisionPolicy
if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(args[4]), &policy); err != nil {
return err
}
msg, err := group.NewMsgCreateGroupWithPolicy(
clientCtx.GetFromAddress().String(),
members,
groupMetadata,
groupPolicyMetadata,
groupPolicyAsAdmin,
policy,
)
if err != nil {
return err
}
if err = msg.ValidateBasic(); err != nil {
return fmt.Errorf("message validation failed: %w", err)
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
cmd.Flags().Bool(FlagGroupPolicyAsAdmin, false, "Sets admin of the newly created group and group policy with group policy address itself when true")
flags.AddTxFlagsToCmd(cmd)
return cmd
}
// MsgCreateGroupPolicyCmd creates a CLI command for Msg/CreateGroupPolicy.
func MsgCreateGroupPolicyCmd() *cobra.Command {
cmd := &cobra.Command{

View File

@ -694,6 +694,216 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() {
}
}
func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() {
val := s.network.Validators[0]
clientCtx := val.ClientCtx
var commonFlags = []string{
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
}
validMembers := fmt.Sprintf(`{"members": [{
"address": "%s",
"weight": "1",
"metadata": "%s"
}]}`, val.Address.String(), validMetadata)
validMembersFile := testutil.WriteToNewTempFile(s.T(), validMembers)
invalidMembersAddress := `{"members": [{
"address": "",
"weight": "1"
}]}`
invalidMembersAddressFile := testutil.WriteToNewTempFile(s.T(), invalidMembersAddress)
invalidMembersWeight := fmt.Sprintf(`{"members": [{
"address": "%s",
"weight": "0"
}]}`, val.Address.String())
invalidMembersWeightFile := testutil.WriteToNewTempFile(s.T(), invalidMembersWeight)
invalidMembersMetadata := fmt.Sprintf(`{"members": [{
"address": "%s",
"weight": "1",
"metadata": "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ=="
}]}`, val.Address.String())
invalidMembersMetadataFile := testutil.WriteToNewTempFile(s.T(), invalidMembersMetadata)
testCases := []struct {
name string
args []string
expectErr bool
expectErrMsg string
respType proto.Message
expectedCode uint32
}{
{
"correct data",
append(
[]string{
val.Address.String(),
validMetadata,
validMetadata,
validMembersFile.Name(),
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"1s\"}",
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
commonFlags...,
),
false,
"",
&sdk.TxResponse{},
0,
},
{
"group-policy-as-admin is true",
append(
[]string{
val.Address.String(),
validMetadata,
validMetadata,
validMembersFile.Name(),
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"1s\"}",
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, true),
},
commonFlags...,
),
false,
"",
&sdk.TxResponse{},
0,
},
{
"with amino-json",
append(
[]string{
val.Address.String(),
validMetadata,
validMetadata,
validMembersFile.Name(),
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"1s\"}",
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON),
},
commonFlags...,
),
false,
"",
&sdk.TxResponse{},
0,
},
{
"group metadata too long",
append(
[]string{
val.Address.String(),
"AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ==",
validMetadata,
validMembersFile.Name(),
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"1s\"}",
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
commonFlags...,
),
true,
"group metadata: limit exceeded",
nil,
0,
},
{
"group policy metadata too long",
append(
[]string{
val.Address.String(),
validMetadata,
"AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ==",
validMembersFile.Name(),
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"1s\"}",
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
commonFlags...,
),
true,
"group policy metadata: limit exceeded",
nil,
0,
},
{
"invalid members address",
append(
[]string{
val.Address.String(),
validMetadata,
validMetadata,
invalidMembersAddressFile.Name(),
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"1s\"}",
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
commonFlags...,
),
true,
"message validation failed: address: empty address string is not allowed",
nil,
0,
},
{
"invalid members weight",
append(
[]string{
val.Address.String(),
validMetadata,
validMetadata,
invalidMembersWeightFile.Name(),
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"1s\"}",
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
commonFlags...,
),
true,
"expected a positive decimal, got 0: invalid decimal string",
nil,
0,
},
{
"members metadata too long",
append(
[]string{
val.Address.String(),
validMetadata,
validMetadata,
invalidMembersMetadataFile.Name(),
"{\"@type\":\"/cosmos.group.v1beta1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"timeout\":\"1s\"}",
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
commonFlags...,
),
true,
"member metadata: limit exceeded",
nil,
0,
},
}
for _, tc := range testCases {
tc := tc
s.Run(tc.name, func() {
cmd := client.MsgCreateGroupWithPolicyCmd()
out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
if tc.expectErr {
s.Require().Contains(out.String(), tc.expectErrMsg)
} else {
s.Require().NoError(err, out.String())
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String())
txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code, out.String())
}
})
}
}
func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
val := s.network.Validators[0]
wrongAdmin := s.network.Validators[1].Address

View File

@ -18,6 +18,7 @@ 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(&MsgCreateGroupWithPolicy{}, "cosmos-sdk/MsgCreateGroupWithPolicy", nil)
cdc.RegisterConcrete(&MsgCreateGroupPolicy{}, "cosmos-sdk/MsgCreateGroupPolicy", nil)
cdc.RegisterConcrete(&MsgUpdateGroupPolicyAdmin{}, "cosmos-sdk/MsgUpdateGroupPolicyAdmin", nil)
cdc.RegisterConcrete(&MsgUpdateGroupPolicyDecisionPolicy{}, "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicy", nil)
@ -34,6 +35,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
&MsgUpdateGroupMembers{},
&MsgUpdateGroupAdmin{},
&MsgUpdateGroupMetadata{},
&MsgCreateGroupWithPolicy{},
&MsgCreateGroupPolicy{},
&MsgUpdateGroupPolicyAdmin{},
&MsgUpdateGroupPolicyDecisionPolicy{},

View File

@ -269,7 +269,6 @@ func (q Keeper) GroupsByMember(goCtx context.Context, request *group.QueryGroups
if err != nil {
return nil, err
}
defer iter.Close()
var members []*group.GroupMember
pageRes, err := orm.Paginate(iter, request.Pagination, &members)

View File

@ -167,7 +167,6 @@ func GroupTotalWeightInvariantHelper(ctx sdk.Context, key storetypes.StoreKey, g
msg += fmt.Sprintf("error while returning group member iterator for group with ID %d\n%v\n", groupInfo.Id, err)
return msg, broken
}
defer memIt.Close()
for {
_, err = memIt.LoadNext(&groupMember)
@ -185,6 +184,8 @@ func GroupTotalWeightInvariantHelper(ctx sdk.Context, key storetypes.StoreKey, g
return msg, broken
}
}
memIt.Close()
groupWeight, err := groupmath.NewNonNegativeDecFromString(groupInfo.GetTotalWeight())
if err != nil {
msg += fmt.Sprintf("error while parsing non-nengative decimal for group with ID %d\n%v\n", groupInfo.Id, err)
@ -278,7 +279,6 @@ func TallyVotesSumInvariantHelper(ctx sdk.Context, key storetypes.StoreKey, grou
msg += fmt.Sprintf("error while returning vote iterator for proposal with ID %d\n%v\n", proposal.Id, err)
return msg, broken
}
defer voteIt.Close()
for {
_, err := voteIt.LoadNext(&vote)
@ -330,6 +330,7 @@ func TallyVotesSumInvariantHelper(ctx sdk.Context, key storetypes.StoreKey, grou
}
}
}
voteIt.Close()
totalProposalVotes, err := proposal.FinalTallyResult.TotalCounts()
if err != nil {

View File

@ -705,6 +705,210 @@ func (s *TestSuite) TestUpdateGroupMembers() {
}
}
func (s *TestSuite) TestCreateGroupWithPolicy() {
addrs := s.addrs
addr1 := addrs[0]
addr3 := addrs[2]
addr5 := addrs[4]
addr6 := addrs[5]
members := []group.Member{{
Address: addr5.String(),
Weight: "1",
Metadata: nil,
AddedAt: s.blockTime,
}, {
Address: addr6.String(),
Weight: "2",
Metadata: nil,
AddedAt: s.blockTime,
}}
specs := map[string]struct {
req *group.MsgCreateGroupWithPolicy
policy group.DecisionPolicy
expErr bool
expErrMsg string
}{
"all good": {
req: &group.MsgCreateGroupWithPolicy{
Admin: addr1.String(),
Members: members,
GroupMetadata: nil,
GroupPolicyMetadata: nil,
GroupPolicyAsAdmin: false,
},
policy: group.NewThresholdDecisionPolicy(
"1",
time.Second,
),
},
"group policy as admin is true": {
req: &group.MsgCreateGroupWithPolicy{
Admin: addr1.String(),
Members: members,
GroupMetadata: nil,
GroupPolicyMetadata: nil,
GroupPolicyAsAdmin: true,
},
policy: group.NewThresholdDecisionPolicy(
"1",
time.Second,
),
},
"group metadata too long": {
req: &group.MsgCreateGroupWithPolicy{
Admin: addr1.String(),
Members: members,
GroupMetadata: bytes.Repeat([]byte{1}, 256),
GroupPolicyMetadata: nil,
GroupPolicyAsAdmin: false,
},
policy: group.NewThresholdDecisionPolicy(
"1",
time.Second,
),
expErr: true,
expErrMsg: "limit exceeded",
},
"group policy metadata too long": {
req: &group.MsgCreateGroupWithPolicy{
Admin: addr1.String(),
Members: members,
GroupMetadata: nil,
GroupPolicyMetadata: bytes.Repeat([]byte{1}, 256),
GroupPolicyAsAdmin: false,
},
policy: group.NewThresholdDecisionPolicy(
"1",
time.Second,
),
expErr: true,
expErrMsg: "limit exceeded",
},
"member metadata too long": {
req: &group.MsgCreateGroupWithPolicy{
Admin: addr1.String(),
Members: []group.Member{{
Address: addr3.String(),
Weight: "1",
Metadata: bytes.Repeat([]byte{1}, 256),
}},
GroupMetadata: nil,
GroupPolicyMetadata: nil,
GroupPolicyAsAdmin: false,
},
policy: group.NewThresholdDecisionPolicy(
"1",
time.Second,
),
expErr: true,
expErrMsg: "limit exceeded",
},
"zero member weight": {
req: &group.MsgCreateGroupWithPolicy{
Admin: addr1.String(),
Members: []group.Member{{
Address: addr3.String(),
Weight: "0",
Metadata: nil,
}},
GroupMetadata: nil,
GroupPolicyMetadata: nil,
GroupPolicyAsAdmin: false,
},
policy: group.NewThresholdDecisionPolicy(
"1",
time.Second,
),
expErr: true,
expErrMsg: "expected a positive decimal",
},
"decision policy threshold > total group weight": {
req: &group.MsgCreateGroupWithPolicy{
Admin: addr1.String(),
Members: members,
GroupMetadata: nil,
GroupPolicyMetadata: nil,
GroupPolicyAsAdmin: false,
},
policy: group.NewThresholdDecisionPolicy(
"10",
time.Second,
),
expErr: false,
},
}
for msg, spec := range specs {
spec := spec
s.Run(msg, func() {
err := spec.req.SetDecisionPolicy(spec.policy)
s.Require().NoError(err)
res, err := s.keeper.CreateGroupWithPolicy(s.ctx, spec.req)
if spec.expErr {
s.Require().Error(err)
s.Require().Contains(err.Error(), spec.expErrMsg)
return
}
s.Require().NoError(err)
id := res.GroupId
groupPolicyAddr := res.GroupPolicyAddress
// then all data persisted in group
loadedGroupRes, err := s.keeper.GroupInfo(s.ctx, &group.QueryGroupInfoRequest{GroupId: id})
s.Require().NoError(err)
s.Assert().Equal(spec.req.GroupMetadata, loadedGroupRes.Info.Metadata)
s.Assert().Equal(id, loadedGroupRes.Info.Id)
if spec.req.GroupPolicyAsAdmin {
s.Assert().NotEqual(spec.req.Admin, loadedGroupRes.Info.Admin)
s.Assert().Equal(groupPolicyAddr, loadedGroupRes.Info.Admin)
} else {
s.Assert().Equal(spec.req.Admin, loadedGroupRes.Info.Admin)
}
// and members are stored as well
membersRes, err := s.keeper.GroupMembers(s.ctx, &group.QueryGroupMembersRequest{GroupId: id})
s.Require().NoError(err)
loadedMembers := membersRes.Members
s.Require().Equal(len(members), len(loadedMembers))
// we reorder members by address to be able to compare them
sort.Slice(members, func(i, j int) bool {
addri, err := sdk.AccAddressFromBech32(members[i].Address)
s.Require().NoError(err)
addrj, err := sdk.AccAddressFromBech32(members[j].Address)
s.Require().NoError(err)
return bytes.Compare(addri, addrj) < 0
})
for i := range loadedMembers {
s.Assert().Equal(members[i].Metadata, loadedMembers[i].Member.Metadata)
s.Assert().Equal(members[i].Address, loadedMembers[i].Member.Address)
s.Assert().Equal(members[i].Weight, loadedMembers[i].Member.Weight)
s.Assert().Equal(members[i].AddedAt, loadedMembers[i].Member.AddedAt)
s.Assert().Equal(id, loadedMembers[i].GroupId)
}
// then all data persisted in group policy
groupPolicyRes, err := s.keeper.GroupPolicyInfo(s.ctx, &group.QueryGroupPolicyInfoRequest{Address: groupPolicyAddr})
s.Require().NoError(err)
groupPolicy := groupPolicyRes.Info
s.Assert().Equal(groupPolicyAddr, groupPolicy.Address)
s.Assert().Equal(id, groupPolicy.GroupId)
s.Assert().Equal(spec.req.GroupPolicyMetadata, groupPolicy.Metadata)
s.Assert().Equal(spec.policy.(*group.ThresholdDecisionPolicy), groupPolicy.GetDecisionPolicy())
if spec.req.GroupPolicyAsAdmin {
s.Assert().NotEqual(spec.req.Admin, groupPolicy.Admin)
s.Assert().Equal(groupPolicyAddr, groupPolicy.Admin)
} else {
s.Assert().Equal(spec.req.Admin, groupPolicy.Admin)
}
})
}
}
func (s *TestSuite) TestCreateGroupPolicy() {
addrs := s.addrs
addr1 := addrs[0]

View File

@ -233,6 +233,60 @@ func (k Keeper) UpdateGroupMetadata(goCtx context.Context, req *group.MsgUpdateG
return &group.MsgUpdateGroupMetadataResponse{}, nil
}
func (k Keeper) CreateGroupWithPolicy(goCtx context.Context, req *group.MsgCreateGroupWithPolicy) (*group.MsgCreateGroupWithPolicyResponse, error) {
groupRes, err := k.CreateGroup(goCtx, &group.MsgCreateGroup{
Admin: req.Admin,
Members: req.Members,
Metadata: req.GroupMetadata,
})
if err != nil {
return nil, sdkerrors.Wrap(err, "group response")
}
groupId := groupRes.GroupId
var groupPolicyAddr sdk.AccAddress
groupPolicyRes, err := k.CreateGroupPolicy(goCtx, &group.MsgCreateGroupPolicy{
Admin: req.Admin,
GroupId: groupId,
Metadata: req.GroupPolicyMetadata,
DecisionPolicy: req.DecisionPolicy,
})
if err != nil {
return nil, sdkerrors.Wrap(err, "group policy response")
}
policyAddr := groupPolicyRes.Address
groupPolicyAddr, err = sdk.AccAddressFromBech32(policyAddr)
if err != nil {
return nil, sdkerrors.Wrap(err, "group policy address")
}
groupPolicyAddress := groupPolicyAddr.String()
if req.GroupPolicyAsAdmin {
updateAdminReq := &group.MsgUpdateGroupAdmin{
GroupId: groupId,
Admin: req.Admin,
NewAdmin: groupPolicyAddress,
}
_, err = k.UpdateGroupAdmin(goCtx, updateAdminReq)
if err != nil {
return nil, err
}
updatePolicyAddressReq := &group.MsgUpdateGroupPolicyAdmin{
Admin: req.Admin,
Address: groupPolicyAddress,
NewAdmin: groupPolicyAddress,
}
_, err = k.UpdateGroupPolicyAdmin(goCtx, updatePolicyAddressReq)
if err != nil {
return nil, err
}
}
return &group.MsgCreateGroupWithPolicyResponse{GroupId: groupId, GroupPolicyAddress: groupPolicyAddress}, nil
}
func (k Keeper) CreateGroupPolicy(goCtx context.Context, req *group.MsgCreateGroupPolicy) (*group.MsgCreateGroupPolicyResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
admin, err := sdk.AccAddressFromBech32(req.GetAdmin())

View File

@ -46,25 +46,11 @@ func (m MsgCreateGroup) ValidateBasic() error {
}
func (m MsgCreateGroup) validateMembers() error {
index := make(map[string]struct{}, len(m.Members))
for i := range m.Members {
member := m.Members[i]
_, err := sdk.AccAddressFromBech32(member.Address)
if err != nil {
return sdkerrors.Wrap(err, "address")
}
if _, err := math.NewPositiveDecFromString(member.Weight); err != nil {
return sdkerrors.Wrap(err, "weight")
}
addr := member.Address
if _, exists := index[addr]; exists {
return sdkerrors.Wrapf(errors.ErrDuplicate, "address: %s", addr)
}
index[addr] = struct{}{}
err := validateMembers(m.Members)
if err != nil {
return err
}
return nil
}
@ -224,6 +210,102 @@ func (m *MsgUpdateGroupMembers) GetGroupID() uint64 {
return m.GroupId
}
var _ sdk.Msg = &MsgCreateGroupWithPolicy{}
var _ types.UnpackInterfacesMessage = MsgCreateGroupWithPolicy{}
// NewMsgCreateGroupWithPolicy creates a new MsgCreateGroupWithPolicy.
func NewMsgCreateGroupWithPolicy(admin string, members []Member, group_metadata []byte, group_policy_metadata []byte, groupPolicyAsAdmin bool, decisionPolicy DecisionPolicy) (*MsgCreateGroupWithPolicy, error) {
m := &MsgCreateGroupWithPolicy{
Admin: admin,
Members: members,
GroupMetadata: group_metadata,
GroupPolicyMetadata: group_policy_metadata,
GroupPolicyAsAdmin: groupPolicyAsAdmin,
}
err := m.SetDecisionPolicy(decisionPolicy)
if err != nil {
return nil, err
}
return m, nil
}
func (m *MsgCreateGroupWithPolicy) GetDecisionPolicy() DecisionPolicy {
decisionPolicy, ok := m.DecisionPolicy.GetCachedValue().(DecisionPolicy)
if !ok {
return nil
}
return decisionPolicy
}
func (m *MsgCreateGroupWithPolicy) SetDecisionPolicy(decisionPolicy DecisionPolicy) error {
msg, ok := decisionPolicy.(proto.Message)
if !ok {
return sdkerrors.ErrInvalidType.Wrapf("can't proto marshal %T", msg)
}
any, err := types.NewAnyWithValue(msg)
if err != nil {
return err
}
m.DecisionPolicy = any
return nil
}
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (m MsgCreateGroupWithPolicy) UnpackInterfaces(unpacker types.AnyUnpacker) error {
var decisionPolicy DecisionPolicy
return unpacker.UnpackAny(m.DecisionPolicy, &decisionPolicy)
}
// Route Implements Msg.
func (m MsgCreateGroupWithPolicy) Route() string {
return sdk.MsgTypeURL(&m)
}
// Type Implements Msg.
func (m MsgCreateGroupWithPolicy) Type() string {
return sdk.MsgTypeURL(&m)
}
// GetSignBytes Implements Msg.
func (m MsgCreateGroupWithPolicy) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}
// GetSigners returns the expected signers for a MsgCreateGroupWithPolicy.
func (m MsgCreateGroupWithPolicy) GetSigners() []sdk.AccAddress {
admin, err := sdk.AccAddressFromBech32(m.Admin)
if err != nil {
panic(err)
}
return []sdk.AccAddress{admin}
}
// ValidateBasic does a sanity check on the provided data
func (m MsgCreateGroupWithPolicy) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(m.Admin)
if err != nil {
return sdkerrors.Wrap(err, "admin")
}
policy := m.GetDecisionPolicy()
if policy == nil {
return sdkerrors.Wrap(errors.ErrEmpty, "decision policy")
}
if err := policy.ValidateBasic(); err != nil {
return sdkerrors.Wrap(err, "decision policy")
}
return m.validateMembers()
}
func (m MsgCreateGroupWithPolicy) validateMembers() error {
err := validateMembers(m.Members)
if err != nil {
return err
}
return nil
}
var _ sdk.Msg = &MsgCreateGroupPolicy{}
// Route Implements Msg.
@ -712,3 +794,26 @@ func (m MsgExec) ValidateBasic() error {
}
return nil
}
func validateMembers(members []Member) error {
index := make(map[string]struct{}, len(members))
for i := range members {
member := members[i]
_, err := sdk.AccAddressFromBech32(member.Address)
if err != nil {
return sdkerrors.Wrap(err, "address")
}
if _, err := math.NewPositiveDecFromString(member.Weight); err != nil {
return sdkerrors.Wrap(err, "weight")
}
addr := member.Address
if _, exists := index[addr]; exists {
return sdkerrors.Wrapf(errors.ErrDuplicate, "address: %s", addr)
}
index[addr] = struct{}{}
}
return nil
}

View File

@ -39,7 +39,7 @@ func TestMsgCreateGroup(t *testing.T) {
&group.MsgCreateGroup{
Admin: admin.String(),
Members: []group.Member{
group.Member{
{
Address: "invalid address",
},
},
@ -52,7 +52,7 @@ func TestMsgCreateGroup(t *testing.T) {
&group.MsgCreateGroup{
Admin: admin.String(),
Members: []group.Member{
group.Member{
{
Address: member1.String(),
Weight: "-1",
},
@ -66,7 +66,7 @@ func TestMsgCreateGroup(t *testing.T) {
&group.MsgCreateGroup{
Admin: admin.String(),
Members: []group.Member{
group.Member{
{
Address: member1.String(),
Weight: "0",
},
@ -80,12 +80,12 @@ func TestMsgCreateGroup(t *testing.T) {
&group.MsgCreateGroup{
Admin: admin.String(),
Members: []group.Member{
group.Member{
{
Address: member1.String(),
Weight: "1",
Metadata: []byte("metadata"),
},
group.Member{
{
Address: member1.String(),
Weight: "1",
Metadata: []byte("metadata"),
@ -100,7 +100,7 @@ func TestMsgCreateGroup(t *testing.T) {
&group.MsgCreateGroup{
Admin: admin.String(),
Members: []group.Member{
group.Member{
{
Address: member1.String(),
Weight: "1",
Metadata: []byte("metadata"),
@ -124,12 +124,12 @@ func TestMsgCreateGroup(t *testing.T) {
&group.MsgCreateGroup{
Admin: admin.String(),
Members: []group.Member{
group.Member{
{
Address: member1.String(),
Weight: "1",
Metadata: []byte("metadata"),
},
group.Member{
{
Address: member2.String(),
Weight: "1",
Metadata: []byte("metadata"),
@ -314,7 +314,7 @@ func TestMsgUpdateGroupMembers(t *testing.T) {
GroupId: 1,
Admin: admin.String(),
MemberUpdates: []group.Member{
group.Member{
{
Address: member1.String(),
Weight: "1",
Metadata: []byte("metadata"),
@ -330,7 +330,7 @@ func TestMsgUpdateGroupMembers(t *testing.T) {
GroupId: 1,
Admin: admin.String(),
MemberUpdates: []group.Member{
group.Member{
{
Address: member1.String(),
Weight: "0",
Metadata: []byte("metadata"),
@ -356,6 +356,185 @@ func TestMsgUpdateGroupMembers(t *testing.T) {
}
}
func TestMsgCreateGroupWithPolicy(t *testing.T) {
testCases := []struct {
name string
msg func() *group.MsgCreateGroupWithPolicy
expErr bool
errMsg string
}{
{
"invalid admin address",
func() *group.MsgCreateGroupWithPolicy {
admin := "admin"
policy := group.NewThresholdDecisionPolicy("1", time.Second)
members := []group.Member{
{
Address: member1.String(),
Weight: "1",
Metadata: []byte("metadata"),
},
}
req, err := group.NewMsgCreateGroupWithPolicy(admin, members, []byte("group_metadata"), []byte("group_policy_metadata"), false, policy)
require.NoError(t, err)
return req
},
true,
"admin: decoding bech32 failed",
},
{
"invalid member address",
func() *group.MsgCreateGroupWithPolicy {
policy := group.NewThresholdDecisionPolicy("1", time.Second)
members := []group.Member{
{
Address: "invalid_address",
Weight: "1",
Metadata: []byte("metadata"),
},
}
req, err := group.NewMsgCreateGroupWithPolicy(admin.String(), members, []byte("group_metadata"), []byte("group_policy_metadata"), false, policy)
require.NoError(t, err)
return req
},
true,
"address: decoding bech32 failed",
},
{
"negative member's weight not allowed",
func() *group.MsgCreateGroupWithPolicy {
policy := group.NewThresholdDecisionPolicy("1", time.Second)
members := []group.Member{
{
Address: member1.String(),
Weight: "-1",
Metadata: []byte("metadata"),
},
}
req, err := group.NewMsgCreateGroupWithPolicy(admin.String(), members, []byte("group_metadata"), []byte("group_policy_metadata"), false, policy)
require.NoError(t, err)
return req
},
true,
"expected a positive decimal",
},
{
"zero member's weight not allowed",
func() *group.MsgCreateGroupWithPolicy {
policy := group.NewThresholdDecisionPolicy("1", time.Second)
members := []group.Member{
{
Address: member1.String(),
Weight: "0",
Metadata: []byte("metadata"),
},
}
req, err := group.NewMsgCreateGroupWithPolicy(admin.String(), members, []byte("group_metadata"), []byte("group_policy_metadata"), false, policy)
require.NoError(t, err)
return req
},
true,
"expected a positive decimal",
},
{
"duplicate member not allowed",
func() *group.MsgCreateGroupWithPolicy {
policy := group.NewThresholdDecisionPolicy("1", time.Second)
members := []group.Member{
{
Address: member1.String(),
Weight: "1",
Metadata: []byte("metadata"),
},
{
Address: member1.String(),
Weight: "1",
Metadata: []byte("metadata"),
},
}
req, err := group.NewMsgCreateGroupWithPolicy(admin.String(), members, []byte("group_metadata"), []byte("group_policy_metadata"), false, policy)
require.NoError(t, err)
return req
},
true,
"duplicate value",
},
{
"invalid threshold policy",
func() *group.MsgCreateGroupWithPolicy {
policy := group.NewThresholdDecisionPolicy("-1", time.Second)
members := []group.Member{
{
Address: member1.String(),
Weight: "1",
Metadata: []byte("metadata"),
},
}
req, err := group.NewMsgCreateGroupWithPolicy(admin.String(), members, []byte("group_metadata"), []byte("group_policy_metadata"), false, policy)
require.NoError(t, err)
return req
},
true,
"expected a positive decimal",
},
{
"valid test case with single member",
func() *group.MsgCreateGroupWithPolicy {
policy := group.NewThresholdDecisionPolicy("1", time.Second)
members := []group.Member{
{
Address: member1.String(),
Weight: "1",
Metadata: []byte("metadata"),
},
}
req, err := group.NewMsgCreateGroupWithPolicy(admin.String(), members, []byte("group_metadata"), []byte("group_policy_metadata"), false, policy)
require.NoError(t, err)
return req
},
false,
"",
},
{
"valid test case with multiple members",
func() *group.MsgCreateGroupWithPolicy {
policy := group.NewThresholdDecisionPolicy("1", time.Second)
members := []group.Member{
{
Address: member1.String(),
Weight: "1",
Metadata: []byte("metadata"),
},
{
Address: member2.String(),
Weight: "1",
Metadata: []byte("metadata"),
},
}
req, err := group.NewMsgCreateGroupWithPolicy(admin.String(), members, []byte("group_metadata"), []byte("group_policy_metadata"), false, policy)
require.NoError(t, err)
return req
},
false,
"",
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
msg := tc.msg()
err := msg.ValidateBasic()
if tc.expErr {
require.Error(t, err)
require.Contains(t, err.Error(), tc.errMsg)
} else {
require.NoError(t, err)
require.Equal(t, msg.Type(), sdk.MsgTypeURL(&group.MsgCreateGroupWithPolicy{}))
}
})
}
}
func TestMsgCreateGroupPolicy(t *testing.T) {
testCases := []struct {
name string

View File

@ -29,6 +29,7 @@ var (
TypeMsgUpdateGroupMembers = sdk.MsgTypeURL(&group.MsgUpdateGroupMembers{})
TypeMsgUpdateGroupAdmin = sdk.MsgTypeURL(&group.MsgUpdateGroupAdmin{})
TypeMsgUpdateGroupMetadata = sdk.MsgTypeURL(&group.MsgUpdateGroupMetadata{})
TypeMsgCreateGroupWithPolicy = sdk.MsgTypeURL(&group.MsgCreateGroupWithPolicy{})
TypeMsgCreateGroupPolicy = sdk.MsgTypeURL(&group.MsgCreateGroupPolicy{})
TypeMsgUpdateGroupPolicyAdmin = sdk.MsgTypeURL(&group.MsgUpdateGroupPolicyAdmin{})
TypeMsgUpdateGroupPolicyDecisionPolicy = sdk.MsgTypeURL(&group.MsgUpdateGroupPolicyDecisionPolicy{})
@ -45,10 +46,11 @@ const (
OpMsgUpdateGroupAdmin = "op_weight_msg_update_group_admin"
OpMsgUpdateGroupMetadata = "op_wieght_msg_update_group_metadata"
OpMsgUpdateGroupMembers = "op_weight_msg_update_group_members"
OpMsgCreateGroupPolicy = "op_weight_msg_create_group_policy"
OpMsgUpdateGroupPolicyAdmin = "op_weight_msg_update_group_policy_admin"
OpMsgUpdateGroupPolicyDecisionPolicy = "op_weight_msg_update_group_policy_decision_policy"
OpMsgUpdateGroupPolicyMetaData = "op_weight_msg_update_group_policy_metadata"
OpMsgCreateGroupPolicy = "op_weight_msg_create_group_account"
OpMsgCreateGroupWithPolicy = "op_weight_msg_create_group_with_policy"
OpMsgUpdateGroupPolicyAdmin = "op_weight_msg_update_group_account_admin"
OpMsgUpdateGroupPolicyDecisionPolicy = "op_weight_msg_update_group_account_decision_policy"
OpMsgUpdateGroupPolicyMetaData = "op_weight_msg_update_group_account_metadata"
OpMsgSubmitProposal = "op_weight_msg_submit_proposal"
OpMsgWithdrawProposal = "op_weight_msg_withdraw_proposal"
OpMsgVote = "op_weight_msg_vote"
@ -59,7 +61,7 @@ const (
// That's why we have less weight for update group & group-policy txn's.
const (
WeightMsgCreateGroup = 100
WeightMsgCreateGroupPolicy = 100
WeightMsgCreateGroupPolicy = 50
WeightMsgSubmitProposal = 90
WeightMsgVote = 90
WeightMsgExec = 90
@ -70,10 +72,9 @@ const (
WeightMsgUpdateGroupPolicyDecisionPolicy = 5
WeightMsgUpdateGroupPolicyMetadata = 5
WeightMsgWithdrawProposal = 20
WeightMsgCreateGroupWithPolicy = 100
)
const GroupMemberWeight = 40
// WeightedOperations returns all the operations from the module with their respective weights
func WeightedOperations(
appParams simtypes.AppParams, cdc codec.JSONCodec, ak group.AccountKeeper,
@ -91,6 +92,7 @@ func WeightedOperations(
weightMsgVote int
weightMsgExec int
weightMsgWithdrawProposal int
weightMsgCreateGroupWithPolicy int
)
appParams.GetOrGenerate(cdc, OpMsgCreateGroup, &weightMsgCreateGroup, nil,
@ -103,6 +105,11 @@ func WeightedOperations(
weightMsgCreateGroupPolicy = WeightMsgCreateGroupPolicy
},
)
appParams.GetOrGenerate(cdc, OpMsgCreateGroupWithPolicy, &weightMsgCreateGroupWithPolicy, nil,
func(_ *rand.Rand) {
weightMsgCreateGroupWithPolicy = WeightMsgCreateGroupWithPolicy
},
)
appParams.GetOrGenerate(cdc, OpMsgSubmitProposal, &weightMsgSubmitProposal, nil,
func(_ *rand.Rand) {
weightMsgSubmitProposal = WeightMsgSubmitProposal
@ -172,6 +179,10 @@ func WeightedOperations(
weightMsgCreateGroupPolicy,
SimulateMsgCreateGroupPolicy(ak, bk, k),
),
// simulation.NewWeightedOperation(
// weightMsgCreateGroupWithPolicy,
// SimulateMsgCreateGroupWithPolicy(ak, bk),
// ),
}
wPostCreateProposalOps := simulation.WeightedOperations{
@ -230,14 +241,7 @@ func SimulateMsgCreateGroup(ak group.AccountKeeper, bk group.BankKeeper) simtype
return simtypes.NoOpMsg(group.ModuleName, TypeMsgCreateGroup, "fee error"), nil, err
}
members := []group.Member{
{
Address: accAddr,
Weight: fmt.Sprintf("%d", GroupMemberWeight),
Metadata: []byte(simtypes.RandStringOfLength(r, 10)),
},
}
members := genGroupMembers(r, accounts)
msg := &group.MsgCreateGroup{Admin: accAddr, Members: members, Metadata: []byte(simtypes.RandStringOfLength(r, 10))}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
@ -264,6 +268,62 @@ func SimulateMsgCreateGroup(ak group.AccountKeeper, bk group.BankKeeper) simtype
}
}
// SimulateMsgCreateGroupWithPolicy generates a MsgCreateGroupWithPolicy with random values
func SimulateMsgCreateGroupWithPolicy(ak group.AccountKeeper, bk group.BankKeeper) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accounts []simtypes.Account, chainID string) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
acc, _ := simtypes.RandomAcc(r, accounts)
account := ak.GetAccount(ctx, acc.Address)
accAddr := acc.Address.String()
spendableCoins := bk.SpendableCoins(ctx, account.GetAddress())
fees, err := simtypes.RandomFees(r, ctx, spendableCoins)
if err != nil {
return simtypes.NoOpMsg(group.ModuleName, TypeMsgCreateGroup, "fee error"), nil, err
}
members := genGroupMembers(r, accounts)
decisionPolicy := &group.ThresholdDecisionPolicy{
Threshold: fmt.Sprintf("%d", simtypes.RandIntBetween(r, 1, 10)),
Timeout: time.Second * time.Duration(30*24*60*60),
}
msg := &group.MsgCreateGroupWithPolicy{
Admin: accAddr,
Members: members,
GroupMetadata: []byte(simtypes.RandStringOfLength(r, 10)),
GroupPolicyMetadata: []byte(simtypes.RandStringOfLength(r, 10)),
GroupPolicyAsAdmin: r.Float32() < 0.5,
}
msg.SetDecisionPolicy(decisionPolicy)
if err != nil {
return simtypes.NoOpMsg(group.ModuleName, msg.Type(), "unable to set decision policy"), nil, err
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
txGen,
[]sdk.Msg{msg},
fees,
helpers.DefaultGenTxGas,
chainID,
[]uint64{account.GetAccountNumber()},
[]uint64{account.GetSequence()},
acc.PrivKey,
)
if err != nil {
return simtypes.NoOpMsg(group.ModuleName, TypeMsgCreateGroupWithPolicy, "unable to generate mock tx"), nil, err
}
_, _, err = app.SimDeliver(txGen.TxEncoder(), tx)
if err != nil {
return simtypes.NoOpMsg(group.ModuleName, msg.Type(), "unable to deliver tx"), nil, err
}
return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil
}
}
// SimulateMsgCreateGroupPolicy generates a NewMsgCreateGroupPolicy with random values
func SimulateMsgCreateGroupPolicy(ak group.AccountKeeper, bk group.BankKeeper, k keeper.Keeper) simtypes.Operation {
return func(
@ -288,7 +348,7 @@ func SimulateMsgCreateGroupPolicy(ak group.AccountKeeper, bk group.BankKeeper, k
groupID,
[]byte(simtypes.RandStringOfLength(r, 10)),
&group.ThresholdDecisionPolicy{
Threshold: "20",
Threshold: fmt.Sprintf("%d", simtypes.RandIntBetween(r, 1, 10)),
Timeout: time.Second * time.Duration(30*24*60*60),
},
)
@ -518,14 +578,32 @@ func SimulateMsgUpdateGroupMembers(ak group.AccountKeeper,
return simtypes.NoOpMsg(group.ModuleName, TypeMsgUpdateGroupMembers, "fee error"), nil, err
}
member, _ := simtypes.RandomAcc(r, accounts)
members := genGroupMembers(r, accounts)
members := []group.Member{
{
Address: member.Address.String(),
Weight: fmt.Sprintf("%d", GroupMemberWeight),
Metadata: []byte(simtypes.RandStringOfLength(r, 10)),
},
ctx := sdk.UnwrapSDKContext(sdkCtx)
res, err := k.GroupMembers(ctx, &group.QueryGroupMembersRequest{GroupId: groupID})
if err != nil {
return simtypes.NoOpMsg(group.ModuleName, TypeMsgUpdateGroupMembers, "group members"), nil, err
}
// set existing radnom group member weight to zero to remove from the group
existigMembers := res.Members
if len(existigMembers) > 0 {
memberToRemove := existigMembers[r.Intn(len(existigMembers))]
var isDuplicateMember bool
for idx, m := range members {
if m.Address == memberToRemove.Member.Address {
members[idx].Weight = "0"
isDuplicateMember = true
break
}
}
if !isDuplicateMember {
m := memberToRemove.Member
m.Weight = "0"
members = append(members, *m)
}
}
msg := group.MsgUpdateGroupMembers{
@ -642,7 +720,7 @@ func SimulateMsgUpdateGroupPolicyDecisionPolicy(ak group.AccountKeeper,
}
msg, err := group.NewMsgUpdateGroupPolicyDecisionPolicyRequest(acc.Address, groupPolicyBech32, &group.ThresholdDecisionPolicy{
Threshold: fmt.Sprintf("%d", simtypes.RandIntBetween(r, 1, 20)),
Threshold: fmt.Sprintf("%d", simtypes.RandIntBetween(r, 1, 10)),
Timeout: time.Second * time.Duration(simtypes.RandIntBetween(r, 100, 1000)),
})
if err != nil {
@ -1132,3 +1210,33 @@ func findAccount(accounts []simtypes.Account, addr string) (idx int) {
}
return idx
}
func genGroupMembers(r *rand.Rand, accounts []simtypes.Account) []group.Member {
if len(accounts) == 1 {
return []group.Member{
{
Address: accounts[0].Address.String(),
Weight: fmt.Sprintf("%d", simtypes.RandIntBetween(r, 1, 5)),
Metadata: []byte(simtypes.RandStringOfLength(r, 10)),
},
}
}
max := 5
if len(accounts) < max {
max = len(accounts)
}
membersLen := simtypes.RandIntBetween(r, 1, max)
members := make([]group.Member, membersLen)
for i := 0; i < membersLen; i++ {
members[i] = group.Member{
Address: accounts[i].Address.String(),
Weight: fmt.Sprintf("%d", simtypes.RandIntBetween(r, 1, 5)),
Metadata: []byte(simtypes.RandStringOfLength(r, 10)),
}
}
return members
}

View File

@ -40,7 +40,7 @@ func (suite *SimTestSuite) TestWeightedOperations() {
suite.app.BankKeeper, suite.app.GroupKeeper, cdc,
)
s := rand.NewSource(1)
s := rand.NewSource(2)
r := rand.New(s)
accs := suite.getTestingAccounts(r, 3)
@ -51,6 +51,7 @@ func (suite *SimTestSuite) TestWeightedOperations() {
}{
{simulation.WeightMsgCreateGroup, group.MsgCreateGroup{}.Route(), simulation.TypeMsgCreateGroup},
{simulation.WeightMsgCreateGroupPolicy, group.MsgCreateGroupPolicy{}.Route(), simulation.TypeMsgCreateGroupPolicy},
// {simulation.WeightMsgCreateGroupWithPolicy, group.MsgCreateGroupWithPolicy{}.Route(), simulation.TypeMsgCreateGroupWithPolicy},
{simulation.WeightMsgSubmitProposal, group.MsgSubmitProposal{}.Route(), simulation.TypeMsgSubmitProposal},
{simulation.WeightMsgSubmitProposal, group.MsgSubmitProposal{}.Route(), simulation.TypeMsgSubmitProposal},
{simulation.WeightMsgWithdrawProposal, group.MsgWithdrawProposal{}.Route(), simulation.TypeMsgWithdrawProposal},
@ -120,6 +121,35 @@ func (suite *SimTestSuite) TestSimulateCreateGroup() {
suite.Require().Len(futureOperations, 0)
}
func (suite *SimTestSuite) TestSimulateCreateGroupWithPolicy() {
// setup 1 account
s := rand.NewSource(1)
r := rand.New(s)
accounts := suite.getTestingAccounts(r, 1)
// begin a new block
suite.app.BeginBlock(abci.RequestBeginBlock{
Header: tmproto.Header{
Height: suite.app.LastBlockHeight() + 1,
AppHash: suite.app.LastCommitID().Hash,
},
})
acc := accounts[0]
// execute operation
op := simulation.SimulateMsgCreateGroupWithPolicy(suite.app.AccountKeeper, suite.app.BankKeeper)
operationMsg, futureOperations, err := op(r, suite.app.BaseApp, suite.ctx, accounts, "")
suite.Require().NoError(err)
var msg group.MsgCreateGroupWithPolicy
err = group.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg)
suite.Require().NoError(err)
suite.Require().True(operationMsg.OK)
suite.Require().Equal(acc.Address.String(), msg.Admin)
suite.Require().Len(futureOperations, 0)
}
func (suite *SimTestSuite) TestSimulateCreateGroupPolicy() {
// setup 1 account
s := rand.NewSource(1)

View File

@ -19,7 +19,7 @@ It's expecting to fail if metadata length is greater than `MaxMetadataLen` confi
Group members can be updated with the `UpdateGroupMembers`.
+++ https://github.com/cosmos/cosmos-sdk/blob/6f58963e7f6ce820e9b33f02f06f7b96f6d2e347/proto/cosmos/group/v1beta1/tx.proto#L74-L86
+++https://github.com/cosmos/cosmos-sdk/blob/9aef070625e9676d7c0acb212c17ae9dba3c32dc/proto/cosmos/group/v1beta1/tx.proto#L74-L86
In the list of `MemberUpdates`, an existing member can be removed by setting its weight to 0.
@ -29,7 +29,7 @@ It's expecting to fail if the signer is not the admin of the group.
The `UpdateGroupAdmin` can be used to update a group admin.
+++ https://github.com/cosmos/cosmos-sdk/blob/6f58963e7f6ce820e9b33f02f06f7b96f6d2e347/proto/cosmos/group/v1beta1/tx.proto#L91-L102
+++ https://github.com/cosmos/cosmos-sdk/blob/9aef070625e9676d7c0acb212c17ae9dba3c32dc/proto/cosmos/group/v1beta1/tx.proto#L91-L102
It's expecting to fail if the signer is not the admin of the group.
@ -37,7 +37,7 @@ It's expecting to fail if the signer is not the admin of the group.
The `UpdateGroupMetadata` can be used to update a group metadata.
+++ https://github.com/cosmos/cosmos-sdk/blob/6f58963e7f6ce820e9b33f02f06f7b96f6d2e347/proto/cosmos/group/v1beta1/tx.proto#L107-L118
+++ https://github.com/cosmos/cosmos-sdk/blob/9aef070625e9676d7c0acb212c17ae9dba3c32dc/proto/cosmos/group/v1beta1/tx.proto#L107-L118
It's expecting to fail if:
@ -48,15 +48,23 @@ It's expecting to fail if:
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
+++ https://github.com/cosmos/cosmos-sdk/blob/9aef070625e9676d7c0acb212c17ae9dba3c32dc/proto/cosmos/group/v1beta1/tx.proto#L127-L142
It's expecting to fail if metadata length is greater than `MaxMetadataLen` config.
## Msg/CreateGroupWithPolicy
A new group with policy can be created with the `MsgCreateGroupWithPolicy`, which has an admin address, a list of members, a decision policy, a group policy as admin field to optionally set group and group policy admin with group policy address and some optional metadata bytes for group and group policy.
+++ https://github.com/cosmos/cosmos-sdk/blob/likhita/MsgCreateGroupWithPolicy/proto/cosmos/group/v1beta1/tx.proto#L167-L188
It's expecting to fail if group metadata or group policy metadata length is greater than some `MaxMetadataLength`.
## Msg/UpdateGroupPolicyAdmin
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
+++ https://github.com/cosmos/cosmos-sdk/blob/9aef070625e9676d7c0acb212c17ae9dba3c32dc/proto/cosmos/group/v1beta1/tx.proto#L151-L162
It's expecting to fail if the signer is not the admin of the group policy.
@ -64,7 +72,7 @@ It's expecting to fail if the signer is not the admin of the group 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
+++ https://github.com/cosmos/cosmos-sdk/blob/9aef070625e9676d7c0acb212c17ae9dba3c32dc/proto/cosmos/group/v1beta1/tx.proto#L167-L179
It's expecting to fail if the signer is not the admin of the group policy.
@ -72,7 +80,7 @@ It's expecting to fail if the signer is not the admin of the group policy.
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
+++ https://github.com/cosmos/cosmos-sdk/blob/9aef070625e9676d7c0acb212c17ae9dba3c32dc/proto/cosmos/group/v1beta1/tx.proto#L184-L195
It's expecting to fail if:
@ -84,7 +92,7 @@ It's expecting to fail if:
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
+++ https://github.com/cosmos/cosmos-sdk/blob/9aef070625e9676d7c0acb212c17ae9dba3c32dc/proto/cosmos/group/v1beta1/tx.proto#L218-L239
It's expecting to fail if metadata length is greater than `MaxMetadataLen` config.
@ -104,7 +112,7 @@ It's expecting to fail if:
A new vote can be created with the `MsgVote`, given a proposal id, a voter address, a choice (yes, no, veto or abstain) and some optional metadata bytes.
An optional `Exec` value can be provided to try to execute the proposal immediately after voting.
+++ https://github.com/cosmos/cosmos-sdk/blob/6f58963e7f6ce820e9b33f02f06f7b96f6d2e347/proto/cosmos/group/v1beta1/tx.proto#L248-L265
+++ https://github.com/cosmos/cosmos-sdk/blob/9aef070625e9676d7c0acb212c17ae9dba3c32dc/proto/cosmos/group/v1beta1/tx.proto#L248-L265
It's expecting to fail if metadata length is greater than `MaxMetadataLen` config.
@ -112,7 +120,7 @@ It's expecting to fail if metadata length is greater than `MaxMetadataLen` confi
A proposal can be executed with the `MsgExec`.
+++ https://github.com/cosmos/cosmos-sdk/blob/6f58963e7f6ce820e9b33f02f06f7b96f6d2e347/proto/cosmos/group/v1beta1/tx.proto#L270-L278
+++ https://github.com/cosmos/cosmos-sdk/blob/9aef070625e9676d7c0acb212c17ae9dba3c32dc/proto/cosmos/group/v1beta1/tx.proto#L270-L278
The messages that are part of this proposal won't be executed if:

View File

@ -467,6 +467,21 @@ Example:
simd tx group create-group-policy cosmos1.. 1 "AQ==" '{"@type":"/cosmos.group.v1beta1.ThresholdDecisionPolicy", "threshold":"1", "timeout":"600s"}'
```
#### create-group-with-policy
The `create-group-with-policy` command allows users to create a group which is an aggregation of member accounts with associated weights and an administrator account with decision policy. If the `--group-policy-as-admin` flag is set to `true`, the group policy address becomes the group and group policy admin.
```bash
simd tx group create-group-with-policy [admin] [group-metadata] [group-policy-metadata] [members-json-file] [decision-policy] [flags]
```
Example:
```bash
simd tx group create-group-with-policy cosmos1.. "AQ==" "AQ==" members.json '{"@type":"/cosmos.group.v1beta1.ThresholdDecisionPolicy", "threshold":"1", "timeout":"600s"}'
```
#### update-group-policy-admin
The `update-group-policy-admin` command allows users to update a group policy admin.

View File

@ -16,12 +16,13 @@ This module allows the creation and management of on-chain multisig accounts and
## Contents
1. **[Concepts](01_concepts.md)**
* [Group](01_concepts.md#group)
* [Group Policy](01_concepts.md#group-policy)
* [Decision Policy](01_concepts.md#decision-policy)
* [Proposal](01_concepts.md#proposal)
* [Voting](01_concepts.md#voting)
* [Executing Proposals](01_concepts.md#executing-proposals)
- [Group](01_concepts.md#group)
- [Group Policy](01_concepts.md#group-policy)
- [Group With Policy](01_concepts.md#group-with-policy)
- [Decision Policy](01_concepts.md#decision-policy)
- [Proposal](01_concepts.md#proposal)
- [Voting](01_concepts.md#voting)
- [Executing Proposals](01_concepts.md#executing-proposals)
2. **[State](02_state.md)**
* [Group Table](02_state.md#group-table)
* [Group Member Table](02_state.md#group-member-table)
@ -29,18 +30,19 @@ This module allows the creation and management of on-chain multisig accounts and
* [Proposal](02_state.md#proposal-table)
* [Vote Table](02_state.md#vote-table)
3. **[Msg Service](03_messages.md)**
* [Msg/CreateGroup](03_messages.md#msgcreategroup)
* [Msg/UpdateGroupMembers](03_messages.md#msgupdategroupmembers)
* [Msg/UpdateGroupAdmin](03_messages.md#msgupdategroupadmin)
* [Msg/UpdateGroupMetadata](03_messages.md#msgupdategroupmetadata)
* [Msg/CreateGroupPolicy](03_messages.md#msgcreategrouppolicy)
* [Msg/UpdateGroupPolicyAdmin](03_messages.md#msgupdategrouppolicyadmin)
* [Msg/UpdateGroupPolicyDecisionPolicy](03_messages.md#msgupdategrouppolicydecisionpolicy)
* [Msg/UpdateGroupPolicyMetadata](03_messages.md#msgupdategrouppolicymetadata)
* [Msg/CreateProposal](03_messages.md#msgcreateproposal)
* [Msg/WithdrawProposal](03_messages.md#msgwithdrawproposal)
* [Msg/Vote](03_messages.md#msgvote)
* [Msg/Exec](03_messages.md#msgexec)
- [Msg/CreateGroup](03_messages.md#msgcreategroup)
- [Msg/UpdateGroupMembers](03_messages.md#msgupdategroupmembers)
- [Msg/UpdateGroupAdmin](03_messages.md#msgupdategroupadmin)
- [Msg/UpdateGroupMetadata](03_messages.md#msgupdategroupmetadata)
- [Msg/CreateGroupPolicy](03_messages.md#msgcreategrouppolicy)
- [Msg/CreateGroupWithPolicy](03_messages.md#msgcreategroupwithpolicy)
- [Msg/UpdateGroupPolicyAdmin](03_messages.md#msgupdategrouppolicyadmin)
- [Msg/UpdateGroupPolicyDecisionPolicy](03_messages.md#msgupdategrouppolicydecisionpolicy)
- [Msg/UpdateGroupPolicyMetadata](03_messages.md#msgupdategrouppolicymetadata)
- [Msg/CreateProposal](03_messages.md#msgcreateproposal)
- [Msg/WithdrawProposal](03_messages.md#msgwithdrawproposal)
- [Msg/Vote](03_messages.md#msgvote)
- [Msg/Exec](03_messages.md#msgexec)
4. **[Events](04_events.md)**
* [EventCreateGroup](04_events.md#eventcreategroup)
* [EventUpdateGroup](04_events.md#eventupdategroup)

View File

@ -632,6 +632,110 @@ func (m *MsgUpdateGroupPolicyAdmin) GetNewAdmin() string {
return ""
}
// MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type.
type MsgCreateGroupWithPolicy struct {
// admin is the account address of the group and group policy admin.
Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"`
// members defines the group members.
Members []Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members"`
// group_metadata is any arbitrary metadata attached to the group.
GroupMetadata []byte `protobuf:"bytes,3,opt,name=group_metadata,json=groupMetadata,proto3" json:"group_metadata,omitempty"`
// group_policy_metadata is any arbitrary metadata attached to the group policy.
GroupPolicyMetadata []byte `protobuf:"bytes,4,opt,name=group_policy_metadata,json=groupPolicyMetadata,proto3" json:"group_policy_metadata,omitempty"`
// group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group and group policy admin.
GroupPolicyAsAdmin bool `protobuf:"varint,5,opt,name=group_policy_as_admin,json=groupPolicyAsAdmin,proto3" json:"group_policy_as_admin,omitempty"`
// 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 *MsgCreateGroupWithPolicy) Reset() { *m = MsgCreateGroupWithPolicy{} }
func (m *MsgCreateGroupWithPolicy) String() string { return proto.CompactTextString(m) }
func (*MsgCreateGroupWithPolicy) ProtoMessage() {}
func (*MsgCreateGroupWithPolicy) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{11}
}
func (m *MsgCreateGroupWithPolicy) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgCreateGroupWithPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgCreateGroupWithPolicy.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgCreateGroupWithPolicy) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgCreateGroupWithPolicy.Merge(m, src)
}
func (m *MsgCreateGroupWithPolicy) XXX_Size() int {
return m.Size()
}
func (m *MsgCreateGroupWithPolicy) XXX_DiscardUnknown() {
xxx_messageInfo_MsgCreateGroupWithPolicy.DiscardUnknown(m)
}
var xxx_messageInfo_MsgCreateGroupWithPolicy proto.InternalMessageInfo
// MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type.
type MsgCreateGroupWithPolicyResponse struct {
// group_id is the unique ID of the newly created group with policy.
GroupId uint64 `protobuf:"varint,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
// group_policy_address is the account address of the newly created group policy.
GroupPolicyAddress string `protobuf:"bytes,2,opt,name=group_policy_address,json=groupPolicyAddress,proto3" json:"group_policy_address,omitempty"`
}
func (m *MsgCreateGroupWithPolicyResponse) Reset() { *m = MsgCreateGroupWithPolicyResponse{} }
func (m *MsgCreateGroupWithPolicyResponse) String() string { return proto.CompactTextString(m) }
func (*MsgCreateGroupWithPolicyResponse) ProtoMessage() {}
func (*MsgCreateGroupWithPolicyResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{12}
}
func (m *MsgCreateGroupWithPolicyResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgCreateGroupWithPolicyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgCreateGroupWithPolicyResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgCreateGroupWithPolicyResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgCreateGroupWithPolicyResponse.Merge(m, src)
}
func (m *MsgCreateGroupWithPolicyResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgCreateGroupWithPolicyResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgCreateGroupWithPolicyResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgCreateGroupWithPolicyResponse proto.InternalMessageInfo
func (m *MsgCreateGroupWithPolicyResponse) GetGroupId() uint64 {
if m != nil {
return m.GroupId
}
return 0
}
func (m *MsgCreateGroupWithPolicyResponse) GetGroupPolicyAddress() string {
if m != nil {
return m.GroupPolicyAddress
}
return ""
}
// MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type.
type MsgUpdateGroupPolicyAdminResponse struct {
}
@ -640,7 +744,7 @@ func (m *MsgUpdateGroupPolicyAdminResponse) Reset() { *m = MsgUpdateGrou
func (m *MsgUpdateGroupPolicyAdminResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateGroupPolicyAdminResponse) ProtoMessage() {}
func (*MsgUpdateGroupPolicyAdminResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{11}
return fileDescriptor_da0de9d603d844fb, []int{13}
}
func (m *MsgUpdateGroupPolicyAdminResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -683,7 +787,7 @@ func (m *MsgUpdateGroupPolicyDecisionPolicy) Reset() { *m = MsgUpdateGro
func (m *MsgUpdateGroupPolicyDecisionPolicy) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateGroupPolicyDecisionPolicy) ProtoMessage() {}
func (*MsgUpdateGroupPolicyDecisionPolicy) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{12}
return fileDescriptor_da0de9d603d844fb, []int{14}
}
func (m *MsgUpdateGroupPolicyDecisionPolicy) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -724,7 +828,7 @@ func (m *MsgUpdateGroupPolicyDecisionPolicyResponse) String() string {
}
func (*MsgUpdateGroupPolicyDecisionPolicyResponse) ProtoMessage() {}
func (*MsgUpdateGroupPolicyDecisionPolicyResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{13}
return fileDescriptor_da0de9d603d844fb, []int{15}
}
func (m *MsgUpdateGroupPolicyDecisionPolicyResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -767,7 +871,7 @@ func (m *MsgUpdateGroupPolicyMetadata) Reset() { *m = MsgUpdateGroupPoli
func (m *MsgUpdateGroupPolicyMetadata) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateGroupPolicyMetadata) ProtoMessage() {}
func (*MsgUpdateGroupPolicyMetadata) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{14}
return fileDescriptor_da0de9d603d844fb, []int{16}
}
func (m *MsgUpdateGroupPolicyMetadata) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -825,7 +929,7 @@ func (m *MsgUpdateGroupPolicyMetadataResponse) Reset() { *m = MsgUpdateG
func (m *MsgUpdateGroupPolicyMetadataResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateGroupPolicyMetadataResponse) ProtoMessage() {}
func (*MsgUpdateGroupPolicyMetadataResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{15}
return fileDescriptor_da0de9d603d844fb, []int{17}
}
func (m *MsgUpdateGroupPolicyMetadataResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -875,7 +979,7 @@ func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} }
func (m *MsgSubmitProposal) String() string { return proto.CompactTextString(m) }
func (*MsgSubmitProposal) ProtoMessage() {}
func (*MsgSubmitProposal) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{16}
return fileDescriptor_da0de9d603d844fb, []int{18}
}
func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -914,7 +1018,7 @@ func (m *MsgSubmitProposalResponse) Reset() { *m = MsgSubmitProposalResp
func (m *MsgSubmitProposalResponse) String() string { return proto.CompactTextString(m) }
func (*MsgSubmitProposalResponse) ProtoMessage() {}
func (*MsgSubmitProposalResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{17}
return fileDescriptor_da0de9d603d844fb, []int{19}
}
func (m *MsgSubmitProposalResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -962,7 +1066,7 @@ func (m *MsgWithdrawProposal) Reset() { *m = MsgWithdrawProposal{} }
func (m *MsgWithdrawProposal) String() string { return proto.CompactTextString(m) }
func (*MsgWithdrawProposal) ProtoMessage() {}
func (*MsgWithdrawProposal) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{18}
return fileDescriptor_da0de9d603d844fb, []int{20}
}
func (m *MsgWithdrawProposal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -1013,7 +1117,7 @@ func (m *MsgWithdrawProposalResponse) Reset() { *m = MsgWithdrawProposal
func (m *MsgWithdrawProposalResponse) String() string { return proto.CompactTextString(m) }
func (*MsgWithdrawProposalResponse) ProtoMessage() {}
func (*MsgWithdrawProposalResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{19}
return fileDescriptor_da0de9d603d844fb, []int{21}
}
func (m *MsgWithdrawProposalResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -1061,7 +1165,7 @@ func (m *MsgVote) Reset() { *m = MsgVote{} }
func (m *MsgVote) String() string { return proto.CompactTextString(m) }
func (*MsgVote) ProtoMessage() {}
func (*MsgVote) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{20}
return fileDescriptor_da0de9d603d844fb, []int{22}
}
func (m *MsgVote) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -1133,7 +1237,7 @@ func (m *MsgVoteResponse) Reset() { *m = MsgVoteResponse{} }
func (m *MsgVoteResponse) String() string { return proto.CompactTextString(m) }
func (*MsgVoteResponse) ProtoMessage() {}
func (*MsgVoteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{21}
return fileDescriptor_da0de9d603d844fb, []int{23}
}
func (m *MsgVoteResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -1174,7 +1278,7 @@ func (m *MsgExec) Reset() { *m = MsgExec{} }
func (m *MsgExec) String() string { return proto.CompactTextString(m) }
func (*MsgExec) ProtoMessage() {}
func (*MsgExec) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{22}
return fileDescriptor_da0de9d603d844fb, []int{24}
}
func (m *MsgExec) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -1225,7 +1329,7 @@ func (m *MsgExecResponse) Reset() { *m = MsgExecResponse{} }
func (m *MsgExecResponse) String() string { return proto.CompactTextString(m) }
func (*MsgExecResponse) ProtoMessage() {}
func (*MsgExecResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_da0de9d603d844fb, []int{23}
return fileDescriptor_da0de9d603d844fb, []int{25}
}
func (m *MsgExecResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -1267,6 +1371,8 @@ func init() {
proto.RegisterType((*MsgCreateGroupPolicy)(nil), "cosmos.group.v1beta1.MsgCreateGroupPolicy")
proto.RegisterType((*MsgCreateGroupPolicyResponse)(nil), "cosmos.group.v1beta1.MsgCreateGroupPolicyResponse")
proto.RegisterType((*MsgUpdateGroupPolicyAdmin)(nil), "cosmos.group.v1beta1.MsgUpdateGroupPolicyAdmin")
proto.RegisterType((*MsgCreateGroupWithPolicy)(nil), "cosmos.group.v1beta1.MsgCreateGroupWithPolicy")
proto.RegisterType((*MsgCreateGroupWithPolicyResponse)(nil), "cosmos.group.v1beta1.MsgCreateGroupWithPolicyResponse")
proto.RegisterType((*MsgUpdateGroupPolicyAdminResponse)(nil), "cosmos.group.v1beta1.MsgUpdateGroupPolicyAdminResponse")
proto.RegisterType((*MsgUpdateGroupPolicyDecisionPolicy)(nil), "cosmos.group.v1beta1.MsgUpdateGroupPolicyDecisionPolicy")
proto.RegisterType((*MsgUpdateGroupPolicyDecisionPolicyResponse)(nil), "cosmos.group.v1beta1.MsgUpdateGroupPolicyDecisionPolicyResponse")
@ -1285,76 +1391,82 @@ func init() {
func init() { proto.RegisterFile("cosmos/group/v1beta1/tx.proto", fileDescriptor_da0de9d603d844fb) }
var fileDescriptor_da0de9d603d844fb = []byte{
// 1089 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcf, 0x6f, 0x1b, 0x45,
0x14, 0xf6, 0xc4, 0x6e, 0x7e, 0xbc, 0x14, 0x37, 0xd9, 0x86, 0xe2, 0x2c, 0x89, 0x63, 0x4c, 0x00,
0x63, 0x92, 0xdd, 0xc6, 0x01, 0x51, 0x59, 0x15, 0x22, 0x49, 0x0d, 0xb2, 0x84, 0x21, 0x6c, 0x28,
0xbf, 0x2e, 0xd6, 0xda, 0x3b, 0x6c, 0xb7, 0xc4, 0x9e, 0x95, 0x67, 0x9d, 0xc4, 0xd7, 0x9e, 0x90,
0x7a, 0xe1, 0x1f, 0x40, 0x42, 0x42, 0xe2, 0xc0, 0x89, 0x43, 0x2f, 0x5c, 0x39, 0x55, 0x9c, 0x2a,
0x4e, 0x9c, 0x50, 0x95, 0x1c, 0x38, 0x80, 0xc4, 0x91, 0x2b, 0xda, 0x99, 0xdd, 0x89, 0x37, 0xde,
0xb5, 0xd7, 0x56, 0xd4, 0x53, 0x32, 0x3b, 0xdf, 0x7b, 0xef, 0xfb, 0xde, 0x7b, 0x33, 0x6f, 0x64,
0x58, 0x6d, 0x12, 0xda, 0x22, 0x54, 0x35, 0x3b, 0xa4, 0x6b, 0xab, 0x47, 0x5b, 0x0d, 0xec, 0xe8,
0x5b, 0xaa, 0x73, 0xa2, 0xd8, 0x1d, 0xe2, 0x10, 0x69, 0x89, 0x6f, 0x2b, 0x6c, 0x5b, 0xf1, 0xb6,
0xe5, 0x25, 0x93, 0x98, 0x84, 0x01, 0x54, 0xf7, 0x3f, 0x8e, 0x95, 0x97, 0x39, 0xb6, 0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, 0xff, 0xe8, 0x9f, 0x5f, 0xcd, 0x27, 0x11, 0x00,
0x00,
// 1199 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcd, 0x6f, 0xe3, 0x44,
0x14, 0xcf, 0x34, 0xde, 0x7e, 0xbc, 0xec, 0x66, 0xbb, 0x6e, 0xba, 0xa4, 0xa6, 0x4d, 0x83, 0xe9,
0x42, 0x29, 0xad, 0xbd, 0x4d, 0xf9, 0x58, 0x55, 0x2b, 0x44, 0xdb, 0x0d, 0x28, 0x88, 0x40, 0x71,
0x59, 0xbe, 0x2e, 0x91, 0x13, 0x1b, 0xaf, 0x97, 0x26, 0xb6, 0x32, 0x4e, 0xdb, 0x9c, 0x90, 0xf6,
0x04, 0xda, 0x0b, 0xff, 0x00, 0x12, 0x12, 0x12, 0x07, 0x4e, 0x1c, 0xf6, 0xc2, 0x95, 0xd3, 0x8a,
0xd3, 0x8a, 0x13, 0x27, 0xb4, 0x6a, 0x0f, 0x1c, 0x40, 0x82, 0x1b, 0x57, 0xe4, 0x19, 0x7b, 0x12,
0x27, 0x76, 0xe2, 0x64, 0xab, 0x3d, 0x25, 0xf6, 0xfc, 0xde, 0x7b, 0xbf, 0xdf, 0x7b, 0x6f, 0xde,
0x4c, 0x02, 0x4b, 0x35, 0x0b, 0xd7, 0x2d, 0x2c, 0x1b, 0x4d, 0xab, 0x65, 0xcb, 0x47, 0x9b, 0x55,
0xdd, 0x51, 0x37, 0x65, 0xe7, 0x44, 0xb2, 0x9b, 0x96, 0x63, 0xf1, 0x19, 0xba, 0x2c, 0x91, 0x65,
0xc9, 0x5b, 0x16, 0x32, 0x86, 0x65, 0x58, 0x04, 0x20, 0xbb, 0xdf, 0x28, 0x56, 0x58, 0xa0, 0xd8,
0x0a, 0x5d, 0xf0, 0x0c, 0xbd, 0x25, 0xc3, 0xb2, 0x8c, 0x43, 0x5d, 0x26, 0x4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 0x77, 0x30, 0x46, 0x4f, 0x80, 0x5e, 0xe8, 0x80, 0x09, 0x10, 0x75, 0x04, 0xf2,
0xef, 0x02, 0x47, 0x8e, 0xbf, 0xa5, 0x48, 0x53, 0x77, 0x59, 0xb8, 0x36, 0x70, 0xb9, 0xdb, 0x1b,
0x19, 0xe8, 0xd1, 0xde, 0xdc, 0xe5, 0x01, 0xde, 0xba, 0x8f, 0x87, 0xdd, 0x37, 0x1e, 0x9e, 0xe6,
0xd0, 0xa3, 0xd3, 0x1c, 0x7a, 0x7c, 0x9a, 0x43, 0xdf, 0x9c, 0xe5, 0x12, 0x8f, 0xce, 0x72, 0x89,
0xdf, 0xcf, 0x72, 0x89, 0xcf, 0x56, 0x0c, 0xd3, 0xb9, 0xd3, 0xaa, 0x4a, 0x35, 0xab, 0xee, 0xfd,
0x55, 0xe6, 0x7d, 0x6c, 0x60, 0xed, 0x0b, 0xf9, 0x84, 0xfe, 0x1d, 0x56, 0x9d, 0x24, 0x77, 0xa0,
0xad, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x4c, 0xbd, 0x11, 0x36, 0xa6, 0x13, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -1379,6 +1491,8 @@ type MsgClient interface {
UpdateGroupMetadata(ctx context.Context, in *MsgUpdateGroupMetadata, opts ...grpc.CallOption) (*MsgUpdateGroupMetadataResponse, error)
// CreateGroupPolicy creates a new group policy using given DecisionPolicy.
CreateGroupPolicy(ctx context.Context, in *MsgCreateGroupPolicy, opts ...grpc.CallOption) (*MsgCreateGroupPolicyResponse, error)
// CreateGroupWithPolicy creates a new group with policy.
CreateGroupWithPolicy(ctx context.Context, in *MsgCreateGroupWithPolicy, opts ...grpc.CallOption) (*MsgCreateGroupWithPolicyResponse, error)
// UpdateGroupPolicyAdmin updates a group policy admin.
UpdateGroupPolicyAdmin(ctx context.Context, in *MsgUpdateGroupPolicyAdmin, opts ...grpc.CallOption) (*MsgUpdateGroupPolicyAdminResponse, error)
// UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated.
@ -1448,6 +1562,15 @@ func (c *msgClient) CreateGroupPolicy(ctx context.Context, in *MsgCreateGroupPol
return out, nil
}
func (c *msgClient) CreateGroupWithPolicy(ctx context.Context, in *MsgCreateGroupWithPolicy, opts ...grpc.CallOption) (*MsgCreateGroupWithPolicyResponse, error) {
out := new(MsgCreateGroupWithPolicyResponse)
err := c.cc.Invoke(ctx, "/cosmos.group.v1beta1.Msg/CreateGroupWithPolicy", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateGroupPolicyAdmin(ctx context.Context, in *MsgUpdateGroupPolicyAdmin, opts ...grpc.CallOption) (*MsgUpdateGroupPolicyAdminResponse, error) {
out := new(MsgUpdateGroupPolicyAdminResponse)
err := c.cc.Invoke(ctx, "/cosmos.group.v1beta1.Msg/UpdateGroupPolicyAdmin", in, out, opts...)
@ -1523,6 +1646,8 @@ type MsgServer interface {
UpdateGroupMetadata(context.Context, *MsgUpdateGroupMetadata) (*MsgUpdateGroupMetadataResponse, error)
// CreateGroupPolicy creates a new group policy using given DecisionPolicy.
CreateGroupPolicy(context.Context, *MsgCreateGroupPolicy) (*MsgCreateGroupPolicyResponse, error)
// CreateGroupWithPolicy creates a new group with policy.
CreateGroupWithPolicy(context.Context, *MsgCreateGroupWithPolicy) (*MsgCreateGroupWithPolicyResponse, error)
// UpdateGroupPolicyAdmin updates a group policy admin.
UpdateGroupPolicyAdmin(context.Context, *MsgUpdateGroupPolicyAdmin) (*MsgUpdateGroupPolicyAdminResponse, error)
// UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated.
@ -1558,6 +1683,9 @@ func (*UnimplementedMsgServer) UpdateGroupMetadata(ctx context.Context, req *Msg
func (*UnimplementedMsgServer) CreateGroupPolicy(ctx context.Context, req *MsgCreateGroupPolicy) (*MsgCreateGroupPolicyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateGroupPolicy not implemented")
}
func (*UnimplementedMsgServer) CreateGroupWithPolicy(ctx context.Context, req *MsgCreateGroupWithPolicy) (*MsgCreateGroupWithPolicyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateGroupWithPolicy not implemented")
}
func (*UnimplementedMsgServer) UpdateGroupPolicyAdmin(ctx context.Context, req *MsgUpdateGroupPolicyAdmin) (*MsgUpdateGroupPolicyAdminResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateGroupPolicyAdmin not implemented")
}
@ -1674,6 +1802,24 @@ func _Msg_CreateGroupPolicy_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
func _Msg_CreateGroupWithPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgCreateGroupWithPolicy)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).CreateGroupWithPolicy(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.group.v1beta1.Msg/CreateGroupWithPolicy",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).CreateGroupWithPolicy(ctx, req.(*MsgCreateGroupWithPolicy))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateGroupPolicyAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateGroupPolicyAdmin)
if err := dec(in); err != nil {
@ -1824,6 +1970,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "CreateGroupPolicy",
Handler: _Msg_CreateGroupPolicy_Handler,
},
{
MethodName: "CreateGroupWithPolicy",
Handler: _Msg_CreateGroupWithPolicy_Handler,
},
{
MethodName: "UpdateGroupPolicyAdmin",
Handler: _Msg_UpdateGroupPolicyAdmin_Handler,
@ -2266,6 +2416,121 @@ func (m *MsgUpdateGroupPolicyAdmin) MarshalToSizedBuffer(dAtA []byte) (int, erro
return len(dAtA) - i, nil
}
func (m *MsgCreateGroupWithPolicy) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgCreateGroupWithPolicy) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgCreateGroupWithPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.DecisionPolicy != nil {
{
size, err := m.DecisionPolicy.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
}
if m.GroupPolicyAsAdmin {
i--
if m.GroupPolicyAsAdmin {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x28
}
if len(m.GroupPolicyMetadata) > 0 {
i -= len(m.GroupPolicyMetadata)
copy(dAtA[i:], m.GroupPolicyMetadata)
i = encodeVarintTx(dAtA, i, uint64(len(m.GroupPolicyMetadata)))
i--
dAtA[i] = 0x22
}
if len(m.GroupMetadata) > 0 {
i -= len(m.GroupMetadata)
copy(dAtA[i:], m.GroupMetadata)
i = encodeVarintTx(dAtA, i, uint64(len(m.GroupMetadata)))
i--
dAtA[i] = 0x1a
}
if len(m.Members) > 0 {
for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.Admin) > 0 {
i -= len(m.Admin)
copy(dAtA[i:], m.Admin)
i = encodeVarintTx(dAtA, i, uint64(len(m.Admin)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgCreateGroupWithPolicyResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgCreateGroupWithPolicyResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgCreateGroupWithPolicyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.GroupPolicyAddress) > 0 {
i -= len(m.GroupPolicyAddress)
copy(dAtA[i:], m.GroupPolicyAddress)
i = encodeVarintTx(dAtA, i, uint64(len(m.GroupPolicyAddress)))
i--
dAtA[i] = 0x12
}
if m.GroupId != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.GroupId))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateGroupPolicyAdminResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -2905,6 +3170,56 @@ func (m *MsgUpdateGroupPolicyAdmin) Size() (n int) {
return n
}
func (m *MsgCreateGroupWithPolicy) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Admin)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if len(m.Members) > 0 {
for _, e := range m.Members {
l = e.Size()
n += 1 + l + sovTx(uint64(l))
}
}
l = len(m.GroupMetadata)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.GroupPolicyMetadata)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.GroupPolicyAsAdmin {
n += 2
}
if m.DecisionPolicy != nil {
l = m.DecisionPolicy.Size()
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgCreateGroupWithPolicyResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.GroupId != 0 {
n += 1 + sovTx(uint64(m.GroupId))
}
l = len(m.GroupPolicyAddress)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgUpdateGroupPolicyAdminResponse) Size() (n int) {
if m == nil {
return 0
@ -4280,6 +4595,347 @@ func (m *MsgUpdateGroupPolicyAdmin) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgCreateGroupWithPolicy) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgCreateGroupWithPolicy: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgCreateGroupWithPolicy: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Admin = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Members = append(m.Members, Member{})
if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GroupMetadata", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GroupMetadata = append(m.GroupMetadata[:0], dAtA[iNdEx:postIndex]...)
if m.GroupMetadata == nil {
m.GroupMetadata = []byte{}
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GroupPolicyMetadata", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GroupPolicyMetadata = append(m.GroupPolicyMetadata[:0], dAtA[iNdEx:postIndex]...)
if m.GroupPolicyMetadata == nil {
m.GroupPolicyMetadata = []byte{}
}
iNdEx = postIndex
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GroupPolicyAsAdmin", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.GroupPolicyAsAdmin = bool(v != 0)
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DecisionPolicy", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.DecisionPolicy == nil {
m.DecisionPolicy = &types.Any{}
}
if err := m.DecisionPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgCreateGroupWithPolicyResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgCreateGroupWithPolicyResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgCreateGroupWithPolicyResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field GroupId", wireType)
}
m.GroupId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.GroupId |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field GroupPolicyAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.GroupPolicyAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateGroupPolicyAdminResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0