Skip to content

Commit ea545b4

Browse files
committed
update rapid test
1 parent 8349b82 commit ea545b4

14 files changed

+1273
-779
lines changed

tests/e2e/action_rapid_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ func GetActionGen() *rapid.Generator[any] {
8989
CreateLightClientEquivocationAttackActionGen().AsAny(),
9090
CreateLightClientAmnesiaAttackActionGen().AsAny(),
9191
CreateLightClientLunaticAttackActionGen().AsAny(),
92+
GetStartConsumerEvidenceDetectorActionGen().AsAny(),
93+
GetForkConsumerChainActionGen().AsAny(),
94+
GetUpdateLightClientActionGen().AsAny(),
9295
)
9396
}
9497

@@ -485,3 +488,33 @@ func GetSlashThrottleDequeueActionGen() *rapid.Generator[slashThrottleDequeueAct
485488
}
486489
})
487490
}
491+
492+
func GetForkConsumerChainActionGen() *rapid.Generator[forkConsumerChainAction] {
493+
return rapid.Custom(func(t *rapid.T) forkConsumerChainAction {
494+
return forkConsumerChainAction{
495+
ConsumerChain: GetChainIDGen().Draw(t, "ConsumerChain"),
496+
ProviderChain: GetChainIDGen().Draw(t, "ProviderChain"),
497+
Validator: GetValidatorIDGen().Draw(t, "Validator"),
498+
RelayerConfig: rapid.String().Draw(t, "RelayerConfig"),
499+
}
500+
})
501+
}
502+
503+
func GetStartConsumerEvidenceDetectorActionGen() *rapid.Generator[startConsumerEvidenceDetectorAction] {
504+
return rapid.Custom(func(t *rapid.T) startConsumerEvidenceDetectorAction {
505+
return startConsumerEvidenceDetectorAction{
506+
Chain: GetChainIDGen().Draw(t, "Chain"),
507+
}
508+
})
509+
}
510+
511+
func GetUpdateLightClientActionGen() *rapid.Generator[updateLightClientAction] {
512+
return rapid.Custom(func(t *rapid.T) updateLightClientAction {
513+
return updateLightClientAction{
514+
Chain: GetChainIDGen().Draw(t, "Chain"),
515+
HostChain: GetChainIDGen().Draw(t, "HostChain"),
516+
RelayerConfig: rapid.String().Draw(t, "RelayerConfig"),
517+
ClientID: rapid.String().Draw(t, "ClientID"),
518+
}
519+
})
520+
}

