diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 373281162d..01851530ec 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -174,7 +174,7 @@ func SlashThrottleTestRun() TestRun { ".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.provider.params.slash_meter_replenish_fraction = \"0.10\" | " + + ".app_state.provider.params.slash_meter_replenish_fraction = \"0.05\" | " + ".app_state.provider.params.slash_meter_replenish_period = \"20s\"", }, chainID("consu"): { diff --git a/tests/e2e/steps_downtime.go b/tests/e2e/steps_downtime.go index 30e833c793..34b7226ef3 100644 --- a/tests/e2e/steps_downtime.go +++ b/tests/e2e/steps_downtime.go @@ -309,21 +309,81 @@ func stepsThrottledDowntime(consumerName string) []Step { chainID("provi"): ChainState{ ValPowers: &map[validatorID]uint{ validatorID("alice"): 511, - validatorID("bob"): 0, // bob is jailed + validatorID("bob"): 0, // bob is jailed on provider validatorID("carol"): 500, }, }, chainID(consumerName): ChainState{ - // VSC packet applying jailing is not yet relayed to consumer ValPowers: &map[validatorID]uint{ validatorID("alice"): 511, + // VSC packet applying jailing may or may not be relayed to consumer + // depending on hermes vs gorelayer behavior. Therefore skip asserting bob's consumer power + validatorID("carol"): 500, + }, + }, + }, + }, + { + // After relaying one more time, vsc packet applying jailing should be seen on consumer + action: relayPacketsAction{ + chainA: chainID("provi"), + chainB: chainID(consumerName), + port: "provider", + channel: 0, + }, + state: State{ + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + validatorID("bob"): 0, + validatorID("carol"): 500, + }, + }, + }, + }, + // Next we unjail bob so that there's enough active VP to continue these steps + { + action: unjailValidatorAction{ + provider: chainID("provi"), + validator: validatorID("bob"), + }, + state: State{ + chainID("provi"): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + // bob's stake should not be slashed + // since the slash was initiated from consumer validatorID("bob"): 500, validatorID("carol"): 500, }, }, + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + validatorID("bob"): 0, + validatorID("carol"): 500, + }, + }, }, }, - // Invoke carol downtime slash on consumer + { + action: relayPacketsAction{ + chainA: chainID("provi"), + chainB: chainID(consumerName), + port: "provider", + channel: 0, + }, + state: State{ + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + validatorID("bob"): 500, // unjail now seen on consumer + validatorID("carol"): 500, + }, + }, + }, + }, + // Next we invoke carol downtime slash on consumer { action: downtimeSlashAction{ chain: chainID(consumerName), @@ -333,14 +393,14 @@ func stepsThrottledDowntime(consumerName string) []Step { chainID("provi"): ChainState{ ValPowers: &map[validatorID]uint{ validatorID("alice"): 511, - validatorID("bob"): 0, + validatorID("bob"): 500, validatorID("carol"): 500, }, }, chainID(consumerName): ChainState{ ValPowers: &map[validatorID]uint{ validatorID("alice"): 511, - validatorID("bob"): 500, // VSC packet applying bob jailing is not yet relayed to consumer + validatorID("bob"): 500, validatorID("carol"): 500, }, }, @@ -357,14 +417,14 @@ func stepsThrottledDowntime(consumerName string) []Step { chainID("provi"): ChainState{ ValPowers: &map[validatorID]uint{ validatorID("alice"): 511, - validatorID("bob"): 0, + validatorID("bob"): 500, validatorID("carol"): 500, // slash packet for carol recv by provider, carol not slashed due to throttling }, }, chainID(consumerName): ChainState{ ValPowers: &map[validatorID]uint{ validatorID("alice"): 511, - validatorID("bob"): 0, // VSC packet applying bob jailing is also relayed and recv by consumer + validatorID("bob"): 500, validatorID("carol"): 500, }, }, @@ -376,16 +436,24 @@ func stepsThrottledDowntime(consumerName string) []Step { action: slashMeterReplenishmentAction{ targetValue: 0, // We just want slash meter to be non-negative - // Slash meter replenish fraction is set to 10%, replenish period is 20 seconds, see config.go - // Meter is initially at 10%, decremented to -23% from bob being jailed. It'll then take three replenishments - // for meter to become positive again. 3*20 = 60 seconds + buffer = 100 seconds + // Slash meter replenish fraction is set to 5%, replenish period is 20 seconds, see config.go + // Meter is initially at 10%, decremented to -23% from bob being jailed. It'll then take five replenishments + // for meter to become positive again. + // + // 5 * 20 = 100 seconds. + // + // We've already waited 60 seconds for unjailValidatorAction + // + // So timeout should be 100 - 60 + // + large buffer to consider that cometmock did not pass blocks during unjail step + // = 100 seconds timeout: 100 * time.Second, }, state: State{ chainID("provi"): ChainState{ ValPowers: &map[validatorID]uint{ validatorID("alice"): 511, - validatorID("bob"): 0, + validatorID("bob"): 500, validatorID("carol"): 500, // Carol still not slashed, packet must be retried }, }, @@ -393,7 +461,7 @@ func stepsThrottledDowntime(consumerName string) []Step { // no updates received on consumer ValPowers: &map[validatorID]uint{ validatorID("alice"): 511, - validatorID("bob"): 0, + validatorID("bob"): 500, validatorID("carol"): 500, }, },