From 92a9d1768e3366bf7b4b897c92a6cc5854976f29 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Wed, 4 Oct 2023 13:23:52 +0200 Subject: [PATCH] fix democ tests --- tests/e2e/config.go | 5 ++-- tests/e2e/main.go | 6 ++++- tests/e2e/steps_democracy.go | 15 +++++++++++- tests/e2e/steps_reward_denom.go | 15 +++++++++++- .../e2e/tracehandler_testdata/democracy.json | 16 ++++++++++--- .../democracyRewardsSteps.json | 23 ++++++++++++++++--- .../e2e/tracehandler_testdata/happyPath.json | 4 ++-- .../e2e/tracehandler_testdata/shorthappy.json | 4 ++-- 8 files changed, 73 insertions(+), 15 deletions(-) diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 0a164c2cec..942bb338e7 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -243,11 +243,12 @@ func DefaultTestConfig() TestConfig { func DemocracyTestConfig(allowReward bool) TestConfig { consumerGenChanges := ".app_state.ccvconsumer.params.blocks_per_distribution_transmission = \"20\" | " + - ".app_state.gov.voting_params.voting_period = \"10s\" | " + + ".app_state.gov.params.voting_period = \"10s\" | " + ".app_state.slashing.params.signed_blocks_window = \"10\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + - ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"" + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + + ".app_state.transfer.params.send_enabled = false" if allowReward { // This allows the consumer chain to send rewards in the stake denom diff --git a/tests/e2e/main.go b/tests/e2e/main.go index 87c617be18..0be163f8db 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -173,8 +173,12 @@ func getTestFileUsageString() string { // Test runner selection builder.WriteString("Test runner selection:\nSelection of test runners to be executed:\n") + testConfigSet := map[string]struct{}{} for _, testConfig := range testConfigs { - builder.WriteString(fmt.Sprintf("- %s\n", testConfig.name)) + if _, ok := testConfigSet[testConfig.name]; !ok { + builder.WriteString(fmt.Sprintf("- %s\n", testConfig.name)) + testConfigSet[testConfig.name] = struct{}{} + } } builder.WriteString("\n") diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index a264f868a7..9605f8698a 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -77,6 +77,8 @@ func stepsDemocracy(consumerName string) []Step { ValidatorID("alice"): 9889999998, ValidatorID("bob"): 9960000001, }, + // Check that the "SendEnabled" transfer parameter is set to false + Params: &([]Param{{Subspace: "transfer", Key: "SendEnabled", Value: "false"}}), Proposals: &map[uint]Proposal{ 1: ParamsProposal{ Deposit: 10000001, @@ -99,10 +101,21 @@ func stepsDemocracy(consumerName string) []Step { }, State: State{ ChainID(consumerName): ChainState{ + // Check that alice gets the prop deposit refunded ValBalances: &map[ValidatorID]uint{ - ValidatorID("alice"): 9889999998, + ValidatorID("alice"): 9899999999, ValidatorID("bob"): 9960000001, }, + // Check that the prop passed + Proposals: &map[uint]Proposal{ + 1: ParamsProposal{ + Deposit: 10000001, + Status: "PROPOSAL_STATUS_PASSED", + Subspace: "transfer", + Key: "SendEnabled", + Value: "true", + }, + }, // Check that the parameter is changed on gov-consumer chain Params: &([]Param{{Subspace: "transfer", Key: "SendEnabled", Value: "true"}}), }, diff --git a/tests/e2e/steps_reward_denom.go b/tests/e2e/steps_reward_denom.go index 1a47accd07..d5b524fbd9 100644 --- a/tests/e2e/steps_reward_denom.go +++ b/tests/e2e/steps_reward_denom.go @@ -75,6 +75,8 @@ func stepsRewardDenomConsumer(consumerName string) []Step { ValidatorID("alice"): 9889999998, ValidatorID("bob"): 9960000001, }, + // Check that the "SendEnabled" transfer parameter is set to false + Params: &([]Param{{Subspace: "transfer", Key: "SendEnabled", Value: "false"}}), Proposals: &map[uint]Proposal{ 1: ParamsProposal{ Deposit: 10000001, @@ -97,10 +99,21 @@ func stepsRewardDenomConsumer(consumerName string) []Step { }, State: State{ ChainID(consumerName): ChainState{ + // Check that alice gets the prop deposit refunded ValBalances: &map[ValidatorID]uint{ - ValidatorID("alice"): 9889999998, + ValidatorID("alice"): 9899999999, ValidatorID("bob"): 9960000001, }, + // Check that the prop passed + Proposals: &map[uint]Proposal{ + 1: ParamsProposal{ + Deposit: 10000001, + Status: "PROPOSAL_STATUS_PASSED", + Subspace: "transfer", + Key: "SendEnabled", + Value: "true", + }, + }, // Check that the parameter is changed on gov-consumer chain Params: &([]Param{{Subspace: "transfer", Key: "SendEnabled", Value: "true"}}), }, diff --git a/tests/e2e/tracehandler_testdata/democracy.json b/tests/e2e/tracehandler_testdata/democracy.json index 9a435b3a0b..12993e4a38 100644 --- a/tests/e2e/tracehandler_testdata/democracy.json +++ b/tests/e2e/tracehandler_testdata/democracy.json @@ -1,4 +1,3 @@ - [ { "ActionType": "main.StartChainAction", @@ -587,7 +586,7 @@ "State": { "democ": { "ValBalances": { - "alice": 9889999998, + "alice": 9899999999, "bob": 9960000001 }, "ValPowers": null, @@ -606,7 +605,18 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, - "Proposals": null + "Proposals": { + "1": { + "RawProposal": { + "Deposit": 10000001, + "Status": "PROPOSAL_STATUS_PASSED", + "Subspace": "transfer", + "Key": "SendEnabled", + "Value": "true" + }, + "Type": "main.ParamsProposal" + } + } } } }, diff --git a/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json b/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json index 355ff1fbb8..0251309ef2 100644 --- a/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json +++ b/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json @@ -546,7 +546,13 @@ }, "ValPowers": null, "StakedTokens": null, - "Params": null, + "Params": [ + { + "Subspace": "transfer", + "Key": "SendEnabled", + "Value": "false" + } + ], "Rewards": null, "ConsumerChains": null, "AssignedKeys": null, @@ -586,7 +592,7 @@ "State": { "democ": { "ValBalances": { - "alice": 9889999998, + "alice": 9899999999, "bob": 9960000001 }, "ValPowers": null, @@ -605,7 +611,18 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, - "Proposals": null + "Proposals": { + "1": { + "RawProposal": { + "Deposit": 10000001, + "Status": "PROPOSAL_STATUS_PASSED", + "Subspace": "transfer", + "Key": "SendEnabled", + "Value": "true" + }, + "Type": "main.ParamsProposal" + } + } } } }, diff --git a/tests/e2e/tracehandler_testdata/happyPath.json b/tests/e2e/tracehandler_testdata/happyPath.json index f46a4e983b..1f5be74833 100644 --- a/tests/e2e/tracehandler_testdata/happyPath.json +++ b/tests/e2e/tracehandler_testdata/happyPath.json @@ -1363,7 +1363,7 @@ "Action": { "Chain": "consu", "Height": 10, - "Time": "2023-09-20T18:24:51.823193+02:00", + "Time": "2023-10-04T12:14:14.883367+02:00", "Power": 500, "Validator": "bob", "Deposit": 10000001, @@ -1656,7 +1656,7 @@ "Action": { "Chain": "consu", "Height": 10, - "Time": "2023-09-20T18:24:51.823197+02:00", + "Time": "2023-10-04T12:14:14.88337+02:00", "Power": 500, "Validator": "bob", "Deposit": 10000001, diff --git a/tests/e2e/tracehandler_testdata/shorthappy.json b/tests/e2e/tracehandler_testdata/shorthappy.json index ee82bf619f..697af97fef 100644 --- a/tests/e2e/tracehandler_testdata/shorthappy.json +++ b/tests/e2e/tracehandler_testdata/shorthappy.json @@ -934,7 +934,7 @@ "Action": { "Chain": "consu", "Height": 10, - "Time": "2023-09-20T18:24:51.823231+02:00", + "Time": "2023-10-04T12:14:14.883385+02:00", "Power": 500, "Validator": "bob", "Deposit": 10000001, @@ -1227,7 +1227,7 @@ "Action": { "Chain": "consu", "Height": 10, - "Time": "2023-09-20T18:24:51.823235+02:00", + "Time": "2023-10-04T12:14:14.883388+02:00", "Power": 500, "Validator": "bob", "Deposit": 10000001,