-
Notifications
You must be signed in to change notification settings - Fork 136
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
feat: add e2e tests for ICS misbehaviour #1118
Merged
sainoe
merged 13 commits into
sainoe/ics-misbehaviour-handling
from
sainoe/ics-misb-e2e
Jul 31, 2023
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3114807
remove unwanted changes
sainoe fffeb07
fix hermes config with assigned key
sainoe 61d8012
revert unwanted changes
sainoe a11ee29
revert local setup
sainoe e79af1e
remove log file
sainoe 0a6cd87
typo
sainoe 9ad0721
update doc
sainoe e0de36d
update ICS misbehaviour test
sainoe 1b718be
update ICS misbehaviour test
sainoe 4357efa
revert mixed commits
sainoe 12728f9
add doc
sainoe 3002fe7
lint
sainoe ec2c60c
Merge branch 'sainoe/ics-misbehaviour-handling' into sainoe/ics-misb-e2e
sainoe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
maybe call it
isConsumer
or something like that