File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -282,8 +282,8 @@ impl VRFProof {
282
282
// |----------------------------|----------|---------------------------|
283
283
// Gamma point c scalar s scalar
284
284
let gamma_opt = CompressedEdwardsY :: from_slice ( & bytes[ 0 ..32 ] )
285
- . unwrap ( )
286
- . decompress ( ) ;
285
+ . ok ( )
286
+ . and_then ( |y| y . decompress ( ) ) ;
287
287
if gamma_opt. is_none ( ) {
288
288
test_debug ! ( "Invalid Gamma" ) ;
289
289
return None ;
@@ -299,8 +299,8 @@ impl VRFProof {
299
299
300
300
c_buf[ ..16 ] . copy_from_slice ( & bytes[ 32 ..( 16 + 32 ) ] ) ;
301
301
s_buf[ ..32 ] . copy_from_slice ( & bytes[ 48 ..( 32 + 48 ) ] ) ;
302
- let c = ed25519_Scalar:: from_canonical_bytes ( c_buf) . expect ( "Invalid C scalar" ) ;
303
- let s = ed25519_Scalar:: from_canonical_bytes ( s_buf) . expect ( "Invalid S scalar" ) ;
302
+ let c = ed25519_Scalar:: from_canonical_bytes ( c_buf) . ok ( ) ? ;
303
+ let s = ed25519_Scalar:: from_canonical_bytes ( s_buf) . ok ( ) ? ;
304
304
305
305
Some ( VRFProof { Gamma : gamma, c, s } )
306
306
}
@@ -388,7 +388,7 @@ impl VRF {
388
388
}
389
389
390
390
let y = CompressedEdwardsY :: from_slice ( & hasher. finalize ( ) [ 0 ..32 ] ) ;
391
- if let Some ( h) = y. unwrap ( ) . decompress ( ) {
391
+ if let Some ( h) = y. ok ( ) . and_then ( |y| y . decompress ( ) ) {
392
392
break h;
393
393
}
394
394
You can’t perform that action at this time.
0 commit comments