mirror of
https://github.com/luxfi/netrunner.git
synced 2026-07-27 00:04:23 +00:00
address PR comments
This commit is contained in:
+587
-588
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -171,7 +171,7 @@ service ControlService {
|
||||
}
|
||||
|
||||
message SubnetParticipants {
|
||||
repeated string subnet_participants = 1;
|
||||
repeated string node_names = 1;
|
||||
}
|
||||
|
||||
message ClusterInfo {
|
||||
@@ -189,7 +189,7 @@ message ClusterInfo {
|
||||
// The map of blockchain IDs in "ids.ID" format to its blockchain information.
|
||||
map<string, CustomChainInfo> custom_chains = 8;
|
||||
repeated string subnets = 9;
|
||||
map<string, SubnetParticipants> subnetParticipants = 10;
|
||||
map<string, SubnetParticipants> subnet_participants = 10;
|
||||
}
|
||||
|
||||
message CustomChainInfo {
|
||||
|
||||
+8
-3
@@ -389,11 +389,16 @@ func (lc *localNetwork) updateSubnetInfo(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var nodeIDList []string
|
||||
var nodeNameList []string
|
||||
|
||||
for _, node := range vdrs {
|
||||
nodeIDList = append(nodeIDList, node.NodeID.String())
|
||||
for nodeName, nodeInfo := range lc.nodeInfos {
|
||||
if nodeInfo.Id == node.NodeID.String() {
|
||||
nodeNameList = append(nodeNameList, nodeName)
|
||||
}
|
||||
}
|
||||
}
|
||||
lc.subnetParticipants[subnetID] = nodeIDList
|
||||
lc.subnetParticipants[subnetID] = nodeNameList
|
||||
}
|
||||
|
||||
for chainID, chainInfo := range lc.customChainIDToInfo {
|
||||
|
||||
+1
-1
@@ -397,7 +397,7 @@ func (s *server) updateClusterInfo() {
|
||||
s.clusterInfo.Subnets = s.network.subnets
|
||||
s.clusterInfo.SubnetParticipants = make(map[string]*rpcpb.SubnetParticipants)
|
||||
for subnetID, nodes := range s.network.subnetParticipants {
|
||||
s.clusterInfo.SubnetParticipants[subnetID] = &rpcpb.SubnetParticipants{SubnetParticipants: nodes}
|
||||
s.clusterInfo.SubnetParticipants[subnetID] = &rpcpb.SubnetParticipants{NodeNames: nodes}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-13
@@ -104,22 +104,13 @@ func VerifySubnetHasCorrectParticipants(
|
||||
subnetID string,
|
||||
) bool {
|
||||
if cluster != nil {
|
||||
var nodeIdsList []string
|
||||
// Get list of node IDs for nodes added as validator to subnet as configured in subnet participants specs
|
||||
for nodeName, nodeInfo := range cluster.NodeInfos {
|
||||
for _, subnetValidatorNodeName := range subnetParticipants {
|
||||
if nodeName == subnetValidatorNodeName {
|
||||
nodeIdsList = append(nodeIdsList, nodeInfo.Id)
|
||||
}
|
||||
}
|
||||
}
|
||||
participatingNodeIds := cluster.SubnetParticipants[subnetID].GetSubnetParticipants()
|
||||
participatingNodeNames := cluster.SubnetParticipants[subnetID].GetNodeNames()
|
||||
var nodeIsInList bool
|
||||
// Check that all subnet validators are equal to the node IDs added as participant in subnet creation
|
||||
for _, nodeID := range nodeIdsList {
|
||||
for _, node := range subnetParticipants {
|
||||
nodeIsInList = false
|
||||
for _, subnetValidator := range participatingNodeIds {
|
||||
if nodeID == subnetValidator {
|
||||
for _, subnetValidator := range participatingNodeNames {
|
||||
if subnetValidator == node {
|
||||
nodeIsInList = true
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user