@@ -94,14 +94,18 @@ impl FinalityCertificate {
9494/// # Returns 
9595/// A Result containing the new `FinalityCertificate` if successful 
9696pub  fn  new ( power_delta :  PowerTableDiff ,  justification :  & Justification )  -> Result < Self >  { 
97-         if  justification. vote . step  != Phase :: Decide  { 
98-             return  Err ( CertsError :: InvalidJustification ( 
99-                 justification. vote . step . to_string ( ) , 
100-             ) ) ; 
97+         if  justification. vote . phase  != Phase :: Decide  { 
98+             return  Err ( CertsError :: InvalidJustificationVotePhase  { 
99+                 expected :  Phase :: Decide , 
100+                 actual :  justification. vote . phase , 
101+             } ) ; 
101102        } 
102103
103104        if  justification. vote . round  != 0  { 
104-             return  Err ( CertsError :: InvalidRound ( justification. vote . round ) ) ; 
105+             return  Err ( CertsError :: InvalidRound  { 
106+                 expected :  0 , 
107+                 actual :  justification. vote . round , 
108+             } ) ; 
105109        } 
106110
107111        if  justification. vote . value . is_empty ( )  { 
@@ -295,7 +299,7 @@ pub fn validate_finality_certificates<'a>(
295299        if  cert. gpbft_instance  != next_instance { 
296300            return  Err ( CertsError :: InstanceMismatch  { 
297301                expected :  next_instance, 
298-                 found :  cert. gpbft_instance , 
302+                 actual :  cert. gpbft_instance , 
299303            } ) ; 
300304        } 
301305
@@ -326,8 +330,8 @@ pub fn validate_finality_certificates<'a>(
326330        if  cert. supplemental_data . power_table  != power_table_cid { 
327331            return  Err ( CertsError :: IncorrectPowerDiff  { 
328332                instance :  cert. gpbft_instance , 
329-                 expected :  cert. supplemental_data . power_table . to_string ( ) , 
330-                 got :  power_table_cid. to_string ( ) , 
333+                 expected :  cert. supplemental_data . power_table . into ( ) , 
334+                 actual :  power_table_cid. into ( ) , 
331335            } ) ; 
332336        } 
333337
@@ -386,7 +390,7 @@ mod tests {
386390            vote :  Payload  { 
387391                instance :  1 , 
388392                round :  0 , 
389-                 step, 
393+                 phase :   step, 
390394                supplemental_data :  SupplementalData  { 
391395                    commitments :  keccak_hash:: H256 :: zero ( ) , 
392396                    power_table :  Cid :: from_str ( cid) . unwrap ( ) , 
@@ -447,7 +451,10 @@ mod tests {
447451        assert ! ( result. is_err( ) ) ; 
448452        assert_eq ! ( 
449453            result. unwrap_err( ) , 
450-             CertsError :: InvalidJustification ( Phase :: Commit . to_string( ) ) 
454+             CertsError :: InvalidJustificationVotePhase  { 
455+                 expected:  Phase :: Decide , 
456+                 actual:  Phase :: Commit 
457+             } 
451458        ) ; 
452459    } 
453460
@@ -460,7 +467,13 @@ mod tests {
460467
461468        let  result = FinalityCertificate :: new ( power_delta,  & justification) ; 
462469        assert ! ( result. is_err( ) ) ; 
463-         assert_eq ! ( result. unwrap_err( ) ,  CertsError :: InvalidRound ( 1 ) ) ; 
470+         assert_eq ! ( 
471+             result. unwrap_err( ) , 
472+             CertsError :: InvalidRound  { 
473+                 expected:  0 , 
474+                 actual:  1 
475+             } 
476+         ) ; 
464477    } 
465478
466479    // It makes no sense that ECChain can be empty. Perhaps this warrants a discussion. 
0 commit comments