Skip to content

Commit 1ff2982

Browse files
authored
Merge pull request #109 from HaoyangLiu/irisnet/hotfix-v0.23.0-iris5
R4R: Fix fuxi-3000 consensus failure
2 parents 5bc397d + b9085be commit 1ff2982

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

x/slashing/keeper.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ func (k Keeper) handleDoubleSign(ctx sdk.Context, pubkey crypto.PubKey, infracti
4141
logger.Info(fmt.Sprintf("Ignored double sign from %s at height %d, age of %d past max age of %d", pubkey.Address(), infractionHeight, age, MaxEvidenceAge))
4242
return
4343
}
44+
signInfo, found := k.getValidatorSigningInfo(ctx, address)
45+
if !found {
46+
logger.Info(fmt.Sprintf("There is no signing info for validator %s. It can't be slashed here", address))
47+
return
48+
}
4449

4550
// Double sign confirmed
4651
logger.Info(fmt.Sprintf("Confirmed double sign from %s at height %d, age of %d less than max age of %d", pubkey.Address(), infractionHeight, age, MaxEvidenceAge))
@@ -52,10 +57,6 @@ func (k Keeper) handleDoubleSign(ctx sdk.Context, pubkey crypto.PubKey, infracti
5257
k.validatorSet.Revoke(ctx, pubkey)
5358

5459
// Jail validator
55-
signInfo, found := k.getValidatorSigningInfo(ctx, address)
56-
if !found {
57-
panic(fmt.Sprintf("Expected signing info for validator %s but not found", address))
58-
}
5960
signInfo.JailedUntil = time + DoubleSignUnbondDuration
6061
k.setValidatorSigningInfo(ctx, address, signInfo)
6162
}

x/stake/keeper/slash.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ func (k Keeper) Slash(ctx sdk.Context, pubkey crypto.PubKey, infractionHeight in
6262
remainingSlashAmount := slashAmount
6363

6464
switch {
65-
case infractionHeight > ctx.BlockHeight():
65+
case infractionHeight > ctx.BlockHeight() + 1:
6666

6767
// Can't slash infractions in the future
6868
panic(fmt.Sprintf(
6969
"impossible attempt to slash future infraction at height %d but we are at height %d",
7070
infractionHeight, ctx.BlockHeight()))
7171

72-
case infractionHeight == ctx.BlockHeight():
72+
case infractionHeight == ctx.BlockHeight() || infractionHeight == ctx.BlockHeight() + 1:
7373

7474
// Special-case slash at current height for efficiency - we don't need to look through unbonding delegations or redelegations
7575
logger.Info(fmt.Sprintf(

0 commit comments

Comments
 (0)