Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL: did_service and did_verification_method entries are overwritten on DID updates #3367

Closed
gerardsn opened this issue Sep 13, 2024 · 3 comments · Fixed by #3373
Closed
Assignees
Labels
bug Something isn't working rc issues for release candidate
Milestone

Comments

@gerardsn
Copy link
Member

gerardsn commented Sep 13, 2024

did_service and did_verification_method table entries use the service.id/verificationMethod.id as primary key. This id does not change when a DID document is updated. Since the tables use the did_document_version.id as foreign key, any unchanged services and vms are overwritten during DID document updates. This means it is not possible to rebuild a DID document from the SQL data.

Does this matter? The latest version is probably the one we are interested in, and for this version the references are correct. For older versions the did_document_version.raw can be used.

@gerardsn gerardsn added bug Something isn't working rc issues for release candidate labels Sep 13, 2024
@woutslakhorst
Copy link
Member

This is a bug. New services get their ID by using a hash of the contents. So an update should definitely not use the same id

@gerardsn gerardsn self-assigned this Sep 13, 2024
@gerardsn
Copy link
Member Author

that is only if the service itself is updated, and that works as intended.

The issue here is that something else on the DID document is changed, and the older versions of the document now lose their reference to service since that now only points to the latest version of the document this service occurs on.

@gerardsn
Copy link
Member Author

We could change the primary key to include did_document_id to make it unique for a document version. This would result in lot of copies of the same services / vms. This is also a foreign key, so I'm not sure this is even possible.

Or invert the relationship. Let did_document_version point to all the services/vms ids it has.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rc issues for release candidate
Projects
None yet
2 participants