Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(x/slashing): migrate ValidatorSigningInfo to collections #17023

Merged
merged 7 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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 @@ -60,6 +60,8 @@ Ref: https://keepachangelog.com/en/1.0.0/

### API Breaking Changes

* (x/slashing) [17023](https://github.com/cosmos/cosmos-sdk/pull/17023) Use collections for `ValidatorSigningInfo`:
* remove `Keeper`: `SetValidatorSigningInfo`, `GetValidatorSigningInfo`, `IterateValidatorSigningInfos`
* (x/staking) [#17026](https://github.com/cosmos/cosmos-sdk/pull/17026) Use collections for `LastTotalPower`:
* remove `Keeper`: `SetLastTotalPower`, `GetLastTotalPower`
* (staking) [#16959](https://github.com/cosmos/cosmos-sdk/pull/16959) Add validator and consensus address codec as staking keeper arguments.
Expand Down
23 changes: 11 additions & 12 deletions simapp/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package simapp

import (
"encoding/json"
"errors"
"fmt"
"log"

cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"

"cosmossdk.io/collections"
storetypes "cosmossdk.io/store/types"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
Expand Down Expand Up @@ -230,18 +232,15 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []
/* Handle slashing state. */

// reset start height on signing infos
err = app.SlashingKeeper.IterateValidatorSigningInfos(
ctx,
func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) {
info.StartHeight = 0
err := app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info)
if err != nil {
panic(err)
}
return false
},
)
if err != nil {
err = app.SlashingKeeper.ValidatorSigningInfo.Walk(ctx, nil, func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool, err error) {
info.StartHeight = 0
err = app.SlashingKeeper.ValidatorSigningInfo.Set(ctx, addr, info)
if err != nil {
panic(err)
Copy link
Member

@julienrbrt julienrbrt Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why cannot we return the error here? We probably should instead of panicking.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we are panicking on every error in prepForZeroHeightGenesis. To keep that consistent behaviour I put panic there instead of returning error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the error is propagated back to err in line 235, so it's fine to error here

}
return false, nil
})
if err != nil && !errors.Is(err, collections.ErrInvalidIterator) {
panic(err)
}
}
2 changes: 1 addition & 1 deletion tests/integration/evidence/keeper/infraction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func TestHandleDoubleSign(t *testing.T) {
assert.NilError(t, f.slashingKeeper.AddPubkey(f.sdkCtx, valpubkey))

info := slashingtypes.NewValidatorSigningInfo(sdk.ConsAddress(valpubkey.Address()), f.sdkCtx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0))
err = f.slashingKeeper.SetValidatorSigningInfo(f.sdkCtx, sdk.ConsAddress(valpubkey.Address()), info)
err = f.slashingKeeper.ValidatorSigningInfo.Set(f.sdkCtx, sdk.ConsAddress(valpubkey.Address()), info)
assert.NilError(t, err)
// handle a signature to set signing info
err = f.slashingKeeper.HandleValidatorSignature(ctx, valpubkey.Address(), selfDelegation.Int64(), comet.BlockIDFlagCommit)
Expand Down
20 changes: 10 additions & 10 deletions tests/integration/slashing/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ func initFixture(tb testing.TB) *fixture {
info1 := slashingtypes.NewValidatorSigningInfo(sdk.ConsAddress(addrDels[0]), int64(4), int64(3), time.Unix(2, 0), false, int64(10))
info2 := slashingtypes.NewValidatorSigningInfo(sdk.ConsAddress(addrDels[1]), int64(5), int64(4), time.Unix(2, 0), false, int64(10))

err = slashingKeeper.SetValidatorSigningInfo(sdkCtx, sdk.ConsAddress(addrDels[0]), info1)
err = slashingKeeper.ValidatorSigningInfo.Set(sdkCtx, sdk.ConsAddress(addrDels[0]), info1)
assert.NilError(tb, err)
err = slashingKeeper.SetValidatorSigningInfo(sdkCtx, sdk.ConsAddress(addrDels[1]), info2)
err = slashingKeeper.ValidatorSigningInfo.Set(sdkCtx, sdk.ConsAddress(addrDels[1]), info2)
assert.NilError(tb, err)
return &fixture{
app: integrationApp,
Expand Down Expand Up @@ -236,7 +236,7 @@ func TestHandleNewValidator(t *testing.T) {
assert.NilError(t, f.slashingKeeper.AddPubkey(f.ctx, pks[0]))

info := slashingtypes.NewValidatorSigningInfo(sdk.ConsAddress(valpubkey.Address()), f.ctx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0))
assert.NilError(t, f.slashingKeeper.SetValidatorSigningInfo(f.ctx, sdk.ConsAddress(valpubkey.Address()), info))
assert.NilError(t, f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, sdk.ConsAddress(valpubkey.Address()), info))

// Validator created
amt := tstaking.CreateValidatorWithValPower(addr, valpubkey, 100, true)
Expand All @@ -261,7 +261,7 @@ func TestHandleNewValidator(t *testing.T) {
f.ctx = f.ctx.WithBlockHeight(signedBlocksWindow + 2)
assert.NilError(t, f.slashingKeeper.HandleValidatorSignature(f.ctx, valpubkey.Address(), 100, comet.BlockIDFlagAbsent))

info, found := f.slashingKeeper.GetValidatorSigningInfo(f.ctx, sdk.ConsAddress(valpubkey.Address()))
info, found := f.slashingKeeper.ValidatorSigningInfo.Get(f.ctx, sdk.ConsAddress(valpubkey.Address()))
assert.Assert(t, found)
assert.Equal(t, signedBlocksWindow+1, info.StartHeight)
assert.Equal(t, int64(2), info.IndexOffset)
Expand Down Expand Up @@ -291,7 +291,7 @@ func TestHandleAlreadyJailed(t *testing.T) {
assert.NilError(t, err)

info := slashingtypes.NewValidatorSigningInfo(sdk.ConsAddress(val.Address()), f.ctx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0))
assert.NilError(t, f.slashingKeeper.SetValidatorSigningInfo(f.ctx, sdk.ConsAddress(val.Address()), info))
assert.NilError(t, f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, sdk.ConsAddress(val.Address()), info))

amt := tstaking.CreateValidatorWithValPower(addr, val, power, true)

Expand Down Expand Up @@ -365,7 +365,7 @@ func TestValidatorDippingInAndOut(t *testing.T) {
assert.NilError(t, f.slashingKeeper.AddPubkey(f.ctx, pks[0]))

info := slashingtypes.NewValidatorSigningInfo(consAddr, f.ctx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0))
assert.NilError(t, f.slashingKeeper.SetValidatorSigningInfo(f.ctx, consAddr, info))
assert.NilError(t, f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, consAddr, info))

tstaking.CreateValidatorWithValPower(valAddr, val, power, true)
validatorUpdates, err := f.stakingKeeper.EndBlocker(f.ctx)
Expand Down Expand Up @@ -426,11 +426,11 @@ func TestValidatorDippingInAndOut(t *testing.T) {
tstaking.CheckValidator(valAddr, stakingtypes.Unbonding, true)

info = slashingtypes.NewValidatorSigningInfo(consAddr, f.ctx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0))
err = f.slashingKeeper.SetValidatorSigningInfo(f.ctx, consAddr, info)
err = f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, consAddr, info)
assert.NilError(t, err)

// check all the signing information
signInfo, found := f.slashingKeeper.GetValidatorSigningInfo(f.ctx, consAddr)
signInfo, found := f.slashingKeeper.ValidatorSigningInfo.Get(f.ctx, consAddr)
assert.Assert(t, found)
assert.Equal(t, int64(700), signInfo.StartHeight)
assert.Equal(t, int64(0), signInfo.MissedBlocksCounter)
Expand All @@ -441,7 +441,7 @@ func TestValidatorDippingInAndOut(t *testing.T) {
f.ctx = f.ctx.WithBlockHeight(height)

info = slashingtypes.NewValidatorSigningInfo(consAddr, f.ctx.BlockHeight(), int64(0), time.Unix(0, 0), false, int64(0))
err = f.slashingKeeper.SetValidatorSigningInfo(f.ctx, consAddr, info)
err = f.slashingKeeper.ValidatorSigningInfo.Set(f.ctx, consAddr, info)
assert.NilError(t, err)

// validator rejoins and starts signing again
Expand All @@ -456,7 +456,7 @@ func TestValidatorDippingInAndOut(t *testing.T) {
tstaking.CheckValidator(valAddr, stakingtypes.Bonded, false)

// check start height is correctly set
signInfo, found = f.slashingKeeper.GetValidatorSigningInfo(f.ctx, consAddr)
signInfo, found = f.slashingKeeper.ValidatorSigningInfo.Get(f.ctx, consAddr)
assert.Assert(t, found)
assert.Equal(t, height, signInfo.StartHeight)

Expand Down
2 changes: 1 addition & 1 deletion x/slashing/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestBeginBlocker(t *testing.T) {
err = slashing.BeginBlocker(ctx, slashingKeeper)
require.NoError(t, err)

info, err := slashingKeeper.GetValidatorSigningInfo(ctx, sdk.ConsAddress(pk.Address()))
info, err := slashingKeeper.ValidatorSigningInfo.Get(ctx, sdk.ConsAddress(pk.Address()))
require.NoError(t, err)
require.Equal(t, ctx.BlockHeight(), info.StartHeight)
require.Equal(t, int64(1), info.IndexOffset)
Expand Down
2 changes: 1 addition & 1 deletion x/slashing/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func TestSlashingMsgs(t *testing.T) {
unjailMsg := &types.MsgUnjail{ValidatorAddr: sdk.ValAddress(addr1).String()}

ctxCheck = app.BaseApp.NewContext(true)
_, err = slashingKeeper.GetValidatorSigningInfo(ctxCheck, sdk.ConsAddress(valAddr))
_, err = slashingKeeper.ValidatorSigningInfo.Get(ctxCheck, sdk.ConsAddress(valAddr))
require.NoError(t, err)

// unjail should fail with unknown validator
Expand Down
12 changes: 8 additions & 4 deletions x/slashing/keeper/genesis.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package keeper

import (
"errors"

"cosmossdk.io/collections"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
Expand Down Expand Up @@ -32,7 +36,7 @@ func (keeper Keeper) InitGenesis(ctx sdk.Context, stakingKeeper types.StakingKee
if err != nil {
panic(err)
}
err = keeper.SetValidatorSigningInfo(ctx, address, info.ValidatorSigningInfo)
err = keeper.ValidatorSigningInfo.Set(ctx, address, info.ValidatorSigningInfo)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -66,7 +70,7 @@ func (keeper Keeper) ExportGenesis(ctx sdk.Context) (data *types.GenesisState) {
}
signingInfos := make([]types.SigningInfo, 0)
missedBlocks := make([]types.ValidatorMissedBlocks, 0)
err = keeper.IterateValidatorSigningInfos(ctx, func(address sdk.ConsAddress, info types.ValidatorSigningInfo) (stop bool) {
err = keeper.ValidatorSigningInfo.Walk(ctx, nil, func(address sdk.ConsAddress, info types.ValidatorSigningInfo) (stop bool, err error) {
bechAddr := address.String()
signingInfos = append(signingInfos, types.SigningInfo{
Address: bechAddr,
Expand All @@ -83,9 +87,9 @@ func (keeper Keeper) ExportGenesis(ctx sdk.Context) (data *types.GenesisState) {
MissedBlocks: localMissedBlocks,
})

return false
return false, nil
})
if err != nil {
if err != nil && !errors.Is(err, collections.ErrInvalidIterator) {
panic(err)
}
return types.NewGenesisState(params, signingInfos, missedBlocks)
Expand Down
14 changes: 7 additions & 7 deletions x/slashing/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ func (s *KeeperTestSuite) TestExportAndInitGenesis() {
require := s.Require()
err := keeper.Params.Set(ctx, testutil.TestParams())
s.Require().NoError(err)
consAddr1 := sdk.ConsAddress(sdk.AccAddress([]byte("addr1_______________")))
consAddr2 := sdk.ConsAddress(sdk.AccAddress([]byte("addr2_______________")))
consAddr1 := sdk.ConsAddress(([]byte("addr1_______________")))
consAddr2 := sdk.ConsAddress(([]byte("addr2_______________")))

info1 := types.NewValidatorSigningInfo(consAddr1, int64(4), int64(3),
time.Now().UTC().Add(100000000000), false, int64(10))
info2 := types.NewValidatorSigningInfo(consAddr2, int64(5), int64(4),
time.Now().UTC().Add(10000000000), false, int64(10))

s.Require().NoError(keeper.SetValidatorSigningInfo(ctx, consAddr1, info1))
s.Require().NoError(keeper.SetValidatorSigningInfo(ctx, consAddr2, info2))
s.Require().NoError(keeper.ValidatorSigningInfo.Set(ctx, consAddr1, info1))
s.Require().NoError(keeper.ValidatorSigningInfo.Set(ctx, consAddr2, info2))
genesisState := keeper.ExportGenesis(ctx)

require.Equal(genesisState.Params, testutil.TestParams())
Expand All @@ -40,7 +40,7 @@ func (s *KeeperTestSuite) TestExportAndInitGenesis() {
ok := keeper.IsTombstoned(ctx, consAddr1)
require.True(ok)

newInfo1, _ := keeper.GetValidatorSigningInfo(ctx, consAddr1)
newInfo1, _ := keeper.ValidatorSigningInfo.Get(ctx, consAddr1)
require.NotEqual(info1, newInfo1)

// Initialize genesis with genesis state before tombstone
Expand All @@ -51,8 +51,8 @@ func (s *KeeperTestSuite) TestExportAndInitGenesis() {
ok = keeper.IsTombstoned(ctx, consAddr1)
require.False(ok)

newInfo1, _ = keeper.GetValidatorSigningInfo(ctx, consAddr1)
newInfo2, _ := keeper.GetValidatorSigningInfo(ctx, consAddr2)
newInfo1, _ = keeper.ValidatorSigningInfo.Get(ctx, consAddr1)
newInfo2, _ := keeper.ValidatorSigningInfo.Get(ctx, consAddr2)
require.Equal(info1, newInfo1)
require.Equal(info2, newInfo2)
}
2 changes: 1 addition & 1 deletion x/slashing/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (k Keeper) SigningInfo(ctx context.Context, req *types.QuerySigningInfoRequ
return nil, err
}

signingInfo, err := k.GetValidatorSigningInfo(ctx, consAddr)
signingInfo, err := k.ValidatorSigningInfo.Get(ctx, consAddr)
if err != nil {
return nil, status.Errorf(codes.NotFound, "SigningInfo not found for validator %s", req.ConsAddress)
}
Expand Down
12 changes: 6 additions & 6 deletions x/slashing/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func (s *KeeperTestSuite) TestGRPCSigningInfo() {
int64(0),
)

require.NoError(keeper.SetValidatorSigningInfo(ctx, consAddr, signingInfo))
info, err := keeper.GetValidatorSigningInfo(ctx, consAddr)
require.NoError(keeper.ValidatorSigningInfo.Set(ctx, consAddr, signingInfo))
info, err := keeper.ValidatorSigningInfo.Get(ctx, consAddr)
require.NoError(err)

infoResp, err = queryClient.SigningInfo(gocontext.Background(),
Expand All @@ -64,14 +64,14 @@ func (s *KeeperTestSuite) TestGRPCSigningInfos() {
int64(0),
)

require.NoError(keeper.SetValidatorSigningInfo(ctx, consAddr1, signingInfo))
require.NoError(keeper.ValidatorSigningInfo.Set(ctx, consAddr1, signingInfo))
signingInfo.Address = string(consAddr2)
require.NoError(keeper.SetValidatorSigningInfo(ctx, consAddr2, signingInfo))
require.NoError(keeper.ValidatorSigningInfo.Set(ctx, consAddr2, signingInfo))
var signingInfos []slashingtypes.ValidatorSigningInfo

err := keeper.IterateValidatorSigningInfos(ctx, func(consAddr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) {
err := keeper.ValidatorSigningInfo.Walk(ctx, nil, func(consAddr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool, err error) {
signingInfos = append(signingInfos, info)
return false
return false, nil
})
require.NoError(err)
// verify all values are returned without pagination
Expand Down
4 changes: 2 additions & 2 deletions x/slashing/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (k Keeper) Hooks() Hooks {
// AfterValidatorBonded updates the signing info start height or create a new signing info
func (h Hooks) AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error {
sdkCtx := sdk.UnwrapSDKContext(ctx)
signingInfo, err := h.k.GetValidatorSigningInfo(ctx, consAddr)
signingInfo, err := h.k.ValidatorSigningInfo.Get(ctx, consAddr)
if err == nil {
signingInfo.StartHeight = sdkCtx.BlockHeight()
} else {
Expand All @@ -41,7 +41,7 @@ func (h Hooks) AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddres
)
}

return h.k.SetValidatorSigningInfo(ctx, consAddr, signingInfo)
return h.k.ValidatorSigningInfo.Set(ctx, consAddr, signingInfo)
}

// AfterValidatorRemoved deletes the address-pubkey relation when a validator is removed,
Expand Down
2 changes: 1 addition & 1 deletion x/slashing/keeper/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func (s *KeeperTestSuite) TestAfterValidatorBonded() {
valAddr := sdk.ValAddress(consAddr.Bytes())
err := keeper.Hooks().AfterValidatorBonded(ctx, consAddr, valAddr)
require.NoError(err)
_, err = keeper.GetValidatorSigningInfo(ctx, consAddr)
_, err = keeper.ValidatorSigningInfo.Get(ctx, consAddr)
require.NoError(err)
}

Expand Down
4 changes: 2 additions & 2 deletions x/slashing/keeper/infractions.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (k Keeper) HandleValidatorSignature(ctx context.Context, addr cryptotypes.A
}

// fetch signing info
signInfo, err := k.GetValidatorSigningInfo(ctx, consAddr)
signInfo, err := k.ValidatorSigningInfo.Get(ctx, consAddr)
if err != nil {
return err
}
Expand Down Expand Up @@ -182,5 +182,5 @@ func (k Keeper) HandleValidatorSignature(ctx context.Context, addr cryptotypes.A
}

// Set the updated signing info
return k.SetValidatorSigningInfo(ctx, consAddr, signInfo)
return k.ValidatorSigningInfo.Set(ctx, consAddr, signInfo)
}
14 changes: 11 additions & 3 deletions x/slashing/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ type Keeper struct {

// the address capable of executing a MsgUpdateParams message. Typically, this
// should be the x/gov module account.
authority string
Schema collections.Schema
Params collections.Item[types.Params]
authority string
Schema collections.Schema
Params collections.Item[types.Params]
ValidatorSigningInfo collections.Map[sdk.ConsAddress, types.ValidatorSigningInfo]
Comment on lines +30 to +31
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random thought but are we able to make these private? params i feel yes since the module can make a query through the router to get the same info

a bit out of scope of this pr but something to think about instead of making it all public

}

// NewKeeper creates a slashing keeper
Expand All @@ -40,6 +41,13 @@ func NewKeeper(cdc codec.BinaryCodec, legacyAmino *codec.LegacyAmino, storeServi
sk: sk,
authority: authority,
Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)),
ValidatorSigningInfo: collections.NewMap(
sb,
types.ValidatorSigningInfoKeyPrefix,
"validator_signing_info",
sdk.ConsAddressKey,
codec.CollValue[types.ValidatorSigningInfo](cdc),
),
}

schema, err := sb.Build()
Expand Down
8 changes: 4 additions & 4 deletions x/slashing/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (s *KeeperTestSuite) TestUnjail() {
info := slashingtypes.NewValidatorSigningInfo(sdk.ConsAddress(addr), int64(4), int64(3),
time.Unix(2, 0), false, int64(10))

s.Require().NoError(s.slashingKeeper.SetValidatorSigningInfo(s.ctx, sdk.ConsAddress(addr), info))
s.Require().NoError(s.slashingKeeper.ValidatorSigningInfo.Set(s.ctx, sdk.ConsAddress(addr), info))
s.stakingKeeper.EXPECT().Validator(s.ctx, valAddr).Return(val, nil)
del := types.NewDelegation(addr, valAddr, sdkmath.LegacyNewDec(100))

Expand Down Expand Up @@ -240,7 +240,7 @@ func (s *KeeperTestSuite) TestUnjail() {
info := slashingtypes.NewValidatorSigningInfo(sdk.ConsAddress(addr), int64(4), int64(3),
time.Unix(2, 0), true, int64(10))

s.Require().NoError(s.slashingKeeper.SetValidatorSigningInfo(s.ctx, sdk.ConsAddress(addr), info))
s.Require().NoError(s.slashingKeeper.ValidatorSigningInfo.Set(s.ctx, sdk.ConsAddress(addr), info))
s.stakingKeeper.EXPECT().Validator(s.ctx, valAddr).Return(val, nil)
del := types.NewDelegation(addr, valAddr, sdkmath.LegacyNewDec(100))

Expand Down Expand Up @@ -269,7 +269,7 @@ func (s *KeeperTestSuite) TestUnjail() {
info := slashingtypes.NewValidatorSigningInfo(sdk.ConsAddress(addr), int64(4), int64(3),
s.ctx.BlockTime().AddDate(0, 0, 1), false, int64(10))

s.Require().NoError(s.slashingKeeper.SetValidatorSigningInfo(s.ctx, sdk.ConsAddress(addr), info))
s.Require().NoError(s.slashingKeeper.ValidatorSigningInfo.Set(s.ctx, sdk.ConsAddress(addr), info))
s.stakingKeeper.EXPECT().Validator(s.ctx, valAddr).Return(val, nil)
del := types.NewDelegation(addr, valAddr, sdkmath.LegacyNewDec(10000))

Expand Down Expand Up @@ -298,7 +298,7 @@ func (s *KeeperTestSuite) TestUnjail() {
info := slashingtypes.NewValidatorSigningInfo(sdk.ConsAddress(addr), int64(4), int64(3),
time.Unix(2, 0), false, int64(10))

s.Require().NoError(s.slashingKeeper.SetValidatorSigningInfo(s.ctx, sdk.ConsAddress(addr), info))
s.Require().NoError(s.slashingKeeper.ValidatorSigningInfo.Set(s.ctx, sdk.ConsAddress(addr), info))
s.stakingKeeper.EXPECT().Validator(s.ctx, valAddr).Return(val, nil)
del := types.NewDelegation(addr, valAddr, sdkmath.LegacyNewDec(100))

Expand Down
Loading