Skip to content

Commit

Permalink
add cmd fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sainoe committed Nov 20, 2023
1 parent 1d29ee2 commit 8ed672e
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions x/ccv/provider/client/cli/tx.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package cli

import (
"encoding/json"
"fmt"
"os"
"strings"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -141,17 +143,28 @@ Example:
WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever)

submitter := clientCtx.GetFromAddress()
var ev *tmproto.DuplicateVoteEvidence
if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(args[1]), &ev); err != nil {

ev := tmproto.DuplicateVoteEvidence{}
evidenceJson, err := os.ReadFile(args[0])
if err != nil {
return err
}

var header ibctmtypes.Header
if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(args[2]), &header); err != nil {
if err := json.Unmarshal(evidenceJson, &ev); err != nil {
return fmt.Errorf("duplicate vote evidence unmarshalling failed: %s", err)
}

headerRaw, err := os.ReadFile(args[1])
if err != nil {
return err
}

msg, err := types.NewMsgSubmitConsumerDoubleVoting(submitter, ev, &header)
header := ibctmtypes.Header{}
if err := types.ModuleCdc.UnmarshalJSON(headerRaw, &header); err != nil {
return fmt.Errorf("infraction IBC header unmarshalling failed: %s", err)
}

msg, err := types.NewMsgSubmitConsumerDoubleVoting(submitter, &ev, &header)
if err != nil {
return err
}
Expand Down

0 comments on commit 8ed672e

Please sign in to comment.