Skip to content

Commit

Permalink
test: update steps and fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalopek committed Aug 2, 2023
1 parent 316ee53 commit 1c9771f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 135 deletions.
7 changes: 4 additions & 3 deletions tests/e2e/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
131 changes: 1 addition & 130 deletions tests/e2e/steps_double_sign.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/steps_submit_equivocation_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
},
},
},
Expand Down

0 comments on commit 1c9771f

Please sign in to comment.