Skip to content

Commit 371bc45

Browse files
author
Yuki I
committed
docs: update method docstrings and inline comments to explain temporary #3649 workaround
Signed-off-by: Yuki I <[email protected]>
1 parent 3ae25a7 commit 371bc45

File tree

3 files changed

+73
-15
lines changed

3 files changed

+73
-15
lines changed

acapy_agent/anoncreds/default/legacy_indy/registry.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,8 @@ async def _revoc_reg_entry_with_fix(
823823
rev_list.issuer_id,
824824
write_ledger=write_ledger,
825825
endorser_did=endorser_did,
826-
profile=profile,
826+
# Temporary fix for #3624 / #3649
827+
profile=profile, # Added profile (#3624 / #3649)
827828
)
828829
except LedgerTransactionError as err:
829830
if "InvalidClientRequest" in err.roll_up:
@@ -1210,7 +1211,7 @@ async def txn_submit(
12101211
taa_accept: Optional[bool] = None,
12111212
sign_did: DIDInfo = sentinel,
12121213
write_ledger: bool = True,
1213-
profile: Optional[Profile] = None,
1214+
profile: Optional[Profile] = None, # Added profile (#3624 / #3649)
12141215
) -> str:
12151216
"""Submit a transaction to the ledger."""
12161217

@@ -1223,6 +1224,7 @@ async def txn_submit(
12231224
"write_ledger": write_ledger,
12241225
}
12251226

1227+
# Temporary fix to include profile to resolve #3624 / #3649
12261228
if profile is not None:
12271229
kwargs["profile"] = profile
12281230

acapy_agent/ledger/base.py

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,17 @@ async def rotate_public_did_keypair(self, next_seed: Optional[str] = None) -> No
176176
"""
177177

178178
@abstractmethod
179-
async def get_wallet_public_did(self, profile: Optional[Profile] = None) -> DIDInfo:
180-
"""Fetch the public DID from the wallet."""
179+
async def get_wallet_public_did(
180+
# Added profile (#3624 / #3649)
181+
self,
182+
profile: Optional[Profile] = None,
183+
) -> DIDInfo:
184+
"""Fetch the public DID from the wallet.
185+
186+
Args:
187+
profile: The profile instance to use for this operation.
188+
Temporary fix for #3624. Ideally obtained via context.
189+
"""
181190

182191
@abstractmethod
183192
async def get_txn_author_agreement(self, reload: bool = False):
@@ -194,8 +203,17 @@ async def accept_txn_author_agreement(
194203
"""Save a new record recording the acceptance of the TAA."""
195204

196205
@abstractmethod
197-
async def get_latest_txn_author_acceptance(self, profile: Optional[Profile] = None):
198-
"""Look up the latest TAA acceptance."""
206+
async def get_latest_txn_author_acceptance(
207+
# Added profile (#3624 / #3649)
208+
self,
209+
profile: Optional[Profile] = None,
210+
):
211+
"""Look up the latest TAA acceptance.
212+
213+
Args:
214+
profile: The profile instance to use for this operation.
215+
Temporary fix for #3624. Ideally obtained via context.
216+
"""
199217

200218
def taa_digest(self, version: str, text: str):
201219
"""Generate the digest of a TAA record."""
@@ -220,9 +238,22 @@ async def txn_submit(
220238
taa_accept: Optional[bool] = None,
221239
sign_did: DIDInfo = sentinel,
222240
write_ledger: bool = True,
223-
profile: Optional[Profile] = None,
241+
profile: Optional[Profile] = None, # Added profile (#3624 / #3649)
224242
) -> str:
225-
"""Write the provided (signed and possibly endorsed) transaction to the ledger."""
243+
"""Write the provided (signed and possibly endorsed) transaction to the ledger.
244+
245+
Args:
246+
request_json: Anoncreds-style ledger transaction as a JSON string.
247+
sign: Whether to sign the transaction using using `sign_did`.
248+
taa_accept: Accept the Transaction Author Agreement, if required.
249+
sign_did: DID to sign with. Required if `sign` is True.
250+
write_ledger: whether to write the request to the ledger
251+
profile: The profile instance to use for this operation.
252+
Temporary fix for #3624. Ideally obtained via context.
253+
254+
Returns:
255+
str: JSON response from the ledger.
256+
"""
226257

227258
@abstractmethod
228259
async def fetch_schema_by_id(self, schema_id: str) -> dict:
@@ -416,9 +447,20 @@ async def send_revoc_reg_entry(
416447
issuer_did: Optional[str] = None,
417448
write_ledger: bool = True,
418449
endorser_did: Optional[str] = None,
419-
profile: Optional[Profile] = None,
450+
profile: Optional[Profile] = None, # Added profile (#3624 / #3649)
420451
) -> dict:
421-
"""Publish a revocation registry entry to the ledger."""
452+
"""Publish a revocation registry entry to the ledger.
453+
454+
Args:
455+
revoc_reg_id: ID of the revocation registry.
456+
revoc_def_type: Type of revocation registry (e.g. CL_ACCUM).
457+
revoc_reg_entry: Entry data to publish.
458+
issuer_did: DID of the issuer writing the entry.
459+
write_ledger: If False, prepare but don't submit the entry.
460+
endorser_did: DID of the endorser if endorsement is required.
461+
profile: The profile instance to use for this operation.
462+
Temporary fix for #3624. Ideally obtained via context.
463+
"""
422464

423465
async def create_and_send_credential_definition(
424466
self,

acapy_agent/ledger/indy_vdr.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ async def _submit(
312312
taa_accept: Optional[bool] = None,
313313
sign_did: DIDInfo = sentinel,
314314
write_ledger: bool = True,
315-
profile: Optional[Profile] = None,
315+
profile: Optional[Profile] = None, # Added profile (#3624 / #3649)
316316
) -> dict:
317317
"""Sign and submit request to ledger.
318318
@@ -323,8 +323,11 @@ async def _submit(
323323
sign_did: override the signing DID
324324
write_ledger: whether to write the request to the ledger
325325
profile: The profile context used for the request
326+
Temporary fix for #3624 to ensure correct wallet/TAA context,
327+
bypassing potentially incorrect self.profile from manager.
326328
"""
327329

330+
# Temporary fix to use profile if provided, otherwise fallback
328331
current_profile = profile or self.profile
329332
if not self.pool_handle:
330333
raise ClosedPoolError(
@@ -1016,9 +1019,12 @@ async def accept_txn_author_agreement(
10161019
await cache.set(cache_key, acceptance, self.pool.cache_duration)
10171020

10181021
async def get_latest_txn_author_acceptance(
1019-
self, profile: Optional[Profile] = None
1022+
self,
1023+
profile: Optional[Profile] = None, # Added profile (#3624 / #3649)
10201024
) -> dict:
10211025
"""Look up the latest TAA acceptance."""
1026+
1027+
# Temporary fix to use profile if provided, otherwise fallback
10221028
current_profile = profile or self.profile
10231029
cache_key = TAA_ACCEPTED_RECORD_TYPE + "::" + current_profile.name
10241030
acceptance = self.pool.cache and await self.pool.cache.get(cache_key)
@@ -1240,10 +1246,11 @@ async def send_revoc_reg_entry(
12401246
issuer_did: Optional[str] = None,
12411247
write_ledger: bool = True,
12421248
endorser_did: Optional[str] = None,
1243-
profile: Optional[Profile] = None,
1249+
profile: Optional[Profile] = None, # Added profile (#3624 / #3649)
12441250
) -> dict:
12451251
"""Publish a revocation registry entry to the ledger."""
12461252

1253+
# Temporary fix to use profile if provided, otherwise fallback
12471254
current_profile = profile or self.profile
12481255
async with current_profile.session() as session:
12491256
wallet = session.inject(BaseWallet)
@@ -1324,8 +1331,14 @@ async def send_revoc_reg_entry(
13241331
"Exception when sending revocation registry entry"
13251332
) from err
13261333

1327-
async def get_wallet_public_did(self, profile: Optional[Profile] = None) -> DIDInfo:
1334+
async def get_wallet_public_did(
1335+
# Added profile (#3624 / #3649)
1336+
self,
1337+
profile: Optional[Profile] = None,
1338+
) -> DIDInfo:
13281339
"""Fetch the public DID from the wallet."""
1340+
1341+
# Temporary fix to use profile if provided, otherwise fallback
13291342
current_profile = profile or self.profile
13301343
async with current_profile.session() as session:
13311344
wallet = session.inject(BaseWallet)
@@ -1365,7 +1378,7 @@ async def txn_submit(
13651378
taa_accept: Optional[bool] = None,
13661379
sign_did: DIDInfo = sentinel,
13671380
write_ledger: bool = True,
1368-
profile: Optional[Profile] = None,
1381+
profile: Optional[Profile] = None, # Added profile (#3624 / #3649)
13691382
) -> str:
13701383
"""Write the provided (signed and possibly endorsed) transaction to the ledger."""
13711384
kwargs = {
@@ -1375,6 +1388,7 @@ async def txn_submit(
13751388
"write_ledger": write_ledger,
13761389
}
13771390

1391+
# Temporary fix to include profile in _submit to resolve error
13781392
if profile:
13791393
kwargs["profile"] = profile
13801394

0 commit comments

Comments
 (0)