Skip to content

Commit 9460902

Browse files
authored
Merge branch 'main' into fix/dependencies-format
2 parents b8ddd3a + 929a09a commit 9460902

6 files changed

Lines changed: 83 additions & 26 deletions

File tree

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"

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/AliceWantsAJsonCredential.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Also note that the above will only work with the `/issue-credential-2.0/create-o
3535

3636
Copy the "invitation" json text from the Faber shell and paste into the Alice shell to establish a connection between the two agents.
3737

38-
(If you are running with `--no-auto` you will also need to call the `/connections/accept-invitation` endpoint in alice's admin api swagger page.)
38+
(If you are running with `--no-auto` you will also need to call the `/connections/{conn_id}/accept-invitation` endpoint in alice's admin api swagger page.)
3939

4040
Now open up two browser windows to the [Faber](http://localhost:8021/api/doc) and [Alice](http://localhost:8031/api/doc) admin api swagger pages.
4141

@@ -82,7 +82,7 @@ Congradulations, you are now ready to start issuing JSON-LD credentials!
8282
- You have created a (non-public) DID for Faber to use to sign/issue the credentials - you will need to copy the DID that you created above into the examples below (as `issuer`).
8383
- You have created a (non-public) DID for Alice to use as her `credentialSubject.id` - this is required for Alice to sign the proof (the `credentialSubject.id` is not required, but then the provided presentation can't be verified).
8484

85-
To issue a credential, use the `/issue-credential-2.0/create-offer` endpoint. (You can also use the `/issue-credential-2.0/send`) endpoint, if, as mentioned above, you have included the `--no-auto` when starting both of the agents.)
85+
To issue a credential, use the `/issue-credential-2.0/send-offer` endpoint. (You can also use the `/issue-credential-2.0/send`) endpoint, if, as mentioned above, you have included the `--no-auto` when starting both of the agents.)
8686

8787
You can test with this example payload (just replace the "connection_id", "issuer" key, "credentialSubject.id" and "proofType" with appropriate values:
8888

@@ -336,7 +336,7 @@ In Alice's swagger page, submit the `/credentials/records/w3c` endpoint to see t
336336

337337
### Request Presentation Example
338338

339-
To request a proof, submit the following (with appropriate `connection_id`) to Faber's `/request-presentation-2.0/request-proof` endpoint:
339+
To request a proof, submit the following (with appropriate `connection_id`) to Faber's `/present-proof-2.0/send-request` endpoint:
340340

341341
```
342342
{
@@ -408,7 +408,7 @@ To request a proof, submit the following (with appropriate `connection_id`) to F
408408

409409
Note that the `is_holder` property can be used by Faber to verify that the holder of credential is the same as the subject of the attribute (`familyName`). Later on, the received presentation will be signed and verifiable only if `is_holder` with ` "directive": "required"` is included in the presentation request.
410410

411-
There are several ways that Alice can respond with a presentation. The simplest will just tell aca-py to put the presentation together and send it to Faber - submit the following to Alice's `/request-presentation-2.0/{pres_ex_id}/send-presentation`:
411+
There are several ways that Alice can respond with a presentation. The simplest will just tell aca-py to put the presentation together and send it to Faber - submit the following to Alice's `/present-proof-2.0/records/{pres_ex_id}/send-presentation`:
412412

413413
```
414414
{

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)