Skip to content

Commit f150a40

Browse files
committed
comments fixes
1 parent 68c16bb commit f150a40

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

rust/rbac-registration/src/cardano/cip509/cip509.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ impl Cip509 {
349349
#[must_use]
350350
pub fn stake_addresses(&self) -> HashSet<StakeAddress> {
351351
self.certificate_uris()
352-
.map(Cip0134UriSet::stake_addresses)
352+
.map(Cip0134UriSet::active_stake_addresses)
353353
.unwrap_or_default()
354354
}
355355

rust/rbac-registration/src/cardano/cip509/utils/cip134_uri_set.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl Cip0134UriSet {
120120

121121
/// Returns a set of all active (without taken) stake addresses.
122122
#[must_use]
123-
pub fn stake_addresses(&self) -> HashSet<StakeAddress> {
123+
pub fn active_stake_addresses(&self) -> HashSet<StakeAddress> {
124124
self.values()
125125
.filter_map(|uri| {
126126
match uri.address() {
@@ -203,7 +203,7 @@ impl Cip0134UriSet {
203203

204204
metadata
205205
.certificate_uris
206-
.stake_addresses()
206+
.active_stake_addresses()
207207
.iter()
208208
.for_each(|v| {
209209
taken_stake_addresses.remove(v);
@@ -225,10 +225,10 @@ impl Cip0134UriSet {
225225
self,
226226
reg: &Cip509RbacMetadata,
227227
) -> Self {
228-
let current_stake_addresses = self.stake_addresses();
228+
let current_stake_addresses = self.active_stake_addresses();
229229
let latest_taken_stake_addresses = reg
230230
.certificate_uris
231-
.stake_addresses()
231+
.active_stake_addresses()
232232
.into_iter()
233233
.filter(|v| current_stake_addresses.contains(v));
234234

@@ -399,7 +399,7 @@ mod tests {
399399
assert!(set.c_uris().is_empty());
400400
assert_eq!(set.role_uris(0).count(), 1);
401401
assert_eq!(set.role_stake_addresses(0).len(), 1);
402-
assert_eq!(set.stake_addresses().len(), 1);
402+
assert_eq!(set.active_stake_addresses().len(), 1);
403403

404404
let x_uris = set.x_uris();
405405
assert_eq!(x_uris.len(), 1);

rust/rbac-registration/src/cardano/state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ pub trait RbacChainsState {
2929
addr: &StakeAddress,
3030
) -> impl Future<Output = anyhow::Result<bool>> + Send;
3131

32-
/// Returns a corresponding to the RBAC chain's Catalyst ID corresponding by the given
32+
/// Returns the Catalyst ID associated with the RBAC chain for the given signing public key
3333
/// signing public key.
3434
fn chain_catalyst_id_from_signing_public_key(
3535
&self,
3636
key: &VerifyingKey,
3737
) -> impl Future<Output = anyhow::Result<Option<CatalystId>>> + Send;
3838

39-
/// Update the chain by "taking" the given `StakeAddress` for the corresponding
39+
/// Update currently assosiated with the stake addresses chains by "taking" the given `StakeAddress` for the corresponding
4040
/// RBAC chain's by the given `CatalystId`.
4141
fn take_stake_address_from_chains<I>(
4242
&mut self,

rust/rbac-registration/src/registration/cardano/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ impl RegistrationChain {
121121
};
122122

123123
// Check that addresses from the new registration aren't used in other chains.
124-
let previous_addresses = self.stake_addresses();
125-
let reg_addresses = cip509.stake_addresses();
126-
let new_addresses: Vec<_> = reg_addresses.difference(&previous_addresses).collect();
127-
for address in &new_addresses {
124+
let previous_stake_addresses = self.stake_addresses();
125+
let reg_stake_addresses = cip509.stake_addresses();
126+
let new_stake_addresses: Vec<_> = reg_stake_addresses.difference(&previous_stake_addresses).collect();
127+
for address in &new_stake_addresses {
128128
if state.is_stake_address_used(address).await? {
129129
cip509.report().functional_validation(
130130
&format!("{address} stake address is already used"),
@@ -257,7 +257,7 @@ impl RegistrationChain {
257257
/// Get the latest encryption public key for a role.
258258
/// Returns the public key and the rotation, `None` if not found.
259259
#[must_use]
260-
pub fn get_latest_encryption_pk_for_role(
260+
pub fn get_latest_encryption_public_key_for_role(
261261
&self,
262262
role: RoleId,
263263
) -> Option<(VerifyingKey, KeyRotation)> {
@@ -329,7 +329,7 @@ impl RegistrationChain {
329329
/// Returns all stake addresses associated to this chain.
330330
#[must_use]
331331
pub fn stake_addresses(&self) -> HashSet<StakeAddress> {
332-
self.inner.certificate_uris.stake_addresses()
332+
self.inner.certificate_uris.active_stake_addresses()
333333
}
334334

335335
/// Returns the latest know applied registration's `PointTxnIdx`.
@@ -748,7 +748,7 @@ where
748748
{
749749
cip509.report().functional_validation(
750750
&format!("An update to {cat_id} registration chain uses the same public key ({key:?}) as {previous} chain"),
751-
"It isn't allowed to use role 0 signing (certificate subject public) key in different chains",
751+
"It isn't allowed to use signing (certificate subject public) key in different chains",
752752
);
753753
}
754754
}

0 commit comments

Comments
 (0)