Skip to content

Commit

Permalink
update cli
Browse files Browse the repository at this point in the history
  • Loading branch information
tubackkhoa committed Dec 26, 2022
1 parent 45e7055 commit 78388f7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
5 changes: 3 additions & 2 deletions module/x/gravity/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,9 @@ func CmdSetOrchestratorAddress() *cobra.Command {
func CmdExecutePendingIbcAutoForwards() *cobra.Command {
// nolint: exhaustruct
cmd := &cobra.Command{
Use: "execute-pending-ibc-auto-forwards [forwards-to-execute]",
Use: "execute-pending-ibc-auto-forwards [forwards-to-execute] [evm chain prefix]",
Short: "Executes a given number of IBC Auto-Forwards",
Args: cobra.ExactArgs(1),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
cliCtx, err := client.GetClientTxContext(cmd)
if err != nil {
Expand All @@ -476,6 +476,7 @@ func CmdExecutePendingIbcAutoForwards() *cobra.Command {
msg := types.MsgExecuteIbcAutoForwards{
ForwardsToClear: forwardsToClear,
Executor: cliCtx.GetFromAddress().String(),
EvmChainPrefix: args[1],
}
if err := msg.ValidateBasic(); err != nil {
return err
Expand Down
23 changes: 14 additions & 9 deletions module/x/gravity/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (msg MsgSendToEth) ValidateBasic() error {
}

if msg.EvmChainPrefix == "" {
return fmt.Errorf("evm_chain_prefix is empty MsgSendToEth")
return fmt.Errorf("evm_chain_prefix is empty")
}

// fee and send must be of the same denom
Expand Down Expand Up @@ -202,7 +202,7 @@ func (msg MsgRequestBatch) Type() string { return "request_batch" }
func (msg MsgRequestBatch) ValidateBasic() error {

if msg.EvmChainPrefix == "" {
return fmt.Errorf("evm_chain_prefix is empty MsgRequestBatch")
return fmt.Errorf("evm_chain_prefix is empty")
}

if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
Expand Down Expand Up @@ -237,7 +237,7 @@ func (msg MsgConfirmBatch) Type() string { return "confirm_batch" }
func (msg MsgConfirmBatch) ValidateBasic() error {

if msg.EvmChainPrefix == "" {
return fmt.Errorf("evm_chain_prefix is empty MsgConfirmBatch")
return fmt.Errorf("evm_chain_prefix is empty")
}

if _, err := sdk.AccAddressFromBech32(msg.Orchestrator); err != nil {
Expand Down Expand Up @@ -280,7 +280,7 @@ func (msg MsgConfirmLogicCall) Type() string { return "confirm_logic" }
func (msg MsgConfirmLogicCall) ValidateBasic() error {

if msg.EvmChainPrefix == "" {
return fmt.Errorf("evm_chain_prefix is empty MsgConfirmLogicCall")
return fmt.Errorf("evm_chain_prefix is empty")
}

if _, err := sdk.AccAddressFromBech32(msg.Orchestrator); err != nil {
Expand Down Expand Up @@ -359,7 +359,7 @@ func (msg *MsgSendToCosmosClaim) GetType() ClaimType {
func (msg *MsgSendToCosmosClaim) ValidateBasic() error {

if msg.EvmChainPrefix == "" {
return fmt.Errorf("evm_chain_prefix is empty MsgSendToCosmosClaim")
return fmt.Errorf("evm_chain_prefix is empty")
}

if err := ValidateEthAddress(msg.EthereumSender); err != nil {
Expand Down Expand Up @@ -438,6 +438,11 @@ func (msg *MsgExecuteIbcAutoForwards) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Executor); err != nil {
return sdkerrors.Wrap(err, "Unable to parse executor as a valid bech32 address")
}

if msg.EvmChainPrefix == "" {
return fmt.Errorf("evm_chain_prefix is empty")
}

return nil
}

Expand All @@ -464,7 +469,7 @@ func (e *MsgBatchSendToEthClaim) ValidateBasic() error {
return fmt.Errorf("batch_nonce == 0")
}
if e.EvmChainPrefix == "" {
return fmt.Errorf("evm_chain_prefix is empty MsgBatchSendToEthClaim")
return fmt.Errorf("evm_chain_prefix is empty")
}
if err := ValidateEthAddress(e.TokenContract); err != nil {
return sdkerrors.Wrap(err, "erc20 token")
Expand Down Expand Up @@ -535,7 +540,7 @@ func (e *MsgERC20DeployedClaim) ValidateBasic() error {
return fmt.Errorf("nonce == 0")
}
if e.EvmChainPrefix == "" {
return fmt.Errorf("evm_chain_prefix is empty MsgERC20DeployedClaim")
return fmt.Errorf("evm_chain_prefix is empty")
}
return nil
}
Expand Down Expand Up @@ -598,7 +603,7 @@ func (e *MsgLogicCallExecutedClaim) ValidateBasic() error {
return fmt.Errorf("nonce == 0")
}
if e.EvmChainPrefix == "" {
return fmt.Errorf("evm_chain_prefix is empty MsgLogicCallExecutedClaim")
return fmt.Errorf("evm_chain_prefix is empty")
}
return nil
}
Expand Down Expand Up @@ -661,7 +666,7 @@ func (e *MsgValsetUpdatedClaim) ValidateBasic() error {
return fmt.Errorf("nonce == 0")
}
if e.EvmChainPrefix == "" {
return fmt.Errorf("evm_chain_prefix is empty MsgValsetUpdatedClaim")
return fmt.Errorf("evm_chain_prefix is empty")
}
err := ValidateEthAddress(e.RewardToken)
if err != nil {
Expand Down

0 comments on commit 78388f7

Please sign in to comment.