Skip to content

Commit

Permalink
update E2E tests comment
Browse files Browse the repository at this point in the history
  • Loading branch information
sainoe committed Aug 3, 2023
1 parent d5b2122 commit c9a9f38
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
27 changes: 9 additions & 18 deletions tests/e2e/steps_consumer_misbehaviour.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,13 @@ func stepsStartChainsWithSoftOptOut(consumerName string) []Step {
return s
}

// stepsCauseConsumerMisbehaviour forks a consumer chain in order to cause a ICS misbehaviour.
// The malicious validator behind the attack gets jailed and the consumer client freezed on the provider.
// stepsCauseConsumerMisbehaviour causes a ICS misbehaviour by forking a consumer chain.
func stepsCauseConsumerMisbehaviour(consumerName string) []Step {
consumerClientID := "07-tendermint-0"
forkRelayerConfig := "/root/.hermes/config_fork.toml"
return []Step{
{
// start a consumer chain's validator clone
// fork the consumer chain by cloning of its validator node
action: forkConsumerChainAction{
consumerChain: chainID(consumerName),
providerChain: chainID("provi"),
Expand All @@ -217,21 +216,10 @@ func stepsCauseConsumerMisbehaviour(consumerName string) []Step {
{
// start relayer to detect ICS misbehaviour
action: startRelayerAction{},
state: State{
// The consumer client shouldn't be frozen on the provider yet since
// no client update packet was sent by the fork yet
chainID("provi"): ChainState{
ClientsFrozenHeights: &map[string]clienttypes.Height{
"07-tendermint-0": {
RevisionNumber: 0,
RevisionHeight: 0,
},
},
},
},
state: State{},
},
{
// update the consumer client hosted on the provider
// update the consumer light client hosted on the provider
// using the consumer fork as the primary node
action: updateLightClientAction{
hostChain: chainID("provi"),
Expand All @@ -240,14 +228,17 @@ func stepsCauseConsumerMisbehaviour(consumerName string) []Step {
},
state: State{
chainID("provi"): ChainState{
// No jailing should have occurred since a consumer fork triggers a ICS misbehaviour
// that can't be handled by a provider chain, see HandleConsumerMisbehaviour() x/ccv/provider/keeper/misbehaviour.go.
ValPowers: &map[validatorID]uint{
validatorID("alice"): 0,
validatorID("alice"): 511,
validatorID("bob"): 20,
},
// The consumer light client shouldn't be frozen
ClientsFrozenHeights: &map[string]clienttypes.Height{
"07-tendermint-0": {
RevisionNumber: 0,
RevisionHeight: 1,
RevisionHeight: 0,
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions x/ccv/provider/keeper/misbehaviour.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
)

// HandleConsumerMisbehaviour checks if the given IBC misbehaviour corresponds to an equivocation light client attack
// and in this case jail and tombstone the Byzantine validators
// HandleConsumerMisbehaviour checks if the given IBC misbehaviour corresponds to an equivocation light client attack,
// and in this case, jails and tombstones the Byzantine validators
func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) error {
logger := k.Logger(ctx)

Expand Down

0 comments on commit c9a9f38

Please sign in to comment.