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

Set node alias #330

Merged
merged 14 commits into from
Oct 7, 2024
Merged

Set node alias #330

merged 14 commits into from
Oct 7, 2024

Commits on Sep 23, 2024

  1. feat: sanitize and set node alias

    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.
    enigbe committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    12dfc1a View commit details
    Browse the repository at this point in the history
  2. feat: broadcast node announcement with set alias

    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.
    enigbe committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    e54bfe0 View commit details
    Browse the repository at this point in the history
  3. fix: correct node announcement, simplify setting alias, clean

         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.
    enigbe committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    5bd4a88 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8e73296 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7ad7029 View commit details
    Browse the repository at this point in the history
  6. refactor: update node alias sanitization

    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.
    enigbe committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    81a0f4d View commit details
    Browse the repository at this point in the history
  7. refactor: decompose connecting w/ peer & opening a channel

    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
    enigbe committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    32e7096 View commit details
    Browse the repository at this point in the history
  8. docs: cleanup documentation

    enigbe committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    059a30e View commit details
    Browse the repository at this point in the history
  9. test: update tests due to connect_open_channel decomposition

    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.
    enigbe committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    09fca09 View commit details
    Browse the repository at this point in the history
  10. fix: change channel config type in open_(announced)_channel

    What this commit does:
    + Removes the wrapping Arc from the channel config. This is a missed
        update after rebasing.
    enigbe committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    1160034 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    6c3deaf View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    6aff282 View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2024

  1. refactor: improve channel announcement logic and fix binding tests

    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
    enigbe committed Sep 24, 2024
    Configuration menu
    Copy the full SHA
    0af5df6 View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2024

  1. fix(test): Implement conditional channel opening based on aliases and…

    … 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
    enigbe committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    4fd1cb8 View commit details
    Browse the repository at this point in the history