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

Feat/autoshard filter #723

Merged
merged 29 commits into from
Sep 20, 2023
Merged

Feat/autoshard filter #723

merged 29 commits into from
Sep 20, 2023

Conversation

chaitanyaprem
Copy link
Collaborator

@chaitanyaprem chaitanyaprem commented Sep 11, 2023

Description

Update Filter client API to work with Autosharding logic. #673
A client user can specify the following options when subscribing/unsubscribing from filter.

  • A pubSubTopic along with a list of contentTopics (that would not be considered for non-autosharding logic)
  • No pubSubTopic, but a list of contentTopics (as per specified format) which would be considered for autosharding. In this case if the contentTopics fall under multiple pubSubTopics , separate Filter subscriptions would be created and a subscribe request would be sent for each derived pubSubTopic.

Note: In order to not bloat this PR, optional pubSubTopic handing in MessagePush shall be done in separate PR.

Changes

  • Changes to FilterClient code to compute pubSubTopic if not specified.
  • Multiple FilterSubscriptions to be created in case contentTopics provided span across multiple pubSubTopics.
  • Added tests to verify filter with Autosharding

Tests

Added new Filter tests to validate Autosharding.
Same can be executed by running below command in waku/v2/protocol/filter directory
go test -testify.m TestAutoShard

@status-im-auto
Copy link

status-im-auto commented Sep 11, 2023

Jenkins Builds

