Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: cover consumer-gov in E2E democracy tests #1341

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tests/e2e/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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\" | " +
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gov props weren't executed due to this typo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems bad that small things like this break things (particularly that this seems to break them silently..), good catch!

".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
Expand Down
6 changes: 5 additions & 1 deletion tests/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}{}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change to remove duplicates in the test runner selection.

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")

Expand Down
15 changes: 14 additions & 1 deletion tests/e2e/steps_democracy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"}}),
},
Expand Down
15 changes: 14 additions & 1 deletion tests/e2e/steps_reward_denom.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"}}),
},
Expand Down
16 changes: 13 additions & 3 deletions tests/e2e/tracehandler_testdata/democracy.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

[
{
"ActionType": "main.StartChainAction",
Expand Down Expand Up @@ -587,7 +586,7 @@
"State": {
"democ": {
"ValBalances": {
"alice": 9889999998,
"alice": 9899999999,
"bob": 9960000001
},
"ValPowers": null,
Expand All @@ -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"
}
}
}
}
},
Expand Down
23 changes: 20 additions & 3 deletions tests/e2e/tracehandler_testdata/democracyRewardsSteps.json
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,13 @@
},
"ValPowers": null,
"StakedTokens": null,
"Params": null,
"Params": [
{
"Subspace": "transfer",
"Key": "SendEnabled",
"Value": "false"
}
],
"Rewards": null,
"ConsumerChains": null,
"AssignedKeys": null,
Expand Down Expand Up @@ -586,7 +592,7 @@
"State": {
"democ": {
"ValBalances": {
"alice": 9889999998,
"alice": 9899999999,
"bob": 9960000001
},
"ValPowers": null,
Expand All @@ -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"
}
}
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/tracehandler_testdata/happyPath.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/tracehandler_testdata/shorthappy.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading