@@ -428,13 +428,18 @@ fn validate_role_0(
428
428
429
429
let mut catalyst_id = None ;
430
430
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
+ } ;
431
436
432
437
match signing_key. local_ref {
433
438
LocalRefInt :: X509Certs => {
434
439
match metadata. x509_certs . first ( ) {
435
440
Some ( X509DerCert :: X509Cert ( cert) ) => {
436
441
// 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) ) ;
438
443
}
439
444
Some ( c) => report. other ( & format ! ( "Invalid X509 certificate value ({c:?}) for role 0 ({role:?})" ) , context) ,
440
445
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(
444
449
match metadata. c509_certs . first ( ) {
445
450
Some ( C509Cert :: C509Certificate ( cert) ) => {
446
451
// 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) ) ;
448
453
}
449
454
Some ( c) => report. other ( & format ! ( "Invalid C509 certificate value ({c:?}) for role 0 ({role:?})" ) , context) ,
450
455
None => report. other ( "Role 0 reference C509 certificate at index 0, but there is no such certificate" , context) ,
0 commit comments