diff --git a/anoncreds/src/services/prover.rs b/anoncreds/src/services/prover.rs index 2b4f2a54..f56fae75 100644 --- a/anoncreds/src/services/prover.rs +++ b/anoncreds/src/services/prover.rs @@ -337,10 +337,6 @@ pub fn create_or_update_revocation_state( &mut issued, &mut revoked, ); - let rev_reg: Option = rev_status_list.into(); - let rev_reg = rev_reg.ok_or_else(|| { - err_msg!("revocation registry is not inside the revocation status list") - })?; let rev_reg_delta = RevocationRegistryDelta::from_parts(None, &rev_reg, &issued, &revoked); Witness::new( rev_reg_idx, diff --git a/anoncreds/tests/anoncreds_demos.rs b/anoncreds/tests/anoncreds_demos.rs index 825de2ac..8ccc2eff 100644 --- a/anoncreds/tests/anoncreds_demos.rs +++ b/anoncreds/tests/anoncreds_demos.rs @@ -224,7 +224,7 @@ fn anoncreds_works_for_single_issuer_single_prover() { None, ) .expect("Error verifying presentation"); - assert!(valid); + assert!(valid.0); } #[test] @@ -439,7 +439,7 @@ fn anoncreds_with_revocation_works_for_single_issuer_single_prover() { Some(&rev_reg_map), ) .expect("Error verifying presentation"); - assert!(valid); + assert!(valid.0); // ===================== Issuer revokes credential ================ let time_revoke_cred = time_after_creating_cred + 1; @@ -488,7 +488,7 @@ fn anoncreds_with_revocation_works_for_single_issuer_single_prover() { Some(&rev_reg_map), ) .expect("Error verifying presentation"); - assert!(!valid); + assert!(!valid.0); } /* diff --git a/anoncreds/tests/utils/mock.rs b/anoncreds/tests/utils/mock.rs index e32fc5bd..e16dafd6 100644 --- a/anoncreds/tests/utils/mock.rs +++ b/anoncreds/tests/utils/mock.rs @@ -19,10 +19,11 @@ use anoncreds::{ types::{ CredentialDefinitionConfig, CredentialRequest, CredentialRevocationConfig, CredentialRevocationState, MakeCredentialValues, PresentCredentials, PresentationRequest, - RegistryType, SignatureType, + RegistryType, RevocationStatusList, SignatureType, }, verifier, }; +use bitvec::bitvec; // {cred_def_id: { // schema_id, credential_values, support_revocation, rev_reg_id, rev_idx @@ -181,6 +182,20 @@ impl<'a> Mock<'a> { HashMap::from([(time_now, revocation_status_list)]), ); + // TODO create_revocation_registry needs issuance type to update this + let list = bitvec![0; self.max_cred_num as usize ]; + let revocation_list = RevocationStatusList::new( + Some(rev_reg_id), + list, + Some(rev_reg.clone().value), + Some(time_now), + ) + .unwrap(); + + self.ledger + .revcation_list + .insert(rev_reg_id, revocation_list); + self.ledger.rev_reg_defs.insert( RevocationRegistryDefinitionId::new_unchecked(*rev_reg_id), rev_reg_def_pub,