Skip to content

Commit

Permalink
fix(cli): revert fees auto flag (Backport cosmos#22) (cosmos#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
GAtom22 authored Mar 14, 2023
1 parent 2537126 commit 563f18c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 21 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## Unrealeased

### Bug Fixes

* (cli) [#22](https://github.com/evmos/cosmos-sdk/pull/22) Rollback `--fees auto` flag

## v0.46.11-ledger - 2023-02-24

### Bug Fixes
Expand Down
14 changes: 0 additions & 14 deletions client/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,20 +308,6 @@ func readTxCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Context, err
}
}

feesStr, _ := flagSet.GetString(flags.FlagFees)
gasStr, _ := flagSet.GetString(flags.FlagGas)
gasPricesStr, _ := flagSet.GetString(flags.FlagGasPrices)

// if used --gas=auto, then don't accept any other flag related to fees (e.g. --fees, --gas-price)
if gasStr == flags.FlagAuto && (feesStr != "" || gasPricesStr != "") {
return clientCtx, fmt.Errorf("you are using the --gas %q flag. It is not allowed to specify other flags (e.g. --fees and/or --gas-prices)", flags.FlagAuto)
}

// ditto for --fees=auto
if feesStr == flags.FlagAuto && (gasStr != "" || gasPricesStr != "") {
return clientCtx, fmt.Errorf("you are using the --fees %q flag. It is not allowed to specify other flags (e.g. --gas and/or --gas-prices)", flags.FlagAuto)
}

return clientCtx, nil
}

Expand Down
2 changes: 1 addition & 1 deletion client/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func AddTxFlagsToCmd(cmd *cobra.Command) {
cmd.Flags().Uint64P(FlagSequence, "s", 0, "The sequence number of the signing account (offline mode only)")
cmd.Flags().String(FlagNote, "", "Note to add a description to the transaction (previously --memo)")
// --fees can accept integers+denom and "auto"
cmd.Flags().String(FlagFees, "", fmt.Sprintf("Fees to pay along with transaction; eg: 10uatom. Set to %q to calculate sufficient fees and gas automatically", FlagAuto))
cmd.Flags().String(FlagFees, "", "Fees to pay along with transaction; eg: 10uatom")
cmd.Flags().String(FlagGasPrices, "", "Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)")
cmd.Flags().String(FlagNode, "tcp://localhost:26657", "<host>:<port> to tendermint rpc interface for this chain")
cmd.Flags().Bool(FlagUseLedger, false, "Use a connected Ledger device")
Expand Down
6 changes: 0 additions & 6 deletions client/tx/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,6 @@ func (f Factory) WithGas(gas uint64) Factory {

// WithFees returns a copy of the Factory with an updated fee.
func (f Factory) WithFees(fees string) Factory {
// When using the FeesFlagAuto, if not provided,
// simulate Tx to get the tx gas
if fees == flags.FlagAuto {
f.simulateAndExecute = true
return f
}
parsedFees, err := sdk.ParseCoinsNormalized(fees)
if err != nil {
panic(err)
Expand Down

0 comments on commit 563f18c

Please sign in to comment.