Skip to content

Commit 02b3dee

Browse files
committed
test comments
1 parent 9103708 commit 02b3dee

File tree

6 files changed

+27
-4
lines changed

6 files changed

+27
-4
lines changed

x/ccv/consumer/keeper/keeper_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ func (suite *KeeperTestSuite) SetupCCVChannel() {
136136
suite.coordinator.CreateChannels(suite.path)
137137
}
138138

139+
// TestUnbondingTime tests getter and setter functionality for the unbonding period of a consumer chain
139140
func TestUnbondingTime(t *testing.T) {
140141
consumerKeeper, ctx := testkeeper.GetConsumerKeeperAndCtx(t)
141142
_, ok := consumerKeeper.GetUnbondingTime(ctx)
@@ -147,7 +148,7 @@ func TestUnbondingTime(t *testing.T) {
147148
require.Equal(t, storedUnbondingPeriod, unbondingPeriod)
148149
}
149150

150-
// Tests that the provider client managed by the consumer keeper matches the client keeper's client state
151+
// TestProviderClientMatches tests that the provider client managed by the consumer keeper matches the client keeper's client state
151152
func (suite *KeeperTestSuite) TestProviderClientMatches() {
152153
providerClientID, ok := suite.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetProviderClientID(suite.ctx)
153154
suite.Require().True(ok)
@@ -156,6 +157,7 @@ func (suite *KeeperTestSuite) TestProviderClientMatches() {
156157
suite.Require().Equal(suite.providerClient, clientState, "stored client state does not match genesis provider client")
157158
}
158159

160+
// TestProviderClientID tests getter and setter functionality for the client ID stored on consumer keeper
159161
func TestProviderClientID(t *testing.T) {
160162
consumerKeeper, ctx := testkeeper.GetConsumerKeeperAndCtx(t)
161163
_, ok := consumerKeeper.GetProviderClientID(ctx)
@@ -166,6 +168,7 @@ func TestProviderClientID(t *testing.T) {
166168
require.Equal(t, "someClientID", clientID)
167169
}
168170

171+
// TestProviderChannel tests getter and setter functionality for the channel ID stored on consumer keeper
169172
func TestProviderChannel(t *testing.T) {
170173
consumerKeeper, ctx := testkeeper.GetConsumerKeeperAndCtx(t)
171174
_, ok := consumerKeeper.GetProviderChannel(ctx)
@@ -176,6 +179,7 @@ func TestProviderChannel(t *testing.T) {
176179
require.Equal(t, "channelID", channelID)
177180
}
178181

182+
// TestPendingChanges tests getter, setter, and delete functionality for pending VSCs on a consumer chain
179183
func TestPendingChanges(t *testing.T) {
180184
pk1, err := cryptocodec.ToTmProtoPublicKey(ed25519.GenPrivKey().PubKey())
181185
require.NoError(t, err)
@@ -209,6 +213,7 @@ func TestPendingChanges(t *testing.T) {
209213
require.Nil(t, gotPd, "got non-nil pending changes after Delete")
210214
}
211215

216+
// TestPacketMaturityTime tests getter, setter, and iterator functionality for the packet maturity time of a received VSC packet
212217
func TestPacketMaturityTime(t *testing.T) {
213218
consumerKeeper, ctx := testkeeper.GetConsumerKeeperAndCtx(t)
214219
consumerKeeper.SetPacketMaturityTime(ctx, 1, 10)
@@ -236,6 +241,7 @@ func TestPacketMaturityTime(t *testing.T) {
236241
})
237242
}
238243

244+
// TestVerifyProviderChain tests the VerifyProviderChain method for the consumer keeper
239245
func (suite *KeeperTestSuite) TestVerifyProviderChain() {
240246
var connectionHops []string
241247
channelID := "channel-0"
@@ -502,6 +508,7 @@ func (suite *KeeperTestSuite) TestValidatorDoubleSigning() {
502508
suite.Require().EqualValues(expCommit, gotCommit)
503509
}
504510

511+
// TestSendSlashPacket tests the functionality of SendSlashPacket and asserts state changes related to that method
505512
func (suite *KeeperTestSuite) TestSendSlashPacket() {
506513
suite.SetupCCVChannel()
507514

@@ -582,6 +589,7 @@ func (suite *KeeperTestSuite) TestSendSlashPacket() {
582589
suite.Require().Len(requests, 0)
583590
}
584591

592+
// TestCrossChainValidator tests the getter, setter, and deletion method for cross chain validator records
585593
func TestCrossChainValidator(t *testing.T) {
586594

587595
// Construct a keeper with a custom codec
@@ -632,6 +640,7 @@ func TestCrossChainValidator(t *testing.T) {
632640
require.False(t, found)
633641
}
634642

643+
// TestPendingSlashRequests tests the getter, setter, appending method, and deletion method for pending slash requests
635644
func TestPendingSlashRequests(t *testing.T) {
636645
consumerKeeper, ctx := testkeeper.GetConsumerKeeperAndCtx(t)
637646

x/ccv/consumer/keeper/params_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/stretchr/testify/require"
99
)
1010

11+
// TestParams tests the default params set for a consumer chain, and related getters/setters
1112
func TestParams(t *testing.T) {
1213
consumerKeeper, ctx := testkeeper.GetConsumerKeeperAndCtx(t)
1314
consumerKeeper.SetParams(ctx, types.DefaultParams())

x/ccv/consumer/keeper/relay_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/tendermint/tendermint/libs/bytes"
2525
)
2626

27+
// TestOnRecvVSCPacket tests the behavior of OnRecvVSCPacket over various packet scenarios
2728
func TestOnRecvVSCPacket(t *testing.T) {
2829
consumerCCVChannelID := "consumerCCVChannelID"
2930
providerCCVChannelID := "providerCCVChannelID"
@@ -200,6 +201,7 @@ func TestOnRecvVSCPacket(t *testing.T) {
200201
}
201202
}
202203

204+
// TestUnbondMaturePackets tests the behavior of UnbondMaturePackets and related state checks
203205
func (suite *KeeperTestSuite) TestUnbondMaturePackets() {
204206
// setup CCV channel
205207
suite.SetupCCVChannel()
@@ -290,7 +292,7 @@ func (suite *KeeperTestSuite) TestUnbondMaturePackets() {
290292
suite.Require().Equal(uint64(2), commitments[1].Sequence, "did not send VSCMatured packet for VSC packet 2")
291293
}
292294

293-
// incrementTimeByUnbondingPeriod increments the overall time by jumpPeriod
295+
// incrementTimeBy increments the overall time by jumpPeriod
294296
func incrementTimeBy(s *KeeperTestSuite, jumpPeriod time.Duration) {
295297
// Get unboding period from staking keeper
296298
consumerUnbondingPeriod, found := s.consumerChain.App.(*appConsumer.App).ConsumerKeeper.GetUnbondingTime(s.consumerChain.GetContext())

x/ccv/consumer/keeper/validators_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
tmtypes "github.com/tendermint/tendermint/types"
2121
)
2222

23+
// TestApplyCCValidatorChanges tests the ApplyCCValidatorChanges method for a consumer keeper
2324
func TestApplyCCValidatorChanges(t *testing.T) {
2425
// Construct a keeper with a custom codec
2526
_, storeKey, paramsSubspace, ctx := testkeeper.SetupInMemKeeper(t)

x/ccv/consumer/types/genesis_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ var (
2929
upgradePath = []string{"upgrade", "upgradedIBCState"}
3030
)
3131

32+
// TestValidateInitialGenesisState tests a NewInitialGenesisState instantiation,
33+
// and its Validate() method over different genesis scenarios
3234
func TestValidateInitialGenesisState(t *testing.T) {
3335
// generate validator public key
3436
pubKey, err := testutil.GenPubKey()
@@ -145,6 +147,8 @@ func TestValidateInitialGenesisState(t *testing.T) {
145147
}
146148
}
147149

150+
// TestValidateRestartGenesisState tests a NewRestartGenesisState instantiation,
151+
// and its Validate() method over different genesis scenarios
148152
func TestValidateRestartGenesisState(t *testing.T) {
149153
// generate validator private/public key
150154
pubKey, err := testutil.GenPubKey()

x/ccv/provider/keeper/keeper_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ func TestKeeperTestSuite(t *testing.T) {
129129
suite.Run(t, new(KeeperTestSuite))
130130
}
131131

132+
// TestValsetUpdateBlockHeight tests the getter, setter, and deletion methods for valset updates mapped to block height
132133
func TestValsetUpdateBlockHeight(t *testing.T) {
133134
providerKeeper, ctx := testkeeper.GetProviderKeeperAndCtx(t)
134135

@@ -149,6 +150,7 @@ func TestValsetUpdateBlockHeight(t *testing.T) {
149150
require.Equal(t, blockHeight, uint64(4))
150151
}
151152

153+
// TestSlashAcks tests the getter, setter, iteration, and deletion methods for stored slash acknowledgements
152154
func TestSlashAcks(t *testing.T) {
153155
providerKeeper, ctx := testkeeper.GetProviderKeeperAndCtx(t)
154156

@@ -190,6 +192,7 @@ func TestSlashAcks(t *testing.T) {
190192
require.Len(t, chainsAcks, len(chains))
191193
}
192194

195+
// TestAppendSlashAck tests the append method for stored slash acknowledgements
193196
func TestAppendSlashAck(t *testing.T) {
194197
providerKeeper, ctx := testkeeper.GetProviderKeeperAndCtx(t)
195198

@@ -208,6 +211,7 @@ func TestAppendSlashAck(t *testing.T) {
208211
require.Len(t, acks, 1)
209212
}
210213

214+
// TestPendingVSCs tests the getter, appending, and deletion methods for stored pending VSCs
211215
func TestPendingVSCs(t *testing.T) {
212216
providerKeeper, ctx := testkeeper.GetProviderKeeperAndCtx(t)
213217

@@ -261,6 +265,7 @@ func TestPendingVSCs(t *testing.T) {
261265
require.False(t, found)
262266
}
263267

268+
// TestInitHeight tests the getter and setter methods for the stored block heights (on provider) when a given consumer chain was started
264269
func TestInitHeight(t *testing.T) {
265270
providerKeeper, ctx := testkeeper.GetProviderKeeperAndCtx(t)
266271

@@ -282,7 +287,7 @@ func TestInitHeight(t *testing.T) {
282287
}
283288
}
284289

285-
// Tests the handling of a double-signing related slash packet, with e2e tests
290+
// TestHandleSlashPacketDoubleSigning tests the handling of a double-signing related slash packet, with e2e tests
286291
func (suite *KeeperTestSuite) TestHandleSlashPacketDoubleSigning() {
287292
providerKeeper := suite.providerChain.App.(*appProvider.App).ProviderKeeper
288293
providerSlashingKeeper := suite.providerChain.App.(*appProvider.App).SlashingKeeper
@@ -323,7 +328,7 @@ func (suite *KeeperTestSuite) TestHandleSlashPacketDoubleSigning() {
323328
suite.Require().True(signingInfo.Tombstoned)
324329
}
325330

326-
// Tests the handling of a double-signing related slash packet, with mocks and unit tests
331+
// TestHandleSlashPacketDoubleSigning tests the handling of a double-signing related slash packet, with mocks and unit tests
327332
func TestHandleSlashPacketDoubleSigning(t *testing.T) {
328333
ctrl := gomock.NewController(t)
329334
defer ctrl.Finish()
@@ -395,6 +400,7 @@ func TestHandleSlashPacketDoubleSigning(t *testing.T) {
395400
require.True(t, success)
396401
}
397402

403+
// TestHandleSlashPacketErrors tests errors for the HandleSlashPacket method in an e2e testing setting
398404
func (suite *KeeperTestSuite) TestHandleSlashPacketErrors() {
399405
providerStakingKeeper := suite.providerChain.App.(*appProvider.App).StakingKeeper
400406
ProviderKeeper := suite.providerChain.App.(*appProvider.App).ProviderKeeper

0 commit comments

Comments
 (0)