Skip to content

Commit

Permalink
fix: feegrant grant cli bug (backport cosmos#9720) (cosmos#9733)
Browse files Browse the repository at this point in the history
* fix: feegrant grant cli bug (cosmos#9720)

<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description
feegrant grant cli granter now accepts key name as well as address in general and accepts only address in `--generate-only` mode

Closes: cosmos#9659

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### 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...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] 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)

(cherry picked from commit 085ab06)

# Conflicts:
#	CHANGELOG.md

* fix conflicts

* fix changelog

* try fixing lint issue

* remove staticcheck comments

* Update server/grpc/gogoreflection/fix_registration.go

* Update server/grpc/gogoreflection/fix_registration.go

Co-authored-by: likhita-809 <[email protected]>
Co-authored-by: likhita-809 <[email protected]>
Co-authored-by: Amaury M <[email protected]>
  • Loading branch information
4 people authored and JeancarloBarrios committed Sep 28, 2024
1 parent dc9c751 commit e2ccf75
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* [\#9720](https://github.com/cosmos/cosmos-sdk/pull/9720) Feegrant grant cli granter now accepts key name as well as address in general and accepts only address in --generate-only mode
* [\#9766](https://github.com/cosmos/cosmos-sdk/pull/9766) Fix hardcoded ledger signing algorithm on `keys add` command.

### Features
Expand Down
8 changes: 2 additions & 6 deletions x/feegrant/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ func GetTxCmd() *cobra.Command {
// This command is more powerful than AutoCLI generated command as it allows a better input validation.
func NewCmdFeeGrant() *cobra.Command {
cmd := &cobra.Command{
Use: "grant <granter_key_or_address> <grantee>",
Aliases: []string{"grant-allowance"},
Short: "Grant Fee allowance to an address",
Use: "grant [granter_key_or_address] [grantee]",
Short: "Grant Fee allowance to an address",
Long: strings.TrimSpace(
fmt.Sprintf(
`Grant authorization to pay fees from your address. Note, the '--from' flag is
Expand All @@ -66,9 +65,6 @@ Examples:
),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
if err := cmd.Flags().Set(flags.FlagFrom, args[0]); err != nil {
return err
}

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand Down
15 changes: 4 additions & 11 deletions x/feegrant/client/cli/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,6 @@ import (
"github.com/cosmos/gogoproto/proto"
"github.com/stretchr/testify/suite"

_ "cosmossdk.io/api/cosmos/feegrant/v1beta1"
v1 "cosmossdk.io/api/cosmos/gov/v1"
v1beta1 "cosmossdk.io/api/cosmos/gov/v1beta1"
"cosmossdk.io/core/address"
sdkmath "cosmossdk.io/math"
"cosmossdk.io/x/feegrant"
"cosmossdk.io/x/feegrant/client/cli"
"cosmossdk.io/x/feegrant/module"
"cosmossdk.io/x/gov"
govcli "cosmossdk.io/x/gov/client/cli"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
Expand Down Expand Up @@ -154,6 +143,10 @@ func (s *CLITestSuite) TestNewCmdFeeGrant() {
s.Require().Equal(fromAddr, granter)
s.Require().NoError(err)

fromAddr, fromName, _, err := client.GetFromFields(clientCtx.Keyring, granter.String(), clientCtx.GenerateOnly)
s.Require().Equal(fromAddr, granter)
s.Require().NoError(err)

commonFlags := []string{
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
Expand Down

0 comments on commit e2ccf75

Please sign in to comment.