You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(network): narrow distinctness godoc and surface failing MSP in error
selectDistinctForMSPSet now returns ([]view.Identity, string, bool):
the string carries the first MSP ID whose pool was exhausted, so the
caller can include it in the error message. The error now reads:
MSP [Org1MSP] requires 2 distinct endorser(s) but only 1 configured
making operator configuration errors immediately diagnosable.
The SelectEndorsersForMSPSets godoc now says "distinct by identity
bytes" rather than just "distinct", to match what the code actually
enforces (byte equality) and distinguish it from the key-equality check
in endorserForThresholdRule.
The existing test for the unsatisfiable single-endorser case gains three
new assertions to pin the MSP name and counts in the error text.
All 14 subtests pass; make checks is clean on the affected files.
Signed-off-by: Akram Bitar <akram@il.ibm.com>
Signed-off-by: AkramBitar <akram@il.ibm.com>
Signed-off-by: Hayim.Shaul@ibm.com <hayimsha@fhe03.vpc.cloud9.ibm.com>
setFailures=append(setFailures, errors.Errorf("MSP [%s] requires %d distinct endorser(s) but only %d configured", failedMSP, required, available))
65
75
}
66
76
67
-
returnnil, errors.Join(errors.Errorf("no configured endorser covers any of the [%d] policy-satisfying MSP set(s) with a distinct endorser per required signer", len(candidates)),
77
+
returnnil, errors.Join(
78
+
errors.Errorf("no configured endorser covers any of the [%d] policy-satisfying MSP set(s) with a distinct endorser per required signer", len(candidates)),
79
+
errors.Join(setFailures...),
68
80
errors.Join(skipped...),
69
-
errors.Errorf("failed to resolve MSP"))
81
+
errors.Errorf("failed to resolve MSP"),
82
+
)
70
83
}
71
84
72
85
// selectDistinctForMSPSet fills one slot per entry of requiredMSPIDs with a random
73
86
// configured endorser of that MSP, never reusing an identity already selected for an
74
-
// earlier slot of the same set. It returns ok=false if some slot cannot be filled with a
75
-
// still-unused endorser, meaning the set is not coverable by distinct endorsers.
87
+
// earlier slot of the same set. It returns (selected, "", true) on success, or
88
+
// (nil, failedMSP, false) where failedMSP is the first MSP ID whose pool was exhausted,
89
+
// meaning the set is not coverable by distinct endorsers.
76
90
//
77
91
// A greedy per-slot pick is complete here: every slot requiring a given MSP ID draws from
78
92
// the same pool, so the only way this fails is that some MSP ID appears in requiredMSPIDs
79
-
// more times than that MSP has distinct configured endorsers - genuinely unsatisfiable
93
+
// more times than that MSP has distinct configured endorsers — genuinely unsatisfiable
80
94
// whatever the order of the picks. No backtracking is needed.
0 commit comments