Skip to content
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## [v0.50.13-xrplevm.2](https://github.com/xrplevm/cosmos-sdk/releases/tag/v0.50.13-xrplevm.2)

### Bug Fixes

* (x/slashing) [#2](https://github.com/xrplevm/cosmos-sdk/pull/2) Validate slashing parameters in genesis

## [v0.50.13-xrplevm.1](https://github.com/xrplevm/cosmos-sdk/releases/tag/v0.50.13-xrplevm.1)

## [v0.50.11-xrplevm.1](https://github.com/xrplevm/cosmos-sdk/releases/tag/v0.50.11-xrplevm.1)

### Bug Fixes
Expand Down
8 changes: 8 additions & 0 deletions x/slashing/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,19 @@ func ValidateGenesis(data GenesisState) error {
if downtime.IsNegative() || downtime.GT(math.LegacyOneDec()) {
return fmt.Errorf("slashing fraction downtime should be less than or equal to one and greater than zero, is %s", downtime.String())
}
// NOTE: IF-FINDING-002 Assert that the downtime slash fraction is zero
if !downtime.IsZero() {
return fmt.Errorf("slash fraction downtime must be zero: %s", downtime)
}

dblSign := data.Params.SlashFractionDoubleSign
if dblSign.IsNegative() || dblSign.GT(math.LegacyOneDec()) {
return fmt.Errorf("slashing fraction double sign should be less than or equal to one and greater than zero, is %s", dblSign.String())
}
// NOTE: IF-FINDING-002 Assert that the double sign slash fraction is zero
if !dblSign.IsZero() {
return fmt.Errorf("slash fraction double sign must be zero: %s", downtime)
}

minSign := data.Params.MinSignedPerWindow
if minSign.IsNegative() || minSign.GT(math.LegacyOneDec()) {
Expand Down
4 changes: 2 additions & 2 deletions x/slashing/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func validateSlashFractionDoubleSign(i interface{}) error {

// NOTE: IF-FINDING-002 Assert that the double sign slash fraction is zero
if !v.IsZero() {
return fmt.Errorf("double sign slash fraction must be zero: %s", v)
return fmt.Errorf("slash fraction double sign must be zero: %s", v)
}

return nil
Expand All @@ -151,7 +151,7 @@ func validateSlashFractionDowntime(i interface{}) error {

// NOTE: IF-FINDING-002 Assert that the downtime slash fraction is zero
if !v.IsZero() {
return fmt.Errorf("downtime sign slash fraction must be zero: %s", v)
return fmt.Errorf("slash fraction downtime must be zero: %s", v)
}

return nil
Expand Down
Loading