Skip to content

Commit

Permalink
fix: update consumer double vote cmd (#1439)
Browse files Browse the repository at this point in the history
add cmd fix
  • Loading branch information
sainoe committed Nov 21, 2023
1 parent 1895f87 commit 695bd6e
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"

ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
Expand Down Expand Up @@ -151,17 +153,28 @@ Example:
txf = txf.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 695bd6e

Please sign in to comment.