Skip to content

lnrpc: add auth_proof to graph APIs#9950

Merged
yyforyongyu merged 2 commits intolightningnetwork:masterfrom
starius:describegraph-authproofs2
Jun 20, 2025
Merged

lnrpc: add auth_proof to graph APIs#9950
yyforyongyu merged 2 commits intolightningnetwork:masterfrom
starius:describegraph-authproofs2

Conversation

@starius
Copy link
Collaborator

@starius starius commented Jun 13, 2025

Change Description

Added flag include_auth_proof to DescribeGraph, GetNodeInfo, GetChanInfo and the corresponding lncli commands. With the flag, these APIs add AuthProof (signatures from the channel announcement) to the returned ChannelEdge.

This is useful to extract this data from the DB.

Steps to Test

lncli getchaninfo --include_auth_proof 891310305098858499 | jq .auth_proof
{
  "node_sig1": "3045022100ab734e333fdc60639e7d1cb6b1dec883d7342ead88599022595ddb07cf981d50022012a2a4f25d186a7202cd6e5d18799a601953c5cf095a4a8642d539fd323a24f2",
  "bitcoin_sig1": "30440220231f0b9a1787fccb7b16561f16129f58954764425798fa72c7a1cec8c770463602201cec6a4221c4204204865ef785990fc6238e6d98b11cc020def51bed5d34398c",
  "node_sig2": "30450221008336ea980f6083b013a4e3976b1358fefd786e782278c83aafba2fca2b03c85902206a2f76ad5d3536339c50ada018a53c00f2ad70ed6f97291861fdb201f92ea6dc",
  "bitcoin_sig2": "304402200fb1375f3bc5127dd075883ccb94f406e5c1165d376da9402ddd10c3430945cf02204437c6e9a632eee56a759fad548c29f0924876d143d446aa9b492429cb84886d"
}

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 13, 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.

@starius starius force-pushed the describegraph-authproofs2 branch 3 times, most recently from 348ab1d to 5e0003c Compare June 14, 2025 01:16
@starius starius marked this pull request as ready for review June 14, 2025 02:30
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK, LGTM 🎉

@ziggie1984 ziggie1984 self-requested a review June 17, 2025 07:23
Copy link
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tack, LGTM

Comment on lines +3493 to +3495
channel. Each of these signatures signs the following digest: chanID ||
nodeID1 || nodeID2 || bitcoinKey1|| bitcoinKey2 || 2-byte-feature-len ||
features.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is outdated, we sign more than just this for the channelAnnouncement so we can maybe remove this comment ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the comment. Note that I copy-pasted the description from graph/db/models/channel_auth_proof.go and the outdated comment still exists there.


// bitcoin_sig1 are the raw bytes of the first bitcoin signature encoded
// in DER format.
bytes bitcoin_sig1 = 2;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: add a comment that this is the signature of the MultiSigKey key of the channel.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

edge.Node2Policy = marshalDBRoutingPolicy(c2)
}

if includeAuthProof && edgeInfo.AuthProof != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment when we do not expect an AuthProof (private channels)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also dont expect it for our own public channels for the time between channel funding & channel announcement

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the comment. Thanks, @ziggie1984 @ellemouton !

// the advertised channel.
// This field is not filled by default. Pass include_auth_proof flag to
// DescribeGraph, GetNodeInfo or GetChanInfo to get this data.
ChannelAuthProof auth_proof = 10;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a comment that this only is available for advertised channels.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the comment.

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.

lgtm!

starius added 2 commits June 19, 2025 18:19
Added flag include_auth_proof to DescribeGraph, GetNodeInfo, GetChanInfo
and the corresponding lncli commands. With the flag, these APIs add AuthProof
(signatures from the channel announcement) to the returned ChannelEdge.

This is useful to extract this data from the DB.
@starius starius force-pushed the describegraph-authproofs2 branch from 5e0003c to 409bf3c Compare June 19, 2025 21:21
@yyforyongyu yyforyongyu merged commit a3209a5 into lightningnetwork:master Jun 20, 2025
35 of 38 checks passed
@starius starius deleted the describegraph-authproofs2 branch June 20, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants