From 1ec6cc5fbe120ae7ef903784cb2bb78d278b10d3 Mon Sep 17 00:00:00 2001 From: Rob Simpson Date: Tue, 26 Sep 2023 18:34:02 -0500 Subject: [PATCH 1/6] fix: Problem Report Before Connection Signed-off-by: Rob Simpson --- .../protocols/issue_credential/v2_0/routes.py | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py index 721128b4ae..6ef8697de0 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py @@ -835,13 +835,6 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): if cred_ex_record: async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) - await report_problem( - err, - ProblemReportReason.ISSUANCE_ABANDONED.value, - web.HTTPBadRequest, - cred_ex_record or conn_record, - outbound_handler, - ) await outbound_handler(cred_proposal_message, connection_id=connection_id) @@ -1042,13 +1035,6 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest): if cred_ex_record: async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) - await report_problem( - err, - ProblemReportReason.ISSUANCE_ABANDONED.value, - web.HTTPBadRequest, - cred_ex_record or conn_record, - outbound_handler, - ) await outbound_handler(cred_offer_message, connection_id=connection_id) @@ -1252,13 +1238,6 @@ async def credential_exchange_send_free_request(request: web.BaseRequest): if cred_ex_record: async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) - await report_problem( - err, - ProblemReportReason.ISSUANCE_ABANDONED.value, - web.HTTPBadRequest, - cred_ex_record, - outbound_handler, - ) await outbound_handler(cred_request_message, connection_id=connection_id) From 90ba448e199811be5ce7da86a957d6933b2e9629 Mon Sep 17 00:00:00 2001 From: Rob Simpson Date: Tue, 26 Sep 2023 18:55:44 -0500 Subject: [PATCH 2/6] fix: Problem Report Before Exchange Signed-off-by: Rob Simpson --- .../protocols/issue_credential/v2_0/routes.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py index 6ef8697de0..431990d4da 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py @@ -836,7 +836,8 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) - await outbound_handler(cred_proposal_message, connection_id=connection_id) + else: + await outbound_handler(cred_proposal_message, connection_id=connection_id) trace_event( context.settings, @@ -1036,7 +1037,8 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest): async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) - await outbound_handler(cred_offer_message, connection_id=connection_id) + else: + await outbound_handler(cred_offer_message, connection_id=connection_id) trace_event( context.settings, @@ -1239,7 +1241,8 @@ async def credential_exchange_send_free_request(request: web.BaseRequest): async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) - await outbound_handler(cred_request_message, connection_id=connection_id) + else: + await outbound_handler(cred_request_message, connection_id=connection_id) trace_event( context.settings, From ad2fa1ca1573b753275080706bd4d9306200e99b Mon Sep 17 00:00:00 2001 From: Rob Simpson Date: Tue, 26 Sep 2023 19:20:09 -0500 Subject: [PATCH 3/6] fix: Problem Report Before Exchange Signed-off-by: Rob Simpson --- .../protocols/issue_credential/v1_0/routes.py | 28 ++++++------------- .../protocols/issue_credential/v2_0/routes.py | 3 ++ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/routes.py b/aries_cloudagent/protocols/issue_credential/v1_0/routes.py index e00411efed..f15622b503 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/routes.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/routes.py @@ -692,18 +692,13 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): if cred_ex_record: async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) - await report_problem( - err, - ProblemReportReason.ISSUANCE_ABANDONED.value, - web.HTTPBadRequest, - cred_ex_record or connection_record, - outbound_handler, - ) + # other party cannot yet receive a problem report about our failed protocol start - await outbound_handler( - credential_proposal, - connection_id=connection_id, - ) + else: + await outbound_handler( + credential_proposal, + connection_id=connection_id, + ) trace_event( context.settings, @@ -903,15 +898,10 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest): if cred_ex_record: async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) - await report_problem( - err, - ProblemReportReason.ISSUANCE_ABANDONED.value, - web.HTTPBadRequest, - cred_ex_record or connection_record, - outbound_handler, - ) + # other party cannot yet receive a problem report about our failed protocol start - await outbound_handler(credential_offer_message, connection_id=connection_id) + else: + await outbound_handler(credential_offer_message, connection_id=connection_id) trace_event( context.settings, diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py index 431990d4da..28827a5289 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py @@ -835,6 +835,7 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): if cred_ex_record: async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) + # other party cannot yet receive a problem report about our failed protocol start else: await outbound_handler(cred_proposal_message, connection_id=connection_id) @@ -1036,6 +1037,7 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest): if cred_ex_record: async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) + # other party cannot yet receive a problem report about our failed protocol start else: await outbound_handler(cred_offer_message, connection_id=connection_id) @@ -1240,6 +1242,7 @@ async def credential_exchange_send_free_request(request: web.BaseRequest): if cred_ex_record: async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) + # other party cannot yet receive a problem report about our failed protocol start else: await outbound_handler(cred_request_message, connection_id=connection_id) From 7f877ff6f45cf18fdb4259754c6b54a825e943e3 Mon Sep 17 00:00:00 2001 From: Rob Simpson Date: Tue, 26 Sep 2023 19:45:19 -0500 Subject: [PATCH 4/6] fix: Problem Report Before Exchange Signed-off-by: Rob Simpson --- aries_cloudagent/protocols/issue_credential/v1_0/routes.py | 6 +++++- aries_cloudagent/protocols/issue_credential/v2_0/routes.py | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/routes.py b/aries_cloudagent/protocols/issue_credential/v1_0/routes.py index f15622b503..dc89bfdc2c 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/routes.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/routes.py @@ -668,6 +668,8 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): connection_record = None cred_ex_record = None + credential_proposal = None + result = None try: preview = CredentialPreview.deserialize(preview_spec) if preview_spec else None async with profile.session() as session: @@ -693,7 +695,7 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) # other party cannot yet receive a problem report about our failed protocol start - + else: await outbound_handler( credential_proposal, @@ -871,6 +873,8 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest): cred_ex_record = None connection_record = None + credential_offer_message = None + result = None try: async with profile.session() as session: connection_record = await ConnRecord.retrieve_by_id(session, connection_id) diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py index 28827a5289..f7a671aa22 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py @@ -805,6 +805,8 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): conn_record = None cred_ex_record = None + cred_proposal_message = None + result = None try: cred_preview = ( V20CredPreview.deserialize(preview_spec) if preview_spec else None @@ -1006,6 +1008,8 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest): cred_ex_record = None conn_record = None + cred_offer_message = None + result = None try: async with profile.session() as session: conn_record = await ConnRecord.retrieve_by_id(session, connection_id) @@ -1198,6 +1202,8 @@ async def credential_exchange_send_free_request(request: web.BaseRequest): conn_record = None cred_ex_record = None + cred_request_message = None + result = None try: try: async with profile.session() as session: From f68914b16f2f4599834c06a2b6e9ecf3dbbcd76f Mon Sep 17 00:00:00 2001 From: Rob Simpson Date: Tue, 26 Sep 2023 19:47:40 -0500 Subject: [PATCH 5/6] fix: Problem Report Before Exchange Signed-off-by: Rob Simpson --- aries_cloudagent/protocols/issue_credential/v1_0/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/routes.py b/aries_cloudagent/protocols/issue_credential/v1_0/routes.py index dc89bfdc2c..beebd0b6ff 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/routes.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/routes.py @@ -695,7 +695,7 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) # other party cannot yet receive a problem report about our failed protocol start - + else: await outbound_handler( credential_proposal, From 7283b43f275bb4ae05f00dd20ce810a2cfba21fb Mon Sep 17 00:00:00 2001 From: Rob Simpson Date: Tue, 26 Sep 2023 20:28:49 -0500 Subject: [PATCH 6/6] fix: Problem Report Before Exchange Signed-off-by: Rob Simpson --- .../protocols/issue_credential/v1_0/routes.py | 18 +++++++----------- .../protocols/issue_credential/v2_0/routes.py | 18 ++++++------------ 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/routes.py b/aries_cloudagent/protocols/issue_credential/v1_0/routes.py index beebd0b6ff..1e08f969fd 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/routes.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/routes.py @@ -668,8 +668,6 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): connection_record = None cred_ex_record = None - credential_proposal = None - result = None try: preview = CredentialPreview.deserialize(preview_spec) if preview_spec else None async with profile.session() as session: @@ -695,12 +693,12 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) # other party cannot yet receive a problem report about our failed protocol start + raise web.HTTPBadRequest(reason=err.roll_up) - else: - await outbound_handler( - credential_proposal, - connection_id=connection_id, - ) + await outbound_handler( + credential_proposal, + connection_id=connection_id, + ) trace_event( context.settings, @@ -873,8 +871,6 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest): cred_ex_record = None connection_record = None - credential_offer_message = None - result = None try: async with profile.session() as session: connection_record = await ConnRecord.retrieve_by_id(session, connection_id) @@ -903,9 +899,9 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest): async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) # other party cannot yet receive a problem report about our failed protocol start + raise web.HTTPBadRequest(reason=err.roll_up) - else: - await outbound_handler(credential_offer_message, connection_id=connection_id) + await outbound_handler(credential_offer_message, connection_id=connection_id) trace_event( context.settings, diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py index f7a671aa22..d1f0995624 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/routes.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/routes.py @@ -805,8 +805,6 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): conn_record = None cred_ex_record = None - cred_proposal_message = None - result = None try: cred_preview = ( V20CredPreview.deserialize(preview_spec) if preview_spec else None @@ -838,9 +836,9 @@ async def credential_exchange_send_proposal(request: web.BaseRequest): async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) # other party cannot yet receive a problem report about our failed protocol start + raise web.HTTPBadRequest(reason=err.roll_up) - else: - await outbound_handler(cred_proposal_message, connection_id=connection_id) + await outbound_handler(cred_proposal_message, connection_id=connection_id) trace_event( context.settings, @@ -1008,8 +1006,6 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest): cred_ex_record = None conn_record = None - cred_offer_message = None - result = None try: async with profile.session() as session: conn_record = await ConnRecord.retrieve_by_id(session, connection_id) @@ -1042,9 +1038,9 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest): async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) # other party cannot yet receive a problem report about our failed protocol start + raise web.HTTPBadRequest(reason=err.roll_up) - else: - await outbound_handler(cred_offer_message, connection_id=connection_id) + await outbound_handler(cred_offer_message, connection_id=connection_id) trace_event( context.settings, @@ -1202,8 +1198,6 @@ async def credential_exchange_send_free_request(request: web.BaseRequest): conn_record = None cred_ex_record = None - cred_request_message = None - result = None try: try: async with profile.session() as session: @@ -1249,9 +1243,9 @@ async def credential_exchange_send_free_request(request: web.BaseRequest): async with profile.session() as session: await cred_ex_record.save_error_state(session, reason=err.roll_up) # other party cannot yet receive a problem report about our failed protocol start + raise web.HTTPBadRequest(reason=err.roll_up) - else: - await outbound_handler(cred_request_message, connection_id=connection_id) + await outbound_handler(cred_request_message, connection_id=connection_id) trace_event( context.settings,