Skip to content

Commit ec48143

Browse files
committed
wip
1 parent ae05abd commit ec48143

File tree

1 file changed

+10
-10
lines changed
  • rust/rbac-registration/src/registration/cardano

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl RegistrationChain {
9292
}
9393
}
9494

95-
if reg.report().is_problematic() {
95+
if cip509.report().is_problematic() {
9696
Ok(None)
9797
} else {
9898
Ok(Some(new_chain))
@@ -102,7 +102,7 @@ impl RegistrationChain {
102102
/// Create a new instance of registration chain.
103103
/// The first new value should be the chain root.
104104
#[must_use]
105-
pub fn new_stateless(cip509: &Cip509) -> Option<Self> {
105+
fn new_stateless(cip509: &Cip509) -> Option<Self> {
106106
let inner = RegistrationChainInner::new(cip509)?;
107107

108108
Some(Self {
@@ -118,23 +118,23 @@ impl RegistrationChain {
118118
/// ownership (e.g., database lookup failures).
119119
pub async fn update<Provider>(
120120
&self,
121-
reg: &Cip509,
121+
cip509: &Cip509,
122122
provider: &Provider,
123123
) -> anyhow::Result<Option<Self>>
124124
where
125125
Provider: RbacRegistrationProvider,
126126
{
127-
let Some(new_chain) = self.update_stateless(reg) else {
127+
let Some(new_chain) = self.update_stateless(cip509) else {
128128
return Ok(None);
129129
};
130130

131131
// Check that addresses from the new registration aren't used in other chains.
132132
let previous_addresses = self.stake_addresses();
133-
let reg_addresses = reg.stake_addresses();
133+
let reg_addresses = cip509.stake_addresses();
134134
let new_addresses: Vec<_> = reg_addresses.difference(&previous_addresses).collect();
135135
for address in &new_addresses {
136136
if provider.chain_from_stake_address(address).await?.is_some() {
137-
reg.report().functional_validation(
137+
cip509.report().functional_validation(
138138
&format!("{address} stake addresses is already used"),
139139
"It isn't allowed to use same stake address in multiple registration chains, if its not a new chain",
140140
);
@@ -145,11 +145,11 @@ impl RegistrationChain {
145145
// other chain. Returns a list of public keys in the registration.
146146
{
147147
let cat_id = self.catalyst_id();
148-
for role in reg.all_roles() {
148+
for role in cip509.all_roles() {
149149
if let Some((key, _)) = new_chain.get_latest_signing_pk_for_role(role) {
150150
if let Some(previous) = provider.catalyst_id_from_public_key(&key).await? {
151151
if &previous != cat_id {
152-
reg.report().functional_validation(
152+
cip509.report().functional_validation(
153153
&format!("An update to {cat_id} registration chain uses the same public key ({key:?}) as {previous} chain"),
154154
"It isn't allowed to use role 0 signing (certificate subject public) key in different chains",
155155
);
@@ -159,7 +159,7 @@ impl RegistrationChain {
159159
}
160160
}
161161

162-
if reg.report().is_problematic() {
162+
if cip509.report().is_problematic() {
163163
Ok(None)
164164
} else {
165165
Ok(Some(new_chain))
@@ -171,7 +171,7 @@ impl RegistrationChain {
171171
/// # Arguments
172172
/// - `cip509` - The CIP509.
173173
#[must_use]
174-
pub fn update_stateless(
174+
fn update_stateless(
175175
&self,
176176
cip509: &Cip509,
177177
) -> Option<Self> {

0 commit comments

Comments
 (0)