Click to see older builds (106)
Commit #️⃣ Finished (UTC) Duration Platform Result
e214652 #1 2023-09-11 04:25:46 ~1 min linux 📄log
✔️ e214652 #1 2023-09-11 04:26:30 ~1 min nix-flake 📄log
✔️ e214652 #1 2023-09-11 04:27:40 ~2 min tests 📄log
✖️ e214652 #1 2023-09-11 04:27:43 ~3 min tests 📄log
✔️ e214652 #1 2023-09-11 04:29:06 ~4 min android 📦tgz
✔️ e214652 #1 2023-09-11 04:30:46 ~6 min ios 📦tgz
✖️ b94ab32 #2 2023-09-11 04:38:15 ~1 min tests 📄log
✔️ b94ab32 #2 2023-09-11 04:38:31 ~1 min linux 📦deb
✔️ b94ab32 #2 2023-09-11 04:38:40 ~1 min tests 📄log
✔️ b94ab32 #2 2023-09-11 04:39:01 ~1 min nix-flake 📄log
✔️ b94ab32 #2 2023-09-11 04:40:26 ~3 min android 📦tgz
✔️ b94ab32 #2 2023-09-11 04:41:10 ~4 min ios 📦tgz
✔️ ced8c0c #3 2023-09-11 05:39:24 ~1 min tests 📄log
✔️ ced8c0c #3 2023-09-11 05:39:42 ~1 min nix-flake 📄log
✔️ ced8c0c #3 2023-09-11 05:39:45 ~1 min tests 📄log
✔️ ced8c0c #3 2023-09-11 05:39:51 ~2 min linux 📦deb
✔️ ced8c0c #3 2023-09-11 05:41:00 ~3 min android 📦tgz
✔️ ced8c0c #3 2023-09-11 05:41:49 ~4 min ios 📦tgz
✔️ c868f31 #4 2023-09-11 05:44:47 ~52 sec linux 📦deb
✔️ c868f31 #4 2023-09-11 05:44:48 ~53 sec tests 📄log
✔️ c868f31 #4 2023-09-11 05:45:47 ~1 min nix-flake 📄log
✔️ c868f31 #4 2023-09-11 05:45:54 ~1 min tests 📄log
✔️ c868f31 #4 2023-09-11 05:46:59 ~3 min android 📦tgz
✔️ c1514a8 #5 2023-09-12 05:17:18 ~55 sec linux 📦deb
✔️ c1514a8 #5 2023-09-12 05:18:15 ~1 min nix-flake 📄log
✔️ c1514a8 #5 2023-09-12 05:19:22 ~2 min tests 📄log
✔️ c1514a8 #5 2023-09-12 05:19:23 ~2 min tests 📄log
✔️ c1514a8 #5 2023-09-12 05:20:21 ~3 min android 📦tgz
✔️ c1514a8 #5 2023-09-12 05:20:22 ~3 min ios 📦tgz
✔️ c525692 #6 2023-09-12 12:58:22 ~53 sec linux 📦deb
✔️ c525692 #6 2023-09-12 12:58:54 ~1 min tests 📄log
✔️ c525692 #6 2023-09-12 12:59:23 ~1 min nix-flake 📄log
✔️ c525692 #6 2023-09-12 13:00:31 ~3 min tests 📄log
✔️ c525692 #6 2023-09-12 13:01:11 ~3 min android 📦tgz
✔️ c525692 #6 2023-09-12 13:02:14 ~4 min ios 📦tgz
✔️ c127322 #7 2023-09-13 05:23:25 ~54 sec linux 📦deb
✔️ c127322 #7 2023-09-13 05:24:13 ~1 min tests 📄log
✔️ c127322 #7 2023-09-13 05:24:23 ~1 min nix-flake 📄log
✔️ c127322 #7 2023-09-13 05:24:35 ~2 min tests 📄log
✔️ c127322 #7 2023-09-13 05:25:47 ~3 min android 📦tgz
✔️ c127322 #7 2023-09-13 05:29:01 ~6 min ios 📦tgz
✖️ 5a37761 #8 2023-09-18 00:04:04 ~16 sec nix-flake 📄log
✔️ 5a37761 #8 2023-09-18 00:04:52 ~1 min linux 📦deb
5a37761 #8 2023-09-18 00:04:57 ~1 min ios 📄log
✔️ 5a37761 #8 2023-09-18 00:05:43 ~1 min tests 📄log
✔️ 5a37761 #8 2023-09-18 00:06:14 ~2 min tests 📄log
✔️ 5a37761 #8 2023-09-18 00:07:49 ~4 min android 📦tgz
✖️ 5a37761 #9 2023-09-18 00:08:30 ~14 sec nix-flake 📄log
5a37761 #9 2023-09-18 00:09:08 ~25 sec ios 📄log
✔️ 5a37761 #10 2023-09-18 07:04:54 ~2 min nix-flake 📄log
5a37761 #10 2023-09-18 07:07:26 ~4 min ios 📄log
✔️ 5a37761 #11 2023-09-18 07:15:11 ~3 min ios 📦tgz
✔️ 58ab07c #9 2023-09-18 13:09:46 ~1 min linux 📦deb
✔️ 58ab07c #11 2023-09-18 13:09:59 ~1 min nix-flake 📄log
✔️ 58ab07c #9 2023-09-18 13:10:58 ~2 min tests 📄log
✔️ 58ab07c #9 2023-09-18 13:11:18 ~3 min tests 📄log
✔️ 58ab07c #9 2023-09-18 13:11:24 ~3 min android 📦tgz
✔️ 58ab07c #12 2023-09-18 13:11:59 ~3 min ios 📦tgz
✔️ 8b1fcdd #10 2023-09-18 13:33:10 ~1 min linux 📦deb
✔️ 8b1fcdd #10 2023-09-18 13:33:46 ~1 min tests 📄log
✔️ 8b1fcdd #12 2023-09-18 13:33:52 ~1 min nix-flake 📄log
✔️ 8b1fcdd #10 2023-09-18 13:34:37 ~2 min tests 📄log
✔️ 8b1fcdd #10 2023-09-18 13:35:23 ~3 min android 📦tgz
✔️ 8b1fcdd #13 2023-09-18 13:35:31 ~3 min ios 📦tgz
✔️ 6eab8fa #11 2023-09-18 13:34:16 ~1 min linux 📦deb
✔️ 6eab8fa #13 2023-09-18 13:35:50 ~1 min nix-flake 📄log
✔️ 6eab8fa #11 2023-09-18 13:35:59 ~2 min tests 📄log
✔️ 6eab8fa #14 2023-09-18 13:37:01 ~3 min ios 📦tgz
✔️ 6eab8fa #11 2023-09-18 13:37:04 ~2 min tests 📄log
✔️ 6eab8fa #11 2023-09-18 13:41:22 ~5 min android 📦tgz
✔️ a91d6e7 #12 2023-09-18 15:26:51 ~1 min linux 📦deb
✔️ a91d6e7 #12 2023-09-18 15:27:48 ~2 min tests 📄log
✔️ a91d6e7 #14 2023-09-18 15:27:53 ~2 min nix-flake 📄log
✔️ a91d6e7 #12 2023-09-18 15:28:56 ~3 min android 📦tgz
✔️ a91d6e7 #15 2023-09-18 15:29:50 ~4 min ios 📦tgz
✖️ a91d6e7 #12 2023-09-18 15:31:22 ~5 min tests 📄log
✔️ fcae89c #13 2023-09-19 06:07:14 ~1 min linux 📦deb
✔️ fcae89c #13 2023-09-19 06:07:35 ~1 min tests 📄log
✔️ fcae89c #15 2023-09-19 06:07:51 ~1 min nix-flake 📄log
✔️ fcae89c #13 2023-09-19 06:08:00 ~1 min tests 📄log
✔️ fcae89c #13 2023-09-19 06:09:21 ~3 min android 📦tgz
✔️ fcae89c #16 2023-09-19 06:09:37 ~3 min ios 📦tgz
✔️ ba856a0 #14 2023-09-19 06:24:26 ~1 min linux 📦deb
✔️ ba856a0 #14 2023-09-19 06:25:04 ~1 min tests 📄log
✔️ ba856a0 #16 2023-09-19 06:25:19 ~1 min nix-flake 📄log
✔️ ba856a0 #14 2023-09-19 06:25:38 ~2 min tests 📄log
✔️ ba856a0 #14 2023-09-19 06:26:32 ~3 min android 📦tgz
✔️ ba856a0 #17 2023-09-19 06:26:48 ~3 min ios 📦tgz
✔️ 1d7dceb #15 2023-09-19 06:36:46 ~1 min linux 📦deb
✔️ 1d7dceb #15 2023-09-19 06:37:26 ~1 min tests 📄log
✔️ 1d7dceb #17 2023-09-19 06:37:40 ~1 min nix-flake 📄log
✔️ 1d7dceb #15 2023-09-19 06:37:48 ~1 min tests 📄log
✔️ 1d7dceb #15 2023-09-19 06:39:16 ~3 min android 📦tgz
✔️ 1d7dceb #18 2023-09-19 06:39:19 ~3 min ios 📦tgz
✔️ f053b8f #16 2023-09-19 07:01:45 ~1 min linux 📦deb
✔️ f053b8f #16 2023-09-19 07:01:59 ~1 min tests 📄log
✔️ f053b8f #18 2023-09-19 07:02:33 ~1 min nix-flake 📄log
✔️ f053b8f #16 2023-09-19 07:02:40 ~1 min tests 📄log
✔️ f053b8f #16 2023-09-19 07:03:52 ~3 min android 📦tgz
✔️ f053b8f #19 2023-09-19 07:04:20 ~3 min ios 📦tgz
✖️ 6457022 #17 2023-09-19 09:21:48 ~22 sec tests 📄log
✖️ 6457022 #17 2023-09-19 09:21:53 ~27 sec tests 📄log
✔️ 6457022 #17 2023-09-19 09:22:27 ~1 min linux 📦deb
✔️ 6457022 #19 2023-09-19 09:23:17 ~1 min nix-flake 📄log
✔️ 6457022 #17 2023-09-19 09:24:53 ~3 min android 📦tgz
✔️ 6457022 #20 2023-09-19 09:25:26 ~4 min ios 📦tgz
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ f43d6ac #18 2023-09-19 14:04:11 ~1 min linux 📦deb
✔️ f43d6ac #18 2023-09-19 14:04:42 ~1 min tests 📄log
✔️ f43d6ac #20 2023-09-19 14:05:17 ~2 min nix-flake 📄log
✔️ f43d6ac #18 2023-09-19 14:05:37 ~2 min tests 📄log
✔️ f43d6ac #18 2023-09-19 14:06:28 ~3 min android 📦tgz
✔️ f43d6ac #21 2023-09-19 14:07:10 ~4 min ios 📦tgz
✔️ ecd355c #19 2023-09-20 05:52:23 ~1 min linux 📦deb
✔️ ecd355c #19 2023-09-20 05:52:58 ~1 min tests 📄log
✔️ ecd355c #21 2023-09-20 05:53:14 ~1 min nix-flake 📄log
✔️ ecd355c #19 2023-09-20 05:53:22 ~1 min tests 📄log
✔️ ecd355c #19 2023-09-20 05:54:55 ~3 min android 📦tgz
✔️ ecd355c #22 2023-09-20 05:55:44 ~4 min ios 📦tgz

