Skip to content

Commit fe61319

Browse files
authored
Merge branch 'main' into main
2 parents 3bd1ca3 + 29ace87 commit fe61319

17 files changed

Lines changed: 642 additions & 26 deletions
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Nightly Tests
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
tests:
10+
name: Tests
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: ["ubuntu-latest"]
15+
python-version: ["3.7", "3.8", "3.9", "3.10"]
16+
include:
17+
- os: "ubuntu-20.04"
18+
python-version: "3.6"
19+
uses: ./.github/workflows/tests.yml
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
os: ${{ matrix.os }}
23+
24+
tests-indy:
25+
name: Tests (Indy)
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
os: ["ubuntu-latest"]
30+
python-version: ["3.7", "3.8", "3.9", "3.10"]
31+
include:
32+
- os: "ubuntu-20.04"
33+
python-version: "3.6"
34+
35+
uses: ./.github/workflows/tests-indy.yml
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
os: ${{ matrix.os }}
39+
indy-version: "1.16.0"

.github/workflows/pr-tests.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: PR Tests
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
tests:
8+
name: Tests
9+
uses: ./.github/workflows/tests.yml
10+
with:
11+
python-version: "3.6"
12+
os: "ubuntu-20.04"
13+
14+
tests-indy:
15+
name: Tests (Indy)
16+
uses: ./.github/workflows/tests-indy.yml
17+
with:
18+
python-version: "3.6"
19+
indy-version: "1.16.0"
20+
os: "ubuntu-20.04"

.github/workflows/tests-indy.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Tests (Indy)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-version:
7+
required: true
8+
type: string
9+
indy-version:
10+
required: true
11+
type: string
12+
os:
13+
required: true
14+
type: string
15+
16+
jobs:
17+
tests:
18+
name: Test Python ${{ inputs.python-version }} on Indy ${{ inputs.indy-version }}
19+
runs-on: ${{ inputs.os }}
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Cache image layers
24+
uses: actions/cache@v3
25+
with:
26+
path: /tmp/.buildx-cache-test
27+
key: ${{ runner.os }}-buildx-test-${{ github.sha }}
28+
restore-keys: |
29+
${{ runner.os }}-buildx-test-
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v1
33+
34+
- name: Build test image
35+
uses: docker/build-push-action@v3
36+
with:
37+
load: true
38+
context: .
39+
file: docker/Dockerfile.indy
40+
target: acapy-test
41+
tags: acapy-test:latest
42+
build-args: |
43+
python_version=${{ inputs.python-version }}
44+
indy_version=${{ inputs.indy-version }}
45+
cache-from: type=local,src=/tmp/.buildx-cache-test
46+
cache-to: type=local,dest=/tmp/.buildx-cache-test-new,mode=max
47+
48+
# Temp fix
49+
# https://github.com/docker/build-push-action/issues/252
50+
# https://github.com/moby/buildkit/issues/1896
51+
- name: Move cache
52+
run: |
53+
rm -rf /tmp/.buildx-cache-test
54+
mv /tmp/.buildx-cache-test-new /tmp/.buildx-cache-test
55+
56+
- name: Run pytest
57+
run: |
58+
docker run --rm acapy-test:latest

.github/workflows/tests.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-version:
7+
required: true
8+
type: string
9+
os:
10+
required: true
11+
type: string
12+
13+
jobs:
14+
tests:
15+
name: Test Python ${{ inputs.python-version }}
16+
runs-on: ${{ inputs.os }}
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up Python ${{ inputs.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ inputs.python-version }}
23+
cache: 'pip'
24+
cache-dependency-path: 'requirements*.txt'
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip3 install --no-cache-dir \
29+
-r requirements.txt \
30+
-r requirements.askar.txt \
31+
-r requirements.bbs.txt \
32+
-r requirements.dev.txt
33+
- name: Tests
34+
run: |
35+
pytest

aries_cloudagent/ledger/multiple_ledger/indy_manager.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from ...cache.base import BaseCache
1111
from ...core.profile import Profile
12+
from ...ledger.base import BaseLedger
1213
from ...ledger.error import LedgerError
1314
from ...wallet.crypto import did_is_self_certified
1415

