From 563f18cfc9bcf59769114a0849fc7899cbcc45b4 Mon Sep 17 00:00:00 2001 From: Tom <54514587+GAtom22@users.noreply.github.com> Date: Tue, 14 Mar 2023 15:48:27 -0300 Subject: [PATCH] fix(cli): revert fees auto flag (Backport #22) (#23) --- CHANGELOG.md | 6 ++++++ client/cmd.go | 14 -------------- client/flags/flags.go | 2 +- client/tx/factory.go | 6 ------ 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6ea43fd4517..3d1b75758c69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/client/cmd.go b/client/cmd.go index 9984cc7ac7a7..8ff09a8f13ac 100644 --- a/client/cmd.go +++ b/client/cmd.go @@ -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 } diff --git a/client/flags/flags.go b/client/flags/flags.go index e458e0ff238c..6cfd9a6b7da7 100644 --- a/client/flags/flags.go +++ b/client/flags/flags.go @@ -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", ": to tendermint rpc interface for this chain") cmd.Flags().Bool(FlagUseLedger, false, "Use a connected Ledger device") diff --git a/client/tx/factory.go b/client/tx/factory.go index d17114df5156..0f0d56329ce8 100644 --- a/client/tx/factory.go +++ b/client/tx/factory.go @@ -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)