@@ -86,7 +86,6 @@ pub struct RbacValidationSuccess {
8686pub async fn update_chain < Provider > (
8787 reg : Cip509 ,
8888 previous_txn : TransactionId ,
89- is_persistent : bool ,
9089 provider : & Provider ,
9190) -> RbacValidationResult
9291where
@@ -96,26 +95,20 @@ where
9695 let report = reg. report ( ) . to_owned ( ) ;
9796
9897 // Find a chain this registration belongs to.
99- let Some ( catalyst_id) = provider
100- . catalyst_id_from_txn_id ( previous_txn, is_persistent)
101- . await ?
102- else {
98+ let Some ( catalyst_id) = provider. catalyst_id_from_txn_id ( previous_txn) . await ? else {
10399 // We are unable to determine a Catalyst ID, so there is no sense to update the problem
104100 // report because we would be unable to store this registration anyway.
105101 return Err ( RbacValidationError :: UnknownCatalystId ) ;
106102 } ;
107- let chain = provider. chain ( catalyst_id. clone ( ) , is_persistent ) . await ?
103+ let chain = provider. chain ( catalyst_id. clone ( ) ) . await ?
108104 . context ( "{catalyst_id} is present in 'catalyst_id_for_txn_id' table, but not in 'rbac_registration'" ) ?;
109105
110106 // Check that addresses from the new registration aren't used in other chains.
111107 let previous_addresses = chain. stake_addresses ( ) ;
112108 let reg_addresses = cip509_stake_addresses ( & reg) ;
113109 let new_addresses: Vec < _ > = reg_addresses. difference ( & previous_addresses) . collect ( ) ;
114110 for address in & new_addresses {
115- match provider
116- . catalyst_id_from_stake_address ( address, is_persistent)
117- . await ?
118- {
111+ match provider. catalyst_id_from_stake_address ( address) . await ? {
119112 None => {
120113 // All good: the address wasn't used before.
121114 } ,
@@ -141,7 +134,7 @@ where
141134 } ) ?;
142135
143136 // Check that new public keys aren't used by other chains.
144- let public_keys = validate_public_keys ( & new_chain, is_persistent , & report, provider) . await ?;
137+ let public_keys = validate_public_keys ( & new_chain, & report, provider) . await ?;
145138
146139 // Return an error if any issues were recorded in the report.
147140 if report. is_problematic ( ) {
@@ -177,7 +170,6 @@ where
177170/// address conflict, or public key duplication occurs.
178171pub async fn start_new_chain < Provider > (
179172 reg : Cip509 ,
180- is_persistent : bool ,
181173 provider : & Provider ,
182174) -> RbacValidationResult
183175where
@@ -202,10 +194,7 @@ where
202194
203195 // Verify that a Catalyst ID of this chain is unique.
204196 let catalyst_id = new_chain. catalyst_id ( ) . as_short_id ( ) ;
205- if provider
206- . is_chain_known ( catalyst_id. clone ( ) , is_persistent)
207- . await ?
208- {
197+ if provider. is_chain_known ( catalyst_id. clone ( ) ) . await ? {
209198 report. functional_validation (
210199 & format ! ( "{catalyst_id} is already used" ) ,
211200 "It isn't allowed to use same Catalyst ID (certificate subject public key) in multiple registration chains" ,
@@ -221,13 +210,10 @@ where
221210 let new_addresses = new_chain. stake_addresses ( ) ;
222211 let mut updated_chains: HashMap < _ , HashSet < StakeAddress > > = HashMap :: new ( ) ;
223212 for address in & new_addresses {
224- if let Some ( id) = provider
225- . catalyst_id_from_stake_address ( address, is_persistent)
226- . await ?
227- {
213+ if let Some ( id) = provider. catalyst_id_from_stake_address ( address) . await ? {
228214 // If an address is used in existing chain then a new chain must have different role 0
229215 // signing key.
230- let previous_chain = provider. chain ( id. clone ( ) , is_persistent )
216+ let previous_chain = provider. chain ( id. clone ( ) )
231217 . await ?
232218 . context ( "{id} is present in 'catalyst_id_for_stake_address', but not in 'rbac_registration'" ) ?;
233219 if previous_chain. get_latest_signing_pk_for_role ( & RoleId :: Role0 )
@@ -253,7 +239,7 @@ where
253239 }
254240
255241 // Check that new public keys aren't used by other chains.
256- let public_keys = validate_public_keys ( & new_chain, is_persistent , & report, provider) . await ?;
242+ let public_keys = validate_public_keys ( & new_chain, & report, provider) . await ?;
257243
258244 if report. is_problematic ( ) {
259245 return Err ( RbacValidationError :: InvalidRegistration {
@@ -285,7 +271,6 @@ where
285271/// (e.g., database lookup failures).
286272pub async fn validate_public_keys < Provider > (
287273 chain : & RegistrationChain ,
288- is_persistent : bool ,
289274 report : & ProblemReport ,
290275 provider : & Provider ,
291276) -> Result < HashSet < VerifyingKey > >
@@ -300,10 +285,7 @@ where
300285 for role in roles {
301286 if let Some ( ( key, _) ) = chain. get_latest_signing_pk_for_role ( role) {
302287 keys. insert ( key) ;
303- if let Some ( previous) = provider
304- . catalyst_id_from_public_key ( key, is_persistent)
305- . await ?
306- {
288+ if let Some ( previous) = provider. catalyst_id_from_public_key ( key) . await ? {
307289 if previous != catalyst_id {
308290 report. functional_validation (
309291 & format ! ( "An update to {catalyst_id} registration chain uses the same public key ({key:?}) as {previous} chain" ) ,
0 commit comments