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 routing in set public did #2288

Merged

Conversation

mkempa
Copy link
Contributor

@mkempa mkempa commented Jul 6, 2023

Having a multitenancy mode and a base wallet mediator, when a DID was being promoted to public the base wallet mediator was not taken into consideration - the returned mediation record was always None. As a result, the agent's endpoint is written to ledger instead of the mediator's.

This PR fixes this issue.

@mkempa mkempa marked this pull request as ready for review July 6, 2023 11:47
aries_cloudagent/wallet/routes.py Outdated Show resolved Hide resolved

routing_keys, mediator_endpoint = await route_manager.routing_info(
profile,
None,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Passed None as endpoint because it is later set to the default_endpoint in the promote_wallet_to_public

Copy link
Contributor

Choose a reason for hiding this comment

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

To clarify, we set the value to None here but the returned mediator_endpoint will be set if there's a base mediator; only if there is no mediator in use would the mediator_endpoint come back as a None and then promote_wallet_public_did will overwrite the none with the default endpoint from our settings. Sound right to you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's the case I was trying to describe. I was referring to the line 630 in this very file

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd like to see this changed up a bit; the logic would be easier to follow if the promote_wallet_public_did just accepted an endpoint (rather than a mediator_endpoint) and then when we call the route_manager.routing_info, we pass in the default endpoint value from settings. Fewer magical None values. However, I think that can wait for a different PR. Thanks for the clarification 🙂

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 6, 2023

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

@mkempa mkempa requested a review from dbluhm July 6, 2023 13:35
@dbluhm
Copy link
Contributor

dbluhm commented Jul 6, 2023

@usingtechnology @TimoGlastra This one is pretty straightforward; the set public DID endpoint was overlooked during recent passes improving handling of mediation for multitenancy. Timo, you've been around this code recently with #2243; your thoughts would be appreciated if you get a chance but, given the straightforwardness, I'm content to merge without additional feedback.

@dbluhm dbluhm merged commit 759b840 into openwallet-foundation:main Jul 7, 2023
@mkempa mkempa deleted the Fix_routing_in_set_public_did branch July 10, 2023 08:24
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.

2 participants