From be1f14dac1dd090e51f5e1e52790cee803898424 Mon Sep 17 00:00:00 2001 From: Keefe Liu Date: Mon, 13 Feb 2023 09:31:32 +0800 Subject: [PATCH] fix jail until time --- x/slashing/keeper/signing_info.go | 4 ++-- x/slashing/keeper/signing_info_test.go | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/x/slashing/keeper/signing_info.go b/x/slashing/keeper/signing_info.go index 74bb4e7dbf..82bae014a9 100644 --- a/x/slashing/keeper/signing_info.go +++ b/x/slashing/keeper/signing_info.go @@ -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) } diff --git a/x/slashing/keeper/signing_info_test.go b/x/slashing/keeper/signing_info_test.go index 167d717807..35f79c5b14 100644 --- a/x/slashing/keeper/signing_info_test.go +++ b/x/slashing/keeper/signing_info_test.go @@ -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) +}