From 4fc9cbdc43f607e59863862a1992d237cb81919b Mon Sep 17 00:00:00 2001 From: lukema95 <867273263@qq.com> Date: Mon, 11 Dec 2023 16:47:12 +0800 Subject: [PATCH] remove ValidateBasic in cli --- x/crosschain/client/cli/cli_cctx.go | 8 ++------ x/crosschain/client/cli/cli_chain_nonce.go | 4 +--- x/crosschain/client/cli/cli_gas_price.go | 4 +--- x/crosschain/client/cli/cli_in_tx_tracker.go | 4 +--- x/crosschain/client/cli/cli_out_tx_tracker.go | 8 ++------ x/crosschain/client/cli/cli_tss.go | 12 +++--------- .../client/cli/tx_deploy_fungible_coin_zrc_4.go | 4 +--- x/fungible/client/cli/tx_remove_foreign_coin.go | 4 +--- .../client/cli/tx_update_zrc20_liquidity_cap.go | 4 +--- x/observer/client/cli/tx_add_blame_vote.go | 4 +--- x/observer/client/cli/tx_add_observer.go | 4 +--- x/observer/client/cli/tx_permission_flags.go | 4 +--- x/observer/client/cli/tx_update_core_params.go | 4 +--- x/observer/client/cli/tx_update_keygen.go | 4 +--- x/observer/client/cli/tx_update_observer.go | 4 +--- 15 files changed, 19 insertions(+), 57 deletions(-) diff --git a/x/crosschain/client/cli/cli_cctx.go b/x/crosschain/client/cli/cli_cctx.go index b97bc649f2..46634f4248 100644 --- a/x/crosschain/client/cli/cli_cctx.go +++ b/x/crosschain/client/cli/cli_cctx.go @@ -175,9 +175,7 @@ func CmdCCTXInboundVoter() *cobra.Command { argsAsset, uint(argsEventIndex), ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } @@ -262,9 +260,7 @@ func CmdCCTXOutboundVoter() *cobra.Command { outTxNonce, argsCoinType, ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/crosschain/client/cli/cli_chain_nonce.go b/x/crosschain/client/cli/cli_chain_nonce.go index b5d1dec101..aa1ced6ce2 100644 --- a/x/crosschain/client/cli/cli_chain_nonce.go +++ b/x/crosschain/client/cli/cli_chain_nonce.go @@ -120,9 +120,7 @@ func CmdNonceVoter() *cobra.Command { } msg := types.NewMsgNonceVoter(clientCtx.GetFromAddress().String(), argsChain, argsNonce) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/crosschain/client/cli/cli_gas_price.go b/x/crosschain/client/cli/cli_gas_price.go index b16aacf3de..b46897b36c 100644 --- a/x/crosschain/client/cli/cli_gas_price.go +++ b/x/crosschain/client/cli/cli_gas_price.go @@ -100,9 +100,7 @@ func CmdGasPriceVoter() *cobra.Command { } msg := types.NewMsgGasPriceVoter(clientCtx.GetFromAddress().String(), argsChain, argsPrice, argsSupply, argsBlockNumber) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/crosschain/client/cli/cli_in_tx_tracker.go b/x/crosschain/client/cli/cli_in_tx_tracker.go index 764127a900..6a3f4bd1c0 100644 --- a/x/crosschain/client/cli/cli_in_tx_tracker.go +++ b/x/crosschain/client/cli/cli_in_tx_tracker.go @@ -38,9 +38,7 @@ func CmdAddToInTxTracker() *cobra.Command { argsCoinType, argTxHash, ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/crosschain/client/cli/cli_out_tx_tracker.go b/x/crosschain/client/cli/cli_out_tx_tracker.go index fc87399818..18dc21213f 100644 --- a/x/crosschain/client/cli/cli_out_tx_tracker.go +++ b/x/crosschain/client/cli/cli_out_tx_tracker.go @@ -114,9 +114,7 @@ func CmdAddToWatchList() *cobra.Command { "", -1, ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } @@ -151,9 +149,7 @@ func CmdRemoveFromWatchList() *cobra.Command { argChain, argNonce, ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/crosschain/client/cli/cli_tss.go b/x/crosschain/client/cli/cli_tss.go index 0dd93a244c..30fce6b015 100644 --- a/x/crosschain/client/cli/cli_tss.go +++ b/x/crosschain/client/cli/cli_tss.go @@ -99,9 +99,7 @@ func CmdCreateTSSVoter() *cobra.Command { } msg := types.NewMsgCreateTSSVoter(clientCtx.GetFromAddress().String(), argsPubkey, keygenBlock, status) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } @@ -128,9 +126,7 @@ func CmdUpdateTss() *cobra.Command { } msg := types.NewMsgUpdateTssAddress(clientCtx.GetFromAddress().String(), argsPubkey) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } @@ -157,9 +153,7 @@ func CmdMigrateTssFunds() *cobra.Command { } msg := types.NewMsgMigrateTssFunds(clientCtx.GetFromAddress().String(), argsChainID, argsAmount) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go b/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go index 3a82f7c75f..f77bb9e7ff 100644 --- a/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go +++ b/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go @@ -55,9 +55,7 @@ func CmdDeployFungibleCoinZRC4() *cobra.Command { common.CoinType(argCoinType), argGasLimit, ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/fungible/client/cli/tx_remove_foreign_coin.go b/x/fungible/client/cli/tx_remove_foreign_coin.go index 00c6a32352..29fdc3612e 100644 --- a/x/fungible/client/cli/tx_remove_foreign_coin.go +++ b/x/fungible/client/cli/tx_remove_foreign_coin.go @@ -25,9 +25,7 @@ func CmdRemoveForeignCoin() *cobra.Command { clientCtx.GetFromAddress().String(), argName, ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/fungible/client/cli/tx_update_zrc20_liquidity_cap.go b/x/fungible/client/cli/tx_update_zrc20_liquidity_cap.go index 8bec27e035..4944e12d81 100644 --- a/x/fungible/client/cli/tx_update_zrc20_liquidity_cap.go +++ b/x/fungible/client/cli/tx_update_zrc20_liquidity_cap.go @@ -29,9 +29,7 @@ func CmdUpdateZRC20LiquidityCap() *cobra.Command { args[0], newCap, ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/observer/client/cli/tx_add_blame_vote.go b/x/observer/client/cli/tx_add_blame_vote.go index 802fda3edd..d91c552033 100644 --- a/x/observer/client/cli/tx_add_blame_vote.go +++ b/x/observer/client/cli/tx_add_blame_vote.go @@ -55,9 +55,7 @@ func CmdAddBlameVote() *cobra.Command { } msg := types.NewMsgAddBlameVoteMsg(clientCtx.GetFromAddress().String(), int64(chainID), blameInfo) - if err := msg.ValidateBasic(); err != nil { - return err - } + println("about to broadcast") return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, diff --git a/x/observer/client/cli/tx_add_observer.go b/x/observer/client/cli/tx_add_observer.go index c9d3670180..1e35552725 100644 --- a/x/observer/client/cli/tx_add_observer.go +++ b/x/observer/client/cli/tx_add_observer.go @@ -33,9 +33,7 @@ func CmdAddObserver() *cobra.Command { args[1], addNodeAccountOnly, ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/observer/client/cli/tx_permission_flags.go b/x/observer/client/cli/tx_permission_flags.go index bad44f32af..71c6304e51 100644 --- a/x/observer/client/cli/tx_permission_flags.go +++ b/x/observer/client/cli/tx_permission_flags.go @@ -30,9 +30,7 @@ func CmdUpdateCrosschainFlags() *cobra.Command { return err } msg := types.NewMsgUpdateCrosschainFlags(clientCtx.GetFromAddress().String(), argIsInboundEnabled, arsIsOutboundEnabled) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/observer/client/cli/tx_update_core_params.go b/x/observer/client/cli/tx_update_core_params.go index e506edeec9..6db2daaca5 100644 --- a/x/observer/client/cli/tx_update_core_params.go +++ b/x/observer/client/cli/tx_update_core_params.go @@ -44,9 +44,7 @@ func CmdUpdateCoreParams() *cobra.Command { clientCtx.GetFromAddress().String(), &clientParams, ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/observer/client/cli/tx_update_keygen.go b/x/observer/client/cli/tx_update_keygen.go index 776389369c..ac98e03046 100644 --- a/x/observer/client/cli/tx_update_keygen.go +++ b/x/observer/client/cli/tx_update_keygen.go @@ -30,9 +30,7 @@ func CmdUpdateKeygen() *cobra.Command { clientCtx.GetFromAddress().String(), argBlock, ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/observer/client/cli/tx_update_observer.go b/x/observer/client/cli/tx_update_observer.go index 3eddcb9a25..f052106136 100644 --- a/x/observer/client/cli/tx_update_observer.go +++ b/x/observer/client/cli/tx_update_observer.go @@ -38,9 +38,7 @@ func CmdUpdateObserver() *cobra.Command { args[1], updateReason, ) - if err := msg.ValidateBasic(); err != nil { - return err - } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, }