From ca94965b8b449657857878d869598fe8be29d2a4 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 11 Apr 2024 22:49:25 +0200 Subject: [PATCH 01/45] :art: set default project version to 0.12.0 --- app/main.py | 2 +- endorser/main.py | 2 +- trustregistry/main.py | 2 +- webhooks/web/main.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index cea73f36f..1c472922e 100644 --- a/app/main.py +++ b/app/main.py @@ -35,7 +35,7 @@ from shared.log_config import get_logger OPENAPI_NAME = os.getenv("OPENAPI_NAME", "OpenAPI") -PROJECT_VERSION = os.getenv("PROJECT_VERSION", "0.11.0") +PROJECT_VERSION = os.getenv("PROJECT_VERSION", "0.12.0") ROLE = os.getenv("ROLE", "*") ROOT_PATH = os.getenv("ROOT_PATH", "") diff --git a/endorser/main.py b/endorser/main.py index 5dfab2c98..d3430beec 100644 --- a/endorser/main.py +++ b/endorser/main.py @@ -35,7 +35,7 @@ async def app_lifespan(_: FastAPI): def create_app() -> FastAPI: openapi_name = os.getenv("OPENAPI_NAME", "Aries Cloud API: Endorser Service") - project_version = os.getenv("PROJECT_VERSION", "0.11.0") + project_version = os.getenv("PROJECT_VERSION", "0.12.0") application = FastAPI( title=openapi_name, diff --git a/trustregistry/main.py b/trustregistry/main.py index 200529627..7145432b0 100644 --- a/trustregistry/main.py +++ b/trustregistry/main.py @@ -14,7 +14,7 @@ logger = get_logger(__name__) OPENAPI_NAME = os.getenv("OPENAPI_NAME", "Trust Registry") -PROJECT_VERSION = os.getenv("PROJECT_VERSION", "0.11.0") +PROJECT_VERSION = os.getenv("PROJECT_VERSION", "0.12.0") ROOT_PATH = os.getenv("ROOT_PATH", "") diff --git a/webhooks/web/main.py b/webhooks/web/main.py index 1c6311d13..2a2423b32 100644 --- a/webhooks/web/main.py +++ b/webhooks/web/main.py @@ -46,7 +46,7 @@ def create_app() -> FastAPI: openapi_name = os.getenv( "OPENAPI_NAME", "Aries Cloud API: Webhooks and Server-Sent Events" ) - project_version = os.getenv("PROJECT_VERSION", "0.11.0") + project_version = os.getenv("PROJECT_VERSION", "0.12.0") application = FastAPI( title=openapi_name, From dcdbc2e629e7fe0975499d0315a524a86925f3a3 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 11 Apr 2024 22:49:49 +0200 Subject: [PATCH 02/45] :arrow_up: Use 0.12.0 ACA-Py base image --- dockerfiles/agents/Dockerfile | 2 +- dockerfiles/agents/Dockerfile.agent | 2 +- dockerfiles/agents/Dockerfile.author.agent | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dockerfiles/agents/Dockerfile b/dockerfiles/agents/Dockerfile index fd6cec2f8..86c0ba49d 100644 --- a/dockerfiles/agents/Dockerfile +++ b/dockerfiles/agents/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.0 ADD configuration ./configuration ADD scripts ./scripts diff --git a/dockerfiles/agents/Dockerfile.agent b/dockerfiles/agents/Dockerfile.agent index 557d725b2..314118e8f 100644 --- a/dockerfiles/agents/Dockerfile.agent +++ b/dockerfiles/agents/Dockerfile.agent @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.0 USER root # install redis-events plugin diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index 3a5a7b56a..a39561b7f 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.0 USER root From 582007d7aa22cd7d7ad7d68a1e115a484ecc4003 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 11 Apr 2024 22:50:06 +0200 Subject: [PATCH 03/45] :construction: test 0.12.0 redis plugin --- dockerfiles/agents/Dockerfile.agent | 2 +- dockerfiles/agents/Dockerfile.author.agent | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dockerfiles/agents/Dockerfile.agent b/dockerfiles/agents/Dockerfile.agent index 314118e8f..74f1d01c5 100644 --- a/dockerfiles/agents/Dockerfile.agent +++ b/dockerfiles/agents/Dockerfile.agent @@ -2,7 +2,7 @@ FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.0 USER root # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-03-25#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@792695b77c4a4f52a6b326ef87a26c918ea15899#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index a39561b7f..26bc35696 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -6,7 +6,7 @@ USER root RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.7.0 # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-03-25#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@792695b77c4a4f52a6b326ef87a26c918ea15899#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh From 8f44910c2bd49f7f2bc518e3ceb09f7f528c59b9 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 11 Apr 2024 22:52:12 +0200 Subject: [PATCH 04/45] :construction: test 0.12.0 groups plugin --- dockerfiles/agents/Dockerfile.author.agent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index 26bc35696..5a7c02951 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -3,7 +3,7 @@ FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.0 USER root # Install wallet group id plugin -RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.7.0 +RUN pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@35bec3c705c687d247f674be483a68e4132b49bf # install redis-events plugin RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@792695b77c4a4f52a6b326ef87a26c918ea15899#subdirectory=redis_events From a6d3a34ffc36f7a6222a1b52f1e5711f55946918 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 23 Apr 2024 17:03:47 +0200 Subject: [PATCH 05/45] :construction: test 0.12 cloudcontroller --- app/requirements.txt | 2 +- dockerfiles/endorser/Dockerfile | 3 +++ dockerfiles/fastapi/Dockerfile | 3 +++ dockerfiles/tests/Dockerfile | 3 +++ dockerfiles/trustregistry/Dockerfile | 3 +++ dockerfiles/webhooks/Dockerfile | 3 +++ endorser/requirements.txt | 2 +- webhooks/requirements.txt | 2 +- 8 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/requirements.txt b/app/requirements.txt index be4efdd3e..13522f0e7 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -1,5 +1,5 @@ aiohttp~=3.9.2 -aries-cloudcontroller==0.11.0.post5 +git+https://github.com/didx-xyz/aries-cloudcontroller-python@1d89a9a602e9b9a495648225b0869cd7fb8ccf53 base58~=2.1.1 fastapi~=0.111.0 fastapi_websocket_pubsub~=0.3.8 diff --git a/dockerfiles/endorser/Dockerfile b/dockerfiles/endorser/Dockerfile index 8026f320f..973090064 100644 --- a/dockerfiles/endorser/Dockerfile +++ b/dockerfiles/endorser/Dockerfile @@ -5,6 +5,9 @@ COPY shared /shared WORKDIR /endorser +RUN apt-get -y update +RUN apt-get -y install git + RUN pip install --no-cache-dir -r requirements.txt -r requirements.dev.txt --upgrade EXPOSE 3009 diff --git a/dockerfiles/fastapi/Dockerfile b/dockerfiles/fastapi/Dockerfile index 3854d050d..d7629e3cb 100644 --- a/dockerfiles/fastapi/Dockerfile +++ b/dockerfiles/fastapi/Dockerfile @@ -5,6 +5,9 @@ COPY shared /shared WORKDIR /app +RUN apt-get -y update +RUN apt-get -y install git + RUN pip install --no-cache-dir -r requirements.txt --upgrade EXPOSE 8000 diff --git a/dockerfiles/tests/Dockerfile b/dockerfiles/tests/Dockerfile index 6789faee6..8cc5572b7 100644 --- a/dockerfiles/tests/Dockerfile +++ b/dockerfiles/tests/Dockerfile @@ -2,6 +2,9 @@ FROM python:3.12-slim WORKDIR /tests +RUN apt-get -y update +RUN apt-get -y install git + COPY requirements.dev.txt . COPY requirements.txt . COPY app/requirements.txt app/ diff --git a/dockerfiles/trustregistry/Dockerfile b/dockerfiles/trustregistry/Dockerfile index aefb5c133..85ef13a68 100644 --- a/dockerfiles/trustregistry/Dockerfile +++ b/dockerfiles/trustregistry/Dockerfile @@ -5,6 +5,9 @@ COPY shared /shared WORKDIR /trustregistry +RUN apt-get -y update +RUN apt-get -y install git + RUN pip install --no-cache-dir -r requirements.txt --upgrade EXPOSE 8001 diff --git a/dockerfiles/webhooks/Dockerfile b/dockerfiles/webhooks/Dockerfile index d88f56461..911ef2504 100644 --- a/dockerfiles/webhooks/Dockerfile +++ b/dockerfiles/webhooks/Dockerfile @@ -5,6 +5,9 @@ COPY shared /shared WORKDIR /webhooks +RUN apt-get -y update +RUN apt-get -y install git + RUN pip install --no-cache-dir -r requirements.txt --upgrade EXPOSE 3010 diff --git a/endorser/requirements.txt b/endorser/requirements.txt index 892e46076..fd9d05f44 100644 --- a/endorser/requirements.txt +++ b/endorser/requirements.txt @@ -1,4 +1,4 @@ -aries-cloudcontroller==0.11.0.post5 +git+https://github.com/didx-xyz/aries-cloudcontroller-python@1d89a9a602e9b9a495648225b0869cd7fb8ccf53 dependency-injector-fork~=4.42.1 # https://github.com/ets-labs/python-dependency-injector/pull/765#issuecomment-1915100744 httpx~=0.27.0 fastapi~=0.111.0 diff --git a/webhooks/requirements.txt b/webhooks/requirements.txt index 140fce530..f741dbe96 100644 --- a/webhooks/requirements.txt +++ b/webhooks/requirements.txt @@ -1,4 +1,4 @@ -aries-cloudcontroller==0.11.0.post5 +git+https://github.com/didx-xyz/aries-cloudcontroller-python@1d89a9a602e9b9a495648225b0869cd7fb8ccf53 dependency-injector-fork~=4.42.1 # https://github.com/ets-labs/python-dependency-injector/pull/765#issuecomment-1915100744 fastapi~=0.111.0 fastapi_websocket_pubsub~=0.3.8 From 218a073e5a20915b1b62ba938d6c611e86c2801b Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 23 Apr 2024 17:44:52 +0200 Subject: [PATCH 06/45] :art: update to new method operation id --- app/routes/wallet/jws.py | 4 ++-- app/routes/wallet/sd_jws.py | 4 ++-- app/services/issuer/acapy_issuer_v2.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/routes/wallet/jws.py b/app/routes/wallet/jws.py index 066d816da..171a74983 100644 --- a/app/routes/wallet/jws.py +++ b/app/routes/wallet/jws.py @@ -51,7 +51,7 @@ async def sign_jws( async with client_from_auth(auth) as aries_controller: jws = await handle_acapy_call( logger=bound_logger, - acapy_call=aries_controller.wallet.wallet_jwt_sign_post, + acapy_call=aries_controller.wallet.sign_jwt, body=sign_request, ) @@ -90,7 +90,7 @@ async def verify_jws( async with client_from_auth(auth) as aries_controller: verify_result = await handle_acapy_call( logger=bound_logger, - acapy_call=aries_controller.wallet.wallet_jwt_verify_post, + acapy_call=aries_controller.wallet.verify_jwt, body=verify_request, ) diff --git a/app/routes/wallet/sd_jws.py b/app/routes/wallet/sd_jws.py index ef765ccf9..3922c545f 100644 --- a/app/routes/wallet/sd_jws.py +++ b/app/routes/wallet/sd_jws.py @@ -52,7 +52,7 @@ async def sign_sd_jws( async with client_from_auth(auth) as aries_controller: sd_jws = await handle_acapy_call( logger=bound_logger, - acapy_call=aries_controller.wallet.wallet_sd_jwt_sign_post, + acapy_call=aries_controller.wallet.sign_sd_jwt, body=sign_request, ) @@ -92,7 +92,7 @@ async def verify_sd_jws( async with client_from_auth(auth) as aries_controller: verify_result = await handle_acapy_call( logger=bound_logger, - acapy_call=aries_controller.wallet.wallet_sd_jwt_verify_post, + acapy_call=aries_controller.wallet.verify_sd_jwt, body=verify_request, ) diff --git a/app/services/issuer/acapy_issuer_v2.py b/app/services/issuer/acapy_issuer_v2.py index 8b716a7f1..b1cc3c7f0 100644 --- a/app/services/issuer/acapy_issuer_v2.py +++ b/app/services/issuer/acapy_issuer_v2.py @@ -119,7 +119,7 @@ async def create_offer( ) record = await handle_acapy_call( logger=bound_logger, - acapy_call=controller.issue_credential_v2_0.issue_credential20_create_offer_post, + acapy_call=controller.issue_credential_v2_0.create_offer, body=request_body, ) From a4383f58f224120b52e2c672e8c60c7eea75f515 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 23 Apr 2024 17:45:02 +0200 Subject: [PATCH 07/45] :art: update models --- app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py | 4 ++-- .../e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py | 4 ++-- app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py | 4 ++-- app/tests/models/test_issuer.py | 4 ++-- app/tests/services/onboarding/test_onboarding.py | 3 +++ 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py index d3f320347..45de3f644 100644 --- a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py +++ b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py @@ -6,7 +6,7 @@ AcaPyClient, Credential, LDProofVCDetail, - LDProofVCDetailOptions, + LDProofVCOptions, ) from assertpy import assert_that from fastapi import HTTPException @@ -45,7 +45,7 @@ issuanceDate="2021-04-12", issuer="", ), - options=LDProofVCDetailOptions(proofType="BbsBlsSignature2020"), + options=LDProofVCOptions(proofType="BbsBlsSignature2020"), ), ).model_dump(by_alias=True, exclude_unset=True) diff --git a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py index 6d7ffe68f..3c319e23d 100644 --- a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py +++ b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py @@ -2,7 +2,7 @@ from copy import deepcopy import pytest -from aries_cloudcontroller import Credential, LDProofVCDetail, LDProofVCDetailOptions +from aries_cloudcontroller import Credential, LDProofVCDetail, LDProofVCOptions from assertpy import assert_that from fastapi import HTTPException @@ -39,7 +39,7 @@ issuanceDate="2021-04-12", issuer="", ), - options=LDProofVCDetailOptions(proofType="Ed25519Signature2018"), + options=LDProofVCOptions(proofType="Ed25519Signature2018"), ), ).model_dump(by_alias=True, exclude_unset=True) diff --git a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py index 5a7b9f65a..178bdd798 100644 --- a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py +++ b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py @@ -6,7 +6,7 @@ AcaPyClient, Credential, LDProofVCDetail, - LDProofVCDetailOptions, + LDProofVCOptions, ) from assertpy import assert_that @@ -43,7 +43,7 @@ issuanceDate="2021-04-12", issuer="", ), - options=LDProofVCDetailOptions(proofType="Ed25519Signature2018"), + options=LDProofVCOptions(proofType="Ed25519Signature2018"), ), ).model_dump(by_alias=True, exclude_unset=True) diff --git a/app/tests/models/test_issuer.py b/app/tests/models/test_issuer.py index ebcc26476..2f84cd42f 100644 --- a/app/tests/models/test_issuer.py +++ b/app/tests/models/test_issuer.py @@ -1,5 +1,5 @@ import pytest -from aries_cloudcontroller import Credential, LDProofVCDetail, LDProofVCDetailOptions +from aries_cloudcontroller import Credential, LDProofVCDetail, LDProofVCOptions from app.models.issuer import CredentialBase, CredentialType, IndyCredential from shared.exceptions.cloudapi_value_error import CloudApiValueError @@ -23,7 +23,7 @@ def test_credential_base_model(): issuer="abc", type=[], ), - options=LDProofVCDetailOptions(proofType="Ed25519Signature2018"), + options=LDProofVCOptions(proofType="Ed25519Signature2018"), ), ) diff --git a/app/tests/services/onboarding/test_onboarding.py b/app/tests/services/onboarding/test_onboarding.py index 28700ac0e..31ff39dce 100644 --- a/app/tests/services/onboarding/test_onboarding.py +++ b/app/tests/services/onboarding/test_onboarding.py @@ -22,6 +22,9 @@ did_object = DID( did="WgWxqztrNooG92RXvxSTWv", verkey="WgWxqztrNooG92RXvxSTWvWgWxqztrNooG92RXvxSTWv", + posture="wallet_only", + key_type="ed25519", + method="sov", ) From c30aa3b52bdd356d32a17c0c166cbd55a73d4470 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 23 Apr 2024 17:45:20 +0200 Subject: [PATCH 08/45] :construction: test on nightly aca-py build --- dockerfiles/agents/Dockerfile | 2 +- dockerfiles/agents/Dockerfile.agent | 2 +- dockerfiles/agents/Dockerfile.author.agent | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dockerfiles/agents/Dockerfile b/dockerfiles/agents/Dockerfile index 86c0ba49d..6902acda8 100644 --- a/dockerfiles/agents/Dockerfile +++ b/dockerfiles/agents/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.0 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-04-20 ADD configuration ./configuration ADD scripts ./scripts diff --git a/dockerfiles/agents/Dockerfile.agent b/dockerfiles/agents/Dockerfile.agent index 74f1d01c5..ec888e820 100644 --- a/dockerfiles/agents/Dockerfile.agent +++ b/dockerfiles/agents/Dockerfile.agent @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.0 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-04-20 USER root # install redis-events plugin diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index 5a7c02951..383df504f 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.0 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-04-20 USER root From f4aad47784807614bd9219a27f592634086540d2 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 23 Apr 2024 17:58:02 +0200 Subject: [PATCH 09/45] :white_check_mark: fix required fields in models --- app/tests/services/onboarding/test_onboarding.py | 2 +- .../services/onboarding/test_register_issuer_did.py | 6 +++--- app/tests/services/test_acapy_wallet.py | 11 +++++++++-- app/tests/services/verifier/test_acapy_verifier_v1.py | 5 ++++- app/tests/services/verifier/test_acapy_verifier_v2.py | 5 ++++- app/tests/services/verifier/test_verifier_utils.py | 2 +- 6 files changed, 22 insertions(+), 9 deletions(-) diff --git a/app/tests/services/onboarding/test_onboarding.py b/app/tests/services/onboarding/test_onboarding.py index 31ff39dce..e16469148 100644 --- a/app/tests/services/onboarding/test_onboarding.py +++ b/app/tests/services/onboarding/test_onboarding.py @@ -42,7 +42,7 @@ async def test_onboard_issuer_public_did_exists( InvitationRecord(invitation=InvitationMessage()) ) when(mock_agent_controller.out_of_band).receive_invitation(...).thenReturn( - ConnRecord() + ConnRecord(connection_id="abc") ) when(acapy_wallet).get_public_did(controller=endorser_controller).thenReturn( diff --git a/app/tests/services/onboarding/test_register_issuer_did.py b/app/tests/services/onboarding/test_register_issuer_did.py index 476a6d116..8bce00a04 100644 --- a/app/tests/services/onboarding/test_register_issuer_did.py +++ b/app/tests/services/onboarding/test_register_issuer_did.py @@ -15,7 +15,7 @@ async def test_wait_endorser_connection_completed_happy_path(): # Mocks logger = MagicMock() endorser_controller = MagicMock() - conn_record = ConnRecord(rfc23_state="completed") + conn_record = ConnRecord(connection_id="abc", rfc23_state="completed") # Configure the mock to return a successful connection state endorser_controller.connection.get_connections = AsyncMock( @@ -42,7 +42,7 @@ async def test_wait_endorser_connection_completed_happy_path(): async def test_wait_endorser_connection_completed_retry_logic(): logger = MagicMock() endorser_controller = MagicMock() - conn_record = ConnRecord(rfc23_state="completed") + conn_record = ConnRecord(connection_id="abc", rfc23_state="completed") # First call raises an exception, second call returns the expected state endorser_controller.connection.get_connections = AsyncMock( @@ -94,7 +94,7 @@ async def test_wait_endorser_connection_completed_max_retries_no_completion(): endorser_controller = MagicMock() # Always return a non-completed state - conn_record = ConnRecord(rfc23_state="not-completed") + conn_record = ConnRecord(connection_id="abc", rfc23_state="not-completed") endorser_controller.connection.get_connections = AsyncMock( return_value=MagicMock(results=[conn_record]) ) diff --git a/app/tests/services/test_acapy_wallet.py b/app/tests/services/test_acapy_wallet.py index 3aec19bc8..8df6d412a 100644 --- a/app/tests/services/test_acapy_wallet.py +++ b/app/tests/services/test_acapy_wallet.py @@ -9,8 +9,15 @@ @pytest.mark.anyio async def test_assert_public_did(mock_agent_controller: AcaPyClient): + did = DID( + did="Ehx3RZSV38pn3MYvxtHhbQ", + verkey="WgWxqztrNooG92RXvxSTWvWgWxqztrNooG92RXvxSTWv", + posture="wallet_only", + key_type="ed25519", + method="sov", + ) when(mock_agent_controller.wallet).get_public_did().thenReturn( - to_async(DIDResult(result=DID(did="Ehx3RZSV38pn3MYvxtHhbQ"))) + to_async(DIDResult(result=did)) ) did = await acapy_wallet.assert_public_did(mock_agent_controller) @@ -18,7 +25,7 @@ async def test_assert_public_did(mock_agent_controller: AcaPyClient): with pytest.raises(CloudApiException, match="Agent has no public did"): when(mock_agent_controller.wallet).get_public_did().thenReturn( - to_async(DIDResult(result=DID())) + to_async(DIDResult(result=None)) ) did = await acapy_wallet.assert_public_did(mock_agent_controller) diff --git a/app/tests/services/verifier/test_acapy_verifier_v1.py b/app/tests/services/verifier/test_acapy_verifier_v1.py index ba9d2f32f..3d4e75709 100644 --- a/app/tests/services/verifier/test_acapy_verifier_v1.py +++ b/app/tests/services/verifier/test_acapy_verifier_v1.py @@ -3,6 +3,7 @@ AcaPyClient, ApiException, DIFProofRequest, + IndyCredInfo, IndyCredPrecis, IndyPresSpec, PresentationDefinition, @@ -363,7 +364,9 @@ async def test_get_credentials_by_proof_id( ): when(mock_agent_controller.present_proof_v1_0).get_matching_credentials( ... - ).thenReturn(to_async([] if empty_result else [IndyCredPrecis()])) + ).thenReturn( + to_async([] if empty_result else [IndyCredPrecis(cred_info=IndyCredInfo())]) + ) creds = await VerifierV1.get_credentials_by_proof_id( controller=mock_agent_controller, proof_id="v1-abc" diff --git a/app/tests/services/verifier/test_acapy_verifier_v2.py b/app/tests/services/verifier/test_acapy_verifier_v2.py index 80bb2490f..7ee271e68 100644 --- a/app/tests/services/verifier/test_acapy_verifier_v2.py +++ b/app/tests/services/verifier/test_acapy_verifier_v2.py @@ -3,6 +3,7 @@ AcaPyClient, ApiException, DIFPresSpec, + IndyCredInfo, IndyCredPrecis, IndyPresSpec, V20PresExRecordList, @@ -442,7 +443,9 @@ async def test_get_credentials_by_proof_id( ): when(mock_agent_controller.present_proof_v2_0).get_matching_credentials( ... - ).thenReturn(to_async([] if empty_result else [IndyCredPrecis()])) + ).thenReturn( + to_async([] if empty_result else [IndyCredPrecis(cred_info=IndyCredInfo())]) + ) creds = await VerifierV2.get_credentials_by_proof_id( controller=mock_agent_controller, proof_id="v2-abc" diff --git a/app/tests/services/verifier/test_verifier_utils.py b/app/tests/services/verifier/test_verifier_utils.py index 21665a081..1a86f71ee 100644 --- a/app/tests/services/verifier/test_verifier_utils.py +++ b/app/tests/services/verifier/test_verifier_utils.py @@ -634,7 +634,7 @@ async def test_assert_valid_prover_x_no_connection_id2( when(mock_agent_controller.connection).get_connection( conn_id="a-connection-id" - ).thenReturn(to_async(ConnRecord(connection_id=None))) + ).thenReturn(to_async(ConnRecord(connection_id=""))) with pytest.raises(CloudApiException, match="Cannot proceed. No connection id."): assert await assert_valid_prover( From f1f9c3f52e283bccc01d6e7c125f9eef3792243b Mon Sep 17 00:00:00 2001 From: ff137 Date: Wed, 24 Apr 2024 00:07:12 +0200 Subject: [PATCH 10/45] :construction: Test fix on ff137:fix/find_oob_target --- docker-compose.yaml | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 9f79f6f16..65bdb560f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -371,21 +371,23 @@ services: image: ${REGISTRY:-local}/governance-multitenant-agent:${IMAGE_TAG:-latest} container_name: governance-multitenant-agent build: - context: . - dockerfile: dockerfiles/agents/Dockerfile.author.agent - # # To run a forked version of the agent use commented out code below - # context: https://github.com/didx-xyz/aries-cloudagent-python.git#add-logging-for-interop-debug - # dockerfile: docker/Dockerfile - # user: root - # entrypoint: - # - sh - # - -c - # - | - # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.5.4 - # aca-py start \ - # -it http "0.0.0.0" "3020" \ - # -e http://governance-multitenant-agent:3020 \ - # --wallet-type askar --auto-promote-author-did --plugin acapy_wallet_groups_plugin + # context: . + # dockerfile: dockerfiles/agents/Dockerfile.author.agent + # # To run a forked version of the agent use commented out code below + context: https://github.com/ff137/aries-cloudagent-python.git#fix/find_oob_target + dockerfile: docker/Dockerfile + user: root + entrypoint: + - sh + - -c + - | + pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@35bec3c705c687d247f674be483a68e4132b49bf + pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events + aca-py start \ + -it http "0.0.0.0" "3020" \ + -e http://governance-multitenant-agent:3020 \ + --wallet-type askar --auto-promote-author-did --plugin acapy_wallet_groups_plugin \ + --plugin redis_events.v1_0.redis_queue.events --plugin-config-value redis_queue.connection.connection_url=\"redis://172.29.0.101:6377\" env_file: - environments/governance-multitenant/aca-py-agent.default.env ports: From deeaf7dfe726a1f90b086ecccd1fa16dc3eef6a3 Mon Sep 17 00:00:00 2001 From: ff137 Date: Wed, 24 Apr 2024 00:07:28 +0200 Subject: [PATCH 11/45] :construction: Use aries-acapy-plugins@v1-2024-04-23 --- dockerfiles/agents/Dockerfile.agent | 2 +- dockerfiles/agents/Dockerfile.author.agent | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dockerfiles/agents/Dockerfile.agent b/dockerfiles/agents/Dockerfile.agent index ec888e820..f2c12024a 100644 --- a/dockerfiles/agents/Dockerfile.agent +++ b/dockerfiles/agents/Dockerfile.agent @@ -2,7 +2,7 @@ FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-04-20 USER root # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@792695b77c4a4f52a6b326ef87a26c918ea15899#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index 383df504f..a7f06e392 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -6,7 +6,7 @@ USER root RUN pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@35bec3c705c687d247f674be483a68e4132b49bf # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@792695b77c4a4f52a6b326ef87a26c918ea15899#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh From 7c8a2b423e7c1dec8ff0171ff87f6af9708fbad2 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 25 Apr 2024 10:40:27 +0200 Subject: [PATCH 12/45] :arrow_up: use latest 0.12.1rc0 image --- dockerfiles/agents/Dockerfile | 2 +- dockerfiles/agents/Dockerfile.agent | 2 +- dockerfiles/agents/Dockerfile.author.agent | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dockerfiles/agents/Dockerfile b/dockerfiles/agents/Dockerfile index 6902acda8..200627526 100644 --- a/dockerfiles/agents/Dockerfile +++ b/dockerfiles/agents/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-04-20 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1rc0 ADD configuration ./configuration ADD scripts ./scripts diff --git a/dockerfiles/agents/Dockerfile.agent b/dockerfiles/agents/Dockerfile.agent index f2c12024a..ac2ad43cf 100644 --- a/dockerfiles/agents/Dockerfile.agent +++ b/dockerfiles/agents/Dockerfile.agent @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-04-20 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1rc0 USER root # install redis-events plugin diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index a7f06e392..7e13e77b6 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-04-20 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1rc0 USER root From 8d323ea4cc6dad0dcf57b38d06bffb0aed8fd6f0 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 25 Apr 2024 10:40:43 +0200 Subject: [PATCH 13/45] :rewind: revert testing with forked aca-py --- docker-compose.yaml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 65bdb560f..9bab7cf54 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -371,23 +371,23 @@ services: image: ${REGISTRY:-local}/governance-multitenant-agent:${IMAGE_TAG:-latest} container_name: governance-multitenant-agent build: - # context: . - # dockerfile: dockerfiles/agents/Dockerfile.author.agent + context: . + dockerfile: dockerfiles/agents/Dockerfile.author.agent # # To run a forked version of the agent use commented out code below - context: https://github.com/ff137/aries-cloudagent-python.git#fix/find_oob_target - dockerfile: docker/Dockerfile - user: root - entrypoint: - - sh - - -c - - | - pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@35bec3c705c687d247f674be483a68e4132b49bf - pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events - aca-py start \ - -it http "0.0.0.0" "3020" \ - -e http://governance-multitenant-agent:3020 \ - --wallet-type askar --auto-promote-author-did --plugin acapy_wallet_groups_plugin \ - --plugin redis_events.v1_0.redis_queue.events --plugin-config-value redis_queue.connection.connection_url=\"redis://172.29.0.101:6377\" + # context: https://github.com/ff137/aries-cloudagent-python.git#fix/find_oob_target + # dockerfile: docker/Dockerfile + # user: root + # entrypoint: + # - sh + # - -c + # - | + # pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@35bec3c705c687d247f674be483a68e4132b49bf + # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events + # aca-py start \ + # -it http "0.0.0.0" "3020" \ + # -e http://governance-multitenant-agent:3020 \ + # --wallet-type askar --auto-promote-author-did --plugin acapy_wallet_groups_plugin \ + # --plugin redis_events.v1_0.redis_queue.events --plugin-config-value redis_queue.connection.connection_url=\"redis://172.29.0.101:6377\" env_file: - environments/governance-multitenant/aca-py-agent.default.env ports: From c09d273d1c047d4f769ee6ff014e38a4a62e9014 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 25 Apr 2024 11:45:58 +0200 Subject: [PATCH 14/45] :arrow_up: Use acapy-wallet-groups-plugin with 0.12.1rc0 --- dockerfiles/agents/Dockerfile.author.agent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index 7e13e77b6..4b35fd751 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -3,7 +3,7 @@ FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1rc0 USER root # Install wallet group id plugin -RUN pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@35bec3c705c687d247f674be483a68e4132b49bf +RUN pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@9c3f889d7905691d7bf9e400926d866c7363b859 # install redis-events plugin RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events From 9d627af6070dc2a825a5dd95b5c18a6bc1644a3f Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 25 Apr 2024 12:45:02 +0200 Subject: [PATCH 15/45] :arrow_up: use latest acapy-wallet-groups-plugin --- docker-compose.yaml | 2 +- dockerfiles/agents/Dockerfile.author.agent | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 9bab7cf54..8bcda2cdb 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -381,7 +381,7 @@ services: # - sh # - -c # - | - # pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@35bec3c705c687d247f674be483a68e4132b49bf + # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1rc0 # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events # aca-py start \ # -it http "0.0.0.0" "3020" \ diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index 4b35fd751..dac0f95bc 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -3,7 +3,7 @@ FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1rc0 USER root # Install wallet group id plugin -RUN pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@9c3f889d7905691d7bf9e400926d866c7363b859 +RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1rc0 # install redis-events plugin RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events From 399957abe07ddc32a9927bb0a85cbbcc5a372a47 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 25 Apr 2024 13:44:31 +0200 Subject: [PATCH 16/45] :arrow_up: use latest cloudcontroller --- app/requirements.txt | 2 +- endorser/requirements.txt | 2 +- webhooks/requirements.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/requirements.txt b/app/requirements.txt index 13522f0e7..7f1b74ed3 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -1,5 +1,5 @@ aiohttp~=3.9.2 -git+https://github.com/didx-xyz/aries-cloudcontroller-python@1d89a9a602e9b9a495648225b0869cd7fb8ccf53 +aries-cloudcontroller==0.12.0 base58~=2.1.1 fastapi~=0.111.0 fastapi_websocket_pubsub~=0.3.8 diff --git a/endorser/requirements.txt b/endorser/requirements.txt index fd9d05f44..906fe893e 100644 --- a/endorser/requirements.txt +++ b/endorser/requirements.txt @@ -1,4 +1,4 @@ -git+https://github.com/didx-xyz/aries-cloudcontroller-python@1d89a9a602e9b9a495648225b0869cd7fb8ccf53 +aries-cloudcontroller==0.12.0 dependency-injector-fork~=4.42.1 # https://github.com/ets-labs/python-dependency-injector/pull/765#issuecomment-1915100744 httpx~=0.27.0 fastapi~=0.111.0 diff --git a/webhooks/requirements.txt b/webhooks/requirements.txt index f741dbe96..a9a1d4c15 100644 --- a/webhooks/requirements.txt +++ b/webhooks/requirements.txt @@ -1,4 +1,4 @@ -git+https://github.com/didx-xyz/aries-cloudcontroller-python@1d89a9a602e9b9a495648225b0869cd7fb8ccf53 +aries-cloudcontroller==0.12.0 dependency-injector-fork~=4.42.1 # https://github.com/ets-labs/python-dependency-injector/pull/765#issuecomment-1915100744 fastapi~=0.111.0 fastapi_websocket_pubsub~=0.3.8 From 36ce1c37c9aa1427e3831e17484071e952bc12e9 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 25 Apr 2024 13:45:17 +0200 Subject: [PATCH 17/45] :rewind: Revert git install --- dockerfiles/endorser/Dockerfile | 3 --- dockerfiles/fastapi/Dockerfile | 3 --- dockerfiles/tests/Dockerfile | 3 --- dockerfiles/trustregistry/Dockerfile | 3 --- dockerfiles/webhooks/Dockerfile | 3 --- 5 files changed, 15 deletions(-) diff --git a/dockerfiles/endorser/Dockerfile b/dockerfiles/endorser/Dockerfile index 973090064..8026f320f 100644 --- a/dockerfiles/endorser/Dockerfile +++ b/dockerfiles/endorser/Dockerfile @@ -5,9 +5,6 @@ COPY shared /shared WORKDIR /endorser -RUN apt-get -y update -RUN apt-get -y install git - RUN pip install --no-cache-dir -r requirements.txt -r requirements.dev.txt --upgrade EXPOSE 3009 diff --git a/dockerfiles/fastapi/Dockerfile b/dockerfiles/fastapi/Dockerfile index d7629e3cb..3854d050d 100644 --- a/dockerfiles/fastapi/Dockerfile +++ b/dockerfiles/fastapi/Dockerfile @@ -5,9 +5,6 @@ COPY shared /shared WORKDIR /app -RUN apt-get -y update -RUN apt-get -y install git - RUN pip install --no-cache-dir -r requirements.txt --upgrade EXPOSE 8000 diff --git a/dockerfiles/tests/Dockerfile b/dockerfiles/tests/Dockerfile index 8cc5572b7..6789faee6 100644 --- a/dockerfiles/tests/Dockerfile +++ b/dockerfiles/tests/Dockerfile @@ -2,9 +2,6 @@ FROM python:3.12-slim WORKDIR /tests -RUN apt-get -y update -RUN apt-get -y install git - COPY requirements.dev.txt . COPY requirements.txt . COPY app/requirements.txt app/ diff --git a/dockerfiles/trustregistry/Dockerfile b/dockerfiles/trustregistry/Dockerfile index 85ef13a68..aefb5c133 100644 --- a/dockerfiles/trustregistry/Dockerfile +++ b/dockerfiles/trustregistry/Dockerfile @@ -5,9 +5,6 @@ COPY shared /shared WORKDIR /trustregistry -RUN apt-get -y update -RUN apt-get -y install git - RUN pip install --no-cache-dir -r requirements.txt --upgrade EXPOSE 8001 diff --git a/dockerfiles/webhooks/Dockerfile b/dockerfiles/webhooks/Dockerfile index 911ef2504..d88f56461 100644 --- a/dockerfiles/webhooks/Dockerfile +++ b/dockerfiles/webhooks/Dockerfile @@ -5,9 +5,6 @@ COPY shared /shared WORKDIR /webhooks -RUN apt-get -y update -RUN apt-get -y install git - RUN pip install --no-cache-dir -r requirements.txt --upgrade EXPOSE 3010 From 8b95c63f3051d47d2465783f11838e76660e9d46 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 9 May 2024 15:59:27 +0300 Subject: [PATCH 18/45] :arrow_up: Upgrade to 0.12.1 --- app/main.py | 2 +- app/requirements.txt | 2 +- docker-compose.yaml | 2 +- dockerfiles/agents/Dockerfile | 2 +- dockerfiles/agents/Dockerfile.agent | 2 +- dockerfiles/agents/Dockerfile.author.agent | 4 ++-- endorser/main.py | 2 +- endorser/requirements.txt | 2 +- trustregistry/main.py | 2 +- webhooks/requirements.txt | 2 +- webhooks/web/main.py | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/main.py b/app/main.py index 1c472922e..3accf2b00 100644 --- a/app/main.py +++ b/app/main.py @@ -35,7 +35,7 @@ from shared.log_config import get_logger OPENAPI_NAME = os.getenv("OPENAPI_NAME", "OpenAPI") -PROJECT_VERSION = os.getenv("PROJECT_VERSION", "0.12.0") +PROJECT_VERSION = os.getenv("PROJECT_VERSION", "0.12.1") ROLE = os.getenv("ROLE", "*") ROOT_PATH = os.getenv("ROOT_PATH", "") diff --git a/app/requirements.txt b/app/requirements.txt index 7f1b74ed3..3829c5f4d 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -1,5 +1,5 @@ aiohttp~=3.9.2 -aries-cloudcontroller==0.12.0 +aries-cloudcontroller==0.12.1 base58~=2.1.1 fastapi~=0.111.0 fastapi_websocket_pubsub~=0.3.8 diff --git a/docker-compose.yaml b/docker-compose.yaml index 8bcda2cdb..35663518d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -381,7 +381,7 @@ services: # - sh # - -c # - | - # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1rc0 + # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events # aca-py start \ # -it http "0.0.0.0" "3020" \ diff --git a/dockerfiles/agents/Dockerfile b/dockerfiles/agents/Dockerfile index 200627526..be525aa3c 100644 --- a/dockerfiles/agents/Dockerfile +++ b/dockerfiles/agents/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1rc0 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1 ADD configuration ./configuration ADD scripts ./scripts diff --git a/dockerfiles/agents/Dockerfile.agent b/dockerfiles/agents/Dockerfile.agent index ac2ad43cf..a121a3aee 100644 --- a/dockerfiles/agents/Dockerfile.agent +++ b/dockerfiles/agents/Dockerfile.agent @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1rc0 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1 USER root # install redis-events plugin diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index dac0f95bc..cf5678ba7 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -1,9 +1,9 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1rc0 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1 USER root # Install wallet group id plugin -RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1rc0 +RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 # install redis-events plugin RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events diff --git a/endorser/main.py b/endorser/main.py index d3430beec..7e73f1aa7 100644 --- a/endorser/main.py +++ b/endorser/main.py @@ -35,7 +35,7 @@ async def app_lifespan(_: FastAPI): def create_app() -> FastAPI: openapi_name = os.getenv("OPENAPI_NAME", "Aries Cloud API: Endorser Service") - project_version = os.getenv("PROJECT_VERSION", "0.12.0") + project_version = os.getenv("PROJECT_VERSION", "0.12.1") application = FastAPI( title=openapi_name, diff --git a/endorser/requirements.txt b/endorser/requirements.txt index 906fe893e..1288f1047 100644 --- a/endorser/requirements.txt +++ b/endorser/requirements.txt @@ -1,4 +1,4 @@ -aries-cloudcontroller==0.12.0 +aries-cloudcontroller==0.12.1 dependency-injector-fork~=4.42.1 # https://github.com/ets-labs/python-dependency-injector/pull/765#issuecomment-1915100744 httpx~=0.27.0 fastapi~=0.111.0 diff --git a/trustregistry/main.py b/trustregistry/main.py index 7145432b0..aef04005a 100644 --- a/trustregistry/main.py +++ b/trustregistry/main.py @@ -14,7 +14,7 @@ logger = get_logger(__name__) OPENAPI_NAME = os.getenv("OPENAPI_NAME", "Trust Registry") -PROJECT_VERSION = os.getenv("PROJECT_VERSION", "0.12.0") +PROJECT_VERSION = os.getenv("PROJECT_VERSION", "0.12.1") ROOT_PATH = os.getenv("ROOT_PATH", "") diff --git a/webhooks/requirements.txt b/webhooks/requirements.txt index a9a1d4c15..0ce76018a 100644 --- a/webhooks/requirements.txt +++ b/webhooks/requirements.txt @@ -1,4 +1,4 @@ -aries-cloudcontroller==0.12.0 +aries-cloudcontroller==0.12.1 dependency-injector-fork~=4.42.1 # https://github.com/ets-labs/python-dependency-injector/pull/765#issuecomment-1915100744 fastapi~=0.111.0 fastapi_websocket_pubsub~=0.3.8 diff --git a/webhooks/web/main.py b/webhooks/web/main.py index 2a2423b32..c25aa8801 100644 --- a/webhooks/web/main.py +++ b/webhooks/web/main.py @@ -46,7 +46,7 @@ def create_app() -> FastAPI: openapi_name = os.getenv( "OPENAPI_NAME", "Aries Cloud API: Webhooks and Server-Sent Events" ) - project_version = os.getenv("PROJECT_VERSION", "0.12.0") + project_version = os.getenv("PROJECT_VERSION", "0.12.1") application = FastAPI( title=openapi_name, From ed5269f0328e62a1f7ab64d96bb7a6842a2b903e Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 9 May 2024 16:11:06 +0300 Subject: [PATCH 19/45] :art: deduplicate project version --- app/main.py | 2 +- endorser/main.py | 4 ++-- shared/constants.py | 4 ++++ trustregistry/main.py | 2 +- webhooks/web/main.py | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/main.py b/app/main.py index 3accf2b00..8fd90c6ac 100644 --- a/app/main.py +++ b/app/main.py @@ -31,11 +31,11 @@ from app.routes.wallet import sd_jws as wallet_sd_jws from app.services.event_handling.websocket_manager import WebsocketManager from app.util.extract_validation_error import extract_validation_error_msg +from shared.constants import PROJECT_VERSION from shared.exceptions import CloudApiValueError from shared.log_config import get_logger OPENAPI_NAME = os.getenv("OPENAPI_NAME", "OpenAPI") -PROJECT_VERSION = os.getenv("PROJECT_VERSION", "0.12.1") ROLE = os.getenv("ROLE", "*") ROOT_PATH = os.getenv("ROOT_PATH", "") diff --git a/endorser/main.py b/endorser/main.py index 7e73f1aa7..802e7bfcf 100644 --- a/endorser/main.py +++ b/endorser/main.py @@ -6,6 +6,7 @@ from endorser.services.dependency_injection.container import Container from endorser.services.endorsement_processor import EndorsementProcessor +from shared.constants import PROJECT_VERSION from shared.log_config import get_logger logger = get_logger(__name__) @@ -35,11 +36,10 @@ async def app_lifespan(_: FastAPI): def create_app() -> FastAPI: openapi_name = os.getenv("OPENAPI_NAME", "Aries Cloud API: Endorser Service") - project_version = os.getenv("PROJECT_VERSION", "0.12.1") application = FastAPI( title=openapi_name, - version=project_version, + version=PROJECT_VERSION, lifespan=app_lifespan, ) diff --git a/shared/constants.py b/shared/constants.py index 6e8fbb012..c74ec6609 100644 --- a/shared/constants.py +++ b/shared/constants.py @@ -4,6 +4,10 @@ url = f"http://{host}" adminApiKey = "adminApiKey" +# pylint: disable=invalid-name + +PROJECT_VERSION = os.getenv("PROJECT_VERSION", "0.12.1") + # the ACAPY_LABEL field with which the governance agent is initialised GOVERNANCE_LABEL = os.getenv("GOVERNANCE_ACAPY_LABEL", "Governance").lower() diff --git a/trustregistry/main.py b/trustregistry/main.py index aef04005a..9e5d96fea 100644 --- a/trustregistry/main.py +++ b/trustregistry/main.py @@ -5,6 +5,7 @@ from sqlalchemy import inspect from sqlalchemy.orm import Session +from shared.constants import PROJECT_VERSION from shared.log_config import get_logger from trustregistry import crud, db from trustregistry.database import engine @@ -14,7 +15,6 @@ logger = get_logger(__name__) OPENAPI_NAME = os.getenv("OPENAPI_NAME", "Trust Registry") -PROJECT_VERSION = os.getenv("PROJECT_VERSION", "0.12.1") ROOT_PATH = os.getenv("ROOT_PATH", "") diff --git a/webhooks/web/main.py b/webhooks/web/main.py index c25aa8801..b35ce0d08 100644 --- a/webhooks/web/main.py +++ b/webhooks/web/main.py @@ -4,6 +4,7 @@ from dependency_injector.wiring import Provide, inject from fastapi import Depends, FastAPI, HTTPException +from shared.constants import PROJECT_VERSION from shared.log_config import get_logger from webhooks.services.acapy_events_processor import AcaPyEventsProcessor from webhooks.services.billing_manager import BillingManager @@ -46,7 +47,6 @@ def create_app() -> FastAPI: openapi_name = os.getenv( "OPENAPI_NAME", "Aries Cloud API: Webhooks and Server-Sent Events" ) - project_version = os.getenv("PROJECT_VERSION", "0.12.1") application = FastAPI( title=openapi_name, @@ -56,7 +56,7 @@ def create_app() -> FastAPI: It supports filtering and forwarding events to subscribers based on topic and wallet ID, as well as handling Server-Sent Events (SSE) for real-time communication with clients. """, - version=project_version, + version=PROJECT_VERSION, lifespan=app_lifespan, ) From b3afe0cf4b77189433272b4e6b182aff9f323671 Mon Sep 17 00:00:00 2001 From: ff137 Date: Fri, 10 May 2024 15:46:35 +0300 Subject: [PATCH 20/45] :arrow_up: Use latest redis-events plugin for 0.12.1 --- docker-compose.yaml | 2 +- dockerfiles/agents/Dockerfile.agent | 2 +- dockerfiles/agents/Dockerfile.author.agent | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 35663518d..9762f452a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -382,7 +382,7 @@ services: # - -c # - | # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 - # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events + # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events # aca-py start \ # -it http "0.0.0.0" "3020" \ # -e http://governance-multitenant-agent:3020 \ diff --git a/dockerfiles/agents/Dockerfile.agent b/dockerfiles/agents/Dockerfile.agent index a121a3aee..2bdbffc90 100644 --- a/dockerfiles/agents/Dockerfile.agent +++ b/dockerfiles/agents/Dockerfile.agent @@ -2,7 +2,7 @@ FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1 USER root # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index cf5678ba7..47ef1555f 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -6,7 +6,7 @@ USER root RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-04-23#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh From 444c9ecccab77f1a08d3ac76e5d0fed9220ebf81 Mon Sep 17 00:00:00 2001 From: ff137 Date: Wed, 22 May 2024 00:21:08 +0300 Subject: [PATCH 21/45] =?UTF-8?q?=E2=9C=A8=20publishing=20pending=20revoca?= =?UTF-8?q?tions=20should=20wait=20and=20assert=20transaction=20has=20been?= =?UTF-8?q?=20acked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/routes/issuer.py | 24 ++++++++++++++++++- app/services/revocation_registry.py | 16 +++++++++---- .../services/test_revocation_registry.py | 12 +++++++++- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/app/routes/issuer.py b/app/routes/issuer.py index faf77930e..9600a7375 100644 --- a/app/routes/issuer.py +++ b/app/routes/issuer.py @@ -1,3 +1,4 @@ +import asyncio from typing import List, Optional from uuid import UUID @@ -26,6 +27,7 @@ issuer_from_protocol_version, ) from app.util.did import did_from_credential_definition_id, qualified_did_sov +from app.util.retry_method import coroutine_with_retry_until_value from shared.log_config import get_logger from shared.models.credential_exchange import ( CredentialExchange, @@ -661,11 +663,31 @@ async def publish_revocations( async with client_from_auth(auth) as aries_controller: bound_logger.debug("Publishing revocations") - await revocation_registry.publish_pending_revocations( + endorser_transaction_id = await revocation_registry.publish_pending_revocations( controller=aries_controller, revocation_registry_credential_map=publish_request.revocation_registry_credential_map, ) + bound_logger.debug( + "Wait for publish complete on transaction id: {}", endorser_transaction_id + ) + try: + # Wait for transaction to be acknowledged and written to the ledger + await coroutine_with_retry_until_value( + coroutine_func=aries_controller.endorse_transaction.get_transaction, + args=(endorser_transaction_id,), + field_name="state", + expected_value="transaction_acked", + logger=bound_logger, + max_attempts=10, + retry_delay=2, + ) + except asyncio.TimeoutError as e: + raise CloudApiException( + "Timeout waiting for endorser to accept the revocations request.", + 504, + ) from e + bound_logger.info("Successfully published revocations.") diff --git a/app/services/revocation_registry.py b/app/services/revocation_registry.py index 224625350..db0ed7855 100644 --- a/app/services/revocation_registry.py +++ b/app/services/revocation_registry.py @@ -117,7 +117,7 @@ async def revoke_credential( async def publish_pending_revocations( controller: AcaPyClient, revocation_registry_credential_map: Dict[str, List[str]] -) -> None: +) -> str: """ Publish pending revocations @@ -130,7 +130,7 @@ async def publish_pending_revocations( Exception: When the pending revocations could not be published Returns: - result (None): Successful execution returns None. + result (str): Successful execution returns the endorser transaction id. """ bound_logger = logger.bind(body=revocation_registry_credential_map) @@ -141,7 +141,7 @@ async def publish_pending_revocations( ) try: - await handle_acapy_call( + result = await handle_acapy_call( logger=bound_logger, acapy_call=controller.revocation.publish_revocations, body=PublishRevocations(rrid2crid=revocation_registry_credential_map), @@ -151,7 +151,15 @@ async def publish_pending_revocations( f"Failed to publish pending revocations: {e.detail}.", e.status_code ) from e - bound_logger.info("Successfully published pending revocations.") + if not result.txn or not result.txn.transaction_id: + raise CloudApiException("Failed to publish pending revocations.", 500) + + endorse_transaction_id = result.txn.transaction_id + bound_logger.info( + "Successfully published pending revocations. Endorser transaction id: {}.", + endorse_transaction_id, + ) + return endorse_transaction_id async def clear_pending_revocations( diff --git a/app/tests/services/test_revocation_registry.py b/app/tests/services/test_revocation_registry.py index e2e2b91d5..ef574d58d 100644 --- a/app/tests/services/test_revocation_registry.py +++ b/app/tests/services/test_revocation_registry.py @@ -11,6 +11,8 @@ PublishRevocations, RevokeRequest, RevRegResult, + TransactionRecord, + TxnOrPublishRevocationsResult, V10CredentialExchange, V20CredExRecordDetail, V20CredExRecordIndy, @@ -115,7 +117,15 @@ async def test_publish_pending_revocations_success(mock_agent_controller: AcaPyC # Simulate successful publish revocations call when(mock_agent_controller.revocation).publish_revocations( body=PublishRevocations(rrid2crid=revocation_registry_credential_map) - ).thenReturn(to_async()) + ).thenReturn( + to_async( + TxnOrPublishRevocationsResult( + txn=TransactionRecord( + transaction_id="97a46fab-5499-42b3-a2a1-7eb9faad31c0" + ) + ) + ) + ) await rg.publish_pending_revocations( controller=mock_agent_controller, From a0d4771eb4c0af0e41f9c08d32c1c5a4800f72f7 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 23 May 2024 09:54:12 +0200 Subject: [PATCH 22/45] :art: --- app/services/revocation_registry.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/services/revocation_registry.py b/app/services/revocation_registry.py index db0ed7855..910443717 100644 --- a/app/services/revocation_registry.py +++ b/app/services/revocation_registry.py @@ -134,12 +134,10 @@ async def publish_pending_revocations( """ bound_logger = logger.bind(body=revocation_registry_credential_map) - bound_logger.info("Validating revocation registry ids") await validate_rev_reg_ids( controller=controller, revocation_registry_credential_map=revocation_registry_credential_map, ) - try: result = await handle_acapy_call( logger=bound_logger, @@ -347,12 +345,13 @@ async def validate_rev_reg_ids( """ bound_logger = logger.bind(body=revocation_registry_credential_map) - bound_logger.info("Validating revocation registry ids") rev_reg_id_list = list(revocation_registry_credential_map.keys()) if not rev_reg_id_list: return + bound_logger.info("Validating revocation registry ids") + for rev_reg_id in rev_reg_id_list: try: rev_reg_result = await handle_acapy_call( From 7293ade413c5099950f1ef489b4014819ffd9825 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 23 May 2024 09:54:33 +0200 Subject: [PATCH 23/45] :art: optionally return the transaction id for a publish revocations request --- app/services/revocation_registry.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/services/revocation_registry.py b/app/services/revocation_registry.py index 910443717..a7a07c5ac 100644 --- a/app/services/revocation_registry.py +++ b/app/services/revocation_registry.py @@ -117,7 +117,7 @@ async def revoke_credential( async def publish_pending_revocations( controller: AcaPyClient, revocation_registry_credential_map: Dict[str, List[str]] -) -> str: +) -> Optional[str]: """ Publish pending revocations @@ -150,7 +150,11 @@ async def publish_pending_revocations( ) from e if not result.txn or not result.txn.transaction_id: - raise CloudApiException("Failed to publish pending revocations.", 500) + bound_logger.warning( + "Published pending revocations but received no endorser transaction id. Got result: {}", + result, + ) + return endorse_transaction_id = result.txn.transaction_id bound_logger.info( From e2c1f618429ef7f0332c0e825d0150a48aa35ffd Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 23 May 2024 09:54:53 +0200 Subject: [PATCH 24/45] :art: only wait if transaction id returned --- app/routes/issuer.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/app/routes/issuer.py b/app/routes/issuer.py index 9600a7375..68547160d 100644 --- a/app/routes/issuer.py +++ b/app/routes/issuer.py @@ -668,25 +668,27 @@ async def publish_revocations( revocation_registry_credential_map=publish_request.revocation_registry_credential_map, ) - bound_logger.debug( - "Wait for publish complete on transaction id: {}", endorser_transaction_id - ) - try: - # Wait for transaction to be acknowledged and written to the ledger - await coroutine_with_retry_until_value( - coroutine_func=aries_controller.endorse_transaction.get_transaction, - args=(endorser_transaction_id,), - field_name="state", - expected_value="transaction_acked", - logger=bound_logger, - max_attempts=10, - retry_delay=2, + if endorser_transaction_id: + bound_logger.debug( + "Wait for publish complete on transaction id: {}", + endorser_transaction_id, ) - except asyncio.TimeoutError as e: - raise CloudApiException( - "Timeout waiting for endorser to accept the revocations request.", - 504, - ) from e + try: + # Wait for transaction to be acknowledged and written to the ledger + await coroutine_with_retry_until_value( + coroutine_func=aries_controller.endorse_transaction.get_transaction, + args=(endorser_transaction_id,), + field_name="state", + expected_value="transaction_acked", + logger=bound_logger, + max_attempts=10, + retry_delay=2, + ) + except asyncio.TimeoutError as e: + raise CloudApiException( + "Timeout waiting for endorser to accept the revocations request.", + 504, + ) from e bound_logger.info("Successfully published revocations.") From 2f896c700fcd1a123ca274ec5bf352d629578c15 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 23 May 2024 09:55:15 +0200 Subject: [PATCH 25/45] :construction: test with forked acapy --- docker-compose.yaml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 9762f452a..773d2d5c2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -371,23 +371,23 @@ services: image: ${REGISTRY:-local}/governance-multitenant-agent:${IMAGE_TAG:-latest} container_name: governance-multitenant-agent build: - context: . - dockerfile: dockerfiles/agents/Dockerfile.author.agent + # context: . + # dockerfile: dockerfiles/agents/Dockerfile.author.agent # # To run a forked version of the agent use commented out code below - # context: https://github.com/ff137/aries-cloudagent-python.git#fix/find_oob_target - # dockerfile: docker/Dockerfile - # user: root - # entrypoint: - # - sh - # - -c - # - | - # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 - # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events - # aca-py start \ - # -it http "0.0.0.0" "3020" \ - # -e http://governance-multitenant-agent:3020 \ - # --wallet-type askar --auto-promote-author-did --plugin acapy_wallet_groups_plugin \ - # --plugin redis_events.v1_0.redis_queue.events --plugin-config-value redis_queue.connection.connection_url=\"redis://172.29.0.101:6377\" + context: https://github.com/ff137/aries-cloudagent-python.git#fix/publish-revocations-response + dockerfile: docker/Dockerfile + user: root + entrypoint: + - sh + - -c + - | + pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 + pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events + aca-py start \ + -it http "0.0.0.0" "3020" \ + -e http://governance-multitenant-agent:3020 \ + --wallet-type askar --auto-promote-author-did --plugin acapy_wallet_groups_plugin \ + --plugin redis_events.v1_0.redis_queue.events --plugin-config-value redis_queue.connection.connection_url=\"redis://172.29.0.101:6377\" env_file: - environments/governance-multitenant/aca-py-agent.default.env ports: From 9ad42186eb49db08db7d56d860360d46804b9be5 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 23 May 2024 11:40:30 +0300 Subject: [PATCH 26/45] :art: publish-revocations only needs to be called once --- app/tests/fixtures/credentials.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/tests/fixtures/credentials.py b/app/tests/fixtures/credentials.py index 6c4c52ce2..d90fa71a9 100644 --- a/app/tests/fixtures/credentials.py +++ b/app/tests/fixtures/credentials.py @@ -245,13 +245,12 @@ async def revoke_alice_creds_and_publish( ) if not auto_publish: - for cred in issue_alice_creds: - await faber_client.post( - f"{CREDENTIALS_BASE_PATH}/publish-revocations", - json={ - "revocation_registry_credential_map": {}, - }, - ) + await faber_client.post( + f"{CREDENTIALS_BASE_PATH}/publish-revocations", + json={ + "revocation_registry_credential_map": {}, + }, + ) return issue_alice_creds From d2cf7c7e00a60a3990e7e2c8623edd313306e3df Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 23 May 2024 12:48:07 +0300 Subject: [PATCH 27/45] :sparkles: the beginnings of asserting that auto_publish revocation request is indeed revoked --- app/services/revocation_registry.py | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/app/services/revocation_registry.py b/app/services/revocation_registry.py index a7a07c5ac..47b4c4490 100644 --- a/app/services/revocation_registry.py +++ b/app/services/revocation_registry.py @@ -19,6 +19,7 @@ ) from app.models.issuer import ClearPendingRevocationsResult from app.util.credentials import strip_protocol_prefix +from app.util.retry_method import coroutine_with_retry from shared.log_config import get_logger logger = get_logger(__name__) @@ -112,6 +113,37 @@ async def revoke_credential( f"Failed to revoke credential: {e.detail}.", e.status_code ) from e + if auto_publish_to_ledger: + bound_logger.debug("Wait for publish complete") + + revoked = False + max_tries = 5 + retry_delay = 1 + n_try = 0 + while not revoked and n_try < max_tries: + n_try += 1 + # Safely fetch revocation record and check if change reflected + record = await coroutine_with_retry( + coroutine_func=controller.revocation.get_revocation_status, + args=(strip_protocol_prefix(credential_exchange_id),), + logger=bound_logger, + max_attempts=5, + retry_delay=0.5, + ) + # Todo: this record state can be "revoked" before it's been endorsed + if record.result: + revoked = record.result.state == "revoked" + + if not revoked and n_try < max_tries: + bound_logger.debug("Not yet revoked, waiting ...") + await asyncio.sleep(retry_delay) + + if not revoked: + raise CloudApiException( + "Could not assert that revocation was published within timeout. " + "Please check the revocation record state and retry if not revoked." + ) + bound_logger.info("Successfully revoked credential.") From 77b2cf1304bb22d558b6459885bab077b160016e Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 23 May 2024 12:48:42 +0300 Subject: [PATCH 28/45] :white_check_mark: use empty non_revoked request to check if cred is revoked at time of proof, instead of time of acme creating proof request --- app/tests/e2e/verifier/test_proof_revoked_credential.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/tests/e2e/verifier/test_proof_revoked_credential.py b/app/tests/e2e/verifier/test_proof_revoked_credential.py index cdbd18f00..e6413dae2 100644 --- a/app/tests/e2e/verifier/test_proof_revoked_credential.py +++ b/app/tests/e2e/verifier/test_proof_revoked_credential.py @@ -36,9 +36,6 @@ async def test_proof_revoked_credential( acme_and_alice_connection: AcmeAliceConnect, protocol_version: str, ): - # Get current time - unix_timestamp = int(time.time()) - # Do proof request request_body = { "protocol_version": protocol_version, @@ -47,7 +44,7 @@ async def test_proof_revoked_credential( "indy_proof_request": { "name": "Proof of SPEED", "version": "1.0", - "non_revoked": {"to": unix_timestamp}, + "non_revoked": {}, # Empty means it must be non_revoked at time of proof "requested_attributes": { "THE_SPEED": { "name": "speed", From 5074159071222c4d13d6994d74525ebbb68387ab Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 23 May 2024 12:51:05 +0300 Subject: [PATCH 29/45] :art: modify `non_revoked` requests to be empty --- .../verifier/test_proof_revoked_credential.py | 2 +- app/tests/e2e/verifier/test_verifier.py | 3 +- app/tests/services/verifier/utils.py | 2 +- docs/Common Steps.md | 32 +++++++------------ 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/app/tests/e2e/verifier/test_proof_revoked_credential.py b/app/tests/e2e/verifier/test_proof_revoked_credential.py index e6413dae2..89b2eba18 100644 --- a/app/tests/e2e/verifier/test_proof_revoked_credential.py +++ b/app/tests/e2e/verifier/test_proof_revoked_credential.py @@ -148,7 +148,7 @@ async def test_regression_proof_revoked_credential( "comment": "Test proof of revocation", "type": "indy", "indy_proof_request": { - "non_revoked": {"to": unix_timestamp}, + "non_revoked": {}, # Empty means it must be non_revoked at time of proof "requested_attributes": { "THE_SPEED": { "name": "speed", diff --git a/app/tests/e2e/verifier/test_verifier.py b/app/tests/e2e/verifier/test_verifier.py index 3ca0dbbb9..8748f8fb9 100644 --- a/app/tests/e2e/verifier/test_verifier.py +++ b/app/tests/e2e/verifier/test_verifier.py @@ -680,7 +680,6 @@ async def test_regression_proof_valid_credential( alice_member_client: RichAsyncClient, acme_and_alice_connection: AcmeAliceConnect, ): - unix_timestamp = int(time.time()) referent = get_or_issue_regression_cred_valid.referent credential_definition_id_revocable = ( get_or_issue_regression_cred_valid.cred_def_revocable @@ -692,7 +691,7 @@ async def test_regression_proof_valid_credential( "comment": "Test cred is not revoked", "type": "indy", "indy_proof_request": { - "non_revoked": {"to": unix_timestamp}, + "non_revoked": {}, # Empty means it must be non_revoked at time of proof "requested_attributes": { "THE_SPEED": { "name": "speed", diff --git a/app/tests/services/verifier/utils.py b/app/tests/services/verifier/utils.py index fa4c2ff2c..9e9a63f41 100644 --- a/app/tests/services/verifier/utils.py +++ b/app/tests/services/verifier/utils.py @@ -57,7 +57,7 @@ indy_proof_request = IndyProofRequest( name="string", - non_revoked=IndyProofRequestNonRevoked(var_from=0, to=20), + non_revoked=IndyProofRequestNonRevoked(), nonce="12345", requested_attributes={ "0_speed_uuid": IndyProofReqAttrSpec( diff --git a/docs/Common Steps.md b/docs/Common Steps.md index d6d5ba1d5..e8af84937 100644 --- a/docs/Common Steps.md +++ b/docs/Common Steps.md @@ -2,12 +2,12 @@ This document will guide you through some common steps and interactions. Please read it carefully, and feel free to open an issue if further questions arise or if you spot a mistake. ->**Note:** It is always helpful to inspect the CloudAPI Swagger UI to understand the available endpoints, their expected inputs, and the corresponding outputs. If requests fail, check the Swagger UI to ensure you've called the correct endpoint with the correct data. The Swagger UI is accessible at: +> **Note:** It is always helpful to inspect the CloudAPI Swagger UI to understand the available endpoints, their expected inputs, and the corresponding outputs. If requests fail, check the Swagger UI to ensure you've called the correct endpoint with the correct data. The Swagger UI is accessible at: > -> * CloudAPI-Multitenant-Admin -> [http://localhost:8100/docs](http://localhost:8100/docs) -> * CloudAPI-Governance -> [http://localhost:8200/docs](http://localhost:8200/docs) -> * CloudAPI-Tenant -> [http://localhost:8300/docs](http://localhost:8300/docs) -> * CloudAPI-Public (trust registry) -> [http://localhost:8400/docs](http://localhost:8400/docs) +> - CloudAPI-Multitenant-Admin -> [http://localhost:8100/docs](http://localhost:8100/docs) +> - CloudAPI-Governance -> [http://localhost:8200/docs](http://localhost:8200/docs) +> - CloudAPI-Tenant -> [http://localhost:8300/docs](http://localhost:8300/docs) +> - CloudAPI-Public (trust registry) -> [http://localhost:8400/docs](http://localhost:8400/docs) > > under a vanilla setup. If you find any model to be unclear from the document below, try finding it in Swagger UI before opening an issue. This document describes only some basic steps; more detailed workflows can be found [here](./Example%20Flows.md). @@ -22,13 +22,11 @@ The admin "wallet" is already configured as it is not a subwallet on a multi-ten ```json { - "wallet_label": "Demo Issuer", - "wallet_name": "Faber", - "roles": [ - "issuer" - ], - "group_id": "API demo", - "image_url": "https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png" + "wallet_label": "Demo Issuer", + "wallet_name": "Faber", + "roles": ["issuer"], + "group_id": "API demo", + "image_url": "https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png" } ``` @@ -119,10 +117,7 @@ To create schemas and effectively write them to the ledger as well as registerin "additionalProp1": { "name": "string", "names": ["string"], - "non_revoked": { - "from": 0, - "to": 0 - }, + "non_revoked": {}, "restrictions": [] } }, @@ -131,10 +126,7 @@ To create schemas and effectively write them to the ledger as well as registerin "name": "string", "p_type": "<", "p_value": 0, - "non_revoked": { - "from": 0, - "to": 0 - }, + "non_revoked": {}, "restrictions": [] }, "name": "string", From a046e27702244c6ac06e1cb1368a69578c33bdcf Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 23 May 2024 13:07:52 +0300 Subject: [PATCH 30/45] :construction_worker: use default docker image again --- docker-compose.yaml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 773d2d5c2..0ac062bec 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -371,23 +371,23 @@ services: image: ${REGISTRY:-local}/governance-multitenant-agent:${IMAGE_TAG:-latest} container_name: governance-multitenant-agent build: - # context: . - # dockerfile: dockerfiles/agents/Dockerfile.author.agent + context: . + dockerfile: dockerfiles/agents/Dockerfile.author.agent # # To run a forked version of the agent use commented out code below - context: https://github.com/ff137/aries-cloudagent-python.git#fix/publish-revocations-response - dockerfile: docker/Dockerfile - user: root - entrypoint: - - sh - - -c - - | - pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 - pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events - aca-py start \ - -it http "0.0.0.0" "3020" \ - -e http://governance-multitenant-agent:3020 \ - --wallet-type askar --auto-promote-author-did --plugin acapy_wallet_groups_plugin \ - --plugin redis_events.v1_0.redis_queue.events --plugin-config-value redis_queue.connection.connection_url=\"redis://172.29.0.101:6377\" + # context: https://github.com/ff137/aries-cloudagent-python.git#fix/publish-revocations-response + # dockerfile: docker/Dockerfile + # user: root + # entrypoint: + # - sh + # - -c + # - | + # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 + # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events + # aca-py start \ + # -it http "0.0.0.0" "3020" \ + # -e http://governance-multitenant-agent:3020 \ + # --wallet-type askar --auto-promote-author-did --plugin acapy_wallet_groups_plugin \ + # --plugin redis_events.v1_0.redis_queue.events --plugin-config-value redis_queue.connection.connection_url=\"redis://172.29.0.101:6377\" env_file: - environments/governance-multitenant/aca-py-agent.default.env ports: From 4e4dc4b33a90eccbbd77f713c92174723e4a14c5 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 23 May 2024 13:08:46 +0300 Subject: [PATCH 31/45] :bug: wait for 2 registries again --- app/services/revocation_registry.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/services/revocation_registry.py b/app/services/revocation_registry.py index 47b4c4490..49458440f 100644 --- a/app/services/revocation_registry.py +++ b/app/services/revocation_registry.py @@ -480,7 +480,8 @@ async def wait_for_active_registry( active_registries = [] sleep_duration = 0 # First sleep should be 0 - while len(active_registries) < 1: # We need one of the two registries to be ready + # we want both active registries ready before trying to publish revocations to it + while len(active_registries) < 2: await asyncio.sleep(sleep_duration) active_registries = await get_created_active_registries(controller, cred_def_id) sleep_duration = 0.5 # Following sleeps should wait 0.5s before retry From cd0753851b0510de242af065e88ee58905d001b3 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 23 May 2024 13:17:53 +0300 Subject: [PATCH 32/45] :art: --- app/tests/e2e/verifier/test_proof_revoked_credential.py | 2 -- app/tests/e2e/verifier/test_verifier.py | 1 - 2 files changed, 3 deletions(-) diff --git a/app/tests/e2e/verifier/test_proof_revoked_credential.py b/app/tests/e2e/verifier/test_proof_revoked_credential.py index 89b2eba18..73392ae74 100644 --- a/app/tests/e2e/verifier/test_proof_revoked_credential.py +++ b/app/tests/e2e/verifier/test_proof_revoked_credential.py @@ -1,4 +1,3 @@ -import time from typing import List import pytest @@ -136,7 +135,6 @@ async def test_regression_proof_revoked_credential( alice_member_client: RichAsyncClient, acme_and_alice_connection: AcmeAliceConnect, ): - unix_timestamp = int(time.time()) referent = get_or_issue_regression_cred_revoked.referent credential_definition_id_revocable = ( get_or_issue_regression_cred_revoked.cred_def_revocable diff --git a/app/tests/e2e/verifier/test_verifier.py b/app/tests/e2e/verifier/test_verifier.py index 8748f8fb9..e4ca621ce 100644 --- a/app/tests/e2e/verifier/test_verifier.py +++ b/app/tests/e2e/verifier/test_verifier.py @@ -1,6 +1,5 @@ import asyncio import json -import time import pytest from aries_cloudcontroller import IndyPresSpec, IndyRequestedCredsRequestedAttr From 1478961c3d9acd83642e5e7935a97c7d21d943f4 Mon Sep 17 00:00:00 2001 From: ff137 Date: Wed, 5 Jun 2024 19:48:20 +0300 Subject: [PATCH 33/45] :bug: non_revoked must be specified to avoid bug in acapy (hyperledger/aries-cloudagent-python/issues/3018) --- app/tests/e2e/verifier/test_proof_revoked_credential.py | 5 +++-- app/tests/e2e/verifier/test_verifier.py | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/tests/e2e/verifier/test_proof_revoked_credential.py b/app/tests/e2e/verifier/test_proof_revoked_credential.py index 73392ae74..b7e906d5c 100644 --- a/app/tests/e2e/verifier/test_proof_revoked_credential.py +++ b/app/tests/e2e/verifier/test_proof_revoked_credential.py @@ -1,3 +1,4 @@ +import time from typing import List import pytest @@ -43,7 +44,7 @@ async def test_proof_revoked_credential( "indy_proof_request": { "name": "Proof of SPEED", "version": "1.0", - "non_revoked": {}, # Empty means it must be non_revoked at time of proof + "non_revoked": {"to": int(time.time())}, "requested_attributes": { "THE_SPEED": { "name": "speed", @@ -146,7 +147,7 @@ async def test_regression_proof_revoked_credential( "comment": "Test proof of revocation", "type": "indy", "indy_proof_request": { - "non_revoked": {}, # Empty means it must be non_revoked at time of proof + "non_revoked": {"to": int(time.time())}, "requested_attributes": { "THE_SPEED": { "name": "speed", diff --git a/app/tests/e2e/verifier/test_verifier.py b/app/tests/e2e/verifier/test_verifier.py index d3638202c..ed2854ad7 100644 --- a/app/tests/e2e/verifier/test_verifier.py +++ b/app/tests/e2e/verifier/test_verifier.py @@ -1,5 +1,6 @@ import asyncio import json +import time import pytest from aries_cloudcontroller import IndyPresSpec, IndyRequestedCredsRequestedAttr @@ -688,6 +689,7 @@ async def test_regression_proof_valid_credential( alice_member_client: RichAsyncClient, acme_and_alice_connection: AcmeAliceConnect, ): + unix_timestamp = int(time.time()) referent = get_or_issue_regression_cred_valid.referent credential_definition_id_revocable = ( get_or_issue_regression_cred_valid.cred_def_revocable @@ -699,7 +701,7 @@ async def test_regression_proof_valid_credential( "comment": "Test cred is not revoked", "type": "indy", "indy_proof_request": { - "non_revoked": {}, # Empty means it must be non_revoked at time of proof + "non_revoked": {"to": unix_timestamp}, "requested_attributes": { "THE_SPEED": { "name": "speed", From 28303787ef738396e35e507191f55d910ec23629 Mon Sep 17 00:00:00 2001 From: ff137 Date: Wed, 5 Jun 2024 19:48:48 +0300 Subject: [PATCH 34/45] :construction: test with acapy nightly build --- dockerfiles/agents/Dockerfile | 2 +- dockerfiles/agents/Dockerfile.agent | 4 ++-- dockerfiles/agents/Dockerfile.author.agent | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dockerfiles/agents/Dockerfile b/dockerfiles/agents/Dockerfile index be525aa3c..9e2863567 100644 --- a/dockerfiles/agents/Dockerfile +++ b/dockerfiles/agents/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-04 ADD configuration ./configuration ADD scripts ./scripts diff --git a/dockerfiles/agents/Dockerfile.agent b/dockerfiles/agents/Dockerfile.agent index 2bdbffc90..f22fd719d 100644 --- a/dockerfiles/agents/Dockerfile.agent +++ b/dockerfiles/agents/Dockerfile.agent @@ -1,8 +1,8 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-04 USER root # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@test/pagination#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index 47ef1555f..db91a910b 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-04 USER root @@ -6,7 +6,7 @@ USER root RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@test/pagination#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh From dd4f88d0a5dea37fafbed6a642fd522ba22f23e0 Mon Sep 17 00:00:00 2001 From: ff137 Date: Wed, 5 Jun 2024 20:24:12 +0300 Subject: [PATCH 35/45] :construction: fix test and leave todo --- app/tests/e2e/test_revocation.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/tests/e2e/test_revocation.py b/app/tests/e2e/test_revocation.py index b2ce0cca3..fd8fbac95 100644 --- a/app/tests/e2e/test_revocation.py +++ b/app/tests/e2e/test_revocation.py @@ -54,7 +54,7 @@ async def test_clear_pending_revokes( "revocation_registry_credential_map" ] - assert revocation_registry_credential_map == {} + # assert revocation_registry_credential_map == {} #todo: aca-py now provides response for cred in revoke_alice_creds: rev_record = ( @@ -85,14 +85,14 @@ async def test_clear_pending_revokes_no_map( faber_client: RichAsyncClient, revoke_alice_creds: List[CredentialExchange], ): - clear_revoke_response = ( - await faber_client.post( - f"{CREDENTIALS_BASE_PATH}/clear-pending-revocations", - json={"revocation_registry_credential_map": {}}, - ) - ).json()["revocation_registry_credential_map"] + # clear_revoke_response = ( + await faber_client.post( + f"{CREDENTIALS_BASE_PATH}/clear-pending-revocations", + json={"revocation_registry_credential_map": {}}, + ) + # ).json()["revocation_registry_credential_map"] - assert clear_revoke_response == {} + # assert clear_revoke_response == {} #todo: aca-py now provides response for cred in revoke_alice_creds: rev_record = ( From eb6506ed5d39127a800ee284d8fb83149aacb6d6 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 11 Jun 2024 17:40:43 +0300 Subject: [PATCH 36/45] Update aries-acapy-plugins tag --- docker-compose.yaml | 2 +- dockerfiles/agents/Dockerfile.agent | 2 +- dockerfiles/agents/Dockerfile.author.agent | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 0ac062bec..054c1b092 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -382,7 +382,7 @@ services: # - -c # - | # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 - # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events + # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-06-11#subdirectory=redis_events # aca-py start \ # -it http "0.0.0.0" "3020" \ # -e http://governance-multitenant-agent:3020 \ diff --git a/dockerfiles/agents/Dockerfile.agent b/dockerfiles/agents/Dockerfile.agent index f22fd719d..93e3d4ac9 100644 --- a/dockerfiles/agents/Dockerfile.agent +++ b/dockerfiles/agents/Dockerfile.agent @@ -2,7 +2,7 @@ FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-04 USER root # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@test/pagination#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-06-11#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index db91a910b..a40632974 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -6,7 +6,7 @@ USER root RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@test/pagination#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-06-11#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh From f66bb04a190e6ad1c22721492b846f97db280752 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 11 Jun 2024 17:45:31 +0300 Subject: [PATCH 37/45] Update acapy-wallet-groups-plugin tag --- docker-compose.yaml | 2 +- dockerfiles/agents/Dockerfile.author.agent | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 054c1b092..a1164965e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -381,7 +381,7 @@ services: # - sh # - -c # - | - # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 + # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.2rc0 # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-06-11#subdirectory=redis_events # aca-py start \ # -it http "0.0.0.0" "3020" \ diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index a40632974..7c94a683a 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -3,7 +3,7 @@ FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-04 USER root # Install wallet group id plugin -RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 +RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.2rc0 # install redis-events plugin RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-06-11#subdirectory=redis_events From 5776362b5fc1acbb18d1914f601a93adb362273c Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 11 Jun 2024 17:46:53 +0300 Subject: [PATCH 38/45] :arrow_up: use latest acapy image --- dockerfiles/agents/Dockerfile | 2 +- dockerfiles/agents/Dockerfile.agent | 2 +- dockerfiles/agents/Dockerfile.author.agent | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dockerfiles/agents/Dockerfile b/dockerfiles/agents/Dockerfile index 9e2863567..9708dad48 100644 --- a/dockerfiles/agents/Dockerfile +++ b/dockerfiles/agents/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-04 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-11 ADD configuration ./configuration ADD scripts ./scripts diff --git a/dockerfiles/agents/Dockerfile.agent b/dockerfiles/agents/Dockerfile.agent index 93e3d4ac9..a4f2fb9a0 100644 --- a/dockerfiles/agents/Dockerfile.agent +++ b/dockerfiles/agents/Dockerfile.agent @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-04 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-11 USER root # install redis-events plugin diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index 7c94a683a..314f76192 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-04 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-11 USER root From 792bf7e6e553fedc8f485c7b4afd5ae0c2be0a40 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 11 Jun 2024 19:18:24 +0300 Subject: [PATCH 39/45] :arrow_up: use acapy-wallet-groups-plugin tagged release --- docker-compose.yaml | 2 +- dockerfiles/agents/Dockerfile.author.agent | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index a1164965e..e7de11689 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -381,7 +381,7 @@ services: # - sh # - -c # - | - # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.2rc0 + # pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@0.12.2rc0 # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-06-11#subdirectory=redis_events # aca-py start \ # -it http "0.0.0.0" "3020" \ diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index 314f76192..6aec0ce28 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -3,7 +3,7 @@ FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-11 USER root # Install wallet group id plugin -RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.2rc0 +RUN pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@0.12.2rc0 # install redis-events plugin RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-06-11#subdirectory=redis_events From 8292ac773807f54519c264a4cd058ced4cd3c12f Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 11 Jun 2024 20:38:01 +0300 Subject: [PATCH 40/45] add sleep to work around acapy issue --- app/tests/e2e/verifier/test_proof_revoked_credential.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/tests/e2e/verifier/test_proof_revoked_credential.py b/app/tests/e2e/verifier/test_proof_revoked_credential.py index b7e906d5c..67e3b1fce 100644 --- a/app/tests/e2e/verifier/test_proof_revoked_credential.py +++ b/app/tests/e2e/verifier/test_proof_revoked_credential.py @@ -36,6 +36,9 @@ async def test_proof_revoked_credential( acme_and_alice_connection: AcmeAliceConnect, protocol_version: str, ): + time.sleep(7) # moment for revocation registry to update + # todo: remove sleep when issue resolved: https://github.com/hyperledger/aries-cloudagent-python/issues/3018 + # Do proof request request_body = { "protocol_version": protocol_version, @@ -136,6 +139,9 @@ async def test_regression_proof_revoked_credential( alice_member_client: RichAsyncClient, acme_and_alice_connection: AcmeAliceConnect, ): + time.sleep(7) # moment for revocation registry to update + # todo: remove sleep when issue resolved: https://github.com/hyperledger/aries-cloudagent-python/issues/3018 + referent = get_or_issue_regression_cred_revoked.referent credential_definition_id_revocable = ( get_or_issue_regression_cred_revoked.cred_def_revocable From eccfb45a65bf987b44072a05d8ec2b693eb69eb7 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 11 Jun 2024 21:22:12 +0300 Subject: [PATCH 41/45] :sparkles: `assert_both_webhooks_received`: use asyncio.gather to simultaneous await two webhooks --- .../ld_proof/test_ld_proof_did_key_bbs.py | 112 +++++++++--------- .../ld_proof/test_ld_proof_did_key_ed25519.py | 110 ++++++++--------- .../issuer/ld_proof/test_ld_proof_did_sov.py | 50 ++++---- app/tests/e2e/issuer/test_indy_credentials.py | 24 ++-- .../verifier/test_proof_revoked_credential.py | 42 +++---- app/tests/e2e/verifier/test_verifier.py | 91 +++++--------- app/tests/util/connections.py | 20 +--- app/tests/util/webhooks.py | 34 ++++++ 8 files changed, 223 insertions(+), 260 deletions(-) diff --git a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py index 45de3f644..99d3cecda 100644 --- a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py +++ b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py @@ -16,7 +16,7 @@ from app.routes.issuer import router as issuer_router from app.routes.oob import router as oob_router from app.tests.util.connections import FaberAliceConnect -from app.tests.util.webhooks import check_webhook_state +from app.tests.util.webhooks import assert_both_webhooks_received, check_webhook_state from shared import RichAsyncClient CREDENTIALS_BASE_PATH = issuer_router.prefix @@ -224,22 +224,22 @@ async def test_send_jsonld_request( thread_id = credential_exchange["thread_id"] assert credential_exchange["protocol_version"] == "v2" - assert await check_webhook_state( - client=faber_client, - topic="credentials", - state="offer-sent", - filter_map={ - "thread_id": thread_id, - }, - look_back=5, - ) - - assert await check_webhook_state( - client=alice_member_client, - topic="credentials", - state="offer-received", - look_back=5, + result = asyncio.gather( + await check_webhook_state( + client=faber_client, + topic="credentials", + state="offer-sent", + filter_map={ + "thread_id": thread_id, + }, + ), + await check_webhook_state( + client=alice_member_client, + topic="credentials", + state="offer-received", + ), ) + assert all(result), "An expected webhook event was not returned" await asyncio.sleep(0.2) # credential may take moment to reflect after webhook response = await alice_member_client.get( @@ -255,19 +255,19 @@ async def test_send_jsonld_request( assert request_response.status_code == 200 - assert await check_webhook_state( - client=alice_member_client, - topic="credentials", - state="request-sent", - look_back=5, - ) - - assert await check_webhook_state( - client=faber_client, - topic="credentials", - state="request-received", - look_back=5, + result = asyncio.gather( + await check_webhook_state( + client=alice_member_client, + topic="credentials", + state="request-sent", + ), + await check_webhook_state( + client=faber_client, + topic="credentials", + state="request-received", + ), ) + assert all(result), "An expected webhook event was not returned" @pytest.mark.anyio @@ -290,23 +290,24 @@ async def test_issue_jsonld_bbs( credential_exchange = response.json() assert credential_exchange["protocol_version"] == "v2" thread_id = credential_exchange["thread_id"] - - assert await check_webhook_state( - client=faber_client, - topic="credentials", - state="offer-sent", - filter_map={ - "thread_id": thread_id, - }, - look_back=5, - ) - - assert await check_webhook_state( - client=alice_member_client, - topic="credentials", - state="offer-received", - look_back=5, + faber_cred_ex_id = credential_exchange["credential_exchange_id"] + + result = asyncio.gather( + await check_webhook_state( + client=faber_client, + topic="credentials", + state="offer-sent", + filter_map={ + "thread_id": thread_id, + }, + ), + await check_webhook_state( + client=alice_member_client, + topic="credentials", + state="offer-received", + ), ) + assert all(result), "An expected webhook event was not returned" await asyncio.sleep(0.2) # credential may take moment to reflect after webhook response = await alice_member_client.get( @@ -314,26 +315,21 @@ async def test_issue_jsonld_bbs( params={"thread_id": thread_id}, ) - credential_exchange_id = (response.json())[0]["credential_exchange_id"] + alice_cred_ex_id = (response.json())[0]["credential_exchange_id"] request_response = await alice_member_client.post( - f"{CREDENTIALS_BASE_PATH}/{credential_exchange_id}/request", + f"{CREDENTIALS_BASE_PATH}/{alice_cred_ex_id}/request", ) assert request_response.status_code == 200 - assert await check_webhook_state( - client=alice_member_client, - topic="credentials", - state="done", - look_back=5, - ) - - assert await check_webhook_state( - client=faber_client, - topic="credentials", - state="done", - look_back=5, + await assert_both_webhooks_received( + alice_member_client, + faber_client, + "credentials", + "done", + alice_cred_ex_id, + faber_cred_ex_id, ) diff --git a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py index 3c319e23d..ce2004252 100644 --- a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py +++ b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py @@ -11,7 +11,7 @@ from app.routes.issuer import router as issuer_router from app.routes.oob import router as oob_router from app.tests.util.connections import FaberAliceConnect -from app.tests.util.webhooks import check_webhook_state +from app.tests.util.webhooks import assert_both_webhooks_received, check_webhook_state from shared import RichAsyncClient CREDENTIALS_BASE_PATH = issuer_router.prefix @@ -221,24 +221,25 @@ async def test_send_jsonld_request( ) credential_exchange = response.json() thread_id = credential_exchange["thread_id"] + faber_cred_ex_id = credential_exchange["credential_exchange_id"] assert credential_exchange["protocol_version"] == "v2" - assert await check_webhook_state( - client=faber_client, - topic="credentials", - state="offer-sent", - filter_map={ - "thread_id": thread_id, - }, - look_back=5, - ) - - assert await check_webhook_state( - client=alice_member_client, - topic="credentials", - state="offer-received", - look_back=5, + result = asyncio.gather( + await check_webhook_state( + client=faber_client, + topic="credentials", + state="offer-sent", + filter_map={ + "thread_id": thread_id, + }, + ), + await check_webhook_state( + client=alice_member_client, + topic="credentials", + state="offer-received", + ), ) + assert all(result), "An expected webhook event was not returned" await asyncio.sleep(0.2) # credential may take moment to reflect after webhook response = await alice_member_client.get( @@ -246,26 +247,21 @@ async def test_send_jsonld_request( params={"thread_id": thread_id}, ) - credential_exchange_id = (response.json())[0]["credential_exchange_id"] + alice_cred_ex_id = (response.json())[0]["credential_exchange_id"] request_response = await alice_member_client.post( - f"{CREDENTIALS_BASE_PATH}/{credential_exchange_id}/request", + f"{CREDENTIALS_BASE_PATH}/{alice_cred_ex_id}/request", ) assert request_response.status_code == 200 - assert await check_webhook_state( - client=alice_member_client, - topic="credentials", - state="request-sent", - look_back=5, - ) - - assert await check_webhook_state( - client=faber_client, - topic="credentials", - state="request-received", - look_back=5, + await assert_both_webhooks_received( + alice_member_client, + faber_client, + "credentials", + "done", + alice_cred_ex_id, + faber_cred_ex_id, ) @@ -291,24 +287,25 @@ async def test_issue_jsonld_ed( ) credential_exchange = response.json() thread_id = credential_exchange["thread_id"] + faber_cred_ex_id = credential_exchange["credential_exchange_id"] assert credential_exchange["protocol_version"] == "v2" - assert await check_webhook_state( - client=faber_client, - topic="credentials", - state="offer-sent", - filter_map={ - "thread_id": thread_id, - }, - look_back=5, - ) - - assert await check_webhook_state( - client=alice_member_client, - topic="credentials", - state="offer-received", - look_back=5, + result = asyncio.gather( + await check_webhook_state( + client=faber_client, + topic="credentials", + state="offer-sent", + filter_map={ + "thread_id": thread_id, + }, + ), + await check_webhook_state( + client=alice_member_client, + topic="credentials", + state="offer-received", + ), ) + assert all(result), "An expected webhook event was not returned" await asyncio.sleep(0.2) # credential may take moment to reflect after webhook response = await alice_member_client.get( @@ -316,26 +313,21 @@ async def test_issue_jsonld_ed( params={"thread_id": thread_id}, ) - credential_exchange_id = (response.json())[0]["credential_exchange_id"] + alice_cred_ex_id = (response.json())[0]["credential_exchange_id"] request_response = await alice_member_client.post( - f"{CREDENTIALS_BASE_PATH}/{credential_exchange_id}/request", + f"{CREDENTIALS_BASE_PATH}/{alice_cred_ex_id}/request", ) assert request_response.status_code == 200 - assert await check_webhook_state( - client=alice_member_client, - topic="credentials", - state="done", - look_back=5, - ) - - assert await check_webhook_state( - client=faber_client, - topic="credentials", - state="done", - look_back=5, + await assert_both_webhooks_received( + alice_member_client, + faber_client, + "credentials", + "done", + alice_cred_ex_id, + faber_cred_ex_id, ) diff --git a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py index 178bdd798..440f8873c 100644 --- a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py +++ b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py @@ -15,7 +15,7 @@ from app.routes.oob import router as oob_router from app.routes.wallet.dids import router as wallet_router from app.tests.util.connections import FaberAliceConnect -from app.tests.util.webhooks import check_webhook_state +from app.tests.util.webhooks import assert_both_webhooks_received, check_webhook_state from shared import RichAsyncClient CREDENTIALS_BASE_PATH = issuer_router.prefix @@ -246,19 +246,19 @@ async def test_send_jsonld_request_sov( assert request_response.status_code == 200 - assert await check_webhook_state( - client=alice_member_client, - topic="credentials", - state="request-sent", - look_back=5, - ) - - assert await check_webhook_state( - client=faber_client, - topic="credentials", - state="request-received", - look_back=5, + result = asyncio.gather( + await check_webhook_state( + client=alice_member_client, + topic="credentials", + state="request-sent", + ), + await check_webhook_state( + client=faber_client, + topic="credentials", + state="request-received", + ), ) + assert all(result), "An expected webhook event was not returned" @pytest.mark.anyio @@ -284,6 +284,7 @@ async def test_issue_jsonld_sov( ) credential_exchange = response.json() thread_id = credential_exchange["thread_id"] + faber_cred_ex_id = credential_exchange["credential_exchange_id"] assert credential_exchange["protocol_version"] == "v2" assert await check_webhook_state( @@ -307,24 +308,19 @@ async def test_issue_jsonld_sov( params={"thread_id": thread_id}, ) - credential_exchange_id = (response.json())[0]["credential_exchange_id"] + alice_cred_ex_id = (response.json())[0]["credential_exchange_id"] request_response = await alice_member_client.post( - f"{CREDENTIALS_BASE_PATH}/{credential_exchange_id}/request", + f"{CREDENTIALS_BASE_PATH}/{alice_cred_ex_id}/request", ) assert request_response.status_code == 200 - assert await check_webhook_state( - client=alice_member_client, - topic="credentials", - state="done", - look_back=5, - ) - - assert await check_webhook_state( - client=faber_client, - topic="credentials", - state="done", - look_back=5, + await assert_both_webhooks_received( + alice_member_client, + faber_client, + "credentials", + "done", + alice_cred_ex_id, + faber_cred_ex_id, ) diff --git a/app/tests/e2e/issuer/test_indy_credentials.py b/app/tests/e2e/issuer/test_indy_credentials.py index 246c26116..96a91a67a 100644 --- a/app/tests/e2e/issuer/test_indy_credentials.py +++ b/app/tests/e2e/issuer/test_indy_credentials.py @@ -212,19 +212,19 @@ async def test_send_credential_request( assert request_response.status_code == 200 - assert await check_webhook_state( - client=alice_member_client, - topic="credentials", - state="request-sent", - look_back=5, - ) - - assert await check_webhook_state( - client=faber_client, - topic="credentials", - state="request-received", - look_back=5, + result = asyncio.gather( + await check_webhook_state( + client=alice_member_client, + topic="credentials", + state="request-sent", + ), + await check_webhook_state( + client=faber_client, + topic="credentials", + state="request-received", + ), ) + assert all(result), "An expected webhook event was not returned" @pytest.mark.anyio diff --git a/app/tests/e2e/verifier/test_proof_revoked_credential.py b/app/tests/e2e/verifier/test_proof_revoked_credential.py index 67e3b1fce..803d450cd 100644 --- a/app/tests/e2e/verifier/test_proof_revoked_credential.py +++ b/app/tests/e2e/verifier/test_proof_revoked_credential.py @@ -9,7 +9,7 @@ from app.tests.util.connections import AcmeAliceConnect from app.tests.util.regression_testing import TestMode from app.tests.util.verifier import send_proof_request -from app.tests.util.webhooks import check_webhook_state +from app.tests.util.webhooks import assert_both_webhooks_received, check_webhook_state from shared import RichAsyncClient from shared.models.credential_exchange import CredentialExchange @@ -100,24 +100,13 @@ async def test_proof_revoked_credential( }, ) - await check_webhook_state( - client=alice_member_client, - topic="proofs", - state="done", - filter_map={ - "proof_id": alice_proof_exchange_id, - }, - look_back=5, - ) - - await check_webhook_state( - client=acme_client, - topic="proofs", - state="done", - filter_map={ - "proof_id": acme_proof_exchange_id, - }, - look_back=5, + await assert_both_webhooks_received( + alice_member_client, + acme_client, + "proofs", + "done", + alice_proof_exchange_id, + acme_proof_exchange_id, ) # Check proof @@ -199,14 +188,13 @@ async def test_regression_proof_revoked_credential( }, ) - await check_webhook_state( - client=acme_client, - topic="proofs", - state="done", - filter_map={ - "proof_id": acme_proof_exchange_id, - }, - look_back=5, + await assert_both_webhooks_received( + alice_member_client, + acme_client, + "proofs", + "done", + alice_proof_exchange_id, + acme_proof_exchange_id, ) # Check proof diff --git a/app/tests/e2e/verifier/test_verifier.py b/app/tests/e2e/verifier/test_verifier.py index ed2854ad7..d02c029dc 100644 --- a/app/tests/e2e/verifier/test_verifier.py +++ b/app/tests/e2e/verifier/test_verifier.py @@ -17,7 +17,7 @@ from app.tests.util.connections import AcmeAliceConnect, MeldCoAliceConnect from app.tests.util.regression_testing import TestMode from app.tests.util.verifier import send_proof_request -from app.tests.util.webhooks import check_webhook_state +from app.tests.util.webhooks import assert_both_webhooks_received, check_webhook_state from shared import RichAsyncClient from shared.models.credential_exchange import CredentialExchange from shared.models.presentation_exchange import PresentationExchange @@ -316,23 +316,13 @@ async def test_get_proof_and_get_proofs( json=proof_accept.model_dump(), ) - await check_webhook_state( - client=alice_member_client, - topic="proofs", - state="done", - filter_map={ - "proof_id": alice_proof_id, - }, - look_back=5, - ) - await check_webhook_state( - client=acme_client, - topic="proofs", - state="done", - filter_map={ - "proof_id": acme_proof_id, - }, - look_back=5, + await assert_both_webhooks_received( + alice_member_client, + acme_client, + "proofs", + "done", + alice_proof_id, + acme_proof_id, ) acme_proof_exchange = ( @@ -536,24 +526,13 @@ async def test_accept_proof_request_verifier_has_issuer_role( json=proof_accept.model_dump(), ) - assert await check_webhook_state( - client=alice_member_client, - topic="proofs", - state="done", - filter_map={ - "proof_id": alice_proof_id, - }, - look_back=5, - ) - - assert await check_webhook_state( - client=meld_co_client, - state="done", - filter_map={ - "proof_id": meld_co_proof_id, - }, - topic="proofs", - look_back=5, + await assert_both_webhooks_received( + alice_member_client, + meld_co_client, + "proofs", + "done", + alice_proof_id, + meld_co_proof_id, ) pres_exchange_result = PresentationExchange(**response.json()) @@ -621,24 +600,13 @@ async def test_saving_of_presentation_exchange_records( json=proof_accept.model_dump(), ) - assert await check_webhook_state( - client=alice_member_client, - topic="proofs", - state="done", - filter_map={ - "proof_id": alice_proof_id, - }, - look_back=5, - ) - - assert await check_webhook_state( - client=acme_client, - topic="proofs", - state="done", - filter_map={ - "proof_id": acme_proof_id, - }, - look_back=5, + await assert_both_webhooks_received( + alice_member_client, + acme_client, + "proofs", + "done", + alice_proof_id, + acme_proof_id, ) result = response.json() @@ -747,14 +715,13 @@ async def test_regression_proof_valid_credential( }, ) - await check_webhook_state( - client=acme_client, - topic="proofs", - state="done", - filter_map={ - "proof_id": acme_proof_exchange_id, - }, - look_back=5, + await assert_both_webhooks_received( + alice_member_client, + acme_client, + "proofs", + "done", + alice_proof_exchange_id, + acme_proof_exchange_id, ) # Check proof diff --git a/app/tests/util/connections.py b/app/tests/util/connections.py index 72416de1f..db6b6f5bc 100644 --- a/app/tests/util/connections.py +++ b/app/tests/util/connections.py @@ -11,7 +11,7 @@ TestMode, assert_fail_on_recreating_fixtures, ) -from app.tests.util.webhooks import check_webhook_state +from app.tests.util.webhooks import assert_both_webhooks_received, check_webhook_state from app.util.string import base64_to_json from shared import RichAsyncClient from shared.models.connection_record import Connection @@ -50,24 +50,14 @@ async def assert_both_connections_ready( connection_id_1: str, connection_id_2: str, ): - assert await check_webhook_state( + await assert_both_webhooks_received( member_client_1, - topic="connections", - state="completed", - filter_map={ - "connection_id": connection_id_1, - }, - look_back=5, - ) - assert await check_webhook_state( member_client_2, topic="connections", state="completed", - filter_map={ - "connection_id": connection_id_2, - }, - look_back=5, - ) + field_id_1=connection_id_1, + field_id_2=connection_id_2, + ), "A connection completed webhook was not received" async def create_bob_alice_connection( diff --git a/app/tests/util/webhooks.py b/app/tests/util/webhooks.py index 5546b91cf..842bd5342 100644 --- a/app/tests/util/webhooks.py +++ b/app/tests/util/webhooks.py @@ -100,3 +100,37 @@ async def check_webhook_state( raise Exception( # pylint: disable=W0719 f"Could not satisfy webhook filter: `{filter_map}`." ) + + +# mapping of topics to their relevant field names +TOPIC_FIELD_MAP = { + "connections": "connection_id", + "proofs": "proof_id", + "credentials": "credential_exchange_id", +} + + +async def assert_both_webhooks_received( + member_client_1: RichAsyncClient, + member_client_2: RichAsyncClient, + topic: str, + state: str, + field_id_1: str, + field_id_2: str, +): + # Lookup the field name for the given topic + field_name = TOPIC_FIELD_MAP.get(topic) + if not field_name: + raise ValueError(f"Unsupported topic: {topic}") + + async def check_webhook(client, field_id): + return await check_webhook_state( + client, topic=topic, state=state, filter_map={field_name: field_id} + ) + + results = await asyncio.gather( + check_webhook(member_client_1, field_id_1), + check_webhook(member_client_2, field_id_2), + ) + + assert all(results), "Not all webhooks received the expected state" From 78a8548a805785a9f24b28c0f06908a1f2ffb8d0 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 11 Jun 2024 21:22:31 +0300 Subject: [PATCH 42/45] :art: remove unneeded look_back --- app/tests/e2e/test_proof_request_models.py | 1 - app/tests/e2e/verifier/test_predicate_proofs.py | 1 - app/tests/e2e/verifier/test_proof_revoked_credential.py | 2 -- app/tests/e2e/verifier/test_verifier.py | 3 --- 4 files changed, 7 deletions(-) diff --git a/app/tests/e2e/test_proof_request_models.py b/app/tests/e2e/test_proof_request_models.py index 4b53693c0..121308e4d 100644 --- a/app/tests/e2e/test_proof_request_models.py +++ b/app/tests/e2e/test_proof_request_models.py @@ -92,7 +92,6 @@ async def test_proof_model_failures( client=alice_member_client, topic="proofs", state="request-received", - look_back=5, ) # Get proof exchange id diff --git a/app/tests/e2e/verifier/test_predicate_proofs.py b/app/tests/e2e/verifier/test_predicate_proofs.py index a785b9265..6722a6cad 100644 --- a/app/tests/e2e/verifier/test_predicate_proofs.py +++ b/app/tests/e2e/verifier/test_predicate_proofs.py @@ -89,7 +89,6 @@ async def test_predicate_proofs( topic="proofs", state="done", filter_map={"thread_id": thread_id}, - look_back=5, ) assert acme_proof_event["verified"] is True diff --git a/app/tests/e2e/verifier/test_proof_revoked_credential.py b/app/tests/e2e/verifier/test_proof_revoked_credential.py index 803d450cd..ed4a0f1f1 100644 --- a/app/tests/e2e/verifier/test_proof_revoked_credential.py +++ b/app/tests/e2e/verifier/test_proof_revoked_credential.py @@ -71,7 +71,6 @@ async def test_proof_revoked_credential( filter_map={ "thread_id": send_proof_response["thread_id"], }, - look_back=5, ) alice_proof_exchange_id = alice_payload["proof_id"] @@ -166,7 +165,6 @@ async def test_regression_proof_revoked_credential( filter_map={ "thread_id": send_proof_response["thread_id"], }, - look_back=5, ) alice_proof_exchange_id = alice_payload["proof_id"] diff --git a/app/tests/e2e/verifier/test_verifier.py b/app/tests/e2e/verifier/test_verifier.py index d02c029dc..e19b642e3 100644 --- a/app/tests/e2e/verifier/test_verifier.py +++ b/app/tests/e2e/verifier/test_verifier.py @@ -148,7 +148,6 @@ async def test_accept_proof_request( filter_map={ "proof_id": alice_proof_id, }, - look_back=5, ) acme_proof_event = await check_webhook_state( @@ -286,7 +285,6 @@ async def test_get_proof_and_get_proofs( filter_map={ "thread_id": thread_id, }, - look_back=5, ) alice_proof_id = alice_payload["proof_id"] @@ -693,7 +691,6 @@ async def test_regression_proof_valid_credential( filter_map={ "thread_id": send_proof_response["thread_id"], }, - look_back=5, ) alice_proof_exchange_id = alice_payload["proof_id"] From 6d0f491fd7d1ecae8f71751489c5f39a781c8f50 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 11 Jun 2024 21:27:23 +0300 Subject: [PATCH 43/45] :art: --- app/tests/util/connections.py | 4 ++-- app/tests/util/webhooks.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/tests/util/connections.py b/app/tests/util/connections.py index db6b6f5bc..7ed84554d 100644 --- a/app/tests/util/connections.py +++ b/app/tests/util/connections.py @@ -49,7 +49,7 @@ async def assert_both_connections_ready( member_client_2: RichAsyncClient, connection_id_1: str, connection_id_2: str, -): +) -> None: await assert_both_webhooks_received( member_client_1, member_client_2, @@ -57,7 +57,7 @@ async def assert_both_connections_ready( state="completed", field_id_1=connection_id_1, field_id_2=connection_id_2, - ), "A connection completed webhook was not received" + ) async def create_bob_alice_connection( diff --git a/app/tests/util/webhooks.py b/app/tests/util/webhooks.py index 842bd5342..49e542dd8 100644 --- a/app/tests/util/webhooks.py +++ b/app/tests/util/webhooks.py @@ -117,7 +117,7 @@ async def assert_both_webhooks_received( state: str, field_id_1: str, field_id_2: str, -): +) -> None: # Lookup the field name for the given topic field_name = TOPIC_FIELD_MAP.get(topic) if not field_name: From bbf51ce320a46e83099fa8017180301f8196d047 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 11 Jun 2024 21:31:15 +0300 Subject: [PATCH 44/45] :art: fix --- .../ld_proof/test_ld_proof_did_key_bbs.py | 18 +++++++++--------- .../ld_proof/test_ld_proof_did_key_ed25519.py | 12 ++++++------ .../issuer/ld_proof/test_ld_proof_did_sov.py | 6 +++--- app/tests/e2e/issuer/test_indy_credentials.py | 6 +++--- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py index 99d3cecda..7eeea0c70 100644 --- a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py +++ b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_bbs.py @@ -224,8 +224,8 @@ async def test_send_jsonld_request( thread_id = credential_exchange["thread_id"] assert credential_exchange["protocol_version"] == "v2" - result = asyncio.gather( - await check_webhook_state( + result = await asyncio.gather( + check_webhook_state( client=faber_client, topic="credentials", state="offer-sent", @@ -233,7 +233,7 @@ async def test_send_jsonld_request( "thread_id": thread_id, }, ), - await check_webhook_state( + check_webhook_state( client=alice_member_client, topic="credentials", state="offer-received", @@ -255,13 +255,13 @@ async def test_send_jsonld_request( assert request_response.status_code == 200 - result = asyncio.gather( - await check_webhook_state( + result = await asyncio.gather( + check_webhook_state( client=alice_member_client, topic="credentials", state="request-sent", ), - await check_webhook_state( + check_webhook_state( client=faber_client, topic="credentials", state="request-received", @@ -292,8 +292,8 @@ async def test_issue_jsonld_bbs( thread_id = credential_exchange["thread_id"] faber_cred_ex_id = credential_exchange["credential_exchange_id"] - result = asyncio.gather( - await check_webhook_state( + result = await asyncio.gather( + check_webhook_state( client=faber_client, topic="credentials", state="offer-sent", @@ -301,7 +301,7 @@ async def test_issue_jsonld_bbs( "thread_id": thread_id, }, ), - await check_webhook_state( + check_webhook_state( client=alice_member_client, topic="credentials", state="offer-received", diff --git a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py index ce2004252..cb7246380 100644 --- a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py +++ b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_key_ed25519.py @@ -224,8 +224,8 @@ async def test_send_jsonld_request( faber_cred_ex_id = credential_exchange["credential_exchange_id"] assert credential_exchange["protocol_version"] == "v2" - result = asyncio.gather( - await check_webhook_state( + result = await asyncio.gather( + check_webhook_state( client=faber_client, topic="credentials", state="offer-sent", @@ -233,7 +233,7 @@ async def test_send_jsonld_request( "thread_id": thread_id, }, ), - await check_webhook_state( + check_webhook_state( client=alice_member_client, topic="credentials", state="offer-received", @@ -290,8 +290,8 @@ async def test_issue_jsonld_ed( faber_cred_ex_id = credential_exchange["credential_exchange_id"] assert credential_exchange["protocol_version"] == "v2" - result = asyncio.gather( - await check_webhook_state( + result = await asyncio.gather( + check_webhook_state( client=faber_client, topic="credentials", state="offer-sent", @@ -299,7 +299,7 @@ async def test_issue_jsonld_ed( "thread_id": thread_id, }, ), - await check_webhook_state( + check_webhook_state( client=alice_member_client, topic="credentials", state="offer-received", diff --git a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py index 440f8873c..aeae6f69a 100644 --- a/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py +++ b/app/tests/e2e/issuer/ld_proof/test_ld_proof_did_sov.py @@ -246,13 +246,13 @@ async def test_send_jsonld_request_sov( assert request_response.status_code == 200 - result = asyncio.gather( - await check_webhook_state( + result = await asyncio.gather( + check_webhook_state( client=alice_member_client, topic="credentials", state="request-sent", ), - await check_webhook_state( + check_webhook_state( client=faber_client, topic="credentials", state="request-received", diff --git a/app/tests/e2e/issuer/test_indy_credentials.py b/app/tests/e2e/issuer/test_indy_credentials.py index 96a91a67a..52a9df76c 100644 --- a/app/tests/e2e/issuer/test_indy_credentials.py +++ b/app/tests/e2e/issuer/test_indy_credentials.py @@ -212,13 +212,13 @@ async def test_send_credential_request( assert request_response.status_code == 200 - result = asyncio.gather( - await check_webhook_state( + result = await asyncio.gather( + check_webhook_state( client=alice_member_client, topic="credentials", state="request-sent", ), - await check_webhook_state( + check_webhook_state( client=faber_client, topic="credentials", state="request-received", From b0098259bc764f8699f9778612abcef65a6569dc Mon Sep 17 00:00:00 2001 From: ff137 Date: Wed, 12 Jun 2024 15:25:52 +0300 Subject: [PATCH 45/45] :rewind: revert from nightly build back to 0.12.1 release --- docker-compose.yaml | 4 ++-- dockerfiles/agents/Dockerfile | 2 +- dockerfiles/agents/Dockerfile.agent | 4 ++-- dockerfiles/agents/Dockerfile.author.agent | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index e7de11689..0ac062bec 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -381,8 +381,8 @@ services: # - sh # - -c # - | - # pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@0.12.2rc0 - # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-06-11#subdirectory=redis_events + # pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 + # pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events # aca-py start \ # -it http "0.0.0.0" "3020" \ # -e http://governance-multitenant-agent:3020 \ diff --git a/dockerfiles/agents/Dockerfile b/dockerfiles/agents/Dockerfile index 9708dad48..be525aa3c 100644 --- a/dockerfiles/agents/Dockerfile +++ b/dockerfiles/agents/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-11 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1 ADD configuration ./configuration ADD scripts ./scripts diff --git a/dockerfiles/agents/Dockerfile.agent b/dockerfiles/agents/Dockerfile.agent index a4f2fb9a0..2bdbffc90 100644 --- a/dockerfiles/agents/Dockerfile.agent +++ b/dockerfiles/agents/Dockerfile.agent @@ -1,8 +1,8 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-11 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1 USER root # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-06-11#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh diff --git a/dockerfiles/agents/Dockerfile.author.agent b/dockerfiles/agents/Dockerfile.author.agent index 6aec0ce28..47ef1555f 100644 --- a/dockerfiles/agents/Dockerfile.author.agent +++ b/dockerfiles/agents/Dockerfile.author.agent @@ -1,12 +1,12 @@ -FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-nightly-2024-06-11 +FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.12.1 USER root # Install wallet group id plugin -RUN pip3 install git+https://github.com/didx-xyz/acapy-wallet-groups-plugin@0.12.2rc0 +RUN pip3 install --no-cache-dir acapy-wallet-groups-plugin==0.12.1 # install redis-events plugin -RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-06-11#subdirectory=redis_events +RUN pip3 install git+https://github.com/didx-xyz/aries-acapy-plugins@v1-2024-05-10#subdirectory=redis_events COPY scripts/startup.sh startup.sh RUN chmod +x ./startup.sh