Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update consumer double vote cmd #1439

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading