|
2 | 2 |
|
3 | 3 | //! Malleability-related Type properties |
4 | 4 |
|
5 | | -use super::ErrorKind; |
6 | | - |
7 | 5 | /// Whether the fragment has a dissatisfaction, and if so, whether |
8 | 6 | /// it is unique. Affects both correctness and malleability-freeness, |
9 | 7 | /// since we assume 3rd parties are able to produce dissatisfactions |
@@ -280,27 +278,27 @@ impl Malleability { |
280 | 278 |
|
281 | 279 | /// Constructor for the malleabilitiy properties of the `thresh` fragment. |
282 | 280 | // Cannot be constfn because it takes a closure. |
283 | | - pub fn threshold<S>(k: usize, n: usize, mut sub_ck: S) -> Result<Self, ErrorKind> |
| 281 | + pub fn threshold<S>(k: usize, n: usize, mut sub_ck: S) -> Self |
284 | 282 | where |
285 | | - S: FnMut(usize) -> Result<Self, ErrorKind>, |
| 283 | + S: FnMut(usize) -> Self, |
286 | 284 | { |
287 | 285 | let mut safe_count = 0; |
288 | 286 | let mut all_are_dissat_unique = true; |
289 | 287 | let mut all_are_non_malleable = true; |
290 | 288 | for i in 0..n { |
291 | | - let subtype = sub_ck(i)?; |
| 289 | + let subtype = sub_ck(i); |
292 | 290 | safe_count += usize::from(subtype.safe); |
293 | 291 | all_are_dissat_unique &= subtype.dissat == Dissat::Unique; |
294 | 292 | all_are_non_malleable &= subtype.non_malleable; |
295 | 293 | } |
296 | | - Ok(Malleability { |
| 294 | + Malleability { |
297 | 295 | dissat: if all_are_dissat_unique && safe_count == n { |
298 | 296 | Dissat::Unique |
299 | 297 | } else { |
300 | 298 | Dissat::Unknown |
301 | 299 | }, |
302 | 300 | safe: safe_count > n - k, |
303 | 301 | non_malleable: all_are_non_malleable && safe_count >= n - k && all_are_dissat_unique, |
304 | | - }) |
| 302 | + } |
305 | 303 | } |
306 | 304 | } |
0 commit comments