Skip to content

Conversation

@s-tikhomirov
Copy link
Contributor

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

Description

Previously, when mounting Lightpush, if Relay was not mounted, a nil Lightpush protocol handler was used. This PR changes node setup logic: mounting Lightpush without Relay mounted results in an error. The rationale behind this change is that a node cannot serve a Lightpush request without Relay. Fixes #2808.

Changes

  • change node setup logic to return error if Lightpush is mounted without Relay
  • add test for this behavior
  • adapt other usages of Lightpush mounting procedure (its signature was changed to return a Result-type value)
  • UPD same logic applies to legacy Lightpush too, as suggested in the comments

Issue

closes #2808

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! 💯

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.

I think it is mostly ok, but I have some concerns.
First of all legacy lightpush shall be treated the same as v3.
On the other hand I think we need to adapt also here: https://github.com/waku-org/nwaku/blob/644b5928c757c07202aec67bc8fc1a11730b374d/waku/factory/conf_builder/waku_conf_builder.nim#L592-L598
Due otherwise the node will advertise lightpush capability while it does not has it.

Finally there was a discussion around local first approach... which is not implemented for lightpush yet, but we had some conclusion I don't remember exactly the outcome.
Meaning that possible to use lightpush without valid relaying might still reach filter and thus local testing is possible from edge node POV.
I think this shall not prevent this PR for now, just for the record.
cc: @Ivansete-status

@s-tikhomirov
Copy link
Contributor Author

Thanks @NagyZoltanPeter , I have a question about this:

First of all legacy lightpush shall be treated the same as v3.

I assumed that calling it "legacy" implies we are not making new changes to it. Is this not the case? Are we aiming to develop two versions of Lightpush in parallel, what is the rationale there?

@NagyZoltanPeter
Copy link
Contributor

Thanks @NagyZoltanPeter , I have a question about this:

First of all legacy lightpush shall be treated the same as v3.

I assumed that calling it "legacy" implies we are not making new changes to it. Is this not the case? Are we aiming to develop two versions of Lightpush in parallel, what is the rationale there?

Sure, unlikely to expect changes in legacy lightpush protocol. But the rationale with this treatment that from clients pov it is mainly one service. Of course there are clients supports only old one... hopefully for not tooo long, the rest can support both for now. So it is not very good that a service node will unexpetedly support only the old protocol while v3 is not mounted due to the circumstances of not having relay. Meanwhile, I know this is a very, very rare case.
Also think of ENR reports lightpush capability without saying the version, so it is better either have them both (until retire legacy) or none.

@github-actions
Copy link

github-actions bot commented Sep 30, 2025

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3540

Built from b6e4414

@Ivansete-status
Copy link
Collaborator

Thanks for this comment @NagyZoltanPeter
I think we agreed to always consider that lightpush, filter and relay are all either mounted or unmounted. In that scenario, the Capabilities can get simpler as we can assume that, if a node mounts relay, then it will also mount both lightpush and filter.
But, as you mentioned, I think we can think about it in a future PR

- Change mountLightPush signature to return Result[void, string]
- Return error when relay is not mounted
- Update all call sites to handle Result return type
- Add test verifying mounting fails without relay
- Only advertise lightpush capability when relay is enabled
@s-tikhomirov s-tikhomirov force-pushed the chore/do-not-mount-lightpush-without-relay branch from 4079d07 to 0930cb9 Compare November 27, 2025 16:31
@s-tikhomirov
Copy link
Contributor Author

Rebased and addressed the comments above. The logic now applies to both lightpush and legacy lightpush.

I see that interop and js-waku tests are failing (in addition to macos-15 and ubuntu-22.04 builds that seem to be failing regardless for instance on my other PR as well). I'm unsure what to do about it...

@s-tikhomirov s-tikhomirov force-pushed the chore/do-not-mount-lightpush-without-relay branch from 7b695a2 to a6d231a Compare November 27, 2025 17:33
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! 🙌

@Ivansete-status
Copy link
Collaborator

Thanks for recent changes @s-tikhomirov
Before merging, we need to make sure the following is green :)
image

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! Thank you!

@NagyZoltanPeter
Copy link
Contributor

@s-tikhomirov Can you please check if failing js-waku tests are because of these changes?

@weboko
Copy link
Contributor

weboko commented Dec 9, 2025

You can merge the PR as it seems the source of the breaking change
We will need to fix it in js-waku later logos-messaging/js-waku#2758

@weboko
Copy link
Contributor

weboko commented Dec 10, 2025

folks, I changed my mind:
HOW CAN NWAKU WORK IN EDGE NODE MODE WITH THIS CHANGE?

@NagyZoltanPeter ?

@NagyZoltanPeter
Copy link
Contributor

NagyZoltanPeter commented Dec 10, 2025

folks, I changed my mind: HOW CAN NWAKU WORK IN EDGE NODE MODE WITH THIS CHANGE?

@NagyZoltanPeter ?

client side of protocols are always mounted.. .so that means edge mode if relay not mounted but client req/resp protocols.
This pr is about service side lightpush has no meaning without mounting relay. It just fixes a misconfiguration pattern.

@s-tikhomirov s-tikhomirov merged commit 7d1c6ab into master Dec 11, 2025
1 check passed
@s-tikhomirov s-tikhomirov deleted the chore/do-not-mount-lightpush-without-relay branch December 11, 2025 09:51
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.

chore: do not mount lightpush without relay

5 participants