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

fix: ignore duplicate record errors on add key #2447

Merged

Conversation

dbluhm
Copy link
Contributor

@dbluhm dbluhm commented Aug 25, 2023

This is a bandaid solution to prevent routing keys from being stored for multiple DIDs. It would be nice to correct behavior of the DIDDoc class to not turn routing keys into values in the publicKey list and then claiming that the DID is the controller (with no evidence). However, given the impending replacement of this behavior with did:peer, it doesn't seem worth it to go through that effort right now.

cc @swcurran @WadeBarnes and others

This is a bandaid solution to prevent routing keys from being stored for
multiple DIDs. It would be nice to correct behavior of the DIDDoc class
to not turn routing keys into values in the publicKey list and then
claiming that the DID is the controller (with no evidence). However,
given the impending replacement of this behavior with did:peer, it
doesn't seem worth it to go through that effort right now.

Signed-off-by: Daniel Bluhm <[email protected]>
@dbluhm
Copy link
Contributor Author

dbluhm commented Aug 25, 2023

I'm working on some additional unit tests but assuming existing tests pass as I expect, testing this in your regression test setup would be helpful @WadeBarnes

@dbluhm
Copy link
Contributor Author

dbluhm commented Aug 25, 2023

Actually, I may have spoken too confidently. Sorry! I'm not seeing the results I expected. I'll continue testing.

@dbluhm dbluhm marked this pull request as draft August 25, 2023 18:35
@dbluhm dbluhm marked this pull request as ready for review August 25, 2023 19:00
@dbluhm
Copy link
Contributor Author

dbluhm commented Aug 25, 2023

I didn't see the results I expected because I initially tried to get the code to misbehave in a way I no longer permitted; worked around this in my test by circumventing the protections I added to recreate the conditions I believe we saw in those regression tests. If I've correctly deduced those conditions, I think this is now ready for testing.

@dbluhm
Copy link
Contributor Author

dbluhm commented Aug 25, 2023

Reiterating that while this is a bandaid, this will no longer be an issue once we get did peer fixes in. If we choose to migrate old records for stored DID documents, I think we should also reconstruct the key-to-DID mapping to get rid of old records of routing keys getting mapped to DIDs when they shouldn't have been. @Jsyro @swcurran

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@swcurran
Copy link
Contributor

Daniel -- when StorageDuplicateError is thrown, is it going to cause a problem with processing? I notice it is a warning, so presumably the service keeps moving along?

Copy link
Contributor

@Jsyro Jsyro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@swcurran swcurran merged commit cb9ab08 into openwallet-foundation:main Aug 25, 2023
@dbluhm
Copy link
Contributor Author

dbluhm commented Aug 25, 2023

Daniel -- when StorageDuplicateError is thrown, is it going to cause a problem with processing? I notice it is a warning, so presumably the service keeps moving along?

@swcurran as far as I understand the circumstances of what led to the duplicate records errors, I believe ignoring the error and raising a warning will not have a negative impact on message processing.

The reason being that it is the routing keys that have duplicate records. These routing keys really have no reason to be stored in the key-to-DID lookup since we will never receive a message from a connection with those keys. If we did receive a message from those keys, prior to this fix we would have failed to process it anyways because we would have received that same duplicate record error. So on the whole, there's no change in how this scenario is handled when compared to the behavior before the introduction of #2409

@swcurran
Copy link
Contributor

Perfect — thanks! -rc2 on the way.

@swcurran
Copy link
Contributor

@dbluhm - Looks like we're not out of the woods yet. In AATH, the Aries Framework Go tests that had been passing failed, as did the Findy Tests. I'll create a new issue and try to get the data needed to review them.

@dbluhm dbluhm deleted the fix/duplicate-records-error branch January 30, 2024 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connection related issues with py3.9-0.10.0-rc1 / py3.9-0.10.0-dev0 images
3 participants