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: waku sync shard matching check #3259

Merged
merged 4 commits into from
Jan 30, 2025
Merged

Conversation

SionoiS
Copy link
Contributor

@SionoiS SionoiS commented Jan 27, 2025

Add a check so that peers supporting different shards don't sync.

@SionoiS SionoiS self-assigned this Jan 27, 2025
@SionoiS SionoiS marked this pull request as ready for review January 27, 2025 21:05
Copy link

github-actions bot commented Jan 27, 2025

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3259

Built from 4ebb5e8

@SionoiS SionoiS force-pushed the feat--waku-sync-shard-support branch from 23ac2a0 to 4b1fa1a Compare January 28, 2025 14:10
Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for it! 💯

Comment on lines 181 to 183
serverSwitch, idsChannel, localWants, remoteNeeds, @[0.uint16, 1, 2, 3]
)
client = await newTestWakuRecon(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry but I can't fully follow why we pass both the localWants and remoteNeeds to both client and server. Somehow I would expect passing either nil or an empty seq in some param, f.e. client with empty remoteNeeds, etc. But I might be missing something

Copy link
Contributor Author

@SionoiS SionoiS Jan 29, 2025

Choose a reason for hiding this comment

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

Since the protocol is symmetrical both peers (client & server) have the same information about who wants what.

Client:
local want -> 0xA
remote need -> 0xB

Server:
remote need -> 0xA
local want -> 0xB

Because of the differences in hashes and peerId you don't have to create 2 for each the result is the same.

waku/waku_store_sync/codec.nim Outdated Show resolved Hide resolved
Copy link
Contributor

@jm-clius jm-clius left a comment

Choose a reason for hiding this comment

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

Generally LGTM. Would be good to see this in a (raw) wire protocol spec too. I think we need network ID + shard to be fully qualified?

@@ -26,6 +26,8 @@ type
ItemSet = 2

RangesData* = object
shards*: seq[uint16]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we'd need the network ID too to fully qualify the shard.

@SionoiS
Copy link
Contributor Author

SionoiS commented Jan 29, 2025

Generally LGTM. Would be good to see this in a (raw) wire protocol spec too. I think we need network ID + shard to be fully qualified?

I'm confused... Why add this to the spec? It's just a quick hack to prevent sync in some cases.

@jm-clius
Copy link
Contributor

I'm confused... Why add this to the spec? It's just a quick hack to prevent sync in some cases.

Afaict this changes what is serialised to the wire, which IMO is good to specify for other implementers/maintainers/testers - even if we expect a future version of the protocol to replace this logic. :)

@SionoiS SionoiS merged commit 42fd6b8 into master Jan 30, 2025
12 of 13 checks passed
@SionoiS SionoiS deleted the feat--waku-sync-shard-support branch January 30, 2025 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants