credo-ts
credo-ts copied to clipboard
Improvements in AFJs reads of AnonCreds transactions during issuance
In examining performance issues in receiving a credential in an Aries Bifold wallet as part of #1613, it was found that AFJ seems to do the following transaction reads to the ledger for AnonCreds objects:
- Get credential definition
- Get transaction
- Get credential definition
- Get transaction
- Get schema
- Get revocation registry definition
It's not clear if this is the sequence only when reading from an Indy ledger or when reading AnonCreds objects from any type of ledger. However, it is likely that the Get Transaction calls are to retrieve the Indy schema transaction ID referenced in the CredDefId on an Indy ledger.
There should be only at most be 3 reads being made:
- Get credential definition
- Get schema
- Get revocation registry definition
This issue is to investigate what where the reads are being made and if they can be reduced -- particularly the duplicate "Get Credential Definition" reads.
Side issues:
- The "get transaction" is (likely) an Indy optimization/legacy because the CredDefId contains the transaction ID of the schema. It would be best to drop the use of the transaction ID because that "shortcut" only resides in the Indy legacy method. It can't be used with
did:indyor when using any other AnonCreds method. - I understand that a cache has been implemented, and that might make "fixing" this issue unnecessary. If that is to be relied upon, when caching a legacy Indy network Schema, it would be good to index the cache with the both the TransactionID (for the Get Transaction reads) and by the Schema ID (for the Get Schema read), since they (very likely) refer to the same ledger transaction. Of course, if the "Get Transaction" calls are eliminated, that problem goes away.