@chaitanyaprem
Copy link
Collaborator Author

chaitanyaprem commented Sep 18, 2023

@jakubgs , some CI checks are failing due to 500 error. Tried re-running it, still seeing failure.
Do take a look when you get time.

+ nix develop --impure .#default --command bash -c 'which xcodebuild'
warning: error: unable to download 'https://nix-cache.status.im/8my2i0lcli53l5jypnzd3cgf7qr3ls06.narinfo': HTTP error 500

       response body:

       Internal Server Error; retrying in 260 ms
warning: error: unable to download 'https://nix-cache.status.im/8my2i0lcli53l5jypnzd3cgf7qr3ls06.narinfo': HTTP error 500

       response body:

       Internal Server Error; retrying in 507 ms
script returned exit code 1

@jakubgs
Copy link
Contributor

jakubgs commented Sep 18, 2023

Fixed.

Copy link
Member

@richard-ramos richard-ramos left a comment

Choose a reason for hiding this comment

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

Looks good, however, where pubsub topic is marked as Optional in the different READMEs and comments, I think we need to add add some note indicating that pubsub topics are considered mandatory when used with named and static sharding, and not when using autosharding (in the case of the READMEs), and expand more on what does it mean for the pubsub topic to be optional?

Makes me wonder if we should convert ContentFilter into an interface and implementations both for named/static sharding and autosharding, with the former requiring the PubsubTopic? i.e.:

// Names are just an example

contentFilterA := NewAutoshardingContentFilter("theContentTopic)
subs, err := node.FilterLightClient().Subscribe(ctx, contentFilterA)

contentFilterB := NewContentFilter("thePubsubTopic", []string{"theContentTopics"...}
subs, err := node.FilterLightClient().Subscribe(ctx, contentFilterB)

The idea would be to allow the pubsub topic to be optional, but make it harder for the library user to use the pubsub topic incorrectly.

I left also some additional comments and questions

waku/v2/protocol/filter/client.go Outdated Show resolved Hide resolved
waku/v2/protocol/filter/client.go Show resolved Hide resolved
waku/v2/protocol/filter/client.go Outdated Show resolved Hide resolved
waku/v2/protocol/filter/client.go Outdated Show resolved Hide resolved
waku/v2/protocol/filter/client.go Outdated Show resolved Hide resolved
waku/v2/protocol/filter/client.go Outdated Show resolved Hide resolved
@chaitanyaprem
Copy link
Collaborator Author

chaitanyaprem commented Sep 19, 2023

Looks good, however, where pubsub topic is marked as Optional in the different READMEs and comments, I think we need to add add some note indicating that pubsub topics are considered mandatory when used with named and static sharding, and not when using autosharding (in the case of the READMEs), and expand more on what does it mean for the pubsub topic to be optional?

Makes me wonder if we should convert ContentFilter into an interface and implementations both for named/static sharding and autosharding, with the former requiring the PubsubTopic? i.e.:

// Names are just an example

contentFilterA := NewAutoshardingContentFilter("theContentTopic)
subs, err := node.FilterLightClient().Subscribe(ctx, contentFilterA)

contentFilterB := NewContentFilter("thePubsubTopic", []string{"theContentTopics"...}
subs, err := node.FilterLightClient().Subscribe(ctx, contentFilterB)

The idea would be to allow the pubsub topic to be optional, but make it harder for the library user to use the pubsub topic incorrectly.

I left also some additional comments and questions

Will update Readme's.

I do like the idea of making contentFilter in a way so that people cannot misuse. But, rather than making this change within the core filter code, it would be better to do it at API side. Otherwise it won't give us flexibility we want within core code. WDYT?

@richard-ramos
Copy link
Member

WDYT?

Sounds good 🚀

@chaitanyaprem
Copy link
Collaborator Author

WDYT?

Sounds good 🚀

Will take care of this in a separate PR, as this PR has been open for too long and has too many merges.

@chaitanyaprem chaitanyaprem merged commit 054bdae into master Sep 20, 2023
9 of 10 checks passed
@chaitanyaprem chaitanyaprem deleted the feat/autoshard-filter branch September 20, 2023 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants