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)

Most upvoted comments

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.

I just tested with the py3.12-nightly-2025-04-16 image and still don’t see WalletNotFoundErrors 🤔

I updated my example, in case that’s useful for reference.

After further testing, I have now discovered that the trigger for the error is setting the configuration value --genesis-transactions-list instead of genesis-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-url also works for me, genesis-transactions-list fails, 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:

DEBUG /acapy_agent/core/event_bus.py:101 Notifying subscribers: <Event topic=acapy::record::endorse_transaction::transaction_acked, payload={"trimmed"}>
DEBUG /acapy_agent/core/event_bus.py:101 Notifying subscribers: <Event topic=acapy::record::endorse_transaction::transaction_acked, payload={"trimmed"}>
DEBUG /acapy_agent/core/event_bus.py:101 Notifying subscribers: <Event topic=anoncreds::revocation-registry-definition::finished, ("trimmed")>
DEBUG /acapy_agent/core/event_bus.py:101 Notifying subscribers: <Event topic=anoncreds::revocation-registry-definition::finished, ("trimmed")>
DEBUG /acapy_agent/ledger/indy_vdr.py:222 Opening the pool ledger
DEBUG /acapy_agent/ledger/indy_vdr.py:222 Opening the pool ledger
DEBUG /acapy_agent/ledger/indy_vdr.py:222 Opening the pool ledger
ERROR /acapy_agent/core/event_bus.py:123 Error occurred while processing event
Traceback (most recent call last):
  File "/acapy_agent/core/event_bus.py", line 121, in notify
    await processor()
  File "/acapy_agent/anoncreds/revocation_setup.py", line 105, in on_rev_reg_def
    await revoc.create_and_register_revocation_list(
  File "/acapy_agent/anoncreds/revocation.py", line 452, in create_and_register_revocation_list
    result = await anoncreds_registry.register_revocation_list(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/acapy_agent/anoncreds/registry.py", line 171, in register_revocation_list
    return await registrar.register_revocation_list(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/acapy_agent/anoncreds/default/legacy_indy/registry.py", line 891, in register_revocation_list
    result = await self._revoc_reg_entry_with_fix(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/acapy_agent/anoncreds/default/legacy_indy/registry.py", line 824, in _revoc_reg_entry_with_fix
    rev_entry_res = await ledger.send_revoc_reg_entry(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/acapy_agent/ledger/indy_vdr.py", line 1271, in send_revoc_reg_entry
    resp = await legacy_indy_registry.txn_submit(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/acapy_agent/anoncreds/default/legacy_indy/registry.py", line 1224, in txn_submit
    return await shield(
           ^^^^^^^^^^^^^
  File "/home/dgateman/.pyenv/versions/3.12.9/lib/python3.12/asyncio/futures.py", line 289, in __await__
    yield self  # This tells Task to wait for completion.
    ^^^^^^^^^^
  File "/home/dgateman/.pyenv/versions/3.12.9/lib/python3.12/asyncio/tasks.py", line 385, in __wakeup
    future.result()
  File "/home/dgateman/.pyenv/versions/3.12.9/lib/python3.12/asyncio/futures.py", line 202, in result
    raise self._exception.with_traceback(self._exception_tb)
  File "/home/dgateman/.pyenv/versions/3.12.9/lib/python3.12/asyncio/tasks.py", line 314, in __step_run_and_handle_result
    result = coro.send(None)
             ^^^^^^^^^^^^^^^
  File "/acapy_agent/ledger/indy_vdr.py", line 1350, in txn_submit
    resp = await self._submit(
           ^^^^^^^^^^^^^^^^^^^
  File "/acapy_agent/ledger/indy_vdr.py", line 360, in _submit
    await wallet.sign_message(request.signature_input, sign_did.verkey)
  File "/acapy_agent/wallet/askar.py", line 729, in sign_message
    raise WalletNotFoundError("Missing key for sign operation")
acapy_agent.wallet.error.WalletNotFoundError: Missing key for sign operation

@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.