From 5db9932ca8b92c4e3be59d460b13cf8edae07500 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 19 Jul 2024 17:22:09 +0200 Subject: [PATCH] Add docstrings for e2e steps --- tests/e2e/main.go | 2 +- tests/e2e/steps_inactive_vals.go | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/e2e/main.go b/tests/e2e/main.go index 508e018604..1f73d68ed7 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -224,7 +224,7 @@ var stepChoices = map[string]StepChoice{ }, "inactive-provider-validators-governance-basecase": { name: "inactive-provider-validators-governance-basecase", - steps: stepsInactiveProviderValidatorsGovernanceComparison(), + steps: stepsInactiveProviderValidatorsGovernanceBasecase(), description: "comparison for governance when there are *no* inactive validators, to verify the difference to the governance test *with* inactive validators", testConfig: GovTestCfg, }, diff --git a/tests/e2e/steps_inactive_vals.go b/tests/e2e/steps_inactive_vals.go index 4e51ee19a1..1fb145e47c 100644 --- a/tests/e2e/steps_inactive_vals.go +++ b/tests/e2e/steps_inactive_vals.go @@ -477,6 +477,11 @@ func stepsOptInValidators(validators ...ValidatorID) []Step { return s } +// stepsInactiveProviderValidatorsGovernance validates that inactive validators +// are not included in the calculation of the quorum for governance proposals. +// It checks that when the quorum is met *among active validators*, +// the proposal can pass, even though the quorum would not be met if inactive validators +// would be counted. func stepsInactiveProviderValidatorsGovernance() []Step { s := concatSteps( []Step{ @@ -561,7 +566,10 @@ func stepsInactiveProviderValidatorsGovernance() []Step { return s } -func stepsInactiveProviderValidatorsGovernanceComparison() []Step { +// stepsInactiveProviderValidatorsGovernanceBasecase is a sanity check to go along with +// stepsInactiveProviderValidatorsGovernance. It tests that with all validators being active, +// the proposal does not pass if it does not meet the quorum among validators. +func stepsInactiveProviderValidatorsGovernanceBasecase() []Step { s := concatSteps( []Step{ { @@ -645,6 +653,8 @@ func stepsInactiveProviderValidatorsGovernanceComparison() []Step { return s } +// stepsMaxRank validates that a validator with a rank higher than the specified maxRank parameter +// cannot validate the consumer chain. func stepsMaxRank() []Step { return concatSteps( []Step{ @@ -753,6 +763,8 @@ func stepsMaxRank() []Step { ) } +// stepsMinStake validates that a validator with less stake than the specified minStake parameter +// cannot validate the consumer chain. func stepsMinStake() []Step { return concatSteps( []Step{ @@ -861,6 +873,8 @@ func stepsMinStake() []Step { ) } +// This test case validates that inactive validators are not included when computing +// the top N. func stepsInactiveValsWithTopN() []Step { return []Step{ { @@ -977,6 +991,9 @@ func stepsInactiveValsWithTopN() []Step { } } +// stepsInactiveValsMint tests the minting of tokens with inactive validators +// It checks that inactive validators are not counted when computing whether the +// inflation rate should go up or down. func stepsInactiveValsMint() []Step { // total supply is 30000000000, bonded goal ratio makes it so we want 30000000 tokens bonded return []Step{ @@ -1021,6 +1038,8 @@ func stepsInactiveValsMint() []Step { } } +// stepsMintBasecase tests the minting of tokens without inactive validators. +// This is done as a sanity check to complement stepsInactiveValsMint. func stepsMintBasecase() []Step { // total supply is 30000000000, bonded goal ratio makes it so we want 30000000 tokens bonded return []Step{ @@ -1054,8 +1073,8 @@ func stepsMintBasecase() []Step { State: State{ ChainID("provi"): ChainState{ ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 28, - ValidatorID("bob"): 29, + ValidatorID("alice"): 27, + ValidatorID("bob"): 28, ValidatorID("carol"): 79, }, InflationRateChange: intPtr(-1), // inflation rate *still* goes down