From be613480568d70bdf40cec22f415f7ba0f934298 Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 3 Apr 2024 15:55:03 +0100 Subject: [PATCH] chore: add panic on invalid staking keeper --- modules/core/keeper/keeper_test.go | 2 -- modules/light-clients/07-tendermint/consensus_host.go | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/core/keeper/keeper_test.go b/modules/core/keeper/keeper_test.go index 4b9f83103bb..95f62bd110a 100644 --- a/modules/core/keeper/keeper_test.go +++ b/modules/core/keeper/keeper_test.go @@ -5,8 +5,6 @@ import ( "testing" "time" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - testifysuite "github.com/stretchr/testify/suite" upgradekeeper "cosmossdk.io/x/upgrade/keeper" diff --git a/modules/light-clients/07-tendermint/consensus_host.go b/modules/light-clients/07-tendermint/consensus_host.go index 0ce7bb4e802..9abfe46ecb9 100644 --- a/modules/light-clients/07-tendermint/consensus_host.go +++ b/modules/light-clients/07-tendermint/consensus_host.go @@ -34,6 +34,10 @@ type StakingKeeper interface { // NewConsensusHost creates and returns a new ConsensusHost for tendermint consensus. func NewConsensusHost(stakingKeeper clienttypes.StakingKeeper) clienttypes.ConsensusHost { + if stakingKeeper == nil { + panic("staking keeper cannot be nil") + } + return &ConsensusHost{ stakingKeeper: stakingKeeper, }