Skip to content

Commit

Permalink
Merge pull request #107 from bnb-chain/keefe/dev
Browse files Browse the repository at this point in the history
fix: fix jail until time for impeaching validator
  • Loading branch information
unclezoro authored Feb 13, 2023
2 parents ca397a3 + be1f14d commit 26bbf23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions x/slashing/keeper/signing_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ func (k Keeper) JailForever(ctx sdk.Context, consAddr sdk.ConsAddress) {
)
}

// Jail to 10000-1-1 08:00:00.
signingInfo.JailedUntil = time.Unix(253402300800, 0)
// Jail to 10000-1-1 07:59:59.
signingInfo.JailedUntil = time.Unix(253402300799, 0)

k.SetValidatorSigningInfo(ctx, consAddr, signingInfo)
}
Expand Down
12 changes: 12 additions & 0 deletions x/slashing/keeper/signing_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,15 @@ func TestJailUntil(t *testing.T) {
require.True(t, ok)
require.Equal(t, time.Unix(253402300799, 0).UTC(), info.JailedUntil)
}

func TestJailForever(t *testing.T) {
app := simapp.Setup(t, false, true)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, app.StakingKeeper.TokensFromConsensusPower(ctx, 200))

app.SlashingKeeper.JailForever(ctx, sdk.ConsAddress(addrDels[0]))

info, ok := app.SlashingKeeper.GetValidatorSigningInfo(ctx, sdk.ConsAddress(addrDels[0]))
require.True(t, ok)
require.Equal(t, time.Unix(253402300799, 0).UTC(), info.JailedUntil)
}

0 comments on commit 26bbf23

Please sign in to comment.