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

Partitioned topic and topic negotiation #8363

Merged
merged 1 commit into from
Jun 24, 2019

Conversation

cammellos
Copy link
Contributor

@cammellos cammellos commented Jun 5, 2019

Adds topic negotiation and partitioned topic for group-chats and pairing.

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.

Testing

This is a fairly large change and affects quite a large part of the codebase.
Specifically:

  1. Group chats
  2. Pairing
  3. Retrieving history from mailserver
  4. Creating/restoring accounts
  5. Gaps
  6. Compatibility with previous versions
  7. Deleting/Creating one-to-one/group/public chats
    8)Performance just after login (between login and plus icon is visible), it should be slightly faster if anything but roughly there should be no difference

Everything should work just in the same way.

To test the actual feature you will have check geth.log, in Debug level, for lines.

Sending on negotiated topic

Sending on partitioned topic

Sending on old discovery topic

And also you need to make sure the public key printed after is the one for the right contact (we also send pairing messages, to your own public key).

How it works

It's all based on device-to-device communications, so make sure you pair your devices before testing (might work even if you don't pair them), and that you don't have more than 3 devices on each side.

The idea is that given a group of devices A1,A2,A3 you will send on:

old discovery topic that happens if 1) if you don't have information about their devices (no communication happened before) or 2) one of those devices is running an older version.

partitioned topic if all 3 devices are running this version, but you have not send a message back from each one of those devices.

negotiated topic if all 3 devices are running this version and you have sent a message back from each one of those devices.

Examples

1 device on each side

A1 running this version, B1 running this version:

