@@ -71,7 +71,7 @@ impl RegistrationChain {
7171 & self ,
7272 cip509 : Cip509 ,
7373 ) -> Option < Self > {
74- let latest_signing_pk = self . get_latest_signing_pk_for_role ( & RoleId :: Role0 ) ;
74+ let latest_signing_pk = self . get_latest_signing_pk_for_role ( RoleId :: Role0 ) ;
7575 let new_inner = if let Some ( ( signing_pk, _) ) = latest_signing_pk {
7676 self . inner . update_stateless ( cip509, signing_pk) ?
7777 } else {
@@ -192,7 +192,7 @@ impl RegistrationChain {
192192 #[ must_use]
193193 pub fn get_latest_signing_pk_for_role (
194194 & self ,
195- role : & RoleId ,
195+ role : RoleId ,
196196 ) -> Option < ( VerifyingKey , KeyRotation ) > {
197197 self . inner . get_latest_signing_pk_for_role ( role)
198198 }
@@ -202,7 +202,7 @@ impl RegistrationChain {
202202 #[ must_use]
203203 pub fn get_latest_encryption_pk_for_role (
204204 & self ,
205- role : & RoleId ,
205+ role : RoleId ,
206206 ) -> Option < ( VerifyingKey , KeyRotation ) > {
207207 self . inner . get_latest_encryption_pk_for_role ( role)
208208 }
@@ -543,13 +543,13 @@ impl RegistrationChainInner {
543543 report. functional_validation (
544544 & format ! ( "{address} stake addresses is already used" ) ,
545545 "It isn't allowed to use same stake address in multiple registration chains" ,
546- ) ;
546+ ) ;
547547 } ,
548548 }
549549 }
550550
551551 // Try to add a new registration to the chain.
552- let ( signing_pk, _) = self . get_latest_signing_pk_for_role ( & RoleId :: Role0 ) ?;
552+ let ( signing_pk, _) = self . get_latest_signing_pk_for_role ( RoleId :: Role0 ) ?;
553553 let new_chain = chain. inner . update_stateless ( reg. clone ( ) , signing_pk) ?;
554554
555555 // Check that new public keys aren't used by other chains.
@@ -602,8 +602,8 @@ impl RegistrationChainInner {
602602 // If an address is used in existing chain then a new chain must have different role
603603 // 0 signing key.
604604 let previous_chain = provider. chain ( id. clone ( ) ) . await . ok ( ) ??;
605- if previous_chain. get_latest_signing_pk_for_role ( & RoleId :: Role0 )
606- == new_chain. get_latest_signing_pk_for_role ( & RoleId :: Role0 )
605+ if previous_chain. get_latest_signing_pk_for_role ( RoleId :: Role0 )
606+ == new_chain. get_latest_signing_pk_for_role ( RoleId :: Role0 )
607607 {
608608 report. functional_validation (
609609 & format ! ( "A new registration ({catalyst_id}) uses the same public key as the previous one ({})" ,
@@ -661,15 +661,15 @@ impl RegistrationChainInner {
661661
662662 let mut result = true ;
663663 for role in roles {
664- if let Some ( ( key, _) ) = self . get_latest_signing_pk_for_role ( role) {
664+ if let Some ( ( key, _) ) = self . get_latest_signing_pk_for_role ( * role) {
665665 if let Some ( previous) = provider. catalyst_id_from_public_key ( key) . await ? {
666666 if previous != catalyst_id {
667667 report. functional_validation (
668668 & format ! ( "An update to {catalyst_id} registration chain uses the same public key ({key:?}) as {previous} chain" ) ,
669669 "It isn't allowed to use role 0 signing (certificate subject public) key in different chains" ,
670670 ) ;
671671
672- result = false
672+ result = false ;
673673 }
674674 }
675675 }
@@ -683,9 +683,9 @@ impl RegistrationChainInner {
683683 #[ must_use]
684684 pub fn get_latest_signing_pk_for_role (
685685 & self ,
686- role : & RoleId ,
686+ role : RoleId ,
687687 ) -> Option < ( VerifyingKey , KeyRotation ) > {
688- self . role_data_record . get ( role) . and_then ( |rdr| {
688+ self . role_data_record . get ( & role) . and_then ( |rdr| {
689689 rdr. signing_keys ( ) . last ( ) . and_then ( |key| {
690690 let rotation = KeyRotation :: from_latest_rotation ( rdr. signing_keys ( ) ) ;
691691
@@ -699,9 +699,9 @@ impl RegistrationChainInner {
699699 #[ must_use]
700700 pub fn get_latest_encryption_pk_for_role (
701701 & self ,
702- role : & RoleId ,
702+ role : RoleId ,
703703 ) -> Option < ( VerifyingKey , KeyRotation ) > {
704- self . role_data_record . get ( role) . and_then ( |rdr| {
704+ self . role_data_record . get ( & role) . and_then ( |rdr| {
705705 rdr. encryption_keys ( ) . last ( ) . and_then ( |key| {
706706 let rotation = KeyRotation :: from_latest_rotation ( rdr. encryption_keys ( ) ) ;
707707
@@ -833,7 +833,7 @@ mod test {
833833 assert_eq ! ( role_0_data. extended_data( ) . len( ) , 2 ) ;
834834
835835 let ( _k, r) = update
836- . get_latest_signing_pk_for_role ( & RoleId :: Role0 )
836+ . get_latest_signing_pk_for_role ( RoleId :: Role0 )
837837 . unwrap ( ) ;
838838 assert_eq ! ( r, KeyRotation :: from( 1 ) ) ;
839839 assert ! ( update
0 commit comments