Skip to content

Commit

Permalink
Perform migrations outside exchange_proof_and_verify
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
  • Loading branch information
mirgee committed Sep 6, 2023
1 parent d536b81 commit e32fbd6
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ impl

impl From<(PresentationRequestSentState, ProblemReport)> for FinishedState {
fn from((state, problem_report): (PresentationRequestSentState, ProblemReport)) -> Self {
trace!("transit state from PresentationRequestSentState to FinishedState");
trace!(
"transit state from PresentationRequestSentState to FinishedState; problem_report: {:?}",
problem_report
);
FinishedState {
presentation_request: Some(state.presentation_request),
presentation: None,
Expand Down
31 changes: 28 additions & 3 deletions aries_vcx/tests/test_creds_proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ mod integration_tests {
#[ignore]
async fn test_agency_pool_generate_proof_with_predicates() {
SetupProfile::run(|mut setup| async move {
let (_, _, _, _, _, _, _, _, rev_reg_id, cred_rev_id, tails_dir, rev_reg) = create_and_store_credential(
let (_, _, _, _, _, _, _, _, rev_reg_id, cred_rev_id, tails_dir, _) = create_and_store_credential(
&setup.profile.inject_anoncreds(),
&setup.profile.inject_anoncreds(),
&setup.profile.inject_anoncreds_ledger_read(),
Expand Down Expand Up @@ -584,7 +584,8 @@ mod tests {
create_nonrevocable_cred_offer, create_proof_proposal, create_proof_request_data, create_prover_from_request,
create_verifier_from_request_data, decline_offer, exchange_proof_and_verify, generate_and_send_proof,
issue_address_credential, prover_select_credentials, prover_select_credentials_and_send_proof,
receive_proof_proposal_rejection, reject_proof_proposal, send_credential, verify_proof,
receive_proof_proposal_rejection, reject_proof_proposal, send_credential,
verifier_create_proof_and_send_request, verify_proof,
};

#[tokio::test]
Expand Down Expand Up @@ -813,7 +814,14 @@ mod tests {
)
.await;

#[cfg(feature = "migration")]
consumer1.migrate().await;

exchange_proof_and_verify(&mut verifier, &mut consumer1, &schema_id, &cred_def_id, Some("request1"), PresentationVerificationStatus::Valid).await;

#[cfg(feature = "migration")]
consumer2.migrate().await;

exchange_proof_and_verify(&mut verifier, &mut consumer2, &schema_id, &cred_def_id, Some("request2"), PresentationVerificationStatus::Valid).await;
}).await;
}
Expand Down Expand Up @@ -841,6 +849,10 @@ mod tests {
PresentationVerificationStatus::Valid,
)
.await;

#[cfg(feature = "migration")]
verifier.migrate().await;

exchange_proof_and_verify(
&mut verifier,
&mut consumer,
Expand Down Expand Up @@ -875,7 +887,16 @@ mod tests {
)
.await;

// NOTE: Credx-anoncreds-implementation-generated presentation is not compatible with vdrtools anoncreds implementation
// as the presentation fails to deserialize
// #[cfg(feature = "migration")]
// consumer.migrate().await;

exchange_proof_and_verify(&mut institution, &mut consumer, &schema_id, &cred_def_id, Some("request1"), PresentationVerificationStatus::Valid).await;

#[cfg(feature = "migration")]
institution.migrate().await;

exchange_proof_and_verify(&mut institution, &mut consumer, &schema_id, &cred_def_id, Some("request2"), PresentationVerificationStatus::Valid).await;
}).await;
}
Expand Down Expand Up @@ -963,7 +984,7 @@ mod tests {
let presentation_thread_id = verifier.get_thread_id().unwrap();

info!("test_real_proof :: Going to create proof");
prover_select_credentials_and_send_proof(&mut consumer, presentation_request, None);
prover_select_credentials_and_send_proof(&mut consumer, presentation_request, None).await;
})
.await;
}
Expand Down Expand Up @@ -1009,6 +1030,10 @@ mod tests {
verifier.migrate().await;

exchange_proof_and_verify(&mut verifier, &mut consumer, &schema_id, &cred_def_id, req1, PresentationVerificationStatus::Valid).await;

#[cfg(feature = "migration")]
consumer.migrate().await;

exchange_proof_and_verify(&mut verifier, &mut consumer, &schema_id, &cred_def_id, req2, PresentationVerificationStatus::Valid).await;
}).await;
}
Expand Down
6 changes: 6 additions & 0 deletions aries_vcx/tests/test_creds_proofs_revocations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ mod integration_tests {
assert!(!issuer_credential2.is_revoked(&institution.profile.inject_anoncreds_ledger_read()).await.unwrap());
assert!(!issuer_credential3.is_revoked(&institution.profile.inject_anoncreds_ledger_read()).await.unwrap());

#[cfg(feature = "migration")]
consumer2.migrate().await;

#[cfg(feature = "migration")]
consumer3.migrate().await;

// Revoke two locally and verify their are all still valid
exchange_proof_and_verify(&mut institution, &mut consumer1, &schema_id, &cred_def_id, Some("request1"), PresentationVerificationStatus::Valid).await;
exchange_proof_and_verify(&mut institution, &mut consumer2, &schema_id, &cred_def_id, Some("request2"), PresentationVerificationStatus::Valid).await;
Expand Down
5 changes: 1 addition & 4 deletions aries_vcx/tests/utils/scenarios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,13 +1082,10 @@ pub mod test_utils {
) -> Verifier {
let mut verifier =
verifier_create_proof_and_send_request(institution, &schema_id, &cred_def_id, request_name).await;

#[cfg(feature = "migration")]
consumer.migrate().await;

let presentation =
prover_select_credentials_and_send_proof(consumer, verifier.get_presentation_request_msg().unwrap(), None)
.await;

verifier
.verify_presentation(
&institution.profile.inject_anoncreds_ledger_read(),
Expand Down

0 comments on commit e32fbd6

Please sign in to comment.