feat(group)!: read the decision policy from disk in group CLI (#12551)

This commit is contained in:
Julien Robert 2022-07-13 19:05:19 +02:00 committed by GitHub
parent ef25a4573b
commit a2744eabc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 120 additions and 110 deletions

View File

@ -37,10 +37,6 @@ Ref: https://keepachangelog.com/en/1.0.0/
## [Unreleased]
### API Breaking Changes
* (types) [\#12355](https://github.com/cosmos/cosmos-sdk/pull/12355) Remove the compile-time `types.DBbackend` variable. Removes usage of the same in server/util.go
### Features
* (cli) [#12028](https://github.com/cosmos/cosmos-sdk/pull/12028) Add the `tendermint key-migrate` to perform Tendermint v0.35 DB key migration.
@ -65,6 +61,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### API Breaking Changes
* (types) [\#12355](https://github.com/cosmos/cosmos-sdk/pull/12355) Remove the compile-time `types.DBbackend` variable. Removes usage of the same in server/util.go
* (x/gov) [#12368](https://github.com/cosmos/cosmos-sdk/pull/12369) Gov keeper is now passed by reference instead of copy to make post-construction mutation of Hooks and Proposal Handlers possible at a framework level.
* (simapp) [#12270](https://github.com/cosmos/cosmos-sdk/pull/12270) Remove `invCheckPeriod uint` attribute from `SimApp` struct as per migration of `x/crisis` to app wiring
* (simapp) [#12334](https://github.com/cosmos/cosmos-sdk/pull/12334) Move `simapp.ConvertAddrsToValAddrs` and `simapp.CreateTestPubKeys ` to respectively `simtestutil.ConvertAddrsToValAddrs` and `simtestutil.CreateTestPubKeys` (`testutil/sims`)
@ -77,6 +74,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/distribution) [#12434](https://github.com/cosmos/cosmos-sdk/pull/12434) `x/distribution` module `SetParams` keeper method definition is now updated to return `error`.
* (x/crisis) [#12445](https://github.com/cosmos/cosmos-sdk/pull/12445) `x/crisis` module `SetConstantFee` keeper method definition is now updated to return `error`.
### CLI Breaking Changes
* (x/group) [#12551](https://github.com/cosmos/cosmos-sdk/pull/12551) read the decision policy from disk in group CLI commands.
### Bug Fixes

View File

@ -3,7 +3,6 @@ package cli
import (
"fmt"
"strconv"
"strings"
"github.com/spf13/cobra"
@ -53,18 +52,12 @@ func TxCmd(name string) *cobra.Command {
// MsgCreateGroupCmd creates a CLI command for Msg/CreateGroup.
func MsgCreateGroupCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "create-group [admin] [metadata] [members-json-file]",
Short: "Create a group which is an aggregation " +
"of member accounts with associated weights and " +
"an administrator account. Note, the '--from' flag is " +
"ignored as it is implied from [admin].",
Long: strings.TrimSpace(
fmt.Sprintf(`Create a group which is an aggregation of member accounts with associated weights and
an administrator account. 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.
Example:
$ %s tx group create-group [admin] [metadata] [members-json-file]
Use: "create-group [admin] [metadata] [members-json-file]",
Short: "Create a group which is an aggregation of member accounts with associated weights and an administrator account.",
Long: `Create a group which is an aggregation of member accounts with associated weights and an administrator account.
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.`,
Example: fmt.Sprintf(`
%s tx group create-group [admin] [metadata] [members-json-file]
Where members.json contains:
@ -81,11 +74,7 @@ Where members.json contains:
"metadata": "some metadata"
}
]
}
`,
version.AppName,
),
),
}`, version.AppName),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
err := cmd.Flags().Set(flags.FlagFrom, args[0])
@ -126,11 +115,8 @@ func MsgUpdateGroupMembersCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update-group-members [admin] [group-id] [members-json-file]",
Short: "Update a group's members. Set a member's weight to \"0\" to delete it.",
Long: strings.TrimSpace(
fmt.Sprintf(`Update a group's members
Example:
$ %s tx group update-group-members [admin] [group-id] [members-json-file]
Example: fmt.Sprintf(`
%s tx group update-group-members [admin] [group-id] [members-json-file]
Where members.json contains:
@ -150,10 +136,7 @@ Where members.json contains:
}
Set a member's weight to "0" to delete it.
`,
version.AppName,
),
),
`, version.AppName),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
err := cmd.Flags().Set(flags.FlagFrom, args[0])
@ -277,21 +260,14 @@ func MsgUpdateGroupMetadataCmd() *cobra.Command {
// 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,
Use: "create-group-with-policy [admin] [group-metadata] [group-policy-metadata] [members-json-file] [decision-policy-json-file]",
Short: "Create a group with policy which is an aggregation of member accounts with associated weights, an administrator account and decision policy.",
Long: `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.v1.ThresholdDecisionPolicy", "threshold":"1", \
"windows": {"voting_period": "120h", "min_execution_period": "0s"}}'
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: fmt.Sprintf(`
%s tx group create-group-with-policy [admin] [group-metadata] [group-policy-metadata] members.json policy.json
where members.json contains:
@ -309,10 +285,18 @@ where members.json contains:
}
]
}
`,
version.AppName,
),
),
and policy.json contains:
{
"@type": "/cosmos.group.v1.ThresholdDecisionPolicy",
"threshold": "1",
"windows": {
"voting_period": "120h",
"min_execution_period": "0s"
}
}
`, version.AppName),
Args: cobra.MinimumNArgs(5),
RunE: func(cmd *cobra.Command, args []string) error {
err := cmd.Flags().Set(flags.FlagFrom, args[0])
@ -335,8 +319,8 @@ where members.json contains:
return err
}
var policy group.DecisionPolicy
if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(args[4]), &policy); err != nil {
policy, err := parseDecisionPolicy(clientCtx.Codec, args[4])
if err != nil {
return err
}
@ -368,26 +352,32 @@ where members.json contains:
// MsgCreateGroupPolicyCmd creates a CLI command for Msg/CreateGroupPolicy.
func MsgCreateGroupPolicyCmd() *cobra.Command {
cmd := &cobra.Command{
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 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].
Use: "create-group-policy [admin] [group-id] [metadata] [decision-policy-json-file]",
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].`,
Example: fmt.Sprintf(`
%s tx group create-group-policy [admin] [group-id] [metadata] policy.json
Example:
$ %s tx group create-group-policy [admin] [group-id] [metadata] \
'{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"1", \
"windows": {"voting_period": "120h", "min_execution_period": "0s"}}'
where policy.json contains:
Here, we can use percentage decision policy when needed, where 0 < percentage <= 1.
Ex: '{"@type":"/cosmos.group.v1.PercentageDecisionPolicy", "percentage":"0.5", "windows": {"voting_period": "120h", "min_execution_period": "0s"}}
`,
version.AppName,
),
),
{
"@type": "/cosmos.group.v1.ThresholdDecisionPolicy",
"threshold": "1",
"windows": {
"voting_period": "120h",
"min_execution_period": "0s"
}
}
Here, we can use percentage decision policy when needed, where 0 < percentage <= 1:
{
"@type": "/cosmos.group.v1.PercentageDecisionPolicy",
"percentage": "0.5",
"windows": {
"voting_period": "120h",
"min_execution_period": "0s"
}
}`, version.AppName),
Args: cobra.ExactArgs(4),
RunE: func(cmd *cobra.Command, args []string) error {
err := cmd.Flags().Set(flags.FlagFrom, args[0])
@ -405,8 +395,8 @@ Ex: '{"@type":"/cosmos.group.v1.PercentageDecisionPolicy", "percentage":"0.5", "
return err
}
var policy group.DecisionPolicy
if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(args[3]), &policy); err != nil {
policy, err := parseDecisionPolicy(clientCtx.Codec, args[3])
if err != nil {
return err
}
@ -470,7 +460,7 @@ func MsgUpdateGroupPolicyAdminCmd() *cobra.Command {
// MsgUpdateGroupPolicyDecisionPolicyCmd creates a CLI command for Msg/UpdateGroupPolicyDecisionPolicy.
func MsgUpdateGroupPolicyDecisionPolicyCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update-group-policy-decision-policy [admin] [group-policy-account] [decision-policy]",
Use: "update-group-policy-decision-policy [admin] [group-policy-account] [decision-policy-json-file]",
Short: "Update a group policy's decision policy",
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
@ -484,8 +474,8 @@ func MsgUpdateGroupPolicyDecisionPolicyCmd() *cobra.Command {
return err
}
var policy group.DecisionPolicy
if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(args[2]), &policy); err != nil {
policy, err := parseDecisionPolicy(clientCtx.Codec, args[2])
if err != nil {
return err
}
@ -556,13 +546,11 @@ func MsgSubmitProposalCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "submit-proposal [proposal_json_file]",
Short: "Submit a new proposal",
Long: fmt.Sprintf(`Submit a new proposal.
Long: `Submit a new proposal.
Parameters:
msg_tx_json_file: path to json file with messages that will be executed if the proposal is accepted.
Example:
$ %s tx group submit-proposal path/to/proposal.json
msg_tx_json_file: path to json file with messages that will be executed if the proposal is accepted.`,
Example: fmt.Sprintf(`
%s tx group submit-proposal path/to/proposal.json
Where proposal.json contains:
@ -638,7 +626,7 @@ func MsgWithdrawProposalCmd() *cobra.Command {
Parameters:
proposal-id: unique ID of the proposal.
group-policy-admin-or-proposer: either admin of the group policy or one the proposer of the proposal.
(note: --from flag will be ignored here)
Note: --from flag will be ignored here.
`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
@ -788,14 +776,13 @@ func MsgExecCmd() *cobra.Command {
func MsgLeaveGroupCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "leave-group [member-address] [group-id]",
Short: "remove member from the group",
Long: ` remove member from the group
Short: "Remove member from the group",
Long: `Remove member from the group
Parameters:
group-id: unique id of the group
member-address: account address of the group member
Note, the '--from' flag is
ignored as it is implied from [member-address]
Note, the '--from' flag is ignored as it is implied from [member-address]
`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {

View File

@ -2,6 +2,7 @@ package cli
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
@ -10,6 +11,24 @@ import (
"github.com/cosmos/cosmos-sdk/x/group"
)
func parseDecisionPolicy(cdc codec.Codec, decisionPolicyFile string) (group.DecisionPolicy, error) {
if decisionPolicyFile == "" {
return nil, fmt.Errorf("decision policy is required")
}
contents, err := ioutil.ReadFile(decisionPolicyFile)
if err != nil {
return nil, err
}
var policy group.DecisionPolicy
if err := cdc.UnmarshalInterfaceJSON(contents, &policy); err != nil {
return nil, fmt.Errorf("failed to parse decision policy: %w", err)
}
return policy, nil
}
func parseMembers(membersFile string) ([]group.MemberRequest, error) {
members := group.MemberRequests{}

View File

@ -134,7 +134,7 @@ func (s *IntegrationTestSuite) SetupSuite() {
val.Address.String(),
"1",
validMetadata,
fmt.Sprintf("{\"@type\":\"/cosmos.group.v1.PercentageDecisionPolicy\", \"percentage\":\"%f\", \"windows\":{\"voting_period\":\"30000s\"}}", percentage),
testutil.WriteToNewTempFile(s.T(), fmt.Sprintf(`{"@type":"/cosmos.group.v1.PercentageDecisionPolicy", "percentage":"%f", "windows":{"voting_period":"30000s"}}`, percentage)).Name(),
},
s.commonFlags...,
),
@ -713,6 +713,8 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() {
}]}`, val.Address.String(), tooLongMetadata)
invalidMembersMetadataFile := testutil.WriteToNewTempFile(s.T(), invalidMembersMetadata)
thresholdDecisionPolicyFile := testutil.WriteToNewTempFile(s.T(), `{"@type": "/cosmos.group.v1.ThresholdDecisionPolicy","threshold": "1","windows": {"voting_period":"1s"}}`)
testCases := []struct {
name string
args []string
@ -729,7 +731,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() {
validMetadata,
validMetadata,
validMembersFile.Name(),
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
s.commonFlags...,
@ -747,7 +749,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() {
validMetadata,
validMetadata,
validMembersFile.Name(),
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, true),
},
s.commonFlags...,
@ -765,7 +767,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() {
validMetadata,
validMetadata,
validMembersFile.Name(),
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON),
},
@ -784,7 +786,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() {
strings.Repeat("a", 256),
validMetadata,
validMembersFile.Name(),
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
s.commonFlags...,
@ -802,7 +804,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() {
validMetadata,
strings.Repeat("a", 256),
validMembersFile.Name(),
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
s.commonFlags...,
@ -820,7 +822,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() {
validMetadata,
validMetadata,
invalidMembersAddressFile.Name(),
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
s.commonFlags...,
@ -838,7 +840,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() {
validMetadata,
validMetadata,
invalidMembersWeightFile.Name(),
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
s.commonFlags...,
@ -856,7 +858,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupWithPolicy() {
validMetadata,
validMetadata,
invalidMembersMetadataFile.Name(),
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
fmt.Sprintf("--%s=%v", client.FlagGroupPolicyAsAdmin, false),
},
s.commonFlags...,
@ -894,6 +896,8 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
groupID := s.group.Id
thresholdDecisionPolicyFile := testutil.WriteToNewTempFile(s.T(), `{"@type": "/cosmos.group.v1.ThresholdDecisionPolicy","threshold": "1","windows": {"voting_period":"1s"}}`)
testCases := []struct {
name string
args []string
@ -909,7 +913,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
val.Address.String(),
fmt.Sprintf("%v", groupID),
validMetadata,
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
},
s.commonFlags...,
),
@ -925,7 +929,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
val.Address.String(),
fmt.Sprintf("%v", groupID),
validMetadata,
"{\"@type\":\"/cosmos.group.v1.PercentageDecisionPolicy\", \"percentage\":\"0.5\", \"windows\":{\"voting_period\":\"1s\"}}",
testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.PercentageDecisionPolicy", "percentage":"0.5", "windows":{"voting_period":"1s"}}`).Name(),
},
s.commonFlags...,
),
@ -941,7 +945,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
val.Address.String(),
fmt.Sprintf("%v", groupID),
validMetadata,
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON),
},
s.commonFlags...,
@ -958,7 +962,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
wrongAdmin.String(),
fmt.Sprintf("%v", groupID),
validMetadata,
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
},
s.commonFlags...,
),
@ -974,7 +978,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
val.Address.String(),
fmt.Sprintf("%v", groupID),
strings.Repeat("a", 500),
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
},
s.commonFlags...,
),
@ -990,7 +994,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
val.Address.String(),
"10",
validMetadata,
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
thresholdDecisionPolicyFile.Name(),
},
s.commonFlags...,
),
@ -1006,7 +1010,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
val.Address.String(),
fmt.Sprintf("%v", groupID),
validMetadata,
"{\"@type\":\"/cosmos.group.v1.PercentageDecisionPolicy\", \"percentage\":\"-0.5\", \"windows\":{\"voting_period\":\"1s\"}}",
testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.PercentageDecisionPolicy", "percentage":"-0.5", "windows":{"voting_period":"1s"}}`).Name(),
},
s.commonFlags...,
),
@ -1022,7 +1026,7 @@ func (s *IntegrationTestSuite) TestTxCreateGroupPolicy() {
val.Address.String(),
fmt.Sprintf("%v", groupID),
validMetadata,
"{\"@type\":\"/cosmos.group.v1.PercentageDecisionPolicy\", \"percentage\":\"2\", \"windows\":{\"voting_period\":\"1s\"}}",
testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.PercentageDecisionPolicy", "percentage":"2", "windows":{"voting_period":"1s"}}`).Name(),
},
s.commonFlags...,
),
@ -1176,7 +1180,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() {
[]string{
groupPolicy.Admin,
groupPolicy.Address,
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"40000s\"}}",
testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"1", "windows":{"voting_period":"40000s"}}`).Name(),
},
commonFlags...,
),
@ -1191,7 +1195,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() {
[]string{
groupPolicy.Admin,
groupPolicy.Address,
"{\"@type\":\"/cosmos.group.v1.PercentageDecisionPolicy\", \"percentage\":\"0.5\", \"windows\":{\"voting_period\":\"40000s\"}}",
testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.PercentageDecisionPolicy", "percentage":"0.5", "windows":{"voting_period":"40000s"}}`).Name(),
},
commonFlags...,
),
@ -1206,7 +1210,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() {
[]string{
groupPolicy.Admin,
groupPolicy.Address,
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"50000s\"}}",
testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"1", "windows":{"voting_period":"50000s"}}`).Name(),
fmt.Sprintf("--%s=%s", flags.FlagSignMode, flags.SignModeLegacyAminoJSON),
},
commonFlags...,
@ -1222,7 +1226,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() {
[]string{
newAdmin.String(),
groupPolicy.Address,
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"1", "windows":{"voting_period":"1s"}}`).Name(),
},
commonFlags...,
),
@ -1237,7 +1241,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() {
[]string{
groupPolicy.Admin,
newAdmin.String(),
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"1\", \"windows\":{\"voting_period\":\"1s\"}}",
testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"1", "windows":{"voting_period":"1s"}}`).Name(),
},
commonFlags...,
),
@ -1252,7 +1256,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() {
[]string{
groupPolicy.Admin,
groupPolicy.Address,
"{\"@type\":\"/cosmos.group.v1.PercentageDecisionPolicy\", \"percentage\":\"-0.5\", \"windows\":{\"voting_period\":\"1s\"}}",
testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.PercentageDecisionPolicy", "percentage":"-0.5", "windows":{"voting_period":"1s"}}`).Name(),
},
commonFlags...,
),
@ -1267,7 +1271,7 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupPolicyDecisionPolicy() {
[]string{
groupPolicy.Admin,
groupPolicy.Address,
"{\"@type\":\"/cosmos.group.v1.PercentageDecisionPolicy\", \"percentage\":\"2\", \"windows\":{\"voting_period\":\"40000s\"}}",
testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.PercentageDecisionPolicy", "percentage":"2", "windows":{"voting_period":"40000s"}}`).Name(),
},
commonFlags...,
),
@ -2109,7 +2113,7 @@ func (s *IntegrationTestSuite) TestTxLeaveGroup() {
val.Address.String(),
groupID,
"AQ==",
"{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"3\", \"windows\":{\"voting_period\":\"1s\"}}",
testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"3", "windows":{"voting_period":"1s"}}`).Name(),
},
s.commonFlags...,
),
@ -2529,7 +2533,7 @@ func (s *IntegrationTestSuite) createGroupThresholdPolicyWithBalance(adminAddres
adminAddress,
groupID,
validMetadata,
fmt.Sprintf("{\"@type\":\"/cosmos.group.v1.ThresholdDecisionPolicy\", \"threshold\":\"%d\", \"windows\":{\"voting_period\":\"30000s\"}}", threshold),
testutil.WriteToNewTempFile(s.T(), fmt.Sprintf(`{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"%d", "windows":{"voting_period":"30000s"}}`, threshold)).Name(),
},
s.commonFlags...,
),