@@ -38,17 +38,17 @@ impl Hasher for Blake2sHasher {
3838 Ok ( <Self :: Function as HashFunction < Self :: Domain > >:: hash ( data) )
3939 }
4040
41- fn sloth_encode ( key : & Self :: Domain , ciphertext : & Self :: Domain ) -> Self :: Domain {
41+ fn sloth_encode ( key : & Self :: Domain , ciphertext : & Self :: Domain ) -> Result < Self :: Domain > {
4242 // TODO: validate this is how sloth should work in this case
4343 let k = ( * key) . into ( ) ;
4444 let c = ( * ciphertext) . into ( ) ;
4545
46- sloth:: encode :: < Bls12 > ( & k, & c) . into ( )
46+ Ok ( sloth:: encode :: < Bls12 > ( & k, & c) . into ( ) )
4747 }
4848
49- fn sloth_decode ( key : & Self :: Domain , ciphertext : & Self :: Domain ) -> Self :: Domain {
49+ fn sloth_decode ( key : & Self :: Domain , ciphertext : & Self :: Domain ) -> Result < Self :: Domain > {
5050 // TODO: validate this is how sloth should work in this case
51- sloth:: decode :: < Bls12 > ( & ( * key) . into ( ) , & ( * ciphertext) . into ( ) ) . into ( )
51+ Ok ( sloth:: decode :: < Bls12 > ( & ( * key) . into ( ) , & ( * ciphertext) . into ( ) ) . into ( ) )
5252 }
5353}
5454
@@ -247,8 +247,8 @@ impl HashFunction<Blake2sDomain> for Blake2sFunction {
247247 Some ( _) => {
248248 let bits = alloc_bits
249249 . iter ( )
250- . map ( |v| v. get_value ( ) . unwrap ( ) )
251- . collect :: < Vec < bool > > ( ) ;
250+ . map ( |v| v. get_value ( ) . ok_or ( SynthesisError :: AssignmentMissing ) )
251+ . collect :: < std :: result :: Result < Vec < bool > , SynthesisError > > ( ) ? ;
252252 // TODO: figure out if we can avoid this
253253 let frs = multipack:: compute_multipacking :: < E > ( & bits) ;
254254 Ok ( frs[ 0 ] )
0 commit comments