From ae20809993e76f0ffd9e53e81853eab969e6e4c4 Mon Sep 17 00:00:00 2001 From: Bernd Date: Fri, 22 Sep 2023 17:29:44 +0200 Subject: [PATCH] Fix linter issues --- x/ccv/consumer/keeper/genesis.go | 1 + x/ccv/consumer/types/genesis.go | 5 ++++- x/ccv/consumer/types/genesis_test.go | 15 ++++++++++----- x/ccv/provider/keeper/proposal_test.go | 2 ++ x/ccv/types/genesis.go | 6 ++---- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/x/ccv/consumer/keeper/genesis.go b/x/ccv/consumer/keeper/genesis.go index 78f777ea6f..0edcb57d7f 100644 --- a/x/ccv/consumer/keeper/genesis.go +++ b/x/ccv/consumer/keeper/genesis.go @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ccv "github.com/cosmos/interchain-security/v3/x/ccv/types" ) diff --git a/x/ccv/consumer/types/genesis.go b/x/ccv/consumer/types/genesis.go index bcc26786fb..0aac48e8f5 100644 --- a/x/ccv/consumer/types/genesis.go +++ b/x/ccv/consumer/types/genesis.go @@ -1,9 +1,12 @@ package types import ( + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + errorsmod "cosmossdk.io/errors" + abci "github.com/cometbft/cometbft/abci/types" - ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + ccv "github.com/cosmos/interchain-security/v3/x/ccv/types" ) diff --git a/x/ccv/consumer/types/genesis_test.go b/x/ccv/consumer/types/genesis_test.go index d36ec5deb0..4fd0ae7c02 100644 --- a/x/ccv/consumer/types/genesis_test.go +++ b/x/ccv/consumer/types/genesis_test.go @@ -90,7 +90,8 @@ func TestValidateInitialGenesisState(t *testing.T) { ProviderClientId: "ccvclient", ProviderChannelId: "", NewChain: true, - Provider: ccv.ProviderInfo{ClientState: cs, + Provider: ccv.ProviderInfo{ + ClientState: cs, ConsensusState: consensusState, InitialValSet: valUpdates, }, @@ -110,7 +111,8 @@ func TestValidateInitialGenesisState(t *testing.T) { ProviderClientId: "", ProviderChannelId: "ccvchannel", NewChain: true, - Provider: ccv.ProviderInfo{ClientState: cs, + Provider: ccv.ProviderInfo{ + ClientState: cs, ConsensusState: consensusState, InitialValSet: valUpdates, }, @@ -130,7 +132,8 @@ func TestValidateInitialGenesisState(t *testing.T) { ProviderClientId: "", ProviderChannelId: "", NewChain: true, - Provider: ccv.ProviderInfo{ClientState: cs, + Provider: ccv.ProviderInfo{ + ClientState: cs, ConsensusState: consensusState, InitialValSet: valUpdates, }, @@ -150,7 +153,8 @@ func TestValidateInitialGenesisState(t *testing.T) { ProviderClientId: "", ProviderChannelId: "", NewChain: true, - Provider: ccv.ProviderInfo{ClientState: cs, + Provider: ccv.ProviderInfo{ + ClientState: cs, ConsensusState: consensusState, InitialValSet: valUpdates, }, @@ -170,7 +174,8 @@ func TestValidateInitialGenesisState(t *testing.T) { ProviderClientId: "", ProviderChannelId: "", NewChain: true, - Provider: ccv.ProviderInfo{ClientState: cs, + Provider: ccv.ProviderInfo{ + ClientState: cs, ConsensusState: consensusState, InitialValSet: valUpdates, }, diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index 64736b4482..7985717100 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -232,6 +232,7 @@ func TestPendingConsumerAdditionPropDeletion(t *testing.T) { defer ctrl.Finish() for _, tc := range testCases { + tc := tc providerKeeper.SetPendingConsumerAdditionProp(ctx, &tc.ConsumerAdditionProposal) } @@ -603,6 +604,7 @@ func TestPendingConsumerRemovalPropDeletion(t *testing.T) { defer ctrl.Finish() for _, tc := range testCases { + tc := tc providerKeeper.SetPendingConsumerRemovalProp(ctx, &tc.ConsumerRemovalProposal) } diff --git a/x/ccv/types/genesis.go b/x/ccv/types/genesis.go index 4aae4609cf..4189c2ec51 100644 --- a/x/ccv/types/genesis.go +++ b/x/ccv/types/genesis.go @@ -55,10 +55,8 @@ func (gs ConsumerGenesisState) Validate() error { if err := gs.Provider.ConsensusState.ValidateBasic(); err != nil { return errorsmod.Wrapf(ErrInvalidGenesis, "provider consensus state invalid for new chain %s", err.Error()) } - } else { - if gs.Provider.ClientState != nil || gs.Provider.ConsensusState != nil { - return errorsmod.Wrap(ErrInvalidGenesis, "provider client state and consensus state must be nil for a restarting genesis state") - } + } else if gs.Provider.ClientState != nil || gs.Provider.ConsensusState != nil { + return errorsmod.Wrap(ErrInvalidGenesis, "provider client state and consensus state must be nil for a restarting genesis state") } return nil }