-
Notifications
You must be signed in to change notification settings - Fork 103
Set node alias #330
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
Set node alias #330
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excuse the delay here!
Thank you for looking into this, approach already looks pretty good! Just a few comments.
63e791a
to
8791d7c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think beyond checking for the node alias and listening addresses before broadcasting, we should also modify the default_user_config
method in Config
to, if any of the two are unconfigured:
a) set UserConfig::accept_forwards_to_priv_channels
to false
b) set ChannelHandshakeConfig::announced_channel
to false
c) set ChannelHandshakeLimits::force_announced_channel_preference
to true
Additionally, we'll want to return an error from connect_open_channel
if any of the two are unconfigured and we try to open an announced channel. To this end, it might be bit cleaner if we'd split the method in two (open_channel
and open_announced_channel
) rather than having it take a simple bool
.
TLDR: We should use the configured listening addresses and node alias as indicators whether we are a forwarding node or not. If we're not, we should disallow announced channels.
Let me know if you'd be up for these additional changes, otherwise I'm happy to pick them up as a follow-up.
Thanks for the review. I am happy to keep working on this until it is ready. |
Thanks again! Do you still intend to do this in this PR, or would you prefer we land this and do additional changes in a follow up? Btw. this also needs a rebase already, and there will be larger code changes upcoming in the LDK/BDK/rust-bitcoin upgrade PR, which will likely also lead to further rebase conflicts. |
Apologies for the delay. I am almost done and will be pushing changes today. I'll rebase and get it ready for another look before the end of the day. |
No worries! Cool, thank you! |
cfd764b
to
3775bad
Compare
Hi @tnull, I have rebased and pushed recommended changes. Unfortunately, the integration tests are flaky and I am uncertain about why. Currently investigating. |
Hi @tnull, thanks for your review so far. Have you had some time to check out the recent changes I have made? I have addressed the comments raised and would be grateful for any further feedback or recommendation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tnull, thanks for your review so far. Have you had some time to check out the recent changes I have made? I have addressed the comments raised and would be grateful for any further feedback or recommendation.
Excuse the delay here! Did another round, already looks pretty good, just a few comments.
To make CI pass you'll need to adjust all prior uses of connect_open_channel
/connectOpenChannel
in the bindings tests (i.e., in bindings/kotlin/ldk-node-jvm/lib/src/test/kotlin/org/lightningdevkit/ldknode/LibraryTest.kt
for Kotlin and bindings/python/src/ldk_node/test_ldk_node.py
for Python).
There are also a few references to connect_open_channel
left in tests and comments which should be renamed accordingly.
src/builder.rs
Outdated
mod tests { | ||
use lightning::routing::gossip::NodeAlias; | ||
|
||
use crate::{builder::sanitize_alias, BuildError}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Given these tests are in a sub-module of builder
, I think you don't need to import these types at all here?
What this commit does: Implements a method `set_node_alias` on NodeBuilder to allow callers customize/set the value of the node alias. This method sanitizes the user-provided alias by ensuring the following: + Node alias is UTF-8-encoded String + Node alias is non-empty + Node alias cannot exceed 32 bytes + Node alias is only valid up to the first null byte. Every character after the null byte is discraded Additionally, a test case is provided to cover sanitizing empty node alias, as well as an alias with emojis (copied and modified from rust-lightning) and a sandwiched null byte.
What this commit does: Broadcasts node announcement with the user-provided alias, if set, else, uses the default [0u8;32]. Additionally, adds a random node alias generating function for use in the generation of random configuration.
alias sanitization - Skips broadcasting node announcement in the event that either the node alias or the listening addresses are not set. - Aligns the InvalidNodeAlias error variant with the others to make it work with language bindings. - Simplifies the method to set the node alias. - Cleans up the alias sanitizing function to ensure that protocol- compliant aliases (in this case, empty strings) are not flagged. Additionally, removes the check for sandwiched null byte. - Finally, adds the relevant update to struct and interface to reflect changes in Rust types.
What this commit does: + Updates the sanitization function for node alias to return NodeAlias + Updates the node alias type in the configuration to NodeAlias and implements a conversion to/from String for bindings + With this update, regardless of where the alias is set, i.e. in the set_node_alias or directly, sanitization occurs.
What this commit does: + Decomposes connect_open_channel into two different functions: open_channel and open_announced_channel. This allows opening announced channels based on configured node alias and listening addresses values. + This enforces channel announcement only on the condition that both configuration values are set. + Additionally, a new error variant `OpenAnnouncedChannelFailed` is introduced to capture failure. Note: I thought I added the `InvalidNodeAlias` variant in the previous commit
What this commit does: + Replaces calls to `connect_open_channel` with `open_channel` and `open_announced_channel` where appropriate. Status: Work In Progress (WIP) Observation: + The integration tests are now flaky and need further investigation to ascertain the reason(s) why and then to fix.
What this commit does: + Removes the wrapping Arc from the channel config. This is a missed update after rebasing.
c2589f3
to
a740401
Compare
This commit addresses changes necessary to: - fix failing tests for generated bindings - remove unnecessary error variant previously introduced to capture failure associated with opening announced channels, and re-use existing variants that better capture the reasons, i.e. `InvalidNodeAlias` and `InvalidSocketAddress`, why opening an announced channel failed. - correct visibility specifiers for objects, and - cleanup nitpicks Specific modifications across several files include: - updating the UDL file, as well as tests related to python and kotlin that call `open_channel` and/or open_announced_channel - repositioning/rearranging methods and struct fields - introducing enums (`ChannelAnnouncementStatus` & `ChannelAnnouncementBlocker`) to capture and codify channel announceable eligibility, providing reasons for unannounceable channels - modifying `can_announce_channel` to utilize the aforementioned enums, as opposed to simply returning a boolean value. - cleaning up and renaming `connect_open_channel` to `open_channel_inner`, and maintaining a boolean flag for channel announcement - updating documentation, unit, and integration tests that factor all these changes
a740401
to
0af5df6
Compare
Seems CI is failing. Let me know when this is ready for another round of review! |
59f77b2
to
5d5d1cd
Compare
… addresses This commit addresses flaky test issues related to conditional channel opening between nodes, considering node aliases and listening addresses. Changes in test modules: - Add/modify helper functions to randomize channel announcement flags - Generate random node aliases based on announcement flags: * Set custom alias if announce_channel is true * Use default alias otherwise - Update channel opening logic to account for node and channel announcements
5d5d1cd
to
4fd1cb8
Compare
I have made some changes to address flaky tests that were failing in CI. They are all passing now with the exception of I am currently investigating it. I would be grateful for another review while I try to fix the build. Edit:I was able to replicate the issue locally (on If you have time, it would be helpful if you could try running the build locally to see if it's replicable or investigate whether this is related to a specific environment setup. I am uncertain about why this is happening but I will keep looking into known issues related to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks and excuse the delay once more! This generally LGTM, although I found a few nits and disgree with the test changes in the last commit. I think I'll land this as is and address the changes in a quick follow-up as we're expecting considerable changes across the codebase in #358 and follow-up PRs, which would likely make rebasing this over and over again pretty painful.
Now opened a follow-up PR to address the remaining feedback here: #366 |
No, I don't mind. I am very grateful. |
What this PR does:
Related issue(s):