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

refactor: draft state machine #2656

Merged
merged 2 commits into from
May 6, 2024
Merged

refactor: draft state machine #2656

merged 2 commits into from
May 6, 2024

Conversation

SionoiS
Copy link
Contributor

@SionoiS SionoiS commented Apr 30, 2024

First draft of the Waku sync type state machine. Much more difficult to do in Nim than Rust but it works.

@chaitanyaprem WDYT?

@SionoiS SionoiS changed the title draft state machine refactor: draft state machine Apr 30, 2024
Copy link

github-actions bot commented Apr 30, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2656-rln-v2

Built from f569321

Copy link

github-actions bot commented Apr 30, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2656-rln-v1

Built from f569321

Copy link
Contributor

@chaitanyaprem chaitanyaprem left a comment

Choose a reason for hiding this comment

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

Code definitely looks cleaner.
But some of the tests seem to be failing.

waku/waku_sync/protocol.nim Show resolved Hide resolved
waku/waku_sync/protocol.nim Outdated Show resolved Hide resolved
waku/waku_sync/protocol.nim Outdated Show resolved Hide resolved
@SionoiS
Copy link
Contributor Author

SionoiS commented May 1, 2024

We still have to wrap the protocol then send a "end" payload from the client to have a clean stop on both side.

@SionoiS SionoiS marked this pull request as draft May 1, 2024 15:24
@SionoiS
Copy link
Contributor Author

SionoiS commented May 1, 2024

The clean stop does not happen when running tests because the test end abruptly.

@SionoiS
Copy link
Contributor Author

SionoiS commented May 2, 2024

About the closing of the connection, it seams like no other protocol do so, so I removed it.

@SionoiS SionoiS marked this pull request as ready for review May 2, 2024 19:18
@SionoiS SionoiS requested a review from Ivansete-status May 2, 2024 19:19
@chaitanyaprem
Copy link
Contributor

About the closing of the connection, it seams like no other protocol do so, so I removed it.

That is interesting, doesn't it cause the stream to stay open? Or when the object is GC'd the stream gets closed. Maybe worth investigating to confirm streams are not left dangling.

@SionoiS SionoiS force-pushed the feat--nwaku-sync branch from 95c2c36 to d76b3d0 Compare May 3, 2024 15:29
@SionoiS SionoiS force-pushed the type-state-machine branch 4 times, most recently from 147f6e3 to d41f23b Compare May 3, 2024 19:51
Co-authored-by: Ivan FB <[email protected]>
Co-authored-by: Prem Chaitanya Prathi <[email protected]>
@SionoiS SionoiS force-pushed the type-state-machine branch from d41f23b to 01c2f10 Compare May 3, 2024 19:54
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!
I just added some minor comments/questions that I hope you find useful
Cheers

waku/waku_sync/common.nim Outdated Show resolved Hide resolved
waku/waku_sync/protocol.nim Outdated Show resolved Hide resolved
waku/waku_sync/protocol.nim Outdated Show resolved Hide resolved
periodicSyncFut: Future[void]
type WakuSync* = ref object of LPProtocol
storage: Storage
peerManager: PeerManager
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we only keep a list of Store peers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would be the responsibility of PeerManager no? Or do you meant instead of PeerManager?

waku/waku_sync/protocol.nim Outdated Show resolved Hide resolved
waku/waku_sync/protocol.nim Show resolved Hide resolved
waku/waku_sync/session.nim Outdated Show resolved Hide resolved
waku/waku_sync/session.nim Outdated Show resolved Hide resolved
waku/waku_sync/session.nim Outdated Show resolved Hide resolved
@SionoiS SionoiS merged commit 4ae9dc7 into feat--nwaku-sync May 6, 2024
9 of 13 checks passed
@SionoiS SionoiS deleted the type-state-machine branch May 6, 2024 13:28
SionoiS added a commit that referenced this pull request May 9, 2024
SionoiS added a commit that referenced this pull request May 14, 2024
SionoiS added a commit that referenced this pull request Jun 3, 2024
SionoiS added a commit that referenced this pull request Jun 7, 2024
SionoiS added a commit that referenced this pull request Jun 12, 2024
SionoiS added a commit that referenced this pull request Jun 12, 2024
SionoiS added a commit that referenced this pull request Jul 2, 2024
SionoiS added a commit that referenced this pull request Jul 9, 2024
SionoiS added a commit that referenced this pull request Aug 2, 2024
SionoiS added a commit that referenced this pull request Aug 12, 2024
SionoiS added a commit that referenced this pull request Aug 13, 2024
SionoiS added a commit that referenced this pull request Aug 13, 2024
SionoiS added a commit that referenced this pull request Aug 13, 2024
* feat: Waku Sync Protocol

* feat: state machine (#2656)

* feat: pruning storage mehcanism (#2673)

* feat: message transfer mechanism & tests (#2688)

* update docker files

* added ENR filed for sync & misc. fixes

* adding new sync range param & fixes

---------

Co-authored-by: Ivan FB <[email protected]>
Co-authored-by: Prem Chaitanya Prathi <[email protected]>
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