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

No need to check permissions ourselves as member when a community updates permisisons #14220

Closed
jrainville opened this issue Mar 28, 2024 · 2 comments · Fixed by #14771 or status-im/status-go#5168
Assignees
Labels
backend-team E:Desktop Comm Perms and Minting MVP Misc tasks about Community permissions that are not part of another Epic, due for the MVP refactor
Milestone

Comments

@jrainville
Copy link
Member

Description

Right now, each time the control node updates the permissions for a community, each member does a small check up on the permission to see if they still fit the permission.

This causes a spike in CPU and also does a call to the ethereum provider for no reason.

We should be relying on the Community Description provided by the control node. Since the control node itself already reevaluates the permissions of each members, we can just check it.

For the community itself and being part of it, we would be out of the member list if we didn't fit the permission.

For the channels, each community channel comes with a list of members. Channels with permissions have an updated list of members for the ones that fit the permission. So we can just see if we are still in that list.

The only exception to that rule is when you are not part of a community. In that case, the control node doesn't know about you, so you need to check your own permissions yourself.

Acceptance criteria

  • When part of a community, members should not check the chain for permissions instead
    • for being part of the community, check the community member list
    • for being part of a channel, check the community channel's member list
      • If you are not part of a channel, then we can check the permissions to see which token is missing, but only when the channel is in view (user clicked on the channel)
  • When not part of a community, we can check the join permission on chain, because we are not part of the member list yet
@jrainville jrainville added refactor backend-team E:Desktop Comm Perms and Minting MVP Misc tasks about Community permissions that are not part of another Epic, due for the MVP E:Desktop Performance Improvements MVP labels Mar 28, 2024
@jrainville jrainville added this to the 2.30.0 Beta milestone Mar 28, 2024
@osmaczko
Copy link
Contributor

It should not result in such big spike, there is something wrong. Maybe there is circular event dependency or recursion.

@jrainville
Copy link
Member Author

Turns out the spike wasn't on the backend but on the Nim/QML side. It was mostly resolved.

I think it's still worth it to improve the backend so that we don,t rely on 3rd party providers anyway. It should make it faster too.

@jrainville jrainville modified the milestones: 2.30.0 Beta, 2.29.0 Beta Apr 5, 2024
@jrainville jrainville assigned endulab and unassigned osmaczko May 3, 2024
endulab added a commit that referenced this issue May 15, 2024
Light functions are used first in order to reduce the number of calls to blockchain.
If the permission is not met (user is not a member of community/channel member list),
then normal permissions-check function is used.

Issue #14220
endulab added a commit that referenced this issue May 15, 2024
endulab added a commit that referenced this issue May 16, 2024
Light functions are used first in order to reduce the number of calls to blockchain.
If the permission is not met (user is not a member of community/channel member list),
then normal permissions-check function is used.

Issue #14220
endulab added a commit that referenced this issue May 16, 2024
endulab added a commit that referenced this issue May 17, 2024
Light functions are used first in order to reduce the number of calls to blockchain.
If the permission is not met (user is not a member of community/channel member list),
then normal permissions-check function is used.

Issue #14220
endulab added a commit that referenced this issue May 17, 2024
endulab added a commit that referenced this issue May 17, 2024
Light functions are used first in order to reduce the number of calls to blockchain.
If the permission is not met (user is not a member of community/channel member list),
then normal permissions-check function is used.

Issue #14220
endulab added a commit that referenced this issue May 17, 2024
endulab added a commit that referenced this issue May 20, 2024
Light functions are used first in order to reduce the number of calls to blockchain.
If the permission is not met (user is not a member of community/channel member list),
then normal permissions-check function is used.

Issue #14220
endulab added a commit that referenced this issue May 20, 2024
endulab added a commit that referenced this issue May 20, 2024
Light functions are used first in order to reduce the number of calls to blockchain.
If the permission is not met (user is not a member of community/channel member list),
then normal permissions-check function is used.

Issue #14220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend-team E:Desktop Comm Perms and Minting MVP Misc tasks about Community permissions that are not part of another Epic, due for the MVP refactor
Projects
Status: Done
3 participants