tests/e2e/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ func ChangeoverTestConfig() TestConfig {
397397

398398
func ConsumerMisbehaviourTestConfig() TestConfig {
399399
tc := TestConfig{
400-
name: "misbehaviour",
400+
name: "consumer-misbehaviour",
401401
containerConfig: ContainerConfig{
402402
ContainerName: "interchain-security-container",
403403
InstanceName: "interchain-security-instance",

tests/e2e/json_utils.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,24 @@ func UnmarshalMapToActionType(rawAction json.RawMessage, actionTypeString string
269269
if err == nil {
270270
return a, nil
271271
}
272+
case "main.forkConsumerChainAction":
273+
var a forkConsumerChainAction
274+
err := json.Unmarshal(rawAction, &a)
275+
if err == nil {
276+
return a, nil
277+
}
278+
case "main.startConsumerEvidenceDetectorAction":
279+
var a startConsumerEvidenceDetectorAction
280+
err := json.Unmarshal(rawAction, &a)
281+
if err == nil {
282+
return a, nil
283+
}
284+
case "main.updateLightClientAction":
285+
var a updateLightClientAction
286+
err := json.Unmarshal(rawAction, &a)
287+
if err == nil {
288+
return a, nil
289+
}
272290
default:
273291
return nil, fmt.Errorf("unknown action type: %s", actionTypeString)
274292
}

tests/e2e/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ func getTestCases(selectedPredefinedTests, selectedTestFiles TestSet) (tests []t
226226
if len(selectedPredefinedTests) == 0 && len(selectedTestFiles) == 0 {
227227
selectedPredefinedTests = TestSet{
228228
"changeover", "happy-path",
229-
"democracy-reward", "democracy", "slash-throttle",
229+
"democracy-reward", "democracy",
230+
"slash-throttle", "consumer-double-sign", "consumer-misbehaviour",
230231
}
231232
if includeMultiConsumer != nil && *includeMultiConsumer {
232233
selectedPredefinedTests = append(selectedPredefinedTests, "multiconsumer")

tests/e2e/trace_handlers_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ func TestWriteExamples(t *testing.T) {
8282
"shorthappy": {shortHappyPathSteps},
8383
"democracyRewardsSteps": {democracyRewardsSteps},
8484
"changeover": {changeoverSteps},
85+
"consumer-misbehaviour": {consumerMisbehaviourSteps},
86+
"consumer-double-sign": {consumerDoubleSignSteps},
8587
}
8688

8789
dir := "tracehandler_testdata"
@@ -131,7 +133,7 @@ func TestMarshalAndUnmarshalChainState(t *testing.T) {
131133
},
132134
},
133135
}},
134-
"consuemr removal proposal": {ChainState{
136+
"consumer removal proposal": {ChainState{
135137
Proposals: &map[uint]Proposal{
136138
5: ConsumerRemovalProposal{
137139
Deposit: 10000001,

tests/e2e/tracehandler_testdata/changeover.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"ConsumerChainQueueSizes": null,
2828
"GlobalSlashQueueSize": null,
2929
"RegisteredConsumerRewardDenoms": null,
30+
"ClientsFrozenHeights": null,
3031
"Proposals": null
3132
}
3233
}
@@ -56,6 +57,7 @@
5657
"ConsumerChainQueueSizes": null,
5758
"GlobalSlashQueueSize": null,
5859
"RegisteredConsumerRewardDenoms": null,
60+
"ClientsFrozenHeights": null,
5961
"Proposals": null
6062
}
6163
}
@@ -82,7 +84,7 @@
8284
}
8385
],
8486
"GenesisChanges": "",
85-
"SkipGentx": false
87+
"IsConsumer": false
8688
},
8789
"State": {
8890
"provi": {
@@ -101,6 +103,7 @@
101103
"ConsumerChainQueueSizes": null,
102104
"GlobalSlashQueueSize": null,
103105
"RegisteredConsumerRewardDenoms": null,
106+
"ClientsFrozenHeights": null,
104107
"Proposals": null
105108
}
106109
}
@@ -147,6 +150,7 @@
147150
"ConsumerChainQueueSizes": null,
148151
"GlobalSlashQueueSize": null,
149152
"RegisteredConsumerRewardDenoms": null,
153+
"ClientsFrozenHeights": null,
150154
"Proposals": {
151155
"1": {
152156
"RawProposal": {
@@ -188,6 +192,7 @@
188192
"ConsumerChainQueueSizes": null,
189193
"GlobalSlashQueueSize": null,
190194
"RegisteredConsumerRewardDenoms": null,
195+
"ClientsFrozenHeights": null,
191196
"Proposals": {
192197
"1": {
193198
"RawProposal": {
@@ -242,6 +247,7 @@
242247
"ConsumerChainQueueSizes": null,
243248
"GlobalSlashQueueSize": null,
244249
"RegisteredConsumerRewardDenoms": null,
250+
"ClientsFrozenHeights": null,
245251
"Proposals": {
246252
"1": {
247253
"RawProposal": {
@@ -291,6 +297,7 @@
291297
"ConsumerChainQueueSizes": null,
292298
"GlobalSlashQueueSize": null,
293299
"RegisteredConsumerRewardDenoms": null,
300+
"ClientsFrozenHeights": null,
294301
"Proposals": {
295302
"1": {
296303
"RawProposal": {
@@ -349,6 +356,7 @@
349356
"ConsumerChainQueueSizes": null,
350357
"GlobalSlashQueueSize": null,
351358
"RegisteredConsumerRewardDenoms": null,
359+
"ClientsFrozenHeights": null,
352360
"Proposals": null
353361
},
354362
"sover": {
@@ -367,6 +375,7 @@
367375
"ConsumerChainQueueSizes": null,
368376
"GlobalSlashQueueSize": null,
369377
"RegisteredConsumerRewardDenoms": null,
378+
"ClientsFrozenHeights": null,
370379
"Proposals": null
371380
}
372381
}
@@ -417,6 +426,7 @@
417426
"ConsumerChainQueueSizes": null,
418427
"GlobalSlashQueueSize": null,
419428
"RegisteredConsumerRewardDenoms": null,
429+
"ClientsFrozenHeights": null,
420430
"Proposals": null
421431
}
422432
}
@@ -446,6 +456,7 @@
446456
"ConsumerChainQueueSizes": null,
447457
"GlobalSlashQueueSize": null,
448458
"RegisteredConsumerRewardDenoms": null,
459+
"ClientsFrozenHeights": null,
449460
"Proposals": null
450461
},
451462
"sover": {
@@ -464,6 +475,7 @@
464475
"ConsumerChainQueueSizes": null,
465476
"GlobalSlashQueueSize": null,
466477
"RegisteredConsumerRewardDenoms": null,
478+
"ClientsFrozenHeights": null,
467479
"Proposals": null
468480
}
469481
}
@@ -493,6 +505,7 @@
493505
"ConsumerChainQueueSizes": null,
494506
"GlobalSlashQueueSize": null,
495507
"RegisteredConsumerRewardDenoms": null,
508+
"ClientsFrozenHeights": null,
496509
"Proposals": null
497510
}
498511
}
@@ -520,6 +533,7 @@
520533
"ConsumerChainQueueSizes": null,
521534
"GlobalSlashQueueSize": null,
522535
"RegisteredConsumerRewardDenoms": null,
536+
"ClientsFrozenHeights": null,
523537
"Proposals": null
524538
}
525539
}
@@ -549,6 +563,7 @@
549563
"ConsumerChainQueueSizes": null,
550564
"GlobalSlashQueueSize": null,
551565
"RegisteredConsumerRewardDenoms": null,
566+
"ClientsFrozenHeights": null,
552567
"Proposals": null
553568
},
554569
"sover": {
@@ -567,6 +582,7 @@
567582
"ConsumerChainQueueSizes": null,
568583
"GlobalSlashQueueSize": null,
569584
"RegisteredConsumerRewardDenoms": null,
585+
"ClientsFrozenHeights": null,
570586
"Proposals": null
571587
}
572588
}
@@ -596,6 +612,7 @@
596612
"ConsumerChainQueueSizes": null,
597613
"GlobalSlashQueueSize": null,
598614
"RegisteredConsumerRewardDenoms": null,
615+
"ClientsFrozenHeights": null,
599616
"Proposals": null
600617
}
601618
}

0 commit comments

Comments
 (0)