-
Notifications
You must be signed in to change notification settings - Fork 279
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] #3962: Revoke associated tokens on entity unregistretration #4213
Conversation
I find this implementation very brittle. If we add a new token we have to make sure that we also add the code for it's removal. I would suggest using |
I will try to figure out how to do this |
@mversic take a look, imo this solution is less brittle |
I think this is fine. But what I think you should do is:
But as far as I can see, you have already done this |
Yes, i already do this |
fafec40
to
dfcf871
Compare
let bob_id: AccountId = "bob@wonderland".parse().expect("Valid"); | ||
let kingdom_id: DomainId = "kingdom".parse().expect("Valid"); |
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.
I think we now discourage the use of expect("Valid")
and prefer just unwrap()
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.
I was unaware of this, where it's stated?
for (owner_id, permission) in accounts_permission_tokens() { | ||
if is_token_domain_associated(&permission, domain_id) { |
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.
I feel like it can (or should in future) be implemented using query filter
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.
Permission tokens are opaque for core, how it should extract fields?
…s removed Signed-off-by: Shanin Roman <[email protected]>
…gistretration Signed-off-by: Shanin Roman <[email protected]>
Signed-off-by: Shanin Roman <[email protected]>
Description
Hook into
visit_unregister_*
was added to remove associated permission tokens.I've decided not to add this cleanup logic for the
Asset
entity because asset entity could be added and remove multiple times (for example when asset value reach 0).Also i've made decision not to use macros here as imo it wouldn't bring much value here.
Linked issue
Closes #3962
Benefits
Tokens are cleaned up.
Drawbacks
Uninteresting entities could became potentially expensive as we have to iterate through every token.