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: support querying history about malicious vote slash #348

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions x/slashing/client/cli/query_sidechain.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func GetCmdQuerySideChainSlashRecord(storeName string, cdc *codec.Codec) *cobra.
return nil
},
}
cmd.Flags().String(FlagInfractionType, "", "infraction type, 'DoubleSign;Downtime'")
cmd.Flags().String(FlagInfractionType, "", "infraction type, 'DoubleSign;Downtime;MaliciousVote'")
cmd.Flags().Int64(FlagInfractionHeight, 0, "infraction height")
cmd.Flags().String(FlagSideChainId, "", "chain-id of the side chain the validator belongs to")
cmd.MarkFlagRequired(FlagInfractionType)
Expand Down Expand Up @@ -264,7 +264,7 @@ func GetCmdQuerySideChainSlashRecords(cdc *codec.Codec) *cobra.Command {
},
}

cmd.Flags().String(FlagInfractionType, "", "infraction type, 'DoubleSign;Downtime'")
cmd.Flags().String(FlagInfractionType, "", "infraction type, 'DoubleSign;Downtime;MaliciousVote'")
cmd.Flags().String(FlagSideChainId, "", "chain-id of the side chain the validator belongs to")
return cmd
}
Expand All @@ -290,6 +290,8 @@ func convertInfractionType(infractionTypeS string) (byte, error) {
res = slashing.DoubleSign
} else if infractionTypeS == "Downtime" {
res = slashing.Downtime
} else if infractionTypeS == "MaliciousVote" {
res = slashing.MaliciousVote
} else {
return 0, errors.New("unknown infraction type")
}
Expand Down
2 changes: 2 additions & 0 deletions x/slashing/slash_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func (r SlashRecord) HumanReadableString() (string, error) {
infraType = "DoubleSign"
} else if r.InfractionType == 1 {
infraType = "Downtime"
} else if r.InfractionType == 2 {
infraType = "MaliciousVote"
}

var consAddr string
Expand Down