acapy: Error during creation of credential definition with revocation enabled
Problem Description
I get the error an error during the creation of a credential definition with revocation enabled using anoncreds. The credential definition is actually created however, the error occurs during the revocation operation. I still haven’t been able to determine what the cause of the error is. Here is a partial log:
File "/home/aries/.venv/lib/python3.12/site-packages/acapy_agent/wallet/askar.py", line 398, in get_local_did
raise WalletNotFoundError("Unknown DID: {}".format(did))
acapy_agent.wallet.error.WalletNotFoundError: Unknown DID: REDACTED
I can create the credential definition in a multitenant - endorsement setup. However, after the successful creation and endorsement of the Revocation Registry Definition (RevRegDef), the automatic process to create the corresponding initial Revocation Registry Entry (the list state) fails with the WalletNotFoundError shown above.
To clarify the sequence based on my logs:
A tenant agent (using askar-anoncreds wallet type, configured with an endorser) successfully creates a CredDef via endorsement. The same tenant agent successfully creates the associated RevRegDef via endorsement. The anoncreds::revocation-registry-definition::finished event is emitted. The event handler revocation_setup.py::on_rev_reg_def triggers automatically upon receiving this event. This handler successfully uploads the tails file and then calls revocation.py::create_and_register_revocation_list. This leads down a call stack eventually calling indy_vdr.py::send_revoc_reg_entry, which needs to look up the tenant’s issuer DID using askar.py::get_local_did to prepare the transaction for endorsement. Failure: get_local_did raises WalletNotFoundError for the tenant’s own DID at this point in the execution flow. It seems that while the initial request context (handled via API and endorsement flow) correctly resolves the tenant’s wallet and DID, the execution context available within the on_rev_reg_def event handler (running asynchronously after the RevRegDef write is acknowledged) is somehow unable to access the same DID within the tenant’s wallet.
Possibly related to #3586
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 35 (35 by maintainers)
I’ll try and look at it but since there’s a way to do the same configuration that doesn’t have the problem I’d like to not block 1.3.0 any longer. If the configuration needs to be done this way they will need to stay on 1.2.4 and we can look at this for a new patch release. There’s enough testing, and enough people have looked at this issue, I’m pretty confident it’s isolated enough.
I agree that perhaps this PR https://github.com/openwallet-foundation/acapy/pull/3470 that actually fixes multitenancy unique profiles could potentially be related if there was an issue with how this configuration was expecting to use the root profile incorrectly. I can try and setup this configuration and look into it asap.
After further testing, I have now discovered that the trigger for the error is setting the configuration value
--genesis-transactions-listinstead ofgenesis-url.The test was conducted using my testing environment however I tested both your configuration and mine and discovered the difference are those values -
genesis-urlalso works for me,genesis-transactions-listfails, even if only 1 ledger is configured.ps: I used my testing environment because I think your test repo hard codes a check for genesis_url and I didn’t want to dig through it.
I have observed this error in version 1.3*.
@MonolithicMonk I attempted to create a minimal example of the issue you’re seeing here: https://github.com/Indicio-tech/acapy-minimal-example/blob/test/rev-reg-entry-failure/examples/multitenancy/example.py
This example succeeds (it can fail occasionally but only from timeouts when a ledger is being particularly slow). You can run that example with
docker-compose run --rm example; do you notice any differences between this setup and yours where you’re encountering this issue?@esune The following is the logs that arises after resolving the profile context switching issue. It is very similar fix however, it is leading me down a rabbit hole of injecting a profile parameter into several functions to get the proper context. I’m not comfortable going down that path because it spans several files that I’m not familiar with. Not to mention the unintended consequences. The code base obviously knew how to determine tenant context before without the need to explicitly pass in a profile to every function.
Here is the error logs for the new issue that arose:
@esune sorry for late reply, I was busy outdoors today. The edits I made are strictly to debug the issue. They may be useful going forward but as is they are far too verbose
Thank you for the troubleshooting @MonolithicMonk, really appreciated. I will try to take a look asap and see if I can help, haven’t yet had a chance to dig into this specific issue. Will report back if/when I do, if anyone else has input please let’s continue this conversation - we’ll get to a resolution.
@esune — heads up on this one that might be related to what you are doing.