status-im / status-go

The Status module that consumes go-ethereum
https://status.im
Mozilla Public License 2.0
726 stars 246 forks source link

Status Communities: CommunityDescription and shards #3555

Open richard-ramos opened 1 year ago

richard-ramos commented 1 year ago

When an user creates a community, a CommunityDescription message is broadcasted in the default waku topic. Users that want to join a community have several ways to do so:

  1. The community owner invites a contact. The invitee's status app will then ask the store node for the CommunityDescription so they can be able to spectate the community and join.
  2. A special link is published in a chat. This is a link that contains the Community ID that follows this format: https://join.status.im/c/<community-id->. Clients that receive a message with this link will automatically attempt to retrieve the CommunityDescription from the store node.
  3. The Community ID is published into the curated communities smart contract. Just like in previous scenarios, the clients will retrieve the community description from store node

In https://github.com/status-im/status-go/issues/3528 and https://rfc.vac.dev/spec/57/ Communities are expected to have their messages sent into a specific shard index, i.e. /waku/2/rs/16/<some-index>. This means that a client will not be able to retrieve the CommunityDescription without knowing on which index it was published.

The following changes are proposed:

cc: @jm-clius @kaiserd @John-44 @cammellos @iurimatias

richard-ramos commented 1 year ago

One of the requirements described in #3528 say that each community should have their own shard. Since each cluster is limited to 1024 shards as defined in https://rfc.vac.dev/spec/51/#static-sharding, we cannot use a single cluster as defined in https://rfc.vac.dev/spec/57/#relay-shards.

This means we have to include also the shard cluster as part of the community link, invitations and curated communities smart contract, otherwise this requirement of unique shards per community is not possible

richard-ramos commented 1 year ago

Also, it seems that CommunityNFTs will require to store the shard cluster and index as well to be able to retrieve the description: https://github.com/status-im/status-go/blob/develop/services/ext/service.go#L550-L562

richard-ramos commented 1 year ago

@kaiserd @jm-clius In https://rfc.vac.dev/spec/51/#index-list it is described that the rs or rsv key of the ENR is only capable of handling a single cluster. If i understood correctly this part of the RFC, this is not compatible with @John-44 requirement of having each community belong to its own shard as just having a single cluster means we're limited to a max of 1024 communities

chaitanyaprem commented 2 months ago

@richard-ramos anything pending to be done wrt this?

else we can close this ticket.