-
Notifications
You must be signed in to change notification settings - Fork 245
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
Feature/topic negotiation #1466
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pull Request Checklist
|
Jenkins BuildsClick to see older builds (216)
|
cammellos
force-pushed
the
feature/topic-negotiation
branch
10 times, most recently
from
May 24, 2019 11:59
44a8c34
to
860792c
Compare
cammellos
force-pushed
the
feature/topic-negotiation
branch
4 times, most recently
from
May 25, 2019 08:46
47f485e
to
b71e76e
Compare
cammellos
force-pushed
the
feature/topic-negotiation
branch
5 times, most recently
from
May 31, 2019 13:33
6607471
to
6f84bcc
Compare
cammellos
force-pushed
the
feature/topic-negotiation
branch
4 times, most recently
from
June 3, 2019 09:47
723a988
to
76a5ec4
Compare
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 12, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 12, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 12, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 12, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 12, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
force-pushed
the
feature/topic-negotiation
branch
from
June 13, 2019 09:37
5e17ab6
to
3a39c66
Compare
This commit add topic negotiation to the protocol. On receiving a message from a client with version >= 1, we will generate a shared key using Diffie-Hellman. We will record also which installationID has sent us a message. This key will be passed back to the above layer, which will then use to start listening to a whisper topic (the `chat` namespace has no knowledge of whisper). When sending a message to a set of InstallationIDs, we check whether we have agreed on a topic with all of them, and if so, we will send on this separate topic, otherwise we fallback on discovery. This change is backward compatible, as long as there is no downgrade of the app on the other side. A few changes: * Factored out the DB in a separate namespace as now it is being used by multiple services (TopicService and EncryptionService). * Factored out multidevice management in a separate namespace * Moved all the test to test the whole protoocl rather than just the encryption service * Moved all the filter management in status-go
cammellos
force-pushed
the
feature/topic-negotiation
branch
2 times, most recently
from
June 13, 2019 11:02
990271f
to
e42df50
Compare
cammellos
force-pushed
the
feature/topic-negotiation
branch
from
June 13, 2019 12:23
e42df50
to
e02f7c0
Compare
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 13, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 13, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 13, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 13, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 13, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 16, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 18, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 19, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 24, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 24, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs.
cammellos
added a commit
to status-im/status-mobile
that referenced
this pull request
Jun 24, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs. Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
pacamara
pushed a commit
to pacamara/status-react
that referenced
this pull request
Jul 2, 2019
All the code has been implemented in statusgo: status-im/status-go#1466 Basically all the whisper filter management is done at that level. Technical description On startup we load all chats and send a list of them to status go: For a public chat: {:chatId "status"}, we create a single filter, based on the name of the chat. For each contact added by us, each user in a group chat and each one to one chat open, we send: {:chatId "0x", :oneToOne true}. This will create a chats, to listen to their contact code. Any previously negotiated topic is also returned. Once loaded, we create our filters, and upsert the mailserver topics, both of which are solely based on the filters loaded. In order to remove a chat, we delete/stopwatching first the the filter in status-react and then ask status-go to remove the filter. For a public chat we always remove, for a one-to-one we remove only if the user is not in our contacts, or in a group chat or we have a chat open. Negotiated topics are never removed, as otherwise the other user won't be able to contact us anymore. On stopping whisper we don't have to ask status-go to remove filters as they are removed automatically. Some more logic can be pushed in status-go, but that will be in subsequent PRs. Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add topic negotiation
This commit add topic negotiation to the protocol.
On receiving a message from a client with version >= 1, we will generate
a shared key using Diffie-Hellman. We will record also which
installationID has sent us a message.
This key will be passed back to the above layer, which will then use to
start listening to a whisper topic (the
chat
namespace has noknowledge of whisper).
When sending a message to a set of InstallationIDs, we check whether we
have agreed on a topic with all of them, and if so, we will send on this separate topic, otherwise we fallback on discovery.
This change is backward compatible with other peers, as long as there is no downgrade of the app on the other side, but it changes some of the APIs so, but it's a breaking change for status-react, I'd rather focus on the status-react PR instead of making it backward compatible, but happy to do so if necessary (it's should be pretty simple, restore one endpoint and set ProtocolVersion to 0).
A few changes:
being used by multiple services (TopicService and EncryptionService).
I still would like to move some parts of status-react to status-go, but I might push them in separate PRs.
Also don't mind the logs please, used as I am still testing, I will remove them.
Sorry for the large PR, I have been carried away, happy to split it if necessary.
status: ready