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(wakunode): advertise custom multiaddresses #1509

Merged
merged 8 commits into from
Jan 26, 2023

Conversation

rymnc
Copy link
Contributor

@rymnc rymnc commented Jan 25, 2023

Should allow the operator to set custom multiaddresses if the node's TLS termination happens upstream of nwaku (k8s ingress, dappnodes).
Fixes #1475

It is possible to set it while running wakunode2 -

./build/wakunode2 --ext-multiaddr:/ip4/200.19.20.21/tcp/60012/wss

image

This could allow operators to introduce bad inputs (wrong ip addresses/ports), so not sure if I should add a mechanism to test for it

@rymnc rymnc added this to the Release 0.15.0 milestone Jan 25, 2023
@rymnc rymnc self-assigned this Jan 25, 2023
@rymnc rymnc marked this pull request as ready for review January 25, 2023 15:22
@rymnc rymnc requested review from LNSD, alrevuelta and jm-clius January 25, 2023 15:22
@LNSD
Copy link
Contributor

LNSD commented Jan 25, 2023

This could allow operators to introduce bad inputs (wrong ip addresses/ports), so not sure if I should add a mechanism to test for it

IMO, it depends on the consequences of adding a "bad multiaddress" (e.g., malformed). E.g., if it crashes the node abruptly, it should be tested and fail graciously.

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 ✅

apps/wakunode2/config.nim Outdated Show resolved Hide resolved
waku/v2/node/waku_node.nim Outdated Show resolved Hide resolved
apps/wakunode2/wakunode2.nim Show resolved Hide resolved
@rymnc
Copy link
Contributor Author

rymnc commented Jan 25, 2023

This could allow operators to introduce bad inputs (wrong ip addresses/ports), so not sure if I should add a mechanism to test for it

IMO, it depends on the consequences of adding a "bad multiaddress" (e.g., malformed). E.g., if it crashes the node abruptly, it should be tested and fail graciously.

It wouldn't crash the node, but advertise incorrectly to other peers.

Copy link
Contributor

@jm-clius jm-clius left a comment

Choose a reason for hiding this comment

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

Thanks for this! Will review more detailed tomorrow, but note that #1475 is not about announced addresses in identify, which I think you're changing here, but about adding manually specified multiaddrs to the discoverable ENR (both for DNS discovery and discv5). Doesn't mean this can't be used, just that there may be a follow-up PR before that issue can be closed :)

@rymnc
Copy link
Contributor Author

rymnc commented Jan 25, 2023

Thanks for this! Will review more detailed tomorrow, but note that #1475 is not about announced addresses in identify, which I think you're changing here, but about adding manually specified multiaddrs to the discoverable ENR (both for DNS discovery and discv5). Doesn't mean this can't be used, just that there may be a follow-up PR before that issue can be closed :)

Was a simple fix, Addressed in 10cc174 :)

@status-im-auto
Copy link
Collaborator

status-im-auto commented Jan 25, 2023

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
10cc174 #1 2023-01-25 23:11:18 ~24 min macos 📄log
✔️ 10cc174 #2 2023-01-26 05:14:44 ~20 min macos 📦bin

Copy link
Contributor

@alrevuelta alrevuelta left a comment

Choose a reason for hiding this comment

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

thanks for this! lgtm!

This could allow operators to introduce bad inputs (wrong ip addresses/ports), so not sure if I should add a mechanism to test for it

Guess this won't be new, I mean with --nat=extip you can also provide a wrong ip.

./build/wakunode2 --ext-multiaddr:/ip4/200.19.20.21/tcp/60012/ws --nat=extip:9.9.9.9

With this you will be advertising a wrong ip (assuming 9.9.9.9 is wrong)

# node with custom multiaddress
nodeKey1 = crypto.PrivateKey.random(Secp256k1, rng[])[]
node1 = WakuNode.new(nodeKey1, ValidIpAddress.init("0.0.0.0"), Port(61018),
Copy link
Contributor

Choose a reason for hiding this comment

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

im starting to use Port(0) which should get one among the available ones. just an fyi :)
https://github.com/waku-org/nwaku/blob/master/tests/v2/test_peer_manager.nim#L157

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will address in a subsequent pr! Don't want to retrigger ci :)

Copy link
Contributor

@jm-clius jm-clius left a comment

Choose a reason for hiding this comment

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

Approving, because I think subsequent steps can be left for next PRs. This still does not close #1475 . :D This is because the ENR we use on discv5 is different from the one you modified here. See: #915

Probably the way to solve that once and for all is to move wakuDiscv5 creation from the app to the node and use that enr for the node (unless discv5 is disabled, in which case we call initEnr like before). Happy to chat about a strategy to do this, as it will require more config to be available to the node during creation.

@rymnc
Copy link
Contributor Author

rymnc commented Jan 26, 2023

Approving, because I think subsequent steps can be left for next PRs. This still does not close #1475 . :D This is because the ENR we use on discv5 is different from the one you modified here. See: #915

Probably the way to solve that once and for all is to move wakuDiscv5 creation from the app to the node and use that enr for the node (unless discv5 is disabled, in which case we call initEnr like before). Happy to chat about a strategy to do this, as it will require more config to be available to the node during creation.

Just saw

[], # Empty enr fields, for now
!
Agree that we should move the wakuDiscv5 creation to the node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

feat: ability to manually specify additional multiaddrs
5 participants