-
Notifications
You must be signed in to change notification settings - Fork 135
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
refactor: update the E2E tests to work with Hermes relayer v1.6.0 #1278
Changes from 8 commits
0883d7a
fe310f5
f0d154e
612427a
64ae54c
9d6f746
0c68fb0
a3c4d36
c849cdb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import ( | |
"fmt" | ||
"log" | ||
"os/exec" | ||
"strconv" | ||
"time" | ||
) | ||
|
||
|
@@ -61,6 +62,7 @@ func (tr TestRun) forkConsumerChain(action forkConsumerChainAction, verbose bool | |
} | ||
|
||
type updateLightClientAction struct { | ||
chain chainID | ||
hostChain chainID | ||
relayerConfig string | ||
clientID string | ||
|
@@ -70,14 +72,17 @@ func (tr TestRun) updateLightClient( | |
action updateLightClientAction, | ||
verbose bool, | ||
) { | ||
// hermes clear packets ibc0 transfer channel-13 | ||
// retrieve a trusted height of the consumer light client | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also required since Hermes v1.6.0 |
||
trustedHeight := tr.getTrustedHeight(action.hostChain, action.clientID, 2) | ||
|
||
//#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. | ||
cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "hermes", | ||
"--config", action.relayerConfig, | ||
"update", | ||
"client", | ||
"--client", action.clientID, | ||
"--host-chain", string(action.hostChain), | ||
"--trusted-height", strconv.Itoa(int(trustedHeight.RevisionHeight)), | ||
) | ||
if verbose { | ||
log.Println("updateLightClientAction cmd:", cmd.String()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,43 +213,65 @@ func stepsCauseConsumerMisbehaviour(consumerName string) []Step { | |
}, | ||
state: State{}, | ||
}, | ||
// start relayer to detect IBC misbehaviour | ||
{ | ||
// start relayer to detect ICS misbehaviour | ||
action: startRelayerAction{}, | ||
state: State{}, | ||
}, | ||
// detect the ICS misbehaviour | ||
// and jail alice on the provider | ||
{ | ||
action: detectConsumerEvidenceAction{ | ||
chain: chainID("consu"), | ||
sainoe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
state: State{ | ||
chainID("provi"): ChainState{ | ||
ValPowers: &map[validatorID]uint{ | ||
validatorID("alice"): 511, | ||
validatorID("bob"): 20, | ||
}, | ||
}, | ||
chainID(consumerName): ChainState{ | ||
ValPowers: &map[validatorID]uint{ | ||
validatorID("alice"): 511, | ||
validatorID("bob"): 20, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
// update the fork consumer client to create a light client attack | ||
// which should trigger a ICS misbehaviour message | ||
action: updateLightClientAction{ | ||
chain: chainID("consu"), | ||
clientID: consumerClientID, | ||
hostChain: chainID("provi"), | ||
relayerConfig: forkRelayerConfig, // this relayer config uses the "forked" consumer | ||
clientID: consumerClientID, | ||
}, | ||
state: State{ | ||
chainID("provi"): ChainState{ | ||
// validator should be jailed on the provider | ||
// alice should be jailed on the provider | ||
ValPowers: &map[validatorID]uint{ | ||
validatorID("alice"): 0, | ||
validatorID("bob"): 20, | ||
}, | ||
// The consumer light client should not be frozen | ||
// The consumer light client should be frozen on the provider | ||
ClientsFrozenHeights: &map[string]clienttypes.Height{ | ||
"07-tendermint-0": { | ||
consumerClientID: { | ||
RevisionNumber: 0, | ||
RevisionHeight: 0, | ||
RevisionHeight: 1, | ||
}, | ||
}, | ||
}, | ||
chainID("consu"): ChainState{ | ||
// consumer should not have learned the jailing of alice | ||
// since its light client is frozen on the provider | ||
ValPowers: &map[validatorID]uint{ | ||
validatorID("alice"): 511, | ||
validatorID("bob"): 20, | ||
}, | ||
}, | ||
}, | ||
}, | ||
// we expect the consumer chain to be halted since the last VSC packet should | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's because the new version of Hermes freezes the client before the jailing occurs on the provider. Consequently, the VSC packet causing the consumer chain to halt is never sent. |
||
// have updated the alice validator power to 0. | ||
{ | ||
action: assertChainIsHaltedAction{ | ||
chain: chainID("consu"), | ||
}, | ||
state: State{}, | ||
}, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last Hermes version requires running the evidence cmd to detect consumer misbehaviours.