Skip to content

Commit

Permalink
fix chain halt
Browse files Browse the repository at this point in the history
  • Loading branch information
shaspitz committed Sep 14, 2023
1 parent 28401ac commit 232c475
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 12 deletions.
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
72 changes: 61 additions & 11 deletions tests/e2e/steps_downtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
},
},
Expand All @@ -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,
},
},
Expand All @@ -394,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
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
},
},
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

0 comments on commit 232c475

Please sign in to comment.