-
Notifications
You must be signed in to change notification settings - Fork 209
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
Remove namespace from identity manager, network map, and group manager calls #862
Conversation
The manager is initialized for a single namespace and can assume all calls are scoped within that namespace. The one exception is for "network version 1", where identities may have been registered on the legacy "ff_system" namespace. In this case, the identity manager will query "ff_system" instead of its assigned namespace (noting that this will only work if "ff_system" shares a database with that namespace). Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Also add namespace as a param to all database queries on identities, verifiers, and groups. Switch group manager to go via identity manager for identity lookups, instead of going directly to the database (to preserve fallback resolutions on ff_system). Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Codecov Report
@@ Coverage Diff @@
## main #862 +/- ##
==========================================
- Coverage 99.96% 99.96% -0.01%
==========================================
Files 300 300
Lines 19655 19610 -45
==========================================
- Hits 19649 19604 -45
Misses 5 5
Partials 1 1
Continue to review full report at Codecov.
|
@@ -389,12 +388,13 @@ func (im *identityManager) cachedIdentityLookupByVerifierRef(ctx context.Context | |||
return nil, err | |||
} else if verifier == nil { | |||
if namespace != core.LegacySystemNamespace && im.blockchain.NetworkVersion() == 1 { | |||
// For V1 networks, fall back to SystemNamespace for looking up identities | |||
// For V1 networks, fall back to LegacySystemNamespace for looking up identities | |||
// This assumes that the system namespace shares a database with this manager's namespace! | |||
return im.cachedIdentityLookupByVerifierRef(ctx, core.LegacySystemNamespace, verifierRef) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the one location where a manager is performing a lookup across namespaces to something other than the one to which it is scoped. As noted, it will only work if the database plugin is shared between this manager's namespace and the ff_system namespace. Side note: ff_system (when enabled) always uses the same set of plugins as the default namespace.
The alternative I considered was giving some sort of global access to the ff_system orchestrator and identity manager, so that other identity managers could specifically query them... but it seemed heavyweight for what is a soon-to-be deprecated behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 - logic makes sense to me on the ff_system
cross-ns identity lookup.
Part of FIR-12
Each manager is initialized for a single namespace and can assume all calls are scoped within that namespace This PR tackles identity manager, network manager, and group manager so they store and use that single namespace.
The one exception is for "network version 1", where identities may have been registered on the legacy "ff_system" namespace. In this case, the identity manager will query "ff_system" instead of its assigned namespace (noting that this will only work if "ff_system" shares a database with that namespace).