Skip to content

Commit 90bf14e

Browse files
Apply suggestions from code review
Co-authored-by: Jean-Philippe Raynaud <jp.raynaud@gmail.com>
1 parent a1ee8c1 commit 90bf14e

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

mithril-common/src/crypto_helper/codec/binary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ mod binary_mithril_stm {
6161

6262
impl TryFromBytes for SingleSignature {
6363
fn try_from_bytes(bytes: &[u8]) -> StdResult<Self> {
64-
Self::from_bytes::<D>(bytes).map_err(|e| anyhow!(e))
64+
Self::from_bytes::<D>(bytes)
6565
}
6666
}
6767

mithril-stm/README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,21 @@ match msig {
136136
println!("Aggregate ok");
137137
assert!(aggr.verify(&msg, &clerk.compute_aggregate_verification_key(), &params).is_ok());
138138
}
139-
Err(error) => assert!(
140-
matches!(
141-
error.downcast_ref::<AggregationError>(),
142-
Some(AggregationError::NotEnoughSignatures { .. })
143-
| Some(AggregationError::UsizeConversionInvalid)
144-
| Some(AggregationError::UnsupportedProofSystem { .. })
145-
),
146-
"Unexpected error: {error}"
147-
),
139+
Err(error) => match error.downcast_ref::<AggregationError>() {
140+
Some(AggregationError::NotEnoughSignatures(n, k)) => {
141+
println!("Not enough signatures");
142+
assert!(n < params.k && k == params.k)
143+
},
144+
Some(AggregationError::UsizeConversionInvalid) => {
145+
println!("Invalid usize conversion");
146+
},
147+
Some(AggregationError::UnsupportedProofSystem(aggregate_signature_type)) => {
148+
println!("Unsupported proof system: {:?}", aggregate_signature_type);
149+
},
150+
None => {
151+
println!("Unexpected error during aggregation: {:?}", error);
152+
}
153+
},
148154
}
149155
```
150156

mithril-stm/src/aggregate_signature/basic_verifier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl BasicVerifier {
247247
let (sigs, vks) = Self::collect_signatures_verification_keys(&unique_sigs);
248248

249249
BlsSignature::verify_aggregate(msg.to_vec().as_slice(), &vks, &sigs)
250-
.with_context(|| "Basic verifier failed in multisignature verification.")?;
250+
.with_context(|| "Basic verifier failed during BLS aggregate signature verification.")?;
251251

252252
Ok(())
253253
}

0 commit comments

Comments
 (0)