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): mounting proc waku_node, barrel imports #1379

Closed
wants to merge 3 commits into from

Conversation

rymnc
Copy link
Contributor

@rymnc rymnc commented Nov 14, 2022

This PR cleans up the imports for rln-relay, and also makes the mounting procedure in line with other protocols.

  • Since waku-rln-relay depends on waku-relay, we pass in wakuRelay to the mounting procedure, instead of the node, clearing a cyclic dependency. (waku_node -> waku_rln_relay_utils -> waku_message -> waku_node)
  • Barrel for waku_rln_relay created so that only one import is required
  • waku_rln_relay_types specifically is required by waku_message, therefore only that module is imported. This should be cleaned up in the future.

Not included in the scope of this PR, but will be included in future PRs -

  • Further refactoring to the mounting procedure of rln-relay in static/dynamic mode

@rymnc rymnc added this to the Release 0.14.0 milestone Nov 14, 2022
@rymnc rymnc added track:production track:rln RLN Track (Secure Messaging/Applied ZK), e.g. relay and applications labels Nov 14, 2022
@rymnc rymnc self-assigned this Nov 14, 2022
@rymnc rymnc requested a review from LNSD November 14, 2022 16:06
@status-im-auto
Copy link
Collaborator

status-im-auto commented Nov 14, 2022

Jenkins Builds

Click to see older builds (2)
Commit #️⃣ Finished (UTC) Duration Platform Result
b9848f9 #1 2022-11-14 16:12:06 ~5 min linux 📄log
b9848f9 #1 2022-11-14 16:12:56 ~6 min macos 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
ee19aa0 #2 2022-11-15 08:17:16 ~5 min linux 📄log
ee19aa0 #2 2022-11-15 08:19:49 ~8 min macos 📄log
✔️ c539bb4 #3 2022-11-15 08:36:41 ~15 min macos 📦bin
✔️ c539bb4 #3 2022-11-15 08:38:19 ~17 min linux 📦bin

proc mountRlnRelay*(node: WakuNode, rlnConf: WakuRlnConfig) {.async.} =
info "mounting rln relay"

let rlnRelayRes = await WakuRlnRelay.init(node.wakuRelay,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the init proc be renamed to new? It is creating a ref object.

From Status Nim Styleguide:

new returns a reference to the given type

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 ee19aa0

Comment on lines 23 to 24
import
./waku_rln_relay/waku_rln_relay_types
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd instead also import the entry point module here. The current module structure is very likely to change and this line will have to change also if we don't put here the entry module.

Comment on lines +3 to +6
./waku_rln_relay/waku_rln_relay_constants,
./waku_rln_relay/waku_rln_relay_types,
./waku_rln_relay/waku_rln_relay_utils,
./waku_rln_relay/waku_rln_relay_metrics
Copy link
Contributor

Choose a reason for hiding this comment

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

Now modules can be renamed using shorter names.

Suggested change
./waku_rln_relay/waku_rln_relay_constants,
./waku_rln_relay/waku_rln_relay_types,
./waku_rln_relay/waku_rln_relay_utils,
./waku_rln_relay/waku_rln_relay_metrics
./waku_rln_relay/constants,
./waku_rln_relay/types,
./waku_rln_relay/utils,
./waku_rln_relay/protocol_metrics

It can be done in another PR.

): Future[RlnRelayResult[void]] {.async.} =
# Returns RlnRelayResult[void], which indicates the success of the call
): Future[RlnRelayResult[WakuRlnRelay]] {.async.} =
# Returns RlnRelayResult[WakuRlnRelay]
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel this comment is redundant 😅

@LNSD
Copy link
Contributor

LNSD commented Nov 14, 2022

Mixing the "protocol mounting" with the "barrel imports" seems too much for a single PR. Is it possible to have a single piece of work per PR? One for "barrel imports" and another for the "protocol mounting"? This will ease the review process, making it more agile.

In any case, the direction of these changes looks promising 😁 Good job!

@rymnc
Copy link
Contributor Author

rymnc commented Nov 15, 2022

Mixing the "protocol mounting" with the "barrel imports" seems too much for a single PR. Is it possible to have a single piece of work per PR? One for "barrel imports" and another for the "protocol mounting"? This will ease the review process, making it more agile.

In any case, the direction of these changes looks promising 😁 Good job!

I agree, that was the idea too. However, importing the "entrypoint" created a cyclic dependency, which would then again require us to import the specific module required so that we don't touch too much code in the PR.
If you're okay with just the barrel in this PR, and no changes in the other parts of the codebase, I can do that, while tackling the cyclic dep in a new PR.

@LNSD
Copy link
Contributor

LNSD commented Nov 15, 2022

If you're okay with just the barrel in this PR, and no changes in the other parts of the codebase, I can do that, while tackling the cyclic dep in a new PR.

It is about atomic commits/changes that, at some point, can be reverted if needed without removing other "unrelated" changes. And, as we are following the "squash and merge" strategy, this means one commit per pull request.

This will help with the reviewing process making it more agile. So if possible, I would prefer two different commits/PRs. Thanks.

@staheri14 staheri14 mentioned this pull request Nov 15, 2022
11 tasks
@rymnc
Copy link
Contributor Author

rymnc commented Nov 16, 2022

Closing to split the PR into

  • Barrel imports
  • Resolving cyclic dependencies
  • Mounting procedure update in waku_node

@rymnc rymnc closed this Nov 16, 2022
@rymnc rymnc deleted the rln-barrel branch November 16, 2022 03:56
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.

3 participants