Skip to content

Conversation

mohamedawnallah
Copy link
Contributor

@mohamedawnallah mohamedawnallah commented Jan 29, 2025

Change Description

Towards #6337.
Towards #9126.
Next #10159.

Steps to Test

Steps for reviewers to follow to test the change.

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering the positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

Copy link
Contributor

coderabbitai bot commented Jan 29, 2025

Important

Review skipped

Auto reviews are limited to specific labels.

🏷️ Labels to auto review (1)
  • llm-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@saubyk saubyk added this to lnd v0.20 May 1, 2025
@saubyk saubyk moved this to In progress in lnd v0.20 May 1, 2025
@mohamedawnallah mohamedawnallah marked this pull request as draft May 2, 2025 17:32
@mohamedawnallah mohamedawnallah force-pushed the supportDNSHostnameInNodeAnnouncement branch 5 times, most recently from c3a6a49 to d67c686 Compare May 3, 2025 12:20
@mohamedawnallah mohamedawnallah mentioned this pull request May 3, 2025
9 tasks
@mohamedawnallah mohamedawnallah force-pushed the supportDNSHostnameInNodeAnnouncement branch 2 times, most recently from 3efa4b2 to 01c57c8 Compare May 3, 2025 15:19
@mohamedawnallah
Copy link
Contributor Author

mohamedawnallah commented May 5, 2025

This PR is not yet ready for review. It looks like more code paths need to be test-covered. I also understand the git commit structure is not still followed per latest feedback as I was trying to make CI happy. I will take a look at this PR soon.

@mohamedawnallah mohamedawnallah force-pushed the supportDNSHostnameInNodeAnnouncement branch 2 times, most recently from d48d1fd to 98d2f2f Compare May 11, 2025 17:43
@mohamedawnallah mohamedawnallah marked this pull request as ready for review May 11, 2025 18:58
@mohamedawnallah
Copy link
Contributor Author

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 New Development Process.

Any follow-up feedback would be very much appreciated!

PS:
It looks like the failed CI tests not related to the changes in this PR also It doesn't look like we need to add itests for this feature change, no?

Copy link
Collaborator

@ellemouton ellemouton 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 the PR :)

I think its a good idea to test/ensure the following:

  1. make sure the node can handle providing its own DNS addr
  2. make sure the node can handle receiving a DNS addr from other nodes

@mohamedawnallah mohamedawnallah force-pushed the supportDNSHostnameInNodeAnnouncement branch 2 times, most recently from 11c8ebc to 6b38f8d Compare August 15, 2025 05:53
Copy link
Collaborator

@ellemouton ellemouton left a 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 :)

Copy link
Collaborator

@ellemouton ellemouton 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!

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

@mohamedawnallah mohamedawnallah force-pushed the supportDNSHostnameInNodeAnnouncement branch 2 times, most recently from 8977287 to 035fac4 Compare August 15, 2025 13:10
@lightninglabs-deploy
Copy link

@mohamedawnallah, remember to re-request review from reviewers when ready

Copy link
Member

@yyforyongyu yyforyongyu left a 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.

}

if len(hostname) > 255 {
return fmt.Errorf("DNS hostname length %d, exceeds limit of "+
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

@mohamedawnallah mohamedawnallah Sep 3, 2025

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.

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

@mohamedawnallah mohamedawnallah force-pushed the supportDNSHostnameInNodeAnnouncement branch from 035fac4 to 84b87a5 Compare September 2, 2025 17:51
mohamedawnallah and others added 3 commits September 2, 2025 17:51
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>
@mohamedawnallah mohamedawnallah force-pushed the supportDNSHostnameInNodeAnnouncement branch from 84b87a5 to 7d084ee Compare September 2, 2025 17:51
Copy link
Member

@yyforyongyu yyforyongyu left a 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

}

if len(hostname) > 255 {
return fmt.Errorf("DNS hostname length %d, exceeds limit of "+
Copy link
Member

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.

@mohamedawnallah mohamedawnallah force-pushed the supportDNSHostnameInNodeAnnouncement branch 2 times, most recently from 0ec6001 to cdf6290 Compare September 3, 2025 01:04
ellemouton and others added 5 commits September 3, 2025 01:11
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.
@mohamedawnallah mohamedawnallah force-pushed the supportDNSHostnameInNodeAnnouncement branch from cdf6290 to ad96615 Compare September 3, 2025 01:11
@ellemouton ellemouton merged commit ea6cc81 into lightningnetwork:master Sep 3, 2025
35 of 39 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in lnd v0.20 Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants