From 389f6fd6965e3489431f00b197104003915bdd3a Mon Sep 17 00:00:00 2001 From: MSalopek Date: Wed, 2 Aug 2023 10:59:02 +0200 Subject: [PATCH 1/4] test: reduce number of happyPath steps --- tests/e2e/steps.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/e2e/steps.go b/tests/e2e/steps.go index aa08426103..5c6713786b 100644 --- a/tests/e2e/steps.go +++ b/tests/e2e/steps.go @@ -21,8 +21,6 @@ var happyPathSteps = concatSteps( stepsCancelUnbond("consu"), stepsRedelegateForOptOut("consu"), stepsDowntimeWithOptOut("consu"), - stepsRedelegate("consu"), - stepsDowntime("consu"), stepsRejectEquivocationProposal("consu", 2), // prop to tombstone bob is rejected stepsDoubleSignOnProviderAndConsumer("consu"), // carol double signs on provider, bob double signs on consumer stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted From 9044f337a2a6eacfb7b5185eed0e042dcf5684c9 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Wed, 2 Aug 2023 11:06:58 +0200 Subject: [PATCH 2/4] test: reduce number of happyPath steps --- tests/e2e/steps.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/e2e/steps.go b/tests/e2e/steps.go index 5c6713786b..cc69b4f803 100644 --- a/tests/e2e/steps.go +++ b/tests/e2e/steps.go @@ -21,12 +21,9 @@ var happyPathSteps = concatSteps( stepsCancelUnbond("consu"), stepsRedelegateForOptOut("consu"), stepsDowntimeWithOptOut("consu"), - stepsRejectEquivocationProposal("consu", 2), // prop to tombstone bob is rejected stepsDoubleSignOnProviderAndConsumer("consu"), // carol double signs on provider, bob double signs on consumer stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted - stepsStartRelayer(), - stepsConsumerRemovalPropNotPassing("consu", 3), // submit removal prop but vote no on it - chain should stay - stepsStopChain("consu", 4), // stop chain + stepsStopChain("consu", 3), // stop chain ) var shortHappyPathSteps = concatSteps( From 41797e981e554115ba3c4995e6bc6fd27d2b91e9 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Wed, 2 Aug 2023 12:14:36 +0200 Subject: [PATCH 3/4] test: update steps after opt-out --- tests/e2e/steps.go | 7 +- tests/e2e/steps_double_sign.go | 130 +++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+), 3 deletions(-) diff --git a/tests/e2e/steps.go b/tests/e2e/steps.go index cc69b4f803..7d6ad93e4f 100644 --- a/tests/e2e/steps.go +++ b/tests/e2e/steps.go @@ -21,9 +21,10 @@ var happyPathSteps = concatSteps( stepsCancelUnbond("consu"), stepsRedelegateForOptOut("consu"), stepsDowntimeWithOptOut("consu"), - stepsDoubleSignOnProviderAndConsumer("consu"), // carol double signs on provider, bob double signs on consumer - stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted - stepsStopChain("consu", 3), // stop chain + stepsRedelegate("consu"), + stepsDoubleSignOnProviderAndConsumerAfterOptOut("consu"), // carol double signs on provider, bob double signs on consumer + stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted + stepsStopChain("consu", 3), // stop chain ) var shortHappyPathSteps = concatSteps( diff --git a/tests/e2e/steps_double_sign.go b/tests/e2e/steps_double_sign.go index c007fa5c1c..53e073742a 100644 --- a/tests/e2e/steps_double_sign.go +++ b/tests/e2e/steps_double_sign.go @@ -128,3 +128,133 @@ func stepsDoubleSignOnProviderAndConsumer(consumerName string) []Step { }, } } + +// Steps that make carol double sign on the provider, and bob double sign on a single consumer. +// These steps happen after opt-out downtime traces have executed. +func stepsDoubleSignOnProviderAndConsumerAfterOptOut(consumerName string) []Step { + return []Step{ + { + // provider double sign + action: doublesignSlashAction{ + chain: chainID("provi"), + validator: validatorID("carol"), + }, + state: State{ + // slash on provider + chainID("provi"): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 509, + validatorID("bob"): 500, + validatorID("carol"): 0, // from 500 to 0 + }, + }, + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 509, + validatorID("bob"): 500, + validatorID("carol"): 501, // not tombstoned on consumerName yet + }, + }, + }, + }, + { + // relay power change to consumerName + action: relayPacketsAction{ + chainA: chainID("provi"), + chainB: chainID(consumerName), + port: "provider", + channel: 0, // consumerName channel + }, + state: State{ + chainID("provi"): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 509, + validatorID("bob"): 500, + validatorID("carol"): 0, + }, + }, + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 509, + validatorID("bob"): 500, + validatorID("carol"): 0, // tombstoning visible on consumerName + }, + }, + }, + }, + { + // consumer double sign + // provider will only log the double sign slash + // stepsSubmitEquivocationProposal will cause the double sign slash to be executed + action: doublesignSlashAction{ + chain: chainID("consu"), + validator: validatorID("bob"), + }, + state: State{ + chainID("provi"): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 509, + validatorID("bob"): 500, + validatorID("carol"): 0, + }, + }, + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 509, + validatorID("bob"): 500, + validatorID("carol"): 0, + }, + }, + }, + }, + { + action: relayPacketsAction{ + chainA: chainID("provi"), + chainB: chainID(consumerName), + port: "provider", + channel: 0, + }, + state: State{ + chainID("provi"): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 509, + validatorID("bob"): 500, // not tombstoned + validatorID("carol"): 0, + }, + }, + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 509, + validatorID("bob"): 500, // not tombstoned + validatorID("carol"): 0, + }, + }, + }, + }, + { + // consumer learns about the double sign + action: relayPacketsAction{ + chainA: chainID("provi"), + chainB: chainID(consumerName), + port: "provider", + channel: 0, + }, + state: State{ + chainID("provi"): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 509, + validatorID("bob"): 500, + validatorID("carol"): 0, + }, + }, + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 509, + validatorID("bob"): 500, // not tombstoned + validatorID("carol"): 0, + }, + }, + }, + }, + } +} From 5457e718fbf292e0fa6d9947e2530e7d3c4f492f Mon Sep 17 00:00:00 2001 From: MSalopek Date: Wed, 2 Aug 2023 12:53:58 +0200 Subject: [PATCH 4/4] test: update steps and fix lint --- tests/e2e/steps.go | 7 +- tests/e2e/steps_double_sign.go | 131 +----------------- .../e2e/steps_submit_equivocation_proposal.go | 4 +- 3 files changed, 7 insertions(+), 135 deletions(-) diff --git a/tests/e2e/steps.go b/tests/e2e/steps.go index 7d6ad93e4f..e6044985c6 100644 --- a/tests/e2e/steps.go +++ b/tests/e2e/steps.go @@ -22,9 +22,10 @@ var happyPathSteps = concatSteps( stepsRedelegateForOptOut("consu"), stepsDowntimeWithOptOut("consu"), stepsRedelegate("consu"), - stepsDoubleSignOnProviderAndConsumerAfterOptOut("consu"), // carol double signs on provider, bob double signs on consumer - stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted - stepsStopChain("consu", 3), // stop chain + stepsRejectEquivocationProposal("consu", 2), // prop to tombstone bob is rejected + stepsDoubleSignOnProviderAndConsumer("consu"), // carol double signs on provider, bob double signs on consumer + stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted + stepsStopChain("consu", 3), // stop chain ) var shortHappyPathSteps = concatSteps( diff --git a/tests/e2e/steps_double_sign.go b/tests/e2e/steps_double_sign.go index 53e073742a..5068f7001d 100644 --- a/tests/e2e/steps_double_sign.go +++ b/tests/e2e/steps_double_sign.go @@ -1,137 +1,8 @@ package main -// Steps that make carol double sign on the provider, and bob double sign on a single consumer -func stepsDoubleSignOnProviderAndConsumer(consumerName string) []Step { - return []Step{ - { - // provider double sign - action: doublesignSlashAction{ - chain: chainID("provi"), - validator: validatorID("carol"), - }, - state: State{ - // slash on provider - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, // from 500 to 0 - }, - }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, // not tombstoned on consumerName yet - }, - }, - }, - }, - { - // relay power change to consumerName - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, // consumerName channel - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, - }, - }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, // tombstoning visible on consumerName - }, - }, - }, - }, - { - // consumer double sign - // provider will only log the double sign slash - // stepsSubmitEquivocationProposal will cause the double sign slash to be executed - action: doublesignSlashAction{ - chain: chainID("consu"), - validator: validatorID("bob"), - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, - }, - }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, - }, - }, - }, - }, - { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, - }, - }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, - }, - }, - }, - }, - { - // consumer learns about the double sign - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, - }, - }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, - }, - }, - }, - }, - } -} - // Steps that make carol double sign on the provider, and bob double sign on a single consumer. // These steps happen after opt-out downtime traces have executed. -func stepsDoubleSignOnProviderAndConsumerAfterOptOut(consumerName string) []Step { +func stepsDoubleSignOnProviderAndConsumer(consumerName string) []Step { return []Step{ { // provider double sign diff --git a/tests/e2e/steps_submit_equivocation_proposal.go b/tests/e2e/steps_submit_equivocation_proposal.go index 8af1d2464d..802e09a138 100644 --- a/tests/e2e/steps_submit_equivocation_proposal.go +++ b/tests/e2e/steps_submit_equivocation_proposal.go @@ -21,7 +21,7 @@ func stepsRejectEquivocationProposal(consumerName string, propNumber uint) []Ste ValPowers: &map[validatorID]uint{ validatorID("alice"): 509, validatorID("bob"): 500, - validatorID("carol"): 495, + validatorID("carol"): 501, }, ValBalances: &map[validatorID]uint{ validatorID("bob"): 9500000000, @@ -35,7 +35,7 @@ func stepsRejectEquivocationProposal(consumerName string, propNumber uint) []Ste ValPowers: &map[validatorID]uint{ validatorID("alice"): 509, validatorID("bob"): 500, - validatorID("carol"): 495, + validatorID("carol"): 501, }, }, },