tests: add multi validators tests setup#51
Conversation
Resolve conflicts by keeping the multi-validator test code from julien/slashing-multi (the full individual validator downtime test) over the TODO placeholder from main's squash-merged PR #39.
| $BINARY genesis gentx val "1000000000${DENOM}" --home "$HOME_DIR" --keyring-backend test --chain-id "$CHAIN_ID" | ||
|
|
||
| # Create gentx for val2 | ||
| $BINARY genesis gentx val2 "1000000000${DENOM}" --home "$VAL2_HOME_DIR" --keyring-backend test --chain-id "$CHAIN_ID" |
There was a problem hiding this comment.
If val2 becomes offline, it should have less than 2/3 of the VP. Here looks like it has 50%.
| // Start provider val1 (second validator node) connecting to val0 as persistent peer | ||
| s.T().Log("starting provider val1 container...") | ||
|
|
||
| val0P2PAddr := fmt.Sprintf("%s:26656", val0Resource.Container.Name) |
There was a problem hiding this comment.
There's a leading / so you should use val0Resource.Container.Name[1:].
In addition apparently --persistent-peers requires a nodeID, so the correct format should be:
fmt.Sprintf("%s@%s:26656", nodeID, val0Resource.Container.Name[1:])| s.Require().GreaterOrEqual(len(s.consumerValRes), 2, | ||
| "need at least 2 consumer validator containers for individual downtime test") | ||
|
|
||
| valoperAddr, tokensBefore := s.getProviderValidatorTokens() |
There was a problem hiding this comment.
Considering that you want select the one-of-two validators that has less than 2/3 of VP, this function should be changed to something more accurate. It might return the wrong validator.
| "26657/tcp": {{HostIP: "", HostPort: "26658"}}, | ||
| "9090/tcp": {{HostIP: "", HostPort: "9091"}}, | ||
| "1317/tcp": {{HostIP: "", HostPort: "1318"}}, | ||
| "26656/tcp": {{HostIP: "", HostPort: "26658"}}, |
There was a problem hiding this comment.
Port collision with line 371.
| // Create consumer val1 (second validator node with val2's keys) | ||
| s.T().Log("setting up consumer val1 node...") | ||
|
|
||
| consumerVal2Dir, err := os.MkdirTemp("", "vaas-e2e-consumer-val2-") |
There was a problem hiding this comment.
Can we remove the double naming val1/val2 ? This is confusing.
| s.consumerValRes = append(s.consumerValRes, consumerVal1Resource) | ||
| s.T().Logf("consumer val1 container started: %s", consumerVal1Resource.Container.ID[:12]) | ||
|
|
||
| time.Sleep(5 * time.Second) |
There was a problem hiding this comment.
We should test val1 liveness instead of sleep.
ref: #39 (comment)