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

Re-implement proof of membership for the profile showcase communities #14084

Closed
MishkaRogachev opened this issue Mar 21, 2024 · 3 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@MishkaRogachev
Copy link
Contributor

MishkaRogachev commented Mar 21, 2024

Description

Building the profile showcase for a contact gets stuck on FetchCommunity call:

---------------------------------------> BuildProfileShowcaseFromIdentity
---------------------------------------> 1
---------------------------------------> fetching community: 0x0297e69bd1fa8f19c2a484d25ed17860fa41cadacb454dbee96118491f0b0b99fe

Probably the problem because of missing shard:

       community, err := m.FetchCommunity(&FetchCommunityRequest{
            CommunityKey:    message.CommunityId,
            Shard:           nil,
            TryDatabase:     true,
            WaitForResponse: true,
        })

Temporary this code is removed

New solution should request communities on the receiver's side

@MishkaRogachev
Copy link
Contributor Author

initial code:

		community, err := m.FetchCommunity(&FetchCommunityRequest{
			CommunityKey:    message.CommunityId,
			Shard:           nil,
			TryDatabase:     true,
			WaitForResponse: true,
		})
		if err != nil {
			m.logger.Warn("failed to fetch community for profile entry ", zap.Error(err))
		}

		if community != nil && community.Encrypted() {
			grant, err := community.VerifyGrantSignature(message.Grant)
			if err != nil {
				m.logger.Warn("failed to verify grant signature ", zap.Error(err))
				entry.MembershipStatus = identity.ProfileShowcaseMembershipStatusNotAMember
			} else {
				if grant != nil && bytes.Equal(grant.MemberId, crypto.CompressPubkey(senderPubKey)) {
					entry.MembershipStatus = identity.ProfileShowcaseMembershipStatusProvenMember
				} else { // Show as not a member if membership can't be proven
					entry.MembershipStatus = identity.ProfileShowcaseMembershipStatusNotAMember
				}
			}
		} else if community != nil {
			// Use member list as a proof for unecrypted communities
			if community.HasMember(senderPubKey) {
				entry.MembershipStatus = identity.ProfileShowcaseMembershipStatusProvenMember
			} else {
				entry.MembershipStatus = identity.ProfileShowcaseMembershipStatusNotAMember
			}
		}

@MishkaRogachev MishkaRogachev changed the title Uncomment & fix proof of membership for the profile showcase communities Re-implement proof of membership for the profile showcase communities Mar 22, 2024
@MishkaRogachev MishkaRogachev self-assigned this Mar 22, 2024
@MishkaRogachev
Copy link
Contributor Author

There is a problem in the current backend implementation:
When status-go receives a contact code message from a contact, a profile showcase for that contact is collected and sent with a signal to the client. Since there is a rule that you can't send requests to the network on network events (e.g. to request community), I plan to remove the collection of the profile showcase by signal and request the data explicitly from the ui

@MishkaRogachev
Copy link
Contributor Author

status-im/status-go#4982

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants