-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[1/2] discovery+lnwire: add support for DNS host name in NodeAnnouncement msg #9455
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
[1/2] discovery+lnwire: add support for DNS host name in NodeAnnouncement msg #9455
Conversation
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
3e93cdf
to
cb36d26
Compare
fb721bc
to
4a8adcb
Compare
c3a6a49
to
d67c686
Compare
3efa4b2
to
01c57c8
Compare
|
d48d1fd
to
98d2f2f
Compare
Thank you, @ellemouton, for your feedback on this PR. I have restructured the commits and added unit tests for encoding/decoding the DNS hostname address, as well as for parsing it. Apologies for the significant delay between receiving your review and addressing it—I’ll do my best to minimize such gaps in the future, in line with the Any follow-up feedback would be very much appreciated! PS: |
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 for the PR :)
I think its a good idea to test/ensure the following:
- make sure the node can handle providing its own DNS addr
- make sure the node can handle receiving a DNS addr from other nodes
11c8ebc
to
6b38f8d
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.
Great work @mohamedawnallah !! 🎉
I think this is pretty much g2g! just 2 comments about commits you can drop in this PR. I'll then make a follow up PR that updates the graph SQL migration accordingly :)
6b38f8d
to
b4a8b24
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.
Looks good!
Thanks for the fast turn around here 🙏
Leaving one more comment re a unit test. Then please also remember to add a release note entry.
Leaving my ACK in the mean time since I'll be away next week
8977287
to
035fac4
Compare
@mohamedawnallah, remember to re-request review from reviewers when ready |
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.
One question re the test, otherwise looks good.
lnwire/dns_addr.go
Outdated
} | ||
|
||
if len(hostname) > 255 { | ||
return fmt.Errorf("DNS hostname length %d, exceeds limit of "+ |
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: think we should define errors above and return fmt.Errorf("%w: ...")
here, so it's easier to be tested below, error string matching is a bit fragile.
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: think we should define errors above and return
fmt.Errorf("%w: ...")
here, so it's easier to be tested below, error string matching is a bit fragile.
Addressed
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.
cool we should return fmt.Errorf("%w: DNS hostname length %d", ...)
- given the goal is to do error matching in the tests, we should also change it to require.ErrorIs
instead of error string matching.
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.
cool we should return
fmt.Errorf("%w: DNS hostname length %d", ...)
- given the goal is to do error matching in the tests, we should also change it torequire.ErrorIs
instead of error string matching.
Used wrapped errors with additional details. It seems eventually we need to match against error string i.e that part ("%w: DNS hostname length %d")
since require.ErrorIs
only checks if the error types match, not the exact error message content
035fac4
to
84b87a5
Compare
In this commit, we remove `AddrLen` as prepration step before adding DNS address type which will have a var length. Co-authored-by: Elle Mouton <elle.mouton@gmail.com>
Co-authored-by: Elle Mouton <elle.mouton@gmail.com>
84b87a5
to
7d084ee
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.
LGTM🚢 Left some nits - will merge once CI passed
lnwire/dns_addr.go
Outdated
} | ||
|
||
if len(hostname) > 255 { | ||
return fmt.Errorf("DNS hostname length %d, exceeds limit of "+ |
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.
cool we should return fmt.Errorf("%w: DNS hostname length %d", ...)
- given the goal is to do error matching in the tests, we should also change it to require.ErrorIs
instead of error string matching.
0ec6001
to
cdf6290
Compare
Check that the node ann doesnt contain more than 1 DNS addr. This will ensure that we now start rejecting new node announcements with multiple DNS addrs since this check is called in the gossiper before persisting a node ann to our local graph. It also validates the DNS fields according to BOLT #7 specs.
We may have already persisted node announcements that have multiple DNS addresses since we may have received them before updating our code to check for this. So here we just make sure not to send these on to our peers.
The first byte of an opaque addr must be one that we dont understand yet. We do this update in preparation for doing an on-the-fly parse of persisted opaque addrs to see if they contain addrs that we now support. For this to work, the first byte cant be 0x01 since this maps to a known address.
cdf6290
to
ad96615
Compare
Change Description
Towards #6337.
Towards #9126.
Next #10159.
Steps to Test
Steps for reviewers to follow to test the change.
Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]
in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.