Skip to content

Commit

Permalink
feat: IS rebase (squash da53124..b45dd5f)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Sep 29, 2022
1 parent 60ab608 commit 83260b0
Show file tree
Hide file tree
Showing 39 changed files with 4,101 additions and 1,123 deletions.
1,883 changes: 1,495 additions & 388 deletions api/cosmos/staking/v1beta1/staking.pulsar.go

Large diffs are not rendered by default.

37 changes: 35 additions & 2 deletions proto/cosmos/staking/v1beta1/staking.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "google/protobuf/timestamp.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "tendermint/types/types.proto";
import "tendermint/abci/types.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types";

Expand Down Expand Up @@ -124,6 +125,12 @@ message Validator {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];

// strictly positive if this validator's unbonding has been stopped by external modules
int64 unbonding_on_hold_ref_count = 12;

// list of unbonding ids, each uniquely identifing an unbonding of this validator
repeated uint64 unbonding_ids = 13;
}

// BondStatus is the status of a validator.
Expand Down Expand Up @@ -216,7 +223,7 @@ message UnbondingDelegation {
// validator_address is the bech32-encoded address of the validator.
string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// entries are the unbonding delegation entries.
repeated UnbondingDelegationEntry entries = 3 [(gogoproto.nullable) = false]; // unbonding delegation entries
repeated UnbondingDelegationEntry entries = 3 [(gogoproto.nullable) = false]; // unbonding delegation entries
}

// UnbondingDelegationEntry defines an unbonding object with relevant metadata.
Expand All @@ -240,6 +247,11 @@ message UnbondingDelegationEntry {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// Incrementing id that uniquely identifies this entry
uint64 unbonding_id = 5;

// Strictly positive if this entry's unbonding has been stopped by external modules
int64 unbonding_on_hold_ref_count = 6;
}

// RedelegationEntry defines a redelegation object with relevant metadata.
Expand All @@ -263,6 +275,11 @@ message RedelegationEntry {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// Incrementing id that uniquely identifies this entry
uint64 unbonding_id = 5;

// Strictly positive if this entry's unbonding has been stopped by external modules
int64 unbonding_on_hold_ref_count = 6;
}

// Redelegation contains the list of a particular delegator's redelegating bonds
Expand All @@ -279,7 +296,7 @@ message Redelegation {
// validator_dst_address is the validator redelegation destination operator address.
string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// entries are the redelegation entries.
repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false]; // redelegation entries
repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false]; // redelegation entries
}

// Params defines the parameters for the x/staking module.
Expand Down Expand Up @@ -358,3 +375,19 @@ message Pool {
(gogoproto.jsontag) = "bonded_tokens"
];
}

// Infraction indicates the infraction a validator commited.
enum Infraction {
// UNSPECIFIED defines an empty infraction.
INFRACTION_UNSPECIFIED = 0;
// DOUBLE_SIGN defines a validator that double-signs a block.
INFRACTION_DOUBLE_SIGN = 1;
// DOWNTIME defines a validator that missed signing too many blocks.
INFRACTION_DOWNTIME = 2;
}

// ValidatorUpdates defines an array of abci.ValidatorUpdate objects.
// TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence
message ValidatorUpdates {
repeated tendermint.abci.ValidatorUpdate updates = 1 [(gogoproto.nullable) = false];
}
14 changes: 7 additions & 7 deletions tests/integration/distribution/keeper/delegation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestCalculateRewardsAfterSlash(t *testing.T) {
ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3)

// slash the validator by 50%
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower, sdk.NewDecWithPrec(5, 1))
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower, sdk.NewDecWithPrec(5, 1), stakingtypes.Infraction_INFRACTION_UNSPECIFIED)

// retrieve validator
val = stakingKeeper.Validator(ctx, valAddrs[0])
Expand Down Expand Up @@ -212,7 +212,7 @@ func TestCalculateRewardsAfterManySlashes(t *testing.T) {
ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3)

// slash the validator by 50%
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower, sdk.NewDecWithPrec(5, 1))
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower, sdk.NewDecWithPrec(5, 1), stakingtypes.Infraction_INFRACTION_UNSPECIFIED)

// fetch the validator again
val = stakingKeeper.Validator(ctx, valAddrs[0])
Expand All @@ -226,7 +226,7 @@ func TestCalculateRewardsAfterManySlashes(t *testing.T) {
distrKeeper.AllocateTokensToValidator(ctx, val, tokens)

// slash the validator by 50% again
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower/2, sdk.NewDecWithPrec(5, 1))
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower/2, sdk.NewDecWithPrec(5, 1), stakingtypes.Infraction_INFRACTION_UNSPECIFIED)

// fetch the validator again
val = stakingKeeper.Validator(ctx, valAddrs[0])
Expand Down Expand Up @@ -466,10 +466,10 @@ func TestCalculateRewardsAfterManySlashesInSameBlock(t *testing.T) {
distrKeeper.AllocateTokensToValidator(ctx, val, tokens)

// slash the validator by 50%
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower, sdk.NewDecWithPrec(5, 1))
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower, sdk.NewDecWithPrec(5, 1), stakingtypes.Infraction_INFRACTION_UNSPECIFIED)

// slash the validator by 50% again
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower/2, sdk.NewDecWithPrec(5, 1))
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower/2, sdk.NewDecWithPrec(5, 1), stakingtypes.Infraction_INFRACTION_UNSPECIFIED)

// fetch the validator again
val = stakingKeeper.Validator(ctx, valAddrs[0])
Expand Down Expand Up @@ -535,7 +535,7 @@ func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) {

// slash the validator
ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3)
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower, sdk.NewDecWithPrec(5, 1))
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower, sdk.NewDecWithPrec(5, 1), stakingtypes.Infraction_INFRACTION_UNSPECIFIED)
ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3)

// second delegation
Expand All @@ -554,7 +554,7 @@ func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) {

// slash the validator again
ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3)
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower, sdk.NewDecWithPrec(5, 1))
stakingKeeper.Slash(ctx, valConsAddr0, ctx.BlockHeight(), valPower, sdk.NewDecWithPrec(5, 1), stakingtypes.Infraction_INFRACTION_UNSPECIFIED)
ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 3)

// fetch updated validator
Expand Down
1 change: 1 addition & 0 deletions tests/integration/staking/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func TestCancelUnbondingDelegation(t *testing.T) {
delegatorAddr, validatorAddr, 10,
ctx.BlockTime().Add(time.Minute*10),
unbondingAmount.Amount,
0,
)

// set and retrieve a record
Expand Down
46 changes: 27 additions & 19 deletions tests/integration/staking/keeper/slash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestSlashUnbondingDelegation(t *testing.T) {
// set an unbonding delegation with expiration timestamp (beyond which the
// unbonding delegation shouldn't be slashed)
ubd := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 0,
time.Unix(5, 0), sdk.NewInt(10))
time.Unix(5, 0), sdk.NewInt(10), 0)

app.StakingKeeper.SetUnbondingDelegation(ctx, ubd)

Expand Down Expand Up @@ -109,7 +109,7 @@ func TestSlashRedelegation(t *testing.T) {
// set a redelegation with an expiration timestamp beyond which the
// redelegation shouldn't be slashed
rd := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 0,
time.Unix(5, 0), sdk.NewInt(10), math.LegacyNewDec(10))
time.Unix(5, 0), sdk.NewInt(10), math.LegacyNewDec(10), 0)

app.StakingKeeper.SetRedelegation(ctx, rd)

Expand Down Expand Up @@ -172,7 +172,7 @@ func TestSlashAtNegativeHeight(t *testing.T) {

validator, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
require.True(t, found)
app.StakingKeeper.Slash(ctx, consAddr, -2, 10, fraction)
app.StakingKeeper.Slash(ctx, consAddr, -2, 10, fraction, types.Infraction_INFRACTION_UNSPECIFIED)

// read updated state
validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
Expand Down Expand Up @@ -203,7 +203,7 @@ func TestSlashValidatorAtCurrentHeight(t *testing.T) {

validator, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
require.True(t, found)
app.StakingKeeper.Slash(ctx, consAddr, ctx.BlockHeight(), 10, fraction)
app.StakingKeeper.Slash(ctx, consAddr, ctx.BlockHeight(), 10, fraction, types.Infraction_INFRACTION_UNSPECIFIED)

// read updated state
validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
Expand Down Expand Up @@ -233,7 +233,7 @@ func TestSlashWithUnbondingDelegation(t *testing.T) {
// set an unbonding delegation with expiration timestamp beyond which the
// unbonding delegation shouldn't be slashed
ubdTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 4)
ubd := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 11, time.Unix(0, 0), ubdTokens)
ubd := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 11, time.Unix(0, 0), ubdTokens, 0)
app.StakingKeeper.SetUnbondingDelegation(ctx, ubd)

// slash validator for the first time
Expand All @@ -243,7 +243,7 @@ func TestSlashWithUnbondingDelegation(t *testing.T) {

validator, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
require.True(t, found)
app.StakingKeeper.Slash(ctx, consAddr, 10, 10, fraction)
app.StakingKeeper.Slash(ctx, consAddr, 10, 10, fraction, types.Infraction_INFRACTION_UNSPECIFIED)

// end block
applyValidatorSetUpdates(t, ctx, app.StakingKeeper, 1)
Expand Down Expand Up @@ -273,7 +273,7 @@ func TestSlashWithUnbondingDelegation(t *testing.T) {

// slash validator again
ctx = ctx.WithBlockHeight(13)
app.StakingKeeper.Slash(ctx, consAddr, 9, 10, fraction)
app.StakingKeeper.Slash(ctx, consAddr, 9, 10, fraction, types.Infraction_INFRACTION_UNSPECIFIED)

ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, addrDels[0], addrVals[0])
require.True(t, found)
Expand All @@ -299,7 +299,7 @@ func TestSlashWithUnbondingDelegation(t *testing.T) {
// on the unbonding delegation, but it will slash stake bonded since the infraction
// this may not be the desirable behaviour, ref https://github.com/cosmos/cosmos-sdk/issues/1440
ctx = ctx.WithBlockHeight(13)
app.StakingKeeper.Slash(ctx, consAddr, 9, 10, fraction)
app.StakingKeeper.Slash(ctx, consAddr, 9, 10, fraction, types.Infraction_INFRACTION_UNSPECIFIED)

ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, addrDels[0], addrVals[0])
require.True(t, found)
Expand All @@ -325,7 +325,7 @@ func TestSlashWithUnbondingDelegation(t *testing.T) {
// on the unbonding delegation, but it will slash stake bonded since the infraction
// this may not be the desirable behaviour, ref https://github.com/cosmos/cosmos-sdk/issues/1440
ctx = ctx.WithBlockHeight(13)
app.StakingKeeper.Slash(ctx, consAddr, 9, 10, fraction)
app.StakingKeeper.Slash(ctx, consAddr, 9, 10, fraction, types.Infraction_INFRACTION_UNSPECIFIED)

ubd, found = app.StakingKeeper.GetUnbondingDelegation(ctx, addrDels[0], addrVals[0])
require.True(t, found)
Expand Down Expand Up @@ -358,7 +358,7 @@ func TestSlashWithRedelegation(t *testing.T) {

// set a redelegation
rdTokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 6)
rd := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, time.Unix(0, 0), rdTokens, sdk.NewDecFromInt(rdTokens))
rd := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, time.Unix(0, 0), rdTokens, sdk.NewDecFromInt(rdTokens), 0)
app.StakingKeeper.SetRedelegation(ctx, rd)

// set the associated delegation
Expand All @@ -382,7 +382,9 @@ func TestSlashWithRedelegation(t *testing.T) {
validator, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
require.True(t, found)

require.NotPanics(t, func() { app.StakingKeeper.Slash(ctx, consAddr, 10, 10, fraction) })
require.NotPanics(t, func() {
app.StakingKeeper.Slash(ctx, consAddr, 10, 10, fraction, types.Infraction_INFRACTION_UNSPECIFIED)
})
burnAmount := sdk.NewDecFromInt(app.StakingKeeper.TokensFromConsensusPower(ctx, 10)).Mul(fraction).TruncateInt()

bondedPool = app.StakingKeeper.GetBondedPool(ctx)
Expand Down Expand Up @@ -413,7 +415,9 @@ func TestSlashWithRedelegation(t *testing.T) {
validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
require.True(t, found)

require.NotPanics(t, func() { app.StakingKeeper.Slash(ctx, consAddr, 10, 10, math.LegacyOneDec()) })
require.NotPanics(t, func() {
app.StakingKeeper.Slash(ctx, consAddr, 10, 10, math.LegacyOneDec(), types.Infraction_INFRACTION_UNSPECIFIED)
})
burnAmount = app.StakingKeeper.TokensFromConsensusPower(ctx, 7)

// read updated pool
Expand Down Expand Up @@ -447,7 +451,9 @@ func TestSlashWithRedelegation(t *testing.T) {
validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
require.True(t, found)

require.NotPanics(t, func() { app.StakingKeeper.Slash(ctx, consAddr, 10, 10, math.LegacyOneDec()) })
require.NotPanics(t, func() {
app.StakingKeeper.Slash(ctx, consAddr, 10, 10, math.LegacyOneDec(), types.Infraction_INFRACTION_UNSPECIFIED)
})

burnAmount = sdk.NewDecFromInt(app.StakingKeeper.TokensFromConsensusPower(ctx, 10)).Mul(math.LegacyOneDec()).TruncateInt()
burnAmount = burnAmount.Sub(math.LegacyOneDec().MulInt(rdTokens).TruncateInt())
Expand Down Expand Up @@ -480,7 +486,9 @@ func TestSlashWithRedelegation(t *testing.T) {
validator, _ = app.StakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
require.Equal(t, validator.GetStatus(), types.Unbonding)

require.NotPanics(t, func() { app.StakingKeeper.Slash(ctx, consAddr, 10, 10, math.LegacyOneDec()) })
require.NotPanics(t, func() {
app.StakingKeeper.Slash(ctx, consAddr, 10, 10, math.LegacyOneDec(), types.Infraction_INFRACTION_UNSPECIFIED)
})

// read updated pool
bondedPool = app.StakingKeeper.GetBondedPool(ctx)
Expand Down Expand Up @@ -510,7 +518,7 @@ func TestSlashBoth(t *testing.T) {
// set a redelegation with expiration timestamp beyond which the
// redelegation shouldn't be slashed
rdATokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 6)
rdA := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, time.Unix(0, 0), rdATokens, sdk.NewDecFromInt(rdATokens))
rdA := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, time.Unix(0, 0), rdATokens, sdk.NewDecFromInt(rdATokens), 0)
app.StakingKeeper.SetRedelegation(ctx, rdA)

// set the associated delegation
Expand All @@ -521,7 +529,7 @@ func TestSlashBoth(t *testing.T) {
// unbonding delegation shouldn't be slashed)
ubdATokens := app.StakingKeeper.TokensFromConsensusPower(ctx, 4)
ubdA := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 11,
time.Unix(0, 0), ubdATokens)
time.Unix(0, 0), ubdATokens, 0)
app.StakingKeeper.SetUnbondingDelegation(ctx, ubdA)

bondedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, rdATokens.MulRaw(2)))
Expand All @@ -544,7 +552,7 @@ func TestSlashBoth(t *testing.T) {
validator, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(PKs[0]))
require.True(t, found)
consAddr0 := sdk.ConsAddress(PKs[0].Address())
app.StakingKeeper.Slash(ctx, consAddr0, 10, 10, fraction)
app.StakingKeeper.Slash(ctx, consAddr0, 10, 10, fraction, types.Infraction_INFRACTION_UNSPECIFIED)

burnedNotBondedAmount := fraction.MulInt(ubdATokens).TruncateInt()
burnedBondAmount := sdk.NewDecFromInt(app.StakingKeeper.TokensFromConsensusPower(ctx, 10)).Mul(fraction).TruncateInt()
Expand Down Expand Up @@ -575,11 +583,11 @@ func TestSlashAmount(t *testing.T) {
app, ctx, _, _ := bootstrapSlashTest(t, 10)
consAddr := sdk.ConsAddress(PKs[0].Address())
fraction := sdk.NewDecWithPrec(5, 1)
burnedCoins := app.StakingKeeper.Slash(ctx, consAddr, ctx.BlockHeight(), 10, fraction)
burnedCoins := app.StakingKeeper.Slash(ctx, consAddr, ctx.BlockHeight(), 10, fraction, types.Infraction_INFRACTION_UNSPECIFIED)
require.True(t, burnedCoins.GT(math.ZeroInt()))

// test the case where the validator was not found, which should return no coins
_, addrVals := generateAddresses(app, ctx, 100)
noBurned := app.StakingKeeper.Slash(ctx, sdk.ConsAddress(addrVals[0]), ctx.BlockHeight(), 10, fraction)
noBurned := app.StakingKeeper.Slash(ctx, sdk.ConsAddress(addrVals[0]), ctx.BlockHeight(), 10, fraction, types.Infraction_INFRACTION_UNSPECIFIED)
require.True(t, sdk.NewInt(0).Equal(noBurned))
}
2 changes: 1 addition & 1 deletion tests/integration/staking/keeper/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func TestSlashToZeroPowerRemoved(t *testing.T) {
require.Equal(t, valTokens, validator.Tokens, "\nvalidator %v\npool %v", validator, valTokens)

// slash the validator by 100%
app.StakingKeeper.Slash(ctx, sdk.ConsAddress(PKs[0].Address()), 0, 100, math.LegacyOneDec())
app.StakingKeeper.Slash(ctx, sdk.ConsAddress(PKs[0].Address()), 0, 100, math.LegacyOneDec(), types.Infraction_INFRACTION_UNSPECIFIED)
// apply TM updates
applyValidatorSetUpdates(t, ctx, app.StakingKeeper, -1)
// validator should be unbonding
Expand Down
4 changes: 4 additions & 0 deletions x/distribution/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,7 @@ func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _
func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error {
return nil
}

func (h Hooks) AfterUnbondingInitiated(_ sdk.Context, _ uint64) error {
return nil
}
30 changes: 17 additions & 13 deletions x/evidence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,19 +264,6 @@ func (k Keeper) HandleEquivocationEvidence(ctx sdk.Context, evidence *types.Equi
logger := k.Logger(ctx)
consAddr := evidence.GetConsensusAddress()

if _, err := k.slashingKeeper.GetPubkey(ctx, consAddr.Bytes()); err != nil {
// Ignore evidence that cannot be handled.
//
// NOTE: We used to panic with:
// `panic(fmt.Sprintf("Validator consensus-address %v not found", consAddr))`,
// but this couples the expectations of the app to both Tendermint and
// the simulator. Both are expected to provide the full range of
// allowable but none of the disallowed evidence types. Instead of
// getting this coordination right, it is easier to relax the
// constraints and ignore evidence that cannot be handled.
return
}

// calculate the age of the evidence
infractionHeight := evidence.GetHeight()
infractionTime := evidence.GetTime()
Expand Down Expand Up @@ -308,6 +295,22 @@ func (k Keeper) HandleEquivocationEvidence(ctx sdk.Context, evidence *types.Equi
return
}

if !validator.GetOperator().Empty() {
if _, err := k.slashingKeeper.GetPubkey(ctx, consAddr.Bytes()); err != nil {
// Ignore evidence that cannot be handled.
//
// NOTE: We used to panic with:
// `panic(fmt.Sprintf("Validator consensus-address %v not found", consAddr))`,
// but this couples the expectations of the app to both Tendermint and
// the simulator. Both are expected to provide the full range of
// allowable but none of the disallowed evidence types. Instead of
// getting this coordination right, it is easier to relax the
// constraints and ignore evidence that cannot be handled.
return
}
}


if ok := k.slashingKeeper.HasValidatorSigningInfo(ctx, consAddr); !ok {
panic(fmt.Sprintf("expected signing info for validator %s but not found", consAddr))
}
Expand Down Expand Up @@ -347,6 +350,7 @@ func (k Keeper) HandleEquivocationEvidence(ctx sdk.Context, evidence *types.Equi
consAddr,
k.slashingKeeper.SlashFractionDoubleSign(ctx),
evidence.GetValidatorPower(), distributionHeight,
stakingtypes.DoubleSign,
)

// Jail the validator if not already jailed. This will begin unbonding the
Expand Down
Loading

0 comments on commit 83260b0

Please sign in to comment.