From 28401ac0b3bdd3c36126b9a135f0354e4ee7c596 Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Wed, 13 Sep 2023 15:14:48 -0700 Subject: [PATCH 1/3] Update steps_downtime.go --- tests/e2e/steps_downtime.go | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/tests/e2e/steps_downtime.go b/tests/e2e/steps_downtime.go index 30e833c793..7820ea1a51 100644 --- a/tests/e2e/steps_downtime.go +++ b/tests/e2e/steps_downtime.go @@ -309,15 +309,33 @@ 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, - validatorID("bob"): 500, + // 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, }, }, @@ -340,7 +358,7 @@ func stepsThrottledDowntime(consumerName string) []Step { 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"): 0, validatorID("carol"): 500, }, }, @@ -364,7 +382,7 @@ func stepsThrottledDowntime(consumerName string) []Step { 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"): 0, validatorID("carol"): 500, }, }, From 232c475e738e3dcf01025caacc7201496068a7cd Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Wed, 13 Sep 2023 22:10:47 -0700 Subject: [PATCH 2/3] fix chain halt --- tests/e2e/config.go | 2 +- tests/e2e/steps_downtime.go | 72 +++++++++++++++++++++++++++++++------ 2 files changed, 62 insertions(+), 12 deletions(-) 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 7820ea1a51..0ef4f90942 100644 --- a/tests/e2e/steps_downtime.go +++ b/tests/e2e/steps_downtime.go @@ -341,7 +341,49 @@ func stepsThrottledDowntime(consumerName string) []Step { }, }, }, - // Invoke carol downtime slash on consumer + // 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, + }, + }, + }, + }, + { + 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), @@ -351,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"): 0, + validatorID("bob"): 500, validatorID("carol"): 500, }, }, @@ -375,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, + validatorID("bob"): 500, validatorID("carol"): 500, }, }, @@ -394,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 - timeout: 100 * time.Second, + // 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 + buffer = 80 seconds + + // timeout: 200 * time.Second, + timeout: 80 * 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 }, }, @@ -411,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, }, }, From c1ee19bd0711d637d251e0ce11dd694370cf8139 Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Wed, 13 Sep 2023 22:29:01 -0700 Subject: [PATCH 3/3] update timeout --- tests/e2e/steps_downtime.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/e2e/steps_downtime.go b/tests/e2e/steps_downtime.go index 0ef4f90942..34b7226ef3 100644 --- a/tests/e2e/steps_downtime.go +++ b/tests/e2e/steps_downtime.go @@ -444,10 +444,10 @@ func stepsThrottledDowntime(consumerName string) []Step { // // We've already waited 60 seconds for unjailValidatorAction // - // So timeout should be 100 - 60 + buffer = 80 seconds - - // timeout: 200 * time.Second, - timeout: 80 * time.Second, + // 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{