decentralized-identity / decentralized-identity/didwebvh-server-py

tails server returns 500 on duplicate upload

Open
#133 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4
Forks
6
Avg merge
2d 19h
Merged PRs (30d)
2

Description

When ACA-Py(1.6.0) uses the webvh plugin with auto_attest=true on the witness, the tails file for a new revocation registry gets uploaded twice to the server:

ACA-Py core calls upload_tails_file before invoking register_revocation_registry_definition.
The webvh plugin calls upload_tails_file a second time inside _create_revocation_list_after_rev_reg_def, after the witness has attested the RevRegDef.
On the second upload, the server attempts to insert a duplicate row into the database and raises an unhandled IntegrityError, returning HTTP 500.

ACA-Py's upload_tails_file (in anoncreds/revocation/revocation.py) treats any non-success response as a failure and sets upload_success=False, which transitions the revocation list to STATE_FAILED. Subsequent credential issuance then fails with:

Revocation registry or list is in a bad state

**To Reproduce**

Start a didwebvh-server-py instance with WEBVH_WITNESS=true.
Configure an ACA-Py witness agent with auto_attest: true.
Configure an ACA-Py issuer agent connected to the witness.
Create a credential definition with support_revocation: true.
Observe the tails upload logs on the server : the second PUT /api/tails/hash/{hash} returns 500.
Attempt to issue a revocable credential → fails with "bad state".

**Workaround/possible fix**

In server/app/routers/tails.py, add a duplicate-check before the database insert:
```
# Return 409 if file already exists (ACA-Py put_file treats 409 as idempotent success)
if storage.get_tails_file(tails_hash):
return Response(content=tails_hash, media_type="text/plain", status_code=409)

# Store file in database
storage.create_tails_file(
tails_hash=tails_hash, file_content_hex=file_content.hex(), file_size=len(file_content)
)
return Response(content=tails_hash, media_type="text/plain", status_code=201)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.