@@ -53,7 +54,11 @@ def __init__(
5354

5455
async def get_write_ledger(self) -> Optional[Tuple[str, IndySdkLedger]]:
5556
"""Return the write IndySdkLedger instance."""
56-
return self.write_ledger_info
57+
# return self.write_ledger_info
58+
if self.write_ledger_info:
59+
return (self.write_ledger_info[0], self.profile.inject_or(BaseLedger))
60+
else:
61+
return None
5762

5863
async def get_prod_ledgers(self) -> Mapping:
5964
"""Return production ledgers mapping."""
@@ -83,7 +88,11 @@ async def _get_ledger_by_did(
8388
"""
8489
try:
8590
indy_sdk_ledger = None
86-
if ledger_id in self.production_ledgers:
91+
if self.write_ledger_info and ledger_id == self.write_ledger_info[0]:
92+
indy_sdk_ledger = await self.get_write_ledger()
93+
if indy_sdk_ledger:
94+
indy_sdk_ledger = indy_sdk_ledger[1]
95+
elif ledger_id in self.production_ledgers:
8796
indy_sdk_ledger = self.production_ledgers.get(ledger_id)
8897
else:
8998
indy_sdk_ledger = self.non_production_ledgers.get(ledger_id)
@@ -134,7 +143,9 @@ async def lookup_did_in_configured_ledgers(
134143
cache_key = f"did_ledger_id_resolver::{did}"
135144
if bool(cache_did and self.cache and await self.cache.get(cache_key)):
136145
cached_ledger_id = await self.cache.get(cache_key)
137-
if cached_ledger_id in self.production_ledgers:
146+
if self.write_ledger_info and cached_ledger_id == self.write_ledger_info[0]:
147+
return self.get_write_ledger()
148+
elif cached_ledger_id in self.production_ledgers:
138149
return (cached_ledger_id, self.production_ledgers.get(cached_ledger_id))
139150
elif cached_ledger_id in self.non_production_ledgers:
140151
return (

aries_cloudagent/ledger/multiple_ledger/manager_provider.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,27 @@ def provide(self, settings: BaseSettings, injector: BaseInjector):
8484
pool_name = config.get("pool_name")
8585
ledger_is_production = config.get("is_production")
8686
ledger_is_write = config.get("is_write")
87-
ledger_pool = pool_class(
88-
pool_name,
89-
keepalive=keepalive,
90-
cache=cache,
91-
genesis_transactions=genesis_transactions,
92-
read_only=read_only,
93-
socks_proxy=socks_proxy,
94-
)
95-
ledger_instance = ledger_class(
96-
pool=ledger_pool,
97-
profile=self.root_profile,
98-
)
9987
if ledger_is_write:
100-
write_ledger_info = (ledger_id, ledger_instance)
101-
if ledger_is_production:
102-
indy_sdk_production_ledgers[ledger_id] = ledger_instance
88+
write_ledger_info = (ledger_id, None)
10389
else:
104-
indy_sdk_non_production_ledgers[ledger_id] = ledger_instance
90+
ledger_pool = pool_class(
91+
pool_name,
92+
keepalive=keepalive,
93+
cache=cache,
94+
genesis_transactions=genesis_transactions,
95+
read_only=read_only,
96+
socks_proxy=socks_proxy,
97+
)
98+
ledger_instance = ledger_class(
99+
pool=ledger_pool,
100+
profile=self.root_profile,
101+
)
102+
if ledger_is_production:
103+
indy_sdk_production_ledgers[ledger_id] = ledger_instance
104+
else:
105+
indy_sdk_non_production_ledgers[
106+
ledger_id
107+
] = ledger_instance
105108
if settings.get_value("ledger.genesis_transactions"):
106109
ledger_instance = self.root_profile.inject_or(BaseLedger)
107110
ledger_id = "startup::" + ledger_instance.pool.name

aries_cloudagent/ledger/multiple_ledger/tests/test_indy_manager.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from ....cache.base import BaseCache
1212
from ....cache.in_memory import InMemoryCache
1313
from ....core.in_memory import InMemoryProfile
14+
from ....ledger.base import BaseLedger
1415
from ....messaging.responder import BaseResponder
1516

1617
from ...error import LedgerError
@@ -36,6 +37,7 @@ async def setUp(self):
3637
IndySdkLedgerPool("test_prod_1", checked=True), self.profile
3738
)
3839
test_write_ledger = ("test_prod_1", test_prod_ledger)
40+
self.context.injector.bind_instance(BaseLedger, test_prod_ledger)
3941
self.production_ledger["test_prod_1"] = test_prod_ledger
4042
self.production_ledger["test_prod_2"] = IndySdkLedger(
4143
IndySdkLedgerPool("test_prod_2", checked=True), self.profile
@@ -385,13 +387,13 @@ async def test_lookup_did_in_configured_ledgers_prod_not_cached(
385387

386388
async def test_lookup_did_in_configured_ledgers_cached_prod_ledger(self):
387389
cache = InMemoryCache()
388-
await cache.set("did_ledger_id_resolver::Av63wJYM7xYR4AiygYq4c3", "test_prod_1")
390+
await cache.set("did_ledger_id_resolver::Av63wJYM7xYR4AiygYq4c3", "test_prod_2")
389391
self.profile.context.injector.bind_instance(BaseCache, cache)
390392
(ledger_id, ledger_inst,) = await self.manager.lookup_did_in_configured_ledgers(
391393
"Av63wJYM7xYR4AiygYq4c3", cache_did=True
392394
)
393-
assert ledger_id == "test_prod_1"
394-
assert ledger_inst.pool.name == "test_prod_1"
395+
assert ledger_id == "test_prod_2"
396+
assert ledger_inst.pool.name == "test_prod_2"
395397

396398
async def test_lookup_did_in_configured_ledgers_cached_non_prod_ledger(self):
397399
cache = InMemoryCache()

demo/bdd_support/agent_backchannel_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,12 @@ def aries_container_receive_credential(
130130
def aries_container_request_proof(
131131
the_container: AgentContainer,
132132
proof_request: dict,
133+
explicit_revoc_required: bool = False,
133134
):
134135
return run_coroutine(
135136
the_container.request_proof,
136137
proof_request,
138+
explicit_revoc_required=explicit_revoc_required,
137139
)
138140

139141

demo/features/0454-present-proof.feature

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Feature: RFC 0454 Aries agent present proof
9898
| Acme | --revocation --public-did --multitenant | --multitenant | driverslicense_v2 | Data_DL_MaxValues | DL_age_over_19_v2 |
9999

100100
@T003-RFC0454.1 @GHA
101-
Scenario Outline: Present Proof for multiple credentials where the one is revocable and one isn't
101+
Scenario Outline: Present Proof for multiple credentials where the one is revocable and one isn't, neither credential is revoked
102102
Given we have "4" agents
103103
| name | role | capabilities |
104104
| Acme1 | issuer1 | <Acme1_capabilities> |
@@ -117,8 +117,28 @@ Feature: RFC 0454 Aries agent present proof
117117
| issuer1 | Acme1_capabilities | issuer2 | Acme2_capabilities | Bob_cap | Schema_name_1 | Credential_data_1 | Schema_name_2 | Credential_data_2 | Proof_request |
118118
| Acme1 | --revocation --public-did | Acme2 | --public-did | | driverslicense_v2 | Data_DL_MaxValues | health_id | Data_DL_MaxValues | DL_age_over_19_v2_with_health_id |
119119

120+
@T003-RFC0454.1f
121+
Scenario Outline: Present Proof for multiple credentials where the one is revocable and one isn't, neither credential is revoked, fails due to requesting request-level revocation
122+
Given we have "4" agents
123+
| name | role | capabilities |
124+
| Acme1 | issuer1 | <Acme1_capabilities> |
125+
| Acme2 | issuer2 | <Acme2_capabilities> |
126+
| Faber | verifier | <Acme1_capabilities> |
127+
| Bob | prover | <Bob_cap> |
128+
And "<issuer1>" and "Bob" have an existing connection
129+
And "Bob" has an issued <Schema_name_1> credential <Credential_data_1> from "<issuer1>"
130+
And "<issuer2>" and "Bob" have an existing connection
131+
And "Bob" has an issued <Schema_name_2> credential <Credential_data_2> from "<issuer2>"
132+
And "Faber" and "Bob" have an existing connection
133+
When "Faber" sends a request for proof presentation <Proof_request> to "Bob"
134+
Then "Faber" has the proof verification fail
135+
136+
Examples:
137+
| issuer1 | Acme1_capabilities | issuer2 | Acme2_capabilities | Bob_cap | Schema_name_1 | Credential_data_1 | Schema_name_2 | Credential_data_2 | Proof_request |
138+
| Acme1 | --revocation --public-did | Acme2 | --public-did | | driverslicense_v2 | Data_DL_MaxValues | health_id | Data_DL_MaxValues | DL_age_over_19_v2_with_health_id_r2 |
139+
120140
@T003-RFC0454.2 @GHA
121-
Scenario Outline: Present Proof for multiple credentials where the one is revocable and one isn't, and the revocable credential is revoked
141+
Scenario Outline: Present Proof for multiple credentials where the one is revocable and one isn't, and the revocable credential is revoked, and the proof checks for revocation and fails
122142
Given we have "4" agents
123143
| name | role | capabilities |
124144
| Acme1 | issuer1 | <Acme1_capabilities> |
@@ -137,3 +157,25 @@ Feature: RFC 0454 Aries agent present proof
137157
Examples:
138158
| issuer1 | Acme1_capabilities | issuer2 | Acme2_capabilities | Bob_cap | Schema_name_1 | Credential_data_1 | Schema_name_2 | Credential_data_2 | Proof_request |
139159
| Acme1 | --revocation --public-did | Acme2 | --public-did | | driverslicense_v2 | Data_DL_MaxValues | health_id | Data_DL_MaxValues | DL_age_over_19_v2_with_health_id |
160+
| Acme1 | --revocation --public-did | Acme2 | --public-did | | driverslicense_v2 | Data_DL_MaxValues | health_id | Data_DL_MaxValues | DL_age_over_19_v2_with_health_id_r2 |
161+
162+
@T003-RFC0454.3 @GHA
163+
Scenario Outline: Present Proof for multiple credentials where the one is revocable and one isn't, and the revocable credential is revoked, and the proof doesn't check for revocation and passes
164+
Given we have "4" agents
165+
| name | role | capabilities |
166+
| Acme1 | issuer1 | <Acme1_capabilities> |
167+
| Acme2 | issuer2 | <Acme2_capabilities> |
168+
| Faber | verifier | <Acme1_capabilities> |
169+
| Bob | prover | <Bob_cap> |
170+
And "<issuer1>" and "Bob" have an existing connection
171+
And "Bob" has an issued <Schema_name_1> credential <Credential_data_1> from "<issuer1>"
172+
And "<issuer1>" revokes the credential
173+
And "<issuer2>" and "Bob" have an existing connection
174+
And "Bob" has an issued <Schema_name_2> credential <Credential_data_2> from "<issuer2>"
175+
And "Faber" and "Bob" have an existing connection
176+
When "Faber" sends a request with explicit revocation status for proof presentation <Proof_request> to "Bob"
177+
Then "Faber" has the proof verified
178+
179+
Examples:
180+
| issuer1 | Acme1_capabilities | issuer2 | Acme2_capabilities | Bob_cap | Schema_name_1 | Credential_data_1 | Schema_name_2 | Credential_data_2 | Proof_request |
181+
| Acme1 | --revocation --public-did | Acme2 | --public-did | | driverslicense_v2 | Data_DL_MaxValues | health_id | Data_DL_MaxValues | DL_age_over_19_v2_with_health_id_no_revoc |

demo/features/0586-sign-transaction.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Feature: RFC 0586 Aries sign (endorse) transactions functions
2626
| --multitenant | --multitenant | driverslicense |
2727
| --mediation --multitenant | --mediation --multitenant | driverslicense |
2828
| --multitenant --multi-ledger | --multitenant --multi-ledger | driverslicense |
29+
| --multitenant --multi-ledger --revocation | --multitenant --multi-ledger --revocation | driverslicense |
2930

3031

3132
@T001.1-RFC0586 @GHA
@@ -94,6 +95,7 @@ Feature: RFC 0586 Aries sign (endorse) transactions functions
9495
| --revocation --public-did --mediation | --revocation --mediation | driverslicense | Data_DL_NormalizedValues |
9596
| --revocation --public-did --multitenant | --revocation --multitenant | driverslicense | Data_DL_NormalizedValues |
9697
| --revocation --public-did --mediation --multitenant | --revocation --mediation --multitenant | driverslicense | Data_DL_NormalizedValues |
98+
| --multitenant --multi-ledger --revocation --public-did | --multitenant --multi-ledger --revocation | driverslicense | Data_DL_NormalizedValues |
9799

98100
@T002.1-RFC0586 @GHA
99101
Scenario Outline: endorse a schema and cred def transaction, write to the ledger, issue and revoke a credential, manually invoking each endorsement endpoint

0 commit comments

Comments
 (0)