Skip to content

Commit

Permalink
chore: rebase fix
Browse files Browse the repository at this point in the history
Signed-off-by: bwty <[email protected]>
  • Loading branch information
whalelephant committed Jan 19, 2023
1 parent 66caeca commit bc1a9f4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
4 changes: 0 additions & 4 deletions anoncreds/src/services/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,6 @@ pub fn create_or_update_revocation_state(
&mut issued,
&mut revoked,
);
let rev_reg: Option<ursa::cl::RevocationRegistry> = 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,
Expand Down
6 changes: 3 additions & 3 deletions anoncreds/tests/anoncreds_demos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ fn anoncreds_works_for_single_issuer_single_prover() {
None,
)
.expect("Error verifying presentation");
assert!(valid);
assert!(valid.0);
}

#[test]
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/*
Expand Down
17 changes: 16 additions & 1 deletion anoncreds/tests/utils/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit bc1a9f4

Please sign in to comment.