Skip to content

Commit

Permalink
test: update confusing e2e democracy setup (#1701)
Browse files Browse the repository at this point in the history
* tests: update confusing e2e democracy setup

* test: refactor after review
  • Loading branch information
MSalopek authored Mar 13, 2024
1 parent f783ebd commit 1a92ffe
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 324 deletions.
4 changes: 2 additions & 2 deletions tests/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ var stepChoices = map[string]StepChoice{
},
"democracy-reward": {
name: "democracy-reward",
steps: democracyRewardsSteps,
steps: democracyRegisteredDenomSteps,
description: "democracy tests allowing rewards",
testConfig: DemocracyRewardTestCfg,
},
"democracy": {
name: "democracy",
steps: democracySteps,
steps: democracyUnregisteredDenomSteps,
description: "democracy tests",
testConfig: DemocracyTestCfg,
},
Expand Down
13 changes: 9 additions & 4 deletions tests/e2e/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,25 @@ var slashThrottleSteps = concatSteps(
stepsStopChain("consu", 2),
)

var democracyRewardsSteps = concatSteps(
// these tests start with transfer SendEnabled set to false
// one of the steps will set SendEnabled to true
var democracyUnregisteredDenomSteps = concatSteps(
// democracySteps requires a transfer channel
stepsStartChains([]string{"democ"}, true),
// delegation needs to happen so the first VSC packet can be delivered
stepsDelegate("democ"),
stepsDemocracy("democ"),
// the denom is not registered on the provider chain so it will not be distributed as rewards
stepsDemocracy("democ", false),
)

var democracySteps = concatSteps(
// these tests start with transfer SendEnabled set to true
var democracyRegisteredDenomSteps = concatSteps(
// democracySteps requires a transfer channel
stepsStartChains([]string{"democ"}, true),
// delegation needs to happen so the first VSC packet can be delivered
stepsDelegate("democ"),
stepsRewardDenomConsumer("democ"),
// the denom is registered on the provider chain so it will be distributed as rewards
stepsDemocracy("democ", true),
)

var multipleConsumers = concatSteps(
Expand Down
13 changes: 7 additions & 6 deletions tests/e2e/steps_democracy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

const consumerRewardDenom = "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9"

func stepsDemocracy(consumerName string) []Step {
func stepsDemocracy(consumerName string, expectRegisteredRewardDistribution bool) []Step {
return []Step{
{
Action: RegisterRepresentativeAction{
Expand Down Expand Up @@ -62,7 +62,7 @@ func stepsDemocracy(consumerName string) []Step {
},
},
{
// whitelisted legacy proposal can only handle ibctransfer.SendEnabled/ReceiveEnabled
// this proposal will allow ibc transfer by setting SendEnabled to true
Action: SubmitParamChangeLegacyProposalAction{
Chain: ChainID(consumerName),
From: ValidatorID("alice"),
Expand Down Expand Up @@ -181,12 +181,13 @@ func stepsDemocracy(consumerName string) []Step {
},
State: State{
ChainID("provi"): ChainState{
// Check that tokens are minted and sent to provider chain and distributed to validators and their delegators on provider chain
// Check that ARE NOT minted and sent to provider chain and distributed to validators and their delegators on provider chain
// the tokens are not sent because the test configuration does not allow sending tokens
Rewards: &Rewards{
IsRewarded: map[ValidatorID]bool{
ValidatorID("alice"): true,
ValidatorID("bob"): true,
ValidatorID("carol"): true,
ValidatorID("alice"): expectRegisteredRewardDistribution,
ValidatorID("bob"): expectRegisteredRewardDistribution,
ValidatorID("carol"): expectRegisteredRewardDistribution,
},
IsIncrementalReward: false,
IsNativeDenom: false,
Expand Down
308 changes: 0 additions & 308 deletions tests/e2e/steps_reward_denom.go

This file was deleted.

Loading

0 comments on commit 1a92ffe

Please sign in to comment.