Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(x/group): update supported flags #22229

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x/group/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ metadata example:
},
}

cmd.Flags().String(FlagExec, "", "Set to 1 to try to execute proposal immediately after creation (proposers signatures are considered as Yes votes)")
cmd.Flags().String(FlagExec, "", "Set to 1 or 'try' to try to execute proposal immediately after creation (proposers signatures are considered as Yes votes)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Correct the help string to accurately reflect the allowed value for FlagExec.

The help string suggests that both 1 and 'try' can be used to execute the proposal immediately after creation. However, according to the PR objectives and linked issue #22220, only 'try' is the valid value. Using 1 does not trigger immediate execution and can lead to confusion for users. Please update the help string to reflect this accurately.

Apply this diff to correct the help string:

-cmd.Flags().String(FlagExec, "", "Set to 1 or 'try' to try to execute proposal immediately after creation (proposers signatures are considered as Yes votes)")
+cmd.Flags().String(FlagExec, "", "Set to 'try' to execute proposal immediately after creation (proposers signatures are considered as Yes votes)")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cmd.Flags().String(FlagExec, "", "Set to 1 or 'try' to try to execute proposal immediately after creation (proposers signatures are considered as Yes votes)")
cmd.Flags().String(FlagExec, "", "Set to 'try' to execute proposal immediately after creation (proposers signatures are considered as Yes votes)")

flags.AddTxFlagsToCmd(cmd)

return cmd
Expand Down
2 changes: 1 addition & 1 deletion x/group/client/cli/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func parseMembers(membersFile string) ([]group.MemberRequest, error) {

func execFromString(execStr string) group.Exec {
exec := group.Exec_EXEC_UNSPECIFIED
if execStr == ExecTry {
if execStr == ExecTry || execStr == "1" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove the condition for "1" to align with PR objectives

The current change contradicts the PR objectives and the linked issue #22220. Adding the condition execStr == "1" allows "1" as a valid input for immediate execution, which is precisely what we're trying to correct.

Please modify the function to only accept "try" (case-insensitive) for immediate execution. Here's the suggested change:

-if execStr == ExecTry || execStr == "1" {
+if strings.EqualFold(execStr, ExecTry) {
 	exec = group.Exec_EXEC_TRY
}

Also, consider adding a comment explaining the accepted values:

// execFromString converts a string to group.Exec
// Only "try" (case-insensitive) is accepted for immediate execution
// All other values result in group.Exec_EXEC_UNSPECIFIED
func execFromString(execStr string) group.Exec {
	// ... (rest of the function)
}

This change ensures that only "try" (case-insensitive) is accepted for immediate execution, aligning with the PR objectives and preventing potential confusion or bugs.

exec = group.Exec_EXEC_TRY
}

Expand Down
Loading