File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
post-compute/src/compute/utils Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ use sha256::{Sha256Digest, digest};
44pub fn concatenate_and_hash ( hexa_strings : & [ & str ] ) -> String {
55 let mut hasher = Keccak256 :: default ( ) ;
66 for hexa_string in hexa_strings {
7- println ! ( "value {hexa_string}" ) ;
87 hasher. update ( hex_string_to_byte_array ( hexa_string) ) ;
98 }
109 format ! ( "0x{:x}" , hasher. finalize( ) )
@@ -19,15 +18,19 @@ pub fn hex_string_to_byte_array(input: &str) -> Vec<u8> {
1918
2019 let mut data: Vec < u8 > = vec ! [ ] ;
2120 let start_idx = if len % 2 != 0 {
22- let byte = u8:: from_str_radix ( & clean_input[ 0 ..1 ] , 16 ) . expect ( "" ) ;
21+ let byte =
22+ u8:: from_str_radix ( & clean_input[ 0 ..1 ] , 16 ) . expect ( "Invalid hex digit in input string" ) ;
2323 data. push ( byte) ;
2424 1
2525 } else {
2626 0
2727 } ;
2828
2929 for i in ( start_idx..len) . step_by ( 2 ) {
30- data. push ( u8:: from_str_radix ( & clean_input[ i..i + 2 ] , 16 ) . expect ( "" ) ) ;
30+ data. push (
31+ u8:: from_str_radix ( & clean_input[ i..i + 2 ] , 16 )
32+ . expect ( "Invalid hex digit in input string" ) ,
33+ ) ;
3134 }
3235
3336 data
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ pub fn sign_enclave_challenge(
4545) -> Result < String , ReplicateStatusCause > {
4646 let signer: PrivateKeySigner = enclave_challenge_private_key
4747 . parse :: < PrivateKeySigner > ( )
48- . map_err ( |_| ReplicateStatusCause :: PreComputeWorkerAddressMissing ) ?;
48+ . map_err ( |_| ReplicateStatusCause :: PreComputeTeeChallengePrivateKeyMissing ) ?;
4949
5050 let signature: Signature = signer
5151 . sign_message_sync ( & hex_string_to_byte_array ( message_hash) )
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ use sha256::digest;
44pub fn concatenate_and_hash ( hexa_strings : & [ & str ] ) -> String {
55 let mut hasher = Keccak256 :: default ( ) ;
66 for hexa_string in hexa_strings {
7- println ! ( "value {hexa_string}" ) ;
87 hasher. update ( hex_string_to_byte_array ( hexa_string) ) ;
98 }
109 format ! ( "0x{:x}" , hasher. finalize( ) )
You can’t perform that action at this time.
0 commit comments