fix(cli): failed to convert address field in withdraw-validator-commission (#25485)

This commit is contained in:
mmsqe 2025-10-23 01:50:22 +08:00 committed by GitHub
parent 9c4af5a70e
commit 5e022baf9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 0 deletions

View File

@ -76,6 +76,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/epochs) [#25087](https://github.com/cosmos/cosmos-sdk/pull/25087) Remove redundant error check in BeginBlocker.
* [GHSA-p22h-3m2v-cmgh](https://github.com/cosmos/cosmos-sdk/security/advisories/GHSA-p22h-3m2v-cmgh) Fix x/distribution can halt when historical rewards overflow.
* (x/staking) [#25258](https://github.com/cosmos/cosmos-sdk/pull/25258) Add delegator address to redelegate event.
* (cli) [#25485](https://github.com/cosmos/cosmos-sdk/pull/25485) Avoid failed to convert address field in `withdraw-validator-commission` cmd.
### Deprecated

View File

@ -43,6 +43,7 @@ func NewTxCmd(valAc, ac address.Codec) *cobra.Command {
NewSetWithdrawAddrCmd(ac),
NewFundCommunityPoolCmd(ac),
NewDepositValidatorRewardsPoolCmd(valAc, ac),
NewWithdrawValidatorCommissionCmd(valAc, ac),
)
return distTxCmd
@ -304,3 +305,30 @@ func NewDepositValidatorRewardsPoolCmd(valCodec, ac address.Codec) *cobra.Comman
return cmd
}
// NewWithdrawValidatorCommissionCmd returns a CLI command handler for creating a MsgWithdrawValidatorCommission transaction.
func NewWithdrawValidatorCommissionCmd(valCodec, ac address.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "withdraw-validator-commission [validator-addr]",
Short: "Withdraw commissions from a validator address (must be a validator operator)",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
_, err = ac.BytesToString(clientCtx.GetFromAddress())
if err != nil {
return err
}
_, err = valCodec.StringToBytes(args[0])
if err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), types.NewMsgWithdrawValidatorCommission(args[0]))
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}