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

[3/3] Graph RIP: multi: RPC GraphSource #9265

Open
wants to merge 16 commits into
base: elle-graphSourceAbstraction
Choose a base branch
from

Conversation

ellemouton
Copy link
Collaborator

@ellemouton ellemouton commented Nov 13, 2024

Depends on #9243

With this PR, an LND node can be be given an external GraphSource to rely on.

  • A grpc implementation of GraphSource is added which purely relies on a remote graph source.

  • A Mux impl of GraphSource is also added which uses a combination of a remote GraphSource along with the local GraphSource to provide a more complete & efficient GraphSource implementation.

  • A new --gossip.no-sync config option is added which results in the gossip
    queries feature bit not being advertised and also means that we dont send
    any gossip queries. The result is that we dont populate our local graph DB
    with any info other than our own channels/channel peers. If an external graph
    source is provided as the GraphSource, then it makes sense to use the new
    configoption since we will use the external source for gossip data.

See the itest for how to test this on regtest :)

@ellemouton ellemouton self-assigned this Nov 13, 2024
Copy link
Contributor

coderabbitai bot commented Nov 13, 2024

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.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

@ellemouton ellemouton marked this pull request as draft November 13, 2024 09:53
@ellemouton ellemouton force-pushed the rpcGraphSource branch 2 times, most recently from f07ff32 to 7df213e Compare November 14, 2024 08:40
@ellemouton ellemouton force-pushed the rpcGraphSource branch 4 times, most recently from cda85de to d37f234 Compare November 19, 2024 04:13
@ellemouton ellemouton marked this pull request as ready for review November 19, 2024 04:14
@ellemouton ellemouton force-pushed the rpcGraphSource branch 2 times, most recently from afc8a84 to a087692 Compare November 19, 2024 05:36
@ellemouton
Copy link
Collaborator Author

2 follow ups to address (potentially in a separate PR):

  1. channel updates received on payment errors should be pushed to the remote graph
  2. the graph cache should be moved a layer up from ChannedGraph so that this is addressed before querying the remote source. A more complex follow up from this would then to let the remote source send stale-cache signals to various dependents so that they know when to update their cache for a given channel

@lightninglabs-deploy
Copy link

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

@ellemouton
Copy link
Collaborator Author

!lightninglabs-deploy mute

These should be addressed in a refactor PR.
Before we continue to add more implementations of the GraphSource
interface, we need to make sure that all implementations behave the same
way if a resource (node or channel) is not found. Either no error should
be returned or it should be clearly defined in the method comment which
error to expect if the resource is not found. This will be important
later when we want to address both a local and remote graph source so
that we can handle the cases where a resource is not found in one source
and then address the other source rather than erroring out.
for when the node in question is not found. This is consistent with
other methods such as GetNodeInfo. This will allow us later on to switch
out a grpc NotFound error with the expected error we implement the
GraphSource interface with a grpc client.
This field is only ever written to and never read from. We remove it so
that later on when we want to convert NetAddress into and from a
protobuf message, we don't need to encode the ChainHash uneccessarily.
This was included in NetAddress when the plan was still to have LND
cater for different blockchains.
We'll make use of this field later when implementing the rpc version of
the IsPublic method of the GraphSource interface.
We'll make use of this field later when implementing the rpc version of
the GraphSource interface.
This commit mostly consists of boilerplate code that adds the new
graphrpc server and provides it with the config it needs. The server is
then implemented by graphrpc.Server.
So that we can import it in other packages without causing a circular
dependency.
In this commit, a grpc version of the GraphSource interface is
implemented. It does so by connecting to server that serves both the
lnrpc.LightningClient service along with the graphrpc.GraphClient
service. Each method on the GraphSource interface is implemented and
tested.
Mux multiplexes the results from a local node GraphSource (likely backed
by a ChannelGraph) and a remote graph source (likely backed by a
graphrpc.Client) to form a new implementation of GraphSource that can be
used by LND for graph queries.
When set, LND will not advertise the gossip queries feature bit and it
will not initiate gossip syncing with any peer.
We already set `nobootstrap` in the default node flags for itest nodes,
so we can remove this check now. This will allow us to later test
bootstrapping in an itest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants