@@ -6,7 +6,7 @@ use kimchi::mina_curves::pasta::{Fp, PallasParameters};
66use kimchi:: verifier_index:: VerifierIndex ;
77use lazy_static:: lazy_static;
88use mina_p2p_messages:: binprot:: BinProtRead ;
9- use mina_p2p_messages:: v2:: { MinaBaseProofStableV2 , StateHash } ;
9+ use mina_p2p_messages:: v2:: MinaBaseProofStableV2 ;
1010use mina_tree:: proofs:: verification:: verify_block;
1111use mina_tree:: verifier:: get_srs;
1212use verifier_index:: deserialize_blockchain_vk;
@@ -35,10 +35,10 @@ pub extern "C" fn verify_protocol_state_proof_ffi(
3535 } else {
3636 return false ;
3737 } ;
38- let protocol_state_hash_base58 = if let Ok ( protocol_state_hash_base58 ) =
38+ let protocol_state_hash_dec = if let Ok ( protocol_state_hash_dec ) =
3939 std:: str:: from_utf8 ( & public_input_bytes[ ..public_input_len] )
4040 {
41- protocol_state_hash_base58
41+ protocol_state_hash_dec
4242 } else {
4343 return false ;
4444 } ;
@@ -50,7 +50,7 @@ pub extern "C" fn verify_protocol_state_proof_ffi(
5050 return false ;
5151 } ;
5252 let protocol_state_hash =
53- if let Ok ( protocol_state_hash) = parse_protocol_state_hash ( protocol_state_hash_base58 ) {
53+ if let Ok ( protocol_state_hash) = parse_protocol_state_hash ( protocol_state_hash_dec ) {
5454 protocol_state_hash
5555 } else {
5656 return false ;
@@ -73,18 +73,16 @@ pub fn parse_protocol_state_proof(
7373 protocol_state_proof_base64 : & str ,
7474) -> Result < MinaBaseProofStableV2 , String > {
7575 let protocol_state_proof_binprot = BASE64_URL_SAFE
76- . decode ( protocol_state_proof_base64. trim_end ( ) )
76+ . decode ( protocol_state_proof_base64. trim_matches ( char :: from ( 0 ) ) )
7777 . map_err ( |err| err. to_string ( ) ) ?;
7878
7979 MinaBaseProofStableV2 :: binprot_read ( & mut protocol_state_proof_binprot. as_slice ( ) )
8080 . map_err ( |err| err. to_string ( ) )
8181}
8282
83- pub fn parse_protocol_state_hash ( protocol_state_hash_base58 : & str ) -> Result < Fp , String > {
84- StateHash :: from_str ( protocol_state_hash_base58. trim_end ( ) )
85- . map_err ( |err| err. to_string ( ) ) ?
86- . to_fp ( )
87- . map_err ( |err| err. to_string ( ) )
83+ pub fn parse_protocol_state_hash ( protocol_state_hash_dec : & str ) -> Result < Fp , String > {
84+ Fp :: from_str ( protocol_state_hash_dec. trim_matches ( char:: from ( 0 ) ) )
85+ . map_err ( |_| "error while deserializing protocol state hash" . to_string ( ) )
8886}
8987
9088#[ cfg( test) ]
0 commit comments