File tree 3 files changed +17
-8
lines changed
rust/rbac-registration/src
3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 2
2
//! Doc Reference: <https://github.com/input-output-hk/catalyst-CIPs/tree/x509-envelope-metadata/CIP-XXXX>
3
3
//! CDDL Reference: <https://github.com/input-output-hk/catalyst-CIPs/blob/x509-envelope-metadata/CIP-XXXX/x509-envelope.cddl>
4
4
5
- use std:: { borrow:: Cow , collections:: HashMap } ;
5
+ use std:: {
6
+ borrow:: Cow ,
7
+ collections:: { HashMap , HashSet } ,
8
+ } ;
6
9
7
10
use anyhow:: { anyhow, Context } ;
8
11
use cardano_blockchain_types:: {
@@ -261,7 +264,7 @@ impl Cip509 {
261
264
262
265
/// Returns a list of role 0 stake addresses.
263
266
#[ must_use]
264
- pub fn role_0_stake_addresses ( & self ) -> Vec < StakeAddress > {
267
+ pub fn role_0_stake_addresses ( & self ) -> HashSet < StakeAddress > {
265
268
self . metadata
266
269
. as_ref ( )
267
270
. map ( |m| m. certificate_uris . stake_addresses ( 0 ) )
Original file line number Diff line number Diff line change 1
1
//! A set of [`Cip0134Uri`].
2
2
3
- use std:: { collections:: HashMap , sync:: Arc } ;
3
+ use std:: {
4
+ collections:: { HashMap , HashSet } ,
5
+ sync:: Arc ,
6
+ } ;
4
7
5
8
use c509_certificate:: {
6
9
extensions:: { alt_name:: GeneralNamesOrText , extension:: ExtensionValue } ,
@@ -70,8 +73,8 @@ impl Cip0134UriSet {
70
73
71
74
/// Returns a list of stake addresses by the given index.
72
75
#[ must_use]
73
- pub fn stake_addresses ( & self , index : usize ) -> Vec < StakeAddress > {
74
- let mut result = Vec :: new ( ) ;
76
+ pub fn stake_addresses ( & self , index : usize ) -> HashSet < StakeAddress > {
77
+ let mut result = HashSet :: new ( ) ;
75
78
76
79
if let Some ( uris) = self . x_uris ( ) . get ( & index) {
77
80
result. extend ( convert_stake_addresses ( uris) ) ;
Original file line number Diff line number Diff line change 2
2
3
3
mod update_rbac;
4
4
5
- use std:: { collections:: HashMap , sync:: Arc } ;
5
+ use std:: {
6
+ collections:: { HashMap , HashSet } ,
7
+ sync:: Arc ,
8
+ } ;
6
9
7
10
use anyhow:: bail;
8
11
use c509_certificate:: c509:: C509 ;
@@ -208,9 +211,9 @@ impl RegistrationChain {
208
211
. and_then ( |rdr| rdr. encryption_key_from_rotation ( rotation) )
209
212
}
210
213
211
- /// Returns a list of role 0 stake addresses.
214
+ /// Returns a set of role 0 stake addresses.
212
215
#[ must_use]
213
- pub fn role_0_stake_addresses ( & self ) -> Vec < StakeAddress > {
216
+ pub fn role_0_stake_addresses ( & self ) -> HashSet < StakeAddress > {
214
217
self . inner . certificate_uris . stake_addresses ( 0 )
215
218
}
216
219
}
You can’t perform that action at this time.
0 commit comments