Skip to content

Commit

Permalink
new logic to form densly connected networks
Browse files Browse the repository at this point in the history
  • Loading branch information
AnieeG committed Jul 8, 2024
1 parent d796990 commit 7068a5e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ DeltaReconcile = '5s'

[CCIP.Groups]
[CCIP.Groups.load]
DenselyConnectedNetworkChainIds = ['90000001', '90000002', '1337']
KeepEnvAlive = true
NoOfCommitNodes = 16
PhaseTimeout = '40m'
Expand Down
16 changes: 10 additions & 6 deletions integration-tests/ccip-tests/testsetups/ccip.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,28 +304,32 @@ func (c *CCIPTestConfig) SetNetworkPairs(lggr zerolog.Logger) error {
var covered map[string]struct{}
// if densely connected networks are provided, choose all the network pairs containing the networks mentioned in the list for DenselyConnectedNetworkChainIds
if c.TestGroupInput.DenselyConnectedNetworkChainIds != nil && len(c.TestGroupInput.DenselyConnectedNetworkChainIds) > 0 {
var networkPairForDenselyConnected []NetworkPair
denselyConnectedNetworks := map[string]struct{}{}
for _, n := range c.TestGroupInput.DenselyConnectedNetworkChainIds {
denselyConnectedNetworks[n] = struct{}{}
}
for _, pair := range c.NetworkPairs {
if _, exists := denselyConnectedNetworks[pair.ChainClientA.GetChainID().String()]; exists {
networkPairForDenselyConnected = append(networkPairForDenselyConnected, pair)
newNetworkPairs = append(newNetworkPairs, pair)
covered[pair.NetworkA.Name] = struct{}{}

Check failure on line 314 in integration-tests/ccip-tests/testsetups/ccip.go

View workflow job for this annotation

GitHub Actions / Build and Lint integration-tests

SA5000: assignment to nil map (staticcheck)
}
}
newNetworkPairs = networkPairForDenselyConnected
}
// shuffle the network pairs, we want to randomly distribute the network pairs among all available networks
rand.Shuffle(len(c.NetworkPairs), func(i, j int) {
c.NetworkPairs[i], c.NetworkPairs[j] = c.NetworkPairs[j], c.NetworkPairs[i]
})
// now add the remaining network pairs by randomly selecting the network pairs
for i := len(newNetworkPairs); i < c.TestGroupInput.MaxNoOfLanes; i++ {
// now add the remaining network pairs by skipping the already covered networks
// and adding the remaining pair from the shuffled list
i := len(newNetworkPairs)
j := 0
for i < c.TestGroupInput.MaxNoOfLanes {
// if the network is already covered, skip it
if _, exists := covered[c.NetworkPairs[i].NetworkA.Name]; !exists {
if _, exists := covered[c.NetworkPairs[j].NetworkA.Name]; !exists {
newNetworkPairs = append(newNetworkPairs, c.NetworkPairs[i])
i++
}
j++
}
c.NetworkPairs = newNetworkPairs
}
Expand Down

0 comments on commit 7068a5e

Please sign in to comment.