Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: fix relayer/consensus discrepancy for throttle v2 e2e test #1298

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/e2e/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"): {
Expand Down
92 changes: 80 additions & 12 deletions tests/e2e/steps_downtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
},
},
Expand All @@ -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,
},
},
Expand All @@ -376,24 +436,32 @@ 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
},
},
chainID(consumerName): ChainState{
// no updates received on consumer
ValPowers: &map[validatorID]uint{
validatorID("alice"): 511,
validatorID("bob"): 0,
validatorID("bob"): 500,
validatorID("carol"): 500,
},
},
Expand Down
Loading