Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

feat(56/STATUS-COMMUNITIES): initial draft #567

Merged
merged 25 commits into from
Feb 21, 2023
Merged

feat(56/STATUS-COMMUNITIES): initial draft #567

merged 25 commits into from
Feb 21, 2023

Conversation

rymnc
Copy link
Contributor

@rymnc rymnc commented Jan 27, 2023

Part of the effort described in waku-org/pm#12

Porting the status community spec to vac research (app-protocol):
vacp2p/research#166

Companion PR - #569

@rymnc rymnc changed the title feat(55/WAKU2-ORGANIZATION-CHATS): initial draft [WIP]: feat(55/WAKU2-ORGANIZATION-CHATS): initial draft Jan 27, 2023
Comment on lines 32 to 44
# Design Requirements

Due to the nature of organizations, the following requirements are necessary for the design of organization chats -

1. The Organization owner is trusted.
2. The Organization owner can add or remove peers from the Organization.
3. The Organization owner can add or remove channels.
4. The peers in the Organization can send/receive messages to the channels which they have access to.
5. Organizations may be encrypted or unencrypted (public).
6. An Organization is uniquely identified by a public key.
7. The public key of the Organization is shared out of band.
8. The metadata of the Organization can be found by listening on a content topic derived from the public key of the Organization.
9. Peers part of an Organization run their own infrastructure.
Copy link
Contributor Author

@rymnc rymnc Jan 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felicio can you confirm if these assumptions are OK?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just,

  1. The Organization owner is trusted.

I'd replace org for community.

  1. The Organization owner can add or remove peers from the Organization.

Specifically, those are kick and ban ops (ref https://discord.com/channels/624205794384281629/730410574428504166/1020292913768443985).

  1. The Organization owner can add or remove channels.

And edit ofc, but dunno how taxative we wanna be here.

  1. Organizations may be encrypted or unencrypted (public).

Might be better to primarily distinguish them as private and public (ref https://discord.com/channels/624205794384281629/1048212980904501329/1052603998714220564).

Also, and maybe just as an fyi, public communities are "de facto unencrypted" atm. Since they're encrypted with a symmetric key, which is however obtainable by anyone (ref. https://discord.com/channels/864066763682218004/865466680129880074/1058202405583474688). If you'd be questioning this, I'd probably agree with you.

  1. Peers part of an Organization run their own infrastructure.

Meaning running Store or Relay protocols, for example? Web clients don't do that for instance.

Copy link

@felicio felicio Jan 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The peers in the Organization can send/receive messages to the channels which they have access to.

Members may be more suitable naming.

Copy link

@felicio felicio Jan 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given op thread at https://discord.com/channels/864066763682218004/1064649971497971862/1065146990540902400, do you think the following is worth mentioning here too:

  • the periodic publishing
  • the clock
  • the token-gating
  • waku protocols in use
  • back-ups
  • notifications

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback.
There are a couple things we need to discuss though -

  1. Since status communities "implements" this spec, the implementation details of web clients will be omitted, as this only serves as a way on how communities work.
  2. unencrypted vs encrypted communities: as per my understanding of the message you shared, it is possible to derive the key of public communities. Is there a reason we're encrypting messages from public communities at all?
  3. Based on naming in other specs, let's try to stick to "peers" instead of "members". No strong opinion here, but can change it if it's required.
  4. I agree that we need to mention periodic publishing, clock, waku protocols in use, and backups. I believe token gating is still being workshopped, so a new PR to this rfc can discuss token gating and relevant ideas/issues there. I'll add it to future work for now.
  5. Imo we don't need to specify how notifications are delivered.

Addressed some of your concerns in 6352e9f

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roger that.

Addressed some of your concerns in 6352e9f

Nice. Would you agree to move "To store and retrieve messages for offline devices" line to "SHOULD" section too instead of "MAY"? Without it, users wouldn't be able to fetch historical messages, for example.

Is there a reason we're encrypting messages from public communities at all?

I don't have a better answer, I'm sorry. @fryorcraken, please do you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, moved WAKU2-STORE to the "SHOULD" section

Copy link
Contributor

@fryorcraken fryorcraken Feb 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we're encrypting messages from public communities at all?

I don't have a better answer, I'm sorry. @fryorcraken, please do you?

Sorry, I don't know either, would need to ask @cammellos

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Historical reasons, it was always a requirement for waku-1/whisper that messages have to be encrypted when sent over the network (there used to be support for unencrypted but it was dropped).
One benefit is that it provides some level of obscurity, since if you don't know/share the public key of the community, traffic can't be encrypted, but it's very bland and that's why we consider them unencrypted.

@rymnc rymnc changed the title [WIP]: feat(55/WAKU2-ORGANIZATION-CHATS): initial draft [WIP]: feat(55/STATUS-COMMUNITIES): initial draft Jan 31, 2023
@rymnc rymnc changed the title [WIP]: feat(55/STATUS-COMMUNITIES): initial draft WIP: feat(55/STATUS-COMMUNITIES): initial draft Jan 31, 2023
@rymnc rymnc changed the title WIP: feat(55/STATUS-COMMUNITIES): initial draft WIP: feat(56/STATUS-COMMUNITIES): initial draft Feb 2, 2023
@rymnc rymnc changed the title WIP: feat(56/STATUS-COMMUNITIES): initial draft feat(56/STATUS-COMMUNITIES): initial draft Feb 2, 2023
@kaiserd kaiserd self-requested a review February 2, 2023 15:47
@oskarth oskarth requested a review from cammellos February 6, 2023 09:42
slug: 56
title: 56/STATUS-COMMUNITIES
name: Status Communities that run on Waku v2
status: raw
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be draft and correspond with actual code running Communities I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 4d11e7a. It is almost 1:1 with the implementation, just a few features which are too large to mention here can be present in follow-up rfcs (backup/sync protocol, archival protocol, etc)


1. The Community owner generates a public/private key pair.
2. The Community owner configures the Community metadata, according to the wire format "CommunityDescription".
3. The Community owner publishes the Community metadata on a content topic derived from the public key of the Community.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More details on topic usage would be useful

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 4d11e7a

@felicio, can you confirm that the content topic usage is as mentioned in the commit? As per my investigation, this is how they're used.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed 👍, just

keccak-256 hash of the result MUST be used as the content topic

the hash is encoded as hex and what's used as a topic is this https://rfc.vac.dev/spec/23/#bridging-waku-v1-and-waku-v2 construct.

Code for ref,

32 bytes and used as the content topic

Same as above would apply.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! thanks, I'll mention the hex-encoding

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in bfd3e02

Copy link
Contributor

@kaiserd kaiserd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the RFC ❇️
I left some in-line comments.

My take on the peers vs members discussion:

I'd use member when you refer to members of a status community, or members associated with a specific content topic. I'd use node/peer for the respective entities on the Waku relay layer.
I use node to refer to the own node, or some nodes from a bird-eye view; and peers to refer to nodes from the perspective of some node. E.g. a node is connected to peers; our node discovers peers, etc.


edit:
accidentally pressed approve. These were just intermediate comments, I'll do another review later.

content/docs/rfcs/56/README.md Outdated Show resolved Hide resolved
The messages in a channel are broadcasted to all the users in the channel.

A regular group chat between two or more peers reduces to a 1:1 chat between each peer and the other peers.
One mechanism for 1:1 chats is described in [55/STATUS-1TO1-CHAT](/spec/55/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo, the difference between a group chat and a community should be made clearer.
I assume, the current explanation would confuse somebody new to Status communities.

Maybe:
The purpose of Status communities, as specified in this document, is allowing for large group chats.
Communities can have further substructure, e.g. specific channels.

Smaller group chats, on the other hand, are out of scope for this document and can be built over 55/STATUS-1TO1-CHAT. We refer to these smaller group chats simply as "group chats", to differentiate them from Communities.
[continue with your explanation]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 72b8553


A regular group chat between two or more peers reduces to a 1:1 chat between each peer and the other peers.
One mechanism for 1:1 chats is described in [55/STATUS-1TO1-CHAT](/spec/55/).
The key-exchange mechanism MUST be X3DH, as described in [53/WAKU2-X3DH](/spec/53/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For 1:1 chat?
If it MUST be X3DH, why does it leave implicit SHOULD or MAY above:

One mechanism for 1:1 chats is described in

Maybe:
[...] for group chats based on 55/STATUS-1TO1-CHAT the key-exchange mechanism MUST be X3DH...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 72b8553

content/docs/rfcs/56/README.md Outdated Show resolved Hide resolved
content/docs/rfcs/56/README.md Outdated Show resolved Hide resolved
content/docs/rfcs/56/README.md Outdated Show resolved Hide resolved
### Community Leave Flow

1. A peer requests to leave a Community by sending a "CommunityRequestToLeave" message to the Community.
2. The Community owner MAY accept or reject the request.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why might a member not be allowed to leave 😅 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the current implementation, the owner has control over this process in the community.

3. [53/WAKU2-X3DH-SESSIONS](/spec/54/) - To handle session keys
4. [14/WAKU2-MESSAGE](/spec/14/) - To wrap community messages in a Waku message
5. [13/WAKU2-STORE](/spec/13/) - To store and retrieve messages for offline devices

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: We should link the scaling BCP RFC here once it is done.

The peer MAY back up their local settings, by encrypting it with their public key, and sending it to a given content topic.
The peer MAY then rely on this backup to restore their local settings, in case of a data loss.
This feature relies on [13/WAKU2-STORE](/spec/13/) for storing and retrieving messages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to analyse this (or at least keep this in mind) in regards to scaling.

The clock used in the wire format refers to the Lamport timestamp of the message.
The Lamport timestamp is a logical clock that is used to determine the order of events in a distributed system.
This allows ordering of messages in an asynchronous network where messages may be received out of order.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This might duplicate features of Waku and add unnecessary complexty. Depends on how Message ID evolves.

@kaiserd kaiserd self-requested a review February 8, 2023 09:36
@rymnc rymnc marked this pull request as ready for review February 8, 2023 11:31
content/docs/rfcs/56/README.md Outdated Show resolved Hide resolved

The following Waku protocols MAY be used to implement Status Communities -

1. [12/WAKU2-FILTER](/spec/12/) - Content filtering for resource restricted devices
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is light push not mentioned here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 53a7692

content/docs/rfcs/56/README.md Outdated Show resolved Hide resolved
This extends to banning and kicking members.
4. The Community owner can add, edit and remove channels.
5. Community members can send/receive messages to the channels which they have access to.
6. Communities may be encrypted (private) or unencrypted (public).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that public communities were dropped out. @John-44 can you confirm?

1. The Community owner generates a public/private key pair.
2. The Community owner configures the Community metadata, according to the wire format "CommunityDescription".
3. The Community owner publishes the Community metadata on a content topic derived from the public key of the Community.
the Community metadata SHOULD be encrypted with the public key of the Community. <!-- TODO: Verify this-->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still a todo? Cc @felicio

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The statement about metadata is true.

2. The Community owner configures the Community metadata, according to the wire format "CommunityDescription".
3. The Community owner publishes the Community metadata on a content topic derived from the public key of the Community.
the Community metadata SHOULD be encrypted with the public key of the Community. <!-- TODO: Verify this-->
The Community metadata MAY be sent during fixed intervals, to ensure that the Community metadata is available to members.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to define the current practice (what interval is used?) as this will help with the correctness of simulations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find instances of the community description being published periodically in status-go except when a change in the community description or control message happens.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content/docs/rfcs/56/README.md Outdated Show resolved Hide resolved

1. The peer is invited to join a Community by the Community owner, by sending a "CommunityInvitation" message.
2. A peer generates a public/private key pair.
3. The peer decrypts the "CommunityInvitation" message, and verifies the signature.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back to my comment above. How does the peer decrypt the message? I guess not with the key it just generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it more clear in 3690bab

content/docs/rfcs/56/README.md Outdated Show resolved Hide resolved
content/docs/rfcs/56/README.md Outdated Show resolved Hide resolved
The content topic that Community channels/chats use MUST be the hex-encoded keccak-256 hash of the public key of the community concatenated with the chat id.

```
contentTopic = hex(keccak256(compressedPublicKey + chatId))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See prev comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 609fd24

2. The Community owner configures the Community metadata, according to the wire format "CommunityDescription".
3. The Community owner publishes the Community metadata on a content topic derived from the public key of the Community.
the Community metadata SHOULD be encrypted with the public key of the Community. <!-- TODO: Verify this-->
The Community metadata MAY be sent during fixed intervals, to ensure that the Community metadata is available to members.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find instances of the community description being published periodically in status-go except when a change in the community description or control message happens.

content/docs/rfcs/56/README.md Outdated Show resolved Hide resolved

### Community Ban Flow

1. The Community owner adds a member to the ban list, revokes their grants, and publishes the updated Community metadata.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When an user is banned a re-key also happens if the community is encrypted. Should that be mentioned here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in b333c9c

Copy link
Contributor

@kaiserd kaiserd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM ❇️

As for the 1:1 chat RFC, we should do a spec-parlance editing pass before moving to stable (future work).

@rymnc rymnc merged commit 7b9950c into master Feb 21, 2023
@rymnc rymnc deleted the organization-spec branch February 21, 2023 16:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants