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(rln-relay): track last seen event #1296

Merged
merged 14 commits into from
Nov 1, 2022
Merged

feat(rln-relay): track last seen event #1296

merged 14 commits into from
Nov 1, 2022

Conversation

rymnc
Copy link
Contributor

@rymnc rymnc commented Oct 25, 2022

Should resolve #1265

Tracks the last seen event and stores it on the WakuRlnRelay instance so that it can be reused in the eth node reconnection feature

@rymnc rymnc added the track:rln RLN Track (Secure Messaging/Applied ZK), e.g. relay and applications label Oct 25, 2022
@rymnc rymnc self-assigned this Oct 25, 2022
@rymnc rymnc requested review from LNSD, s1fr0 and staheri14 October 25, 2022 06:56
# TODO: check the index and the pubkey depending on
# the group update operation
var handler: GroupUpdateHandler
handler = proc(pubkey: Uint256, index: Uint256): RlnRelayResult[void] {.raises: [Defect].} =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As part of the member deletion feature, this handler will soon take in an additional argument, GroupUpdateType, which will be either Insertion or Deletion, and then we can handle those cases separately.

@rymnc rymnc marked this pull request as ready for review October 25, 2022 06:58
@status-im-auto
Copy link
Collaborator

status-im-auto commented Oct 25, 2022

Jenkins Builds

Click to see older builds (24)
Commit #️⃣ Finished (UTC) Duration Platform Result
3030fe3 #1 2022-10-25 07:15:46 ~19 min linux 📄log
3030fe3 #1 2022-10-25 07:21:33 ~24 min macos 📄log
a6be6ae #2 2022-10-25 07:15:50 ~16 min linux 📄log
a6be6ae #2 2022-10-25 07:21:55 ~22 min macos 📄log
✔️ bd43a8a #3 2022-10-25 07:24:17 ~15 min macos 📦bin
✔️ bd43a8a #3 2022-10-25 07:24:50 ~16 min linux 📦bin
✔️ 3b76d3f #4 2022-10-25 11:45:45 ~17 min linux 📦bin
✔️ 3b76d3f #4 2022-10-25 11:52:21 ~24 min macos 📦bin
✔️ b6a23e0 #5 2022-10-25 15:16:46 ~18 min macos 📦bin
✔️ b6a23e0 #5 2022-10-25 15:17:27 ~19 min linux 📦bin
✔️ 0572e4c #6 2022-10-26 14:46:12 ~15 min linux 📦bin
✔️ 0572e4c #6 2022-10-26 14:49:23 ~18 min macos 📦bin
✔️ d1f5faf #7 2022-10-26 23:36:38 ~16 min linux 📦bin
✔️ d1f5faf #7 2022-10-26 23:39:34 ~19 min macos 📦bin
✔️ 750199e #8 2022-10-27 12:13:37 ~17 min linux 📦bin
✔️ 750199e #8 2022-10-27 12:18:22 ~21 min macos 📦bin
✔️ 7718c8d #9 2022-10-27 16:34:45 ~14 min linux 📦bin
✔️ 7718c8d #9 2022-10-27 16:39:18 ~19 min macos 📦bin
✔️ 6f1ec0e #10 2022-10-28 06:36:18 ~14 min linux 📦bin
✔️ 6f1ec0e #10 2022-10-28 06:41:58 ~20 min macos 📦bin
✔️ 582a6c3 #11 2022-10-28 06:45:29 ~14 min linux 📦bin
✔️ 582a6c3 #11 2022-10-28 06:45:31 ~14 min macos 📦bin
✔️ 90f83e6 #12 2022-10-28 10:10:59 ~17 min linux 📦bin
✔️ 90f83e6 #12 2022-10-28 10:14:20 ~20 min macos 📦bin
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 1ea65b2 #13 2022-10-30 18:29:02 ~16 min linux 📦bin
✔️ 1ea65b2 #13 2022-10-30 18:34:09 ~21 min macos 📦bin
✔️ 4fabf12 #14 2022-11-01 00:42:34 ~16 min linux 📦bin
✔️ 4fabf12 #14 2022-11-01 00:47:26 ~21 min macos 📦bin

Copy link
Contributor

@s1fr0 s1fr0 left a comment

Choose a reason for hiding this comment

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

The PR looks good to me, but I'm still not sure about using the last seen index as indicator. See #1265 (comment).

Copy link
Contributor

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

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

Thanks, please see my comments below.



proc handleGroupUpdates*(rlnPeer: WakuRLNRelay, handler: RegistrationEventHandler) {.async, gcsafe.} =
proc handleGroupUpdates*(rlnPeer: WakuRLNRelay) {.async, gcsafe.} =
# mounts the supplied handler for the registration events emitting from the membership contract
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these comments still hold?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 582a6c3

ethAccountAddress: Option[Address] = none(Address),
contractAddress: Address,
blockNumber: string = "0x0",
handler: GroupUpdateHandler) {.async, gcsafe.} =
## connects to the eth client whose URI is supplied as `ethClientUri`
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update the proc description to match the new semantics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 582a6c3

@@ -945,20 +976,25 @@ proc subscribeToGroupEvents(ethClientUri: string, ethAccountAddress: Option[Addr

proc startSubscription(web3: Web3) {.async, gcsafe.} =
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to have a separate proc for this, why not just call the subscribeToMemberRegistrations proc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eventually, when we have the reconnection logic, it becomes easier to resubscribe to events from the last processed block.

@rymnc rymnc added this to the Release 0.13.0 milestone Oct 28, 2022
@rymnc rymnc requested review from staheri14 and s1fr0 October 28, 2022 07:03
Copy link
Contributor

@LNSD LNSD left a comment

Choose a reason for hiding this comment

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

LGTM ✅

@rymnc rymnc merged commit cd73029 into master Nov 1, 2022
@rymnc rymnc deleted the rln-track-latest-pk branch November 1, 2022 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
track:rln RLN Track (Secure Messaging/Applied ZK), e.g. relay and applications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(rln-relay): Keep track of the last processed event for membership changes
5 participants