Skip to content

Commit fb88d47

Browse files
committed
fix test setups
1 parent ad79dbc commit fb88d47

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

x/ccv/child/module_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,24 @@ import (
55
"testing"
66

77
sdk "github.com/cosmos/cosmos-sdk/types"
8+
89
clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types"
910
channeltypes "github.com/cosmos/ibc-go/modules/core/04-channel/types"
1011
commitmenttypes "github.com/cosmos/ibc-go/modules/core/23-commitment/types"
1112
host "github.com/cosmos/ibc-go/modules/core/24-host"
1213
ibctmtypes "github.com/cosmos/ibc-go/modules/light-clients/07-tendermint/types"
1314
ibctesting "github.com/cosmos/ibc-go/testing"
15+
1416
"github.com/cosmos/interchain-security/app"
1517
"github.com/cosmos/interchain-security/testutil/simapp"
1618
"github.com/cosmos/interchain-security/x/ccv/child"
1719
"github.com/cosmos/interchain-security/x/ccv/child/types"
1820
childtypes "github.com/cosmos/interchain-security/x/ccv/child/types"
1921
parenttypes "github.com/cosmos/interchain-security/x/ccv/parent/types"
2022
ccv "github.com/cosmos/interchain-security/x/ccv/types"
23+
24+
tmtypes "github.com/tendermint/tendermint/types"
25+
2126
"github.com/stretchr/testify/suite"
2227
)
2328

@@ -62,7 +67,11 @@ func (suite *ChildTestSuite) SetupTest() {
6267
)
6368
suite.parentConsState = suite.parentChain.LastHeader.ConsensusState()
6469

65-
childGenesis := types.NewInitialGenesisState(suite.parentClient, suite.parentConsState)
70+
// mocking the fact that child chain validators should be parent chain validators
71+
// TODO: Fix testing suite so we can initialize both chains with the same validator set
72+
valUpdates := tmtypes.TM2PB.ValidatorUpdates(suite.parentChain.Vals)
73+
74+
childGenesis := types.NewInitialGenesisState(suite.parentClient, suite.parentConsState, valUpdates)
6675
suite.childChain.App.(*app.App).ChildKeeper.InitGenesis(suite.childChain.GetContext(), childGenesis)
6776

6877
// create the ccv path and set child's clientID to genesis client

x/ccv/parent/keeper/keeper_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import (
1717
parenttypes "github.com/cosmos/interchain-security/x/ccv/parent/types"
1818
"github.com/cosmos/interchain-security/x/ccv/types"
1919

20+
tmtypes "github.com/tendermint/tendermint/types"
21+
2022
"github.com/stretchr/testify/suite"
2123
)
2224

@@ -61,7 +63,9 @@ func (suite *KeeperTestSuite) SetupTest() {
6163
)
6264
suite.parentConsState = suite.parentChain.LastHeader.ConsensusState()
6365

64-
childGenesis := childtypes.NewInitialGenesisState(suite.parentClient, suite.parentConsState)
66+
valUpdates := tmtypes.TM2PB.ValidatorUpdates(suite.parentChain.Vals)
67+
68+
childGenesis := childtypes.NewInitialGenesisState(suite.parentClient, suite.parentConsState, valUpdates)
6569
suite.childChain.App.(*app.App).ChildKeeper.InitGenesis(suite.childChain.GetContext(), childGenesis)
6670

6771
suite.ctx = suite.parentChain.GetContext()

x/ccv/parent/parent_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727

2828
abci "github.com/tendermint/tendermint/abci/types"
2929
"github.com/tendermint/tendermint/libs/bytes"
30+
tmtypes "github.com/tendermint/tendermint/types"
3031

3132
"github.com/stretchr/testify/suite"
3233
)
@@ -72,7 +73,9 @@ func (suite *ParentTestSuite) SetupTest() {
7273
)
7374
suite.parentConsState = suite.parentChain.LastHeader.ConsensusState()
7475

75-
childGenesis := childtypes.NewInitialGenesisState(suite.parentClient, suite.parentConsState)
76+
valUpdates := tmtypes.TM2PB.ValidatorUpdates(suite.parentChain.Vals)
77+
78+
childGenesis := childtypes.NewInitialGenesisState(suite.parentClient, suite.parentConsState, valUpdates)
7679
suite.childChain.App.(*app.App).ChildKeeper.InitGenesis(suite.childChain.GetContext(), childGenesis)
7780

7881
suite.ctx = suite.parentChain.GetContext()

0 commit comments

Comments
 (0)