From 7fe522fad029ed10110981c2bc3120f3b43b0d19 Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Tue, 29 Oct 2024 08:49:22 -0500 Subject: [PATCH] fix: disable gas auto for gentx cmd Signed-off-by: Artur Troian --- go/cli/genesis_gentx.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/go/cli/genesis_gentx.go b/go/cli/genesis_gentx.go index 50f8cd5f..ce50514f 100644 --- a/go/cli/genesis_gentx.go +++ b/go/cli/genesis_gentx.go @@ -8,6 +8,7 @@ import ( "io" "os" "path/filepath" + "strconv" tmtypes "github.com/cometbft/cometbft/types" "github.com/pkg/errors" @@ -54,6 +55,18 @@ $ %s gentx my-key-name 1000000uakt --home=/path/to/home/dir --keyring-backend=os --website="..." `, defaultsDesc, version.AppName, ), + PreRunE: func(cmd *cobra.Command, args []string) error { + gas, err := cmd.Flags().GetString(cflags.FlagGas) + if err != nil { + return err + } + + if gas == cflags.GasFlagAuto { + cmd.Flags().Set(cflags.FlagGas, strconv.Itoa(cflags.DefaultGasLimit)) + } + + return nil + }, RunE: func(cmd *cobra.Command, args []string) error { stcx := server.GetServerContextFromCmd(cmd) cctx, err := client.GetClientTxContext(cmd)