Skip to content

Conversation

@s-tikhomirov
Copy link
Contributor

@s-tikhomirov s-tikhomirov commented Aug 13, 2025

Description

In the spirit of "make change easy", this PR is a minor refactor of Lightpush that would hopefully make the protocol easier to reason about.

Changes

  • extract helper functions to make code more DRY
  • add a few comments

Issue

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.

Wonderful PR! Thanks so much for it! 💯

Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter 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 to me, thanks for the effort! Added some considerations though.

@github-actions
Copy link

github-actions bot commented Sep 9, 2025

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3538

Built from 5602781

Copy link
Contributor

@darshankabariya darshankabariya left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@fryorcraken fryorcraken left a comment

Choose a reason for hiding this comment

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

excellent

@s-tikhomirov s-tikhomirov force-pushed the chore/lightpush-minor-refactor branch 4 times, most recently from 79f1f08 to 297fa16 Compare September 12, 2025 15:22
@s-tikhomirov
Copy link
Contributor Author

Did some more refactoring unifying publishing procedures to avoid code duplication. No more substantial changes planned, re-requesting review.

wl: WakuLightPush, peerId: PeerId, pushRequest: LightpushRequest
): Future[WakuLightPushResult] {.async.} =
let pubsubTopic = pushRequest.pubSubTopic.valueOr:
proc extractPubsubTopic(
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I am wondering if this logic should be handled by the pushHandler instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you elaborate? I'm not sure I understand how this relates to your other suggestion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, the question is where should the pubsubtopic/sharding logic be applied? Within handleRequest ? or by the caller of handleRequest?

I am not sure which one is a best choice. My comment was here to raise awareness so you can think of it. Maybe @NagyZoltanPeter has an opinion as he touched light push recently.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, the question is where should the pubsubtopic/sharding logic be applied? Within handleRequest ? or by the caller of handleRequest?

I am not sure which one is a best choice. My comment was here to raise awareness so you can think of it. Maybe @NagyZoltanPeter has an opinion as he touched light push recently.

Hm, good question.
I'm not against this change, meanwhile I think pubsub-topic or better shard handling shall be refactored separately from this. Due we have this shard derivative spread in many places of the code (waku interface, rest api, filter and lightpush). It would be good to concentrate into fewer places. Ideally from send perspective it would be good to place it into behind relay's publish.

One naming comment from my side for @s-tikhomirov, is I would name extractPubsubTopic rather extractShard.
WDYT?

@s-tikhomirov s-tikhomirov force-pushed the chore/lightpush-minor-refactor branch from 746570f to 2d22dcb Compare October 14, 2025 19:41
@s-tikhomirov s-tikhomirov force-pushed the chore/lightpush-minor-refactor branch from 2d22dcb to d778bb0 Compare October 16, 2025 10:05
@s-tikhomirov s-tikhomirov force-pushed the chore/lightpush-minor-refactor branch from 3a8f126 to da4394c Compare October 16, 2025 13:48
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.

8 participants