-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add e2e tests for ICS misbehaviour (#1118)
* remove unwanted changes * fix hermes config with assigned key * revert unwanted changes * revert local setup * remove log file * typo * update doc * update ICS misbehaviour test * update ICS misbehaviour test * revert mixed commits * add doc * lint
- Loading branch information
Showing
14 changed files
with
659 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package main | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
"log" | ||
"os/exec" | ||
"time" | ||
) | ||
|
||
type forkConsumerChainAction struct { | ||
consumerChain chainID | ||
providerChain chainID | ||
validator validatorID | ||
relayerConfig string | ||
} | ||
|
||
func (tr TestRun) forkConsumerChain(action forkConsumerChainAction, verbose bool) { | ||
valCfg := tr.validatorConfigs[action.validator] | ||
|
||
//#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. | ||
configureNodeCmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "/bin/bash", | ||
"/testnet-scripts/fork-consumer.sh", tr.chainConfigs[action.consumerChain].binaryName, | ||
string(action.validator), string(action.consumerChain), | ||
tr.chainConfigs[action.consumerChain].ipPrefix, | ||
tr.chainConfigs[action.providerChain].ipPrefix, | ||
valCfg.mnemonic, | ||
action.relayerConfig, | ||
) | ||
|
||
if verbose { | ||
fmt.Println("forkConsumerChain - reconfigure node cmd:", configureNodeCmd.String()) | ||
} | ||
|
||
cmdReader, err := configureNodeCmd.StdoutPipe() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
configureNodeCmd.Stderr = configureNodeCmd.Stdout | ||
|
||
if err := configureNodeCmd.Start(); err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
scanner := bufio.NewScanner(cmdReader) | ||
|
||
for scanner.Scan() { | ||
out := scanner.Text() | ||
if verbose { | ||
fmt.Println("fork consumer validator : " + out) | ||
} | ||
if out == done { | ||
break | ||
} | ||
} | ||
if err := scanner.Err(); err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
time.Sleep(5 * time.Second) | ||
} | ||
|
||
type updateLightClientAction struct { | ||
hostChain chainID | ||
relayerConfig string | ||
clientID string | ||
} | ||
|
||
func (tr TestRun) updateLightClient( | ||
action updateLightClientAction, | ||
verbose bool, | ||
) { | ||
// hermes clear packets ibc0 transfer channel-13 | ||
//#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), | ||
) | ||
if verbose { | ||
log.Println("updateLightClientAction cmd:", cmd.String()) | ||
} | ||
|
||
bz, err := cmd.CombinedOutput() | ||
if err != nil { | ||
log.Fatal(err, "\n", string(bz)) | ||
} | ||
|
||
tr.waitBlocks(action.hostChain, 5, 30*time.Second) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.