@@ -428,13 +428,18 @@ fn validate_role_0(
428428
429429 let mut catalyst_id = None ;
430430 let network = "cardano" ;
431+ // <https://input-output-hk.github.io/catalyst-libs/architecture/08_concepts/rbac_id_uri/catalyst-id-uri/#authority>
432+ let subnet = match subnet {
433+ Network :: Mainnet => None ,
434+ subnet => Some ( subnet. to_string ( ) ) ,
435+ } ;
431436
432437 match signing_key. local_ref {
433438 LocalRefInt :: X509Certs => {
434439 match metadata. x509_certs . first ( ) {
435440 Some ( X509DerCert :: X509Cert ( cert) ) => {
436441 // All good: role 0 references a valid X509 certificate.
437- catalyst_id = x509_cert_key ( cert, context, report) . map ( |k| CatalystId :: new ( network, Some ( & subnet. to_string ( ) ) , k) ) ;
442+ catalyst_id = x509_cert_key ( cert, context, report) . map ( |k| CatalystId :: new ( network, subnet. as_deref ( ) , k) ) ;
438443 }
439444 Some ( c) => report. other ( & format ! ( "Invalid X509 certificate value ({c:?}) for role 0 ({role:?})" ) , context) ,
440445 None => report. other ( "Role 0 reference X509 certificate at index 0, but there is no such certificate" , context) ,
@@ -444,7 +449,7 @@ fn validate_role_0(
444449 match metadata. c509_certs . first ( ) {
445450 Some ( C509Cert :: C509Certificate ( cert) ) => {
446451 // All good: role 0 references a valid C509 certificate.
447- catalyst_id = c509_cert_key ( cert, context, report) . map ( |k| CatalystId :: new ( network, Some ( & subnet. to_string ( ) ) , k) ) ;
452+ catalyst_id = c509_cert_key ( cert, context, report) . map ( |k| CatalystId :: new ( network, subnet. as_deref ( ) , k) ) ;
448453 }
449454 Some ( c) => report. other ( & format ! ( "Invalid C509 certificate value ({c:?}) for role 0 ({role:?})" ) , context) ,
450455 None => report. other ( "Role 0 reference C509 certificate at index 0, but there is no such certificate" , context) ,
0 commit comments