Send messages from A1, (don't send any message from B1) you should see either: Sending on old discovery topic or Sending on partitioned topic. The more you wait with both devices online, the more likely you will start seeing Sending on partitioned topic. (This is due to the fact that devices advertise themselves periodically, so it might take some time to detect each other).

Once you reply from B1 you should see Sending on negotiated topic on both devices when sending a message.

A1 running this version, B1 running an older version

You should always see Sending on old discovery topic when sending messages from A1 (B1 will not have those logs as running an older version).

1 device on one side, 2 on the other

A1 running this version, B1 , B2 running this version.

Pair B1 & B2, sending from A1 should be either Sending on old discovery topic or Sending on partitioned topic.
Send a message from B1, you should see Send on negotiated topic.
Send a message from A1 you should see Send on partitioned topic.
Send a message from B2 you should see Send on negotiated topic.
Send a message from A1 you should see Send on negotiated topic.

A1 running this version, B1 running this version B2 running an older version.

Pair B1 & B2, sending from A1 should be either Sending on old discovery topic or Sending on partitioned topic.
Send a message from B1, you should see Send on negotiated topic.
Send a message from A1 you should see Send on old discovery topic.
Send a message from B2 (no logs as an older version).
Send a message from A1 you should see Send on old discovery topic.

If a device is running this version, and sending a message to a user that has at least one device running an older version, you should always see: Sending on old discovery topic.

Basically if all the devices you are sending the message to are running this version

apologies if it's not clear, feel free to ask any question.

To test using normal one to one messages (easier) you can enable device-to-device in the settings.

status: ready

@cammellos cammellos requested review from jakubgs and a team as code owners June 5, 2019 11:44
@cammellos cammellos self-assigned this Jun 5, 2019
@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@status-github-bot
Copy link

Pull Request Checklist

  • Have you updated the documentation, if impacted (e.g. docs.status.im)?

@status-im-auto
Copy link
Member

status-im-auto commented Jun 5, 2019

Jenkins Builds

Click to see older builds (202)
Commit #️⃣ Finished (UTC) Duration Platform Result
f0a2999 #1 2019-06-05 11:48:44 ~4 min windows 📄 log
f0a2999 #1 2019-06-05 11:48:46 ~4 min macos 📄 log
f0a2999 #1 2019-06-05 11:49:37 ~5 min ios 📄 log
f0a2999 #1 2019-06-05 11:49:46 ~5 min linux 📄 log
f0a2999 #1 2019-06-05 12:01:30 ~17 min android 📄 log
f0a2999 #1 2019-06-05 12:01:30 ~17 min android-e2e 📄 log
d203fab #3 2019-06-10 17:28:16 ~1 min windows 📄 log
d203fab #3 2019-06-10 17:29:30 ~2 min linux 📄 log
d203fab #3 2019-06-10 17:29:37 ~3 min macos 📄 log
d203fab #3 2019-06-10 17:31:30 ~4 min ios 📄 log
d203fab #3 2019-06-10 17:37:07 ~10 min android-e2e 📄 log
d203fab #3 2019-06-10 17:37:19 ~10 min android 📄 log
9b894a9 #4 2019-06-11 06:26:36 ~4 min windows 📄 log
9b894a9 #4 2019-06-11 06:26:55 ~4 min macos 📄 log
9b894a9 #4 2019-06-11 06:27:30 ~5 min linux 📄 log
9b894a9 #4 2019-06-11 06:27:39 ~5 min ios 📄 log
9b894a9 #4 2019-06-11 06:31:51 ~9 min android 📄 log
9b894a9 #4 2019-06-11 06:31:51 ~9 min android-e2e 📄 log
5de283f #5 2019-06-11 12:54:07 ~3 min windows 📄 log
5de283f #5 2019-06-11 12:55:01 ~4 min macos 📄 log
5de283f #5 2019-06-11 12:55:08 ~4 min linux 📄 log
5de283f #5 2019-06-11 12:56:40 ~6 min ios 📄 log
5de283f #5 2019-06-11 13:06:18 ~16 min android-e2e 📄 log
5de283f #5 2019-06-11 13:06:30 ~16 min android 📄 log
✔️ 054f294 #6 2019-06-11 13:55:23 ~13 min ios 📦 ipa
✔️ 054f294 #6 2019-06-11 13:58:47 ~16 min linux 📦 App
✔️ 054f294 #6 2019-06-11 14:00:32 ~18 min windows 📦 exe
✔️ 054f294 #6 2019-06-11 14:00:47 ~18 min android 📦 apk
✔️ 054f294 #6 2019-06-11 14:01:08 ~18 min android-e2e 📦 apk
✔️ 054f294 #6 2019-06-11 14:01:42 ~19 min macos 📦 dmg
7d37d2e #7 2019-06-11 14:26:54 ~1 min windows 📄 log
7d37d2e #7 2019-06-11 14:27:08 ~2 min macos 📄 log
7d37d2e #7 2019-06-11 14:27:37 ~2 min ios 📄 log
7d37d2e #7 2019-06-11 14:27:59 ~2 min linux 📄 log
7d37d2e #7 2019-06-11 14:40:25 ~15 min android-e2e 📄 log
7d37d2e #7 2019-06-11 14:40:26 ~15 min android 📄 log
e6dfa50 #8 2019-06-12 07:21:10 ~3 min ios 📄 log
e6dfa50 #8 2019-06-12 07:21:25 ~3 min macos 📄 log
e6dfa50 #8 2019-06-12 07:21:43 ~3 min linux 📄 log
e6dfa50 #8 2019-06-12 07:21:50 ~3 min windows 📄 log
e6dfa50 #8 2019-06-12 07:27:38 ~9 min android 📄 log
e6dfa50 #8 2019-06-12 07:27:38 ~9 min android-e2e 📄 log
✔️ c17d68d #9 2019-06-12 07:48:31 ~13 min ios 📦 ipa
✔️ c17d68d #9 2019-06-12 07:51:04 ~16 min linux 📦 App
✔️ c17d68d #9 2019-06-12 07:52:58 ~18 min android 📦 apk
✔️ c17d68d #9 2019-06-12 07:53:14 ~18 min macos 📦 dmg
✔️ c17d68d #9 2019-06-12 07:53:22 ~18 min windows 📦 exe
✔️ c17d68d #9 2019-06-12 07:53:33 ~19 min android-e2e 📦 apk
✔️ 3281e12 #11 2019-06-12 08:58:13 ~10 min macos 📦 dmg
✔️ 3281e12 #11 2019-06-12 08:58:19 ~11 min ios 📦 ipa
✔️ 3281e12 #11 2019-06-12 09:03:14 ~16 min linux 📦 App
✔️ 3281e12 #11 2019-06-12 09:03:33 ~16 min windows 📦 exe
✔️ 3281e12 #11 2019-06-12 09:03:55 ~16 min android 📦 apk
✔️ 3281e12 #11 2019-06-12 09:04:11 ~17 min android-e2e 📦 apk
✔️ f78dde5 #12 2019-06-12 09:35:32 ~11 min android-e2e 📦 apk
✔️ f78dde5 #12 2019-06-12 09:36:16 ~12 min macos 📦 dmg
✔️ f78dde5 #12 2019-06-12 09:37:59 ~14 min windows 📦 exe
✔️ f78dde5 #12 2019-06-12 09:42:11 ~18 min android 📦 apk
✔️ f78dde5 #12 2019-06-12 09:43:32 ~19 min linux 📦 App
✔️ 3b3dd7c #13 2019-06-12 12:15:09 ~12 min ios 📦 ipa
✔️ 3b3dd7c #13 2019-06-12 12:15:39 ~13 min macos 📦 dmg
✔️ 3b3dd7c #13 2019-06-12 12:17:40 ~15 min android 📦 apk
✔️ 3b3dd7c #13 2019-06-12 12:17:53 ~15 min android-e2e 📦 apk
✔️ 3b3dd7c #13 2019-06-12 12:18:13 ~16 min linux 📦 App
✔️ 3b3dd7c #13 2019-06-12 12:20:29 ~18 min windows 📦 exe
✔️ 2b3f023 #14 2019-06-12 13:59:04 ~12 min ios 📦 ipa
✔️ 2b3f023 #14 2019-06-12 13:59:43 ~12 min windows 📦 exe
✔️ 2b3f023 #14 2019-06-12 13:59:56 ~12 min linux 📦 App
✔️ 2b3f023 #14 2019-06-12 14:00:30 ~13 min macos 📦 dmg
✔️ 2b3f023 #14 2019-06-12 14:06:17 ~19 min android 📦 apk
✔️ 2b3f023 #14 2019-06-12 14:06:31 ~19 min android-e2e 📦 apk
✔️ de03693 #15 2019-06-12 15:08:59 ~12 min ios 📦 ipa
✔️ de03693 #15 2019-06-12 15:09:50 ~13 min macos 📦 dmg
✔️ de03693 #15 2019-06-12 15:10:59 ~14 min windows 📦 exe
✔️ de03693 #15 2019-06-12 15:11:21 ~14 min android-e2e 📦 apk
✔️ de03693 #15 2019-06-12 15:13:15 ~16 min android 📦 apk
✔️ de03693 #15 2019-06-12 15:15:02 ~18 min linux 📦 App
b8151a2 #16 2019-06-13 12:31:54 ~2 min windows 📄 log
b8151a2 #16 2019-06-13 12:33:09 ~4 min linux 📄 log
b8151a2 #16 2019-06-13 12:33:52 ~4 min macos 📄 log
b8151a2 #16 2019-06-13 12:35:40 ~6 min ios 📄 log
f095cce #17 2019-06-13 12:38:34 ~2 min ios 📄 log
f095cce #17 2019-06-13 12:41:08 ~5 min macos 📄 log
f095cce #17 2019-06-13 12:41:50 ~5 min windows 📄 log
f095cce #17 2019-06-13 12:43:08 ~7 min linux 📄 log
f095cce #17 2019-06-13 12:44:11 ~8 min android-e2e 📄 log
f095cce #17 2019-06-13 12:44:55 ~9 min android 📄 log
541fec7 #18 2019-06-13 13:43:09 ~15 min android-e2e 📄 log
541fec7 #18 2019-06-13 13:43:09 ~15 min android 📄 log
541fec7 #18 2019-06-13 13:43:30 ~15 min ios 📄 log
541fec7 #18 2019-06-13 13:44:00 ~16 min windows 📄 log
541fec7 #18 2019-06-13 13:44:27 ~16 min linux 📄 log
541fec7 #18 2019-06-13 13:44:55 ~17 min macos 📄 log
✔️ 1bff8fd #20 2019-06-13 14:05:09 ~16 min android-e2e 📦 apk
✔️ 1bff8fd #20 2019-06-13 14:06:31 ~18 min macos 📦 dmg
✔️ 1bff8fd #20 2019-06-13 14:07:43 ~19 min ios 📦 ipa
✔️ 1bff8fd #20 2019-06-13 14:08:11 ~19 min linux 📦 App
✔️ 1bff8fd #20 2019-06-13 14:11:13 ~22 min android 📦 apk
✔️ 1bff8fd #20 2019-06-13 14:13:52 ~25 min windows 📦 exe
✔️ 12c00da #21 2019-06-16 22:30:28 ~12 min ios 📦 ipa
✔️ 12c00da #21 2019-06-16 22:32:06 ~14 min linux 📦 App
✔️ 12c00da #21 2019-06-16 22:32:34 ~14 min macos 📦 dmg
✔️ 12c00da #21 2019-06-16 22:32:53 ~15 min windows 📦 exe
✔️ 12c00da #21 2019-06-16 22:34:13 ~16 min android 📦 apk
✔️ 12c00da #21 2019-06-16 22:34:35 ~16 min android-e2e 📦 apk
✔️ 5b68033 #22 2019-06-17 13:42:12 ~12 min ios 📦 ipa
✔️ 5b68033 #22 2019-06-17 13:45:59 ~16 min android 📦 apk
✔️ 5b68033 #22 2019-06-17 13:45:59 ~16 min android-e2e 📦 apk
✔️ 5b68033 #22 2019-06-17 13:46:20 ~16 min macos 📦 dmg
✔️ 5b68033 #22 2019-06-17 13:47:50 ~18 min linux 📦 App
✔️ 5b68033 #22 2019-06-17 13:48:22 ~18 min windows 📦 exe
✔️ 971f13a #23 2019-06-17 14:22:38 ~11 min android-e2e 📦 apk
✔️ 971f13a #23 2019-06-17 14:24:00 ~12 min ios 📦 ipa
✔️ 971f13a #23 2019-06-17 14:24:30 ~13 min linux 📦 App
✔️ 971f13a #23 2019-06-17 14:24:39 ~13 min windows 📦 exe
✔️ 971f13a #23 2019-06-17 14:25:28 ~14 min macos 📦 dmg
✔️ 971f13a #23 2019-06-17 14:25:52 ~14 min android 📦 apk
b90d912 #24 2019-06-18 14:54:27 ~1 min android 📄 log
✔️ b90d912 #24 2019-06-18 15:04:23 ~11 min android-e2e 📦 apk
✔️ b90d912 #24 2019-06-18 15:05:00 ~12 min ios 📦 ipa
✔️ b90d912 #24 2019-06-18 15:05:09 ~12 min macos 📦 dmg
✔️ b90d912 #24 2019-06-18 15:13:58 ~21 min linux 📦 App
✔️ b90d912 #24 2019-06-18 15:14:33 ~21 min windows 📦 exe
✔️ 2b6e63c #25 2019-06-18 19:43:29 ~14 min ios 📦 ipa
✔️ 2b6e63c #25 2019-06-18 19:43:44 ~14 min linux 📦 App
✔️ 2b6e63c #25 2019-06-18 19:44:38 ~15 min windows 📦 exe
✔️ 2b6e63c #25 2019-06-18 19:45:33 ~16 min macos 📦 dmg
✔️ 2b6e63c #25 2019-06-18 19:45:53 ~16 min android 📦 apk
✔️ 2b6e63c #25 2019-06-18 19:46:17 ~17 min android-e2e 📦 apk
✔️ 498f2ea #26 2019-06-18 20:30:03 ~12 min macos 📦 dmg
✔️ 498f2ea #26 2019-06-18 20:30:25 ~13 min ios 📦 ipa
✔️ 498f2ea #26 2019-06-18 20:30:48 ~13 min android 📦 apk
✔️ 498f2ea #26 2019-06-18 20:31:13 ~13 min android-e2e 📦 apk
✔️ 498f2ea #26 2019-06-18 20:40:23 ~23 min linux 📦 App
✔️ 498f2ea #26 2019-06-18 20:45:22 ~27 min windows 📦 exe
✔️ b694739 #27 2019-06-19 15:13:45 ~13 min ios 📦 ipa
✔️ b694739 #27 2019-06-19 15:14:53 ~14 min macos 📦 dmg
✔️ b694739 #27 2019-06-19 15:16:46 ~16 min android 📦 apk
✔️ b694739 #27 2019-06-19 15:16:57 ~16 min android-e2e 📦 apk
✔️ b694739 #27 2019-06-19 15:21:12 ~20 min linux 📦 App
✔️ b694739 #27 2019-06-19 15:22:09 ~21 min windows 📦 exe
fd37a25 #28 2019-06-19 15:47:08 ~1 min android 📄 log
fd37a25 #28 2019-06-19 15:47:23 ~1 min android-e2e 📄 log
✔️ fd37a25 #28 2019-06-19 15:59:05 ~13 min ios 📦 ipa
✔️ fd37a25 #28 2019-06-19 15:59:26 ~13 min macos 📦 dmg
✔️ fd37a25 #28 2019-06-19 16:01:29 ~15 min linux 📦 App
✔️ fd37a25 #28 2019-06-19 16:02:29 ~16 min windows 📦 exe
0d93523 #30 2019-06-19 20:06:41 ~3 min ios 📄 log
✔️ 0d93523 #30 2019-06-19 20:14:22 ~11 min macos 📦 dmg
✔️ 0d93523 #30 2019-06-19 20:16:14 ~13 min linux 📦 App
✔️ 0d93523 #30 2019-06-19 20:17:20 ~14 min windows 📦 exe
0d93523 #30 2019-06-19 20:17:51 ~15 min android-e2e 📄 log
✔️ 0d93523 #30 2019-06-19 20:17:57 ~15 min android 📦 apk
0d93523 #31 2019-06-20 05:03:22 ~16 sec android-e2e 📄 log
0d93523 #32 2019-06-20 05:06:59 ~8.3 sec android-e2e 📄 log
0d93523 #33 2019-06-20 05:20:16 ~6 min android-e2e 📄 log
✔️ 06e6ac2 #31 2019-06-20 06:38:38 ~13 min ios 📦 ipa
✔️ 06e6ac2 #31 2019-06-20 06:39:04 ~13 min android 📦 apk
✔️ 06e6ac2 #31 2019-06-20 06:39:27 ~13 min linux 📦 App
✔️ 06e6ac2 #31 2019-06-20 06:39:41 ~14 min macos 📦 dmg
✔️ 06e6ac2 #34 2019-06-20 06:40:43 ~15 min android-e2e 📦 apk
✔️ 06e6ac2 #31 2019-06-20 06:47:37 ~22 min windows 📦 exe
✔️ 6afe6d7 #32 2019-06-20 13:21:11 ~12 min macos 📦 dmg
✔️ 6afe6d7 #32 2019-06-20 13:21:29 ~13 min ios 📦 ipa
✔️ 6afe6d7 #32 2019-06-20 13:24:20 ~16 min android 📦 apk
✔️ 6afe6d7 #35 2019-06-20 13:24:42 ~16 min android-e2e 📦 apk
✔️ 6afe6d7 #32 2019-06-20 13:29:05 ~20 min linux 📦 App
✔️ 6afe6d7 #32 2019-06-20 13:29:54 ~21 min windows 📦 exe
93c1a45 #33 2019-06-20 13:59:57 ~1 min ios 📄 log
93c1a45 #33 2019-06-20 14:00:11 ~1 min macos 📄 log
93c1a45 #33 2019-06-20 14:00:24 ~1 min linux 📄 log
93c1a45 #36 2019-06-20 14:01:23 ~2 min android-e2e 📄 log
93c1a45 #33 2019-06-20 14:03:33 ~4 min windows 📄 log
93c1a45 #33 2019-06-20 14:03:45 ~5 min android 📄 log
9b8a59a #34 2019-06-20 14:23:40 ~4 min windows 📄 log
9b8a59a #34 2019-06-20 14:23:49 ~4 min linux 📄 log
9b8a59a #34 2019-06-20 14:24:00 ~4 min macos 📄 log
9b8a59a #34 2019-06-20 14:24:56 ~5 min ios 📄 log
43c703f #35 2019-06-20 14:45:53 ~13 min windows 📄 log
✔️ 43c703f #35 2019-06-20 14:46:13 ~13 min linux 📦 App
✔️ 43c703f #35 2019-06-20 14:47:36 ~15 min ios 📦 ipa
✔️ 43c703f #35 2019-06-20 14:47:51 ~15 min macos 📦 dmg
43c703f #38 2019-06-20 14:49:16 ~17 min android-e2e 📄 log
✔️ 43c703f #35 2019-06-20 14:58:04 ~25 min android 📦 apk
✔️ 0c2c0ee #36 2019-06-20 15:22:28 ~14 min linux 📦 App
✔️ 0c2c0ee #36 2019-06-20 15:23:10 ~15 min ios 📦 ipa
✔️ 0c2c0ee #36 2019-06-20 15:23:33 ~15 min macos 📦 dmg
✔️ 0c2c0ee #36 2019-06-20 15:24:00 ~16 min windows 📦 exe
✔️ 0c2c0ee #36 2019-06-20 15:30:06 ~22 min android 📦 apk
✔️ 0c2c0ee #39 2019-06-20 15:30:21 ~22 min android-e2e 📦 apk
✔️ 79e4044 #38 2019-06-20 20:18:07 ~13 min macos 📦 dmg
✔️ 79e4044 #38 2019-06-20 20:19:15 ~14 min ios 📦 ipa
✔️ 79e4044 #38 2019-06-20 20:21:04 ~16 min linux 📦 App
✔️ 79e4044 #38 2019-06-20 20:23:42 ~19 min android 📦 apk
✔️ 79e4044 #38 2019-06-20 20:24:34 ~19 min windows 📦 exe
79e4044 #41 2019-06-20 20:26:10 ~21 min android-e2e 📄 log
✔️ 62546e6 #39 2019-06-20 21:42:16 ~15 min ios 📦 ipa
✔️ 62546e6 #39 2019-06-20 21:43:33 ~17 min linux 📦 App
✔️ 62546e6 #39 2019-06-20 21:43:42 ~17 min windows 📦 exe
✔️ 62546e6 #39 2019-06-20 21:43:52 ~17 min macos 📦 dmg
✔️ 62546e6 #39 2019-06-20 21:48:50 ~22 min android 📦 apk
✔️ 62546e6 #42 2019-06-20 21:48:57 ~22 min android-e2e 📦 apk
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ ad953b9 #40 2019-06-23 20:27:37 ~12 min linux 📦 App
✔️ ad953b9 #40 2019-06-23 20:28:54 ~13 min windows 📦 exe
✔️ ad953b9 #40 2019-06-23 20:31:15 ~15 min android 📦 apk
✔️ ad953b9 #43 2019-06-23 20:31:27 ~15 min android-e2e 📦 apk
✔️ ad953b9 #40 2019-06-23 20:31:27 ~15 min ios 📦 ipa
✔️ ad953b9 #40 2019-06-23 20:33:49 ~18 min macos 📦 dmg
✔️ 252ab1a #41 2019-06-24 07:18:41 ~12 min ios 📦 ipa
✔️ 252ab1a #41 2019-06-24 07:18:52 ~12 min android 📦 apk
✔️ 252ab1a #44 2019-06-24 07:19:13 ~13 min android-e2e 📦 apk
✔️ 252ab1a #41 2019-06-24 07:19:54 ~13 min macos 📦 dmg
✔️ 252ab1a #41 2019-06-24 07:19:56 ~13 min linux 📦 App
✔️ 252ab1a #41 2019-06-24 07:20:02 ~14 min windows 📦 exe

}

@ReactMethod
public void removeFilter(final String chat, final Callback callback) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you chose to do this in native rather than using rpc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I went initially for native, I got my signals crossed, I thought that was what we wanted, but it's on RPC already, I will remove this

@@ -169,22 +169,16 @@
(log/error "can't remove a chat:" error))}]}
(navigation/navigate-to-cofx :home {}))
(fx/merge cofx
;; TODO: There's a race condition here, as the removal of the filter (async)
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

@@ -17,9 +17,9 @@
(str pk "-contact-code"))

(fx/defn listen [cofx chat-id]
(transport.public-chat/join-public-chat
(transport.public-chat/join-one-to-one-chat
Copy link
Contributor

Choose a reason for hiding this comment

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

that's odd why is join one-to-one in public-chat namespace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh it's all still WIP, I just did not want to modify join-public-chat for now

@@ -34,7 +34,8 @@
;; as soon as the mailserver becomes available


(def one-day (* 24 3600))
(def one-hour 3600)
Copy link
Contributor

Choose a reason for hiding this comment

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

seriously :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

testing :)

@@ -152,6 +152,30 @@
(when (status)
(.disableInstallation (status) installation-id callback)))

(defn load-filters [chats callback]
Copy link
Contributor

Choose a reason for hiding this comment

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

ok here it is rpc calls so the native code above is going to be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct

(re-frame/dispatch
[:shh.callback/filters-added
(keep
(fn [{:keys [options callback chat-id]}]
(when-let [filter (.newMessageFilter
(when-let [filter (.newRawMessageFilter
Copy link
Contributor

Choose a reason for hiding this comment

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

seems like the last use of web3 could you use json rpc here so we can finaly get rid of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this one I need for the polling (I just need the Filter js object), it actually does not make any request through RPC, but we can get rid of it all together once we use signals for messages, once we get closer to completion of the PR we can revisit and we can decide whether to include it in this one or a separate, depending on how much stuff there is to test

@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

8 similar comments
@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

Copy link
Member

@jakubgs jakubgs left a comment

Choose a reason for hiding this comment

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

I don't see anything wrong with the dependency changes, but this bot is really starting to get on my nerves with how much it spams PRs, @pombeirp any thoughts on maybe quieting it down?

@cammellos cammellos requested a review from vkjr as a code owner June 11, 2019 12:49
@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

1 similar comment
@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

1 similar comment
@dependency-lockfile-snitch
Copy link

mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

desktop_files/yarn.lock and mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

desktop_files/yarn.lock and mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@dependency-lockfile-snitch
Copy link

desktop_files/yarn.lock and mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@cammellos
Copy link
Contributor Author

cammellos commented Jun 21, 2019

@churik it should be ready to be tested again
7 is fixed

Also message "New device detected" appears immediately after login (before it appeared after clicking on another device "Advertise")

The message appears as soon as we detect some activity from another device, so it might happen before you click on Advertise.

I could not replicate 8, it might be due to a dropped message, currently we don't resend them.

There's an outstanding issue on upgrade that on slow devices it might take some time (1/2 minutes, depending on how many public-chat/one-to-one), during this time the app is usable, but no messages are sent/received.

After the initial upgrade everything should be working fast (this is due to the fact that we have to generate some keys the first time around).
I can make it faster, but I would address it in a separate PR if it's ok.

I have also reverted the short interval for gaps for easier testing, feel free to re-introduce it.

Thanks for your patience

@churik
Copy link
Member

churik commented Jun 21, 2019

@cammellos about recent changes: as I understand, I should retest once more:

  • upgrade
  • the issues (that they are fixed)
  • and the feature itself (from the description, so search for log entries).
    Is it right?

@cammellos
Copy link
Contributor Author

cammellos commented Jun 21, 2019 via email

@churik
Copy link
Member

churik commented Jun 21, 2019

@cammellos
Issue 7 is fixed.
Issue 8 is still reproducible, more detailed steps are below (sorry if they weren't clear):

Issue 8: If you add to contact via 1-1 chat after syncing, new contact doesn't appear on paired device

Steps:

  • create accountA on deviceA
  • restore accountA on deviceB
  • deviceA: start 1-1 chat with UserC, send several messages to UserC (don't add UserC to contacts)
    So "Add to contacts" should be visible in 1-1 chat.
  • deviceB: advertise deviceB to deviceA
  • deviceA: enable deviceB in "Devices"
  • deviceA: tap on sync all
  • deviceA: send message to 1-1 chat with UserC. It should appear on deviceB.
  • deviceA : tap on "Add to contacts" in 1-1 chat with UserC

Expected result: contact is added on both devices
Actual result: contact is added only on deviceA.

"Sync all" on deviceA doesn't help.
All fine if I add new contact on deviceA from public chat - it appears on deviceB.

Logs from deviceA: Status-debug-logsA.zip

Logs from deviceB: status_logsB.zip

@cammellos
Copy link
Contributor Author

cammellos commented Jun 21, 2019 via email

@dependency-lockfile-snitch
Copy link

desktop_files/yarn.lock and mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@cammellos
Copy link
Contributor Author

@churik thanks for the repro steps, managed to replicate.

I believe the issue is also present in develop, and likely was introduced either with the introduction of system-tags or tribute to talk, as essentially system tags have changed the way we represent a contact, while ttt made some changes on when we store a record (opening a chat will add a "contact" to a list internally, which was then synced when pressing sync-all), and pairing code was not updated accordingly.
In any case it should be fixed in the latest build, good catch!

There might still be some issues lurking around contacts & syncing, but probably best to fix separately.

@dependency-lockfile-snitch
Copy link

desktop_files/yarn.lock and mobile_files/yarn.lock changed. Pinging @jakubgs, @mandrigin, and @corpetty

@churik
Copy link
Member

churik commented Jun 24, 2019

Retested on previous builds:

Retested on last build (252ab1a):

Looks good for me.
Thanks @cammellos for your patience!

@cammellos
Copy link
Contributor Author

awesome, thanks a lot for your help and patience @churik !

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
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

9 participants