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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (cli) [#25485](https://github.com/cosmos/cosmos-sdk/pull/25485) Avoid failed to convert address field in `withdraw-validator-commission` cmd.
* (baseapp) [#25642](https://github.com/cosmos/cosmos-sdk/pull/25642) Mark pre-block events for indexing based on local configuration.

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

## [v0.53.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.53.3) - 2025-07-25

This patch update also includes minor dependency bumps.
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/evidence/keeper/infraction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ func TestHandleDoubleSign(t *testing.T) {

// tokens should be decreased
newTokens := val.GetTokens()
assert.Assert(t, newTokens.LT(oldTokens))
// NOTE: IF-FINDING-002 Assert that slashed fraction double sign is 0
assert.Assert(t, newTokens.LTE(oldTokens))

// submit duplicate evidence
assert.NilError(t, f.evidenceKeeper.BeginBlocker(ctx))
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/slashing/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ func TestHandleAlreadyJailed(t *testing.T) {
assert.Equal(t, stakingtypes.Unbonding, validator.GetStatus())

// validator should have been slashed
resultingTokens := amt.Sub(f.stakingKeeper.TokensFromConsensusPower(f.ctx, 1))
// NOTE: IF-FINDING-002 Assert that slashed fraction downtime is 0
resultingTokens := amt.Sub(f.stakingKeeper.TokensFromConsensusPower(f.ctx, 0))
assert.DeepEqual(t, resultingTokens, validator.GetTokens())

// another block missed
Expand Down
6 changes: 4 additions & 2 deletions x/slashing/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ func (s *KeeperTestSuite) TestUpdateParams() {
minSignedPerWindow, err := sdkmath.LegacyNewDecFromStr("0.60")
require.NoError(err)

slashFractionDoubleSign, err := sdkmath.LegacyNewDecFromStr("0.022")
// NOTE: IF-FINDING-002 Set slash fraction double sign to default value 0
slashFractionDoubleSign, err := sdkmath.LegacyNewDecFromStr("0")
require.NoError(err)

slashFractionDowntime, err := sdkmath.LegacyNewDecFromStr("0.0089")
// NOTE: IF-FINDING-002 Set slash fraction downtime to default value 0
slashFractionDowntime, err := sdkmath.LegacyNewDecFromStr("0")
require.NoError(err)

invalidVal, err := sdkmath.LegacyNewDecFromStr("-1")
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.String())
}

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", dblSign.String())
}

minSign := data.Params.MinSignedPerWindow
if minSign.IsNegative() || minSign.GT(math.LegacyOneDec()) {
Expand Down
12 changes: 10 additions & 2 deletions x/slashing/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const (

var (
DefaultMinSignedPerWindow = math.LegacyNewDecWithPrec(5, 1)
DefaultSlashFractionDoubleSign = math.LegacyNewDec(1).Quo(math.LegacyNewDec(20))
DefaultSlashFractionDowntime = math.LegacyNewDec(1).Quo(math.LegacyNewDec(100))
DefaultSlashFractionDoubleSign = math.LegacyNewDec(0)
DefaultSlashFractionDowntime = math.LegacyNewDec(0)
)

// NewParams creates a new Params object
Expand Down Expand Up @@ -124,6 +124,10 @@ func validateSlashFractionDoubleSign(i any) error {
if v.GT(math.LegacyOneDec()) {
return fmt.Errorf("double sign slash fraction too large: %s", v)
}
// NOTE: IF-FINDING-002 Assert that the double sign slash fraction is zero
if !v.IsZero() {
return fmt.Errorf("slash fraction double sign must be zero: %s", v)
}

return nil
}
Expand All @@ -143,6 +147,10 @@ func validateSlashFractionDowntime(i any) error {
if v.GT(math.LegacyOneDec()) {
return fmt.Errorf("downtime slash fraction too large: %s", v)
}
// NOTE: IF-FINDING-002 Assert that the downtime slash fraction is zero
if !v.IsZero() {
return fmt.Errorf("slash fraction downtime must be zero: %s", v)
}

return nil
}
Loading