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

Add Experimental Endorsement Signalling #8390

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

carlaKC
Copy link
Collaborator

@carlaKC carlaKC commented Jan 17, 2024

This PR adds the ability for LND to set and relay an experimental range endorsement field with UpdateAddHTLC.

Fixes #7883.

Depends on #9049, uses custom records added to payload descriptor!

@carlaKC carlaKC added the channel jamming Issues related to channel jamming mitigation label Jan 17, 2024
Copy link
Contributor

coderabbitai bot commented Jan 17, 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.

lnwire/update_add_htlc.go Outdated Show resolved Hide resolved
lnwallet/channel.go Outdated Show resolved Hide resolved
lnwallet/channel.go Outdated Show resolved Hide resolved
lnwallet/channel.go Outdated Show resolved Hide resolved
routing/router.go Outdated Show resolved Hide resolved
lnrpc/routerrpc/router.swagger.json Outdated Show resolved Hide resolved
@carlaKC carlaKC force-pushed the 7883-experimental-endorsement branch from 294acee to 2e980c9 Compare May 22, 2024 14:45
@carlaKC carlaKC changed the base branch from master to 0-19-staging May 22, 2024 14:45
@carlaKC
Copy link
Collaborator Author

carlaKC commented May 22, 2024

Updated to depend on some of the new APIS, depends on #8660 so only the last 4 commits are relevant.

Copy link

@PurpleTimez PurpleTimez left a comment

Choose a reason for hiding this comment

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

Reviewed commit 5efd43b5

server.go Outdated
// EndorsementExperimentEnd is the time after which nodes should stop
// propagating experimental endorsement signals.
EndorsementExperimentEnd = time.Date(
2027, time.January, 1, 0, 0, 0, 0, time.UTC,

Choose a reason for hiding this comment

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

I have a doubt if the code is corrected related to the blip.

The blip currently says:

Experiment Parameters, expressed as unix time (seconds):
* `experiment_start`: TODO: set once feature bit is widely deployed
* `experiment_end`: 1767225600

Using 1767225600 with a epoch to human-readable data.

> python3
>>> from datetime import datetime
>>> my_time = int('1767225600')
>>> print(datetime.utcfromtimestamp(my_time).strftime('%Y-%m-%d %H:%M:%S'))
2026-01-01 00:00:00

Current encoding with time.Date(2027, time.January, 1, 0, 0, 0, 0, time.UTC) sounds to yield 1st January 2027. If my correct, I think this is more an issue with the blip itself.

server.go Show resolved Hide resolved
htlcswitch/link.go Show resolved Hide resolved
@carlaKC carlaKC force-pushed the 7883-experimental-endorsement branch 8 times, most recently from 7697999 to d07cd38 Compare May 28, 2024 17:03
Copy link

@PurpleTimez PurpleTimez left a comment

Choose a reason for hiding this comment

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

Reviewed "lnrpc: set a zero value endorsement signal on sender outgoing htlc" and "multi: add experimental endorsement feature bit and disable option" commits.

rpcserver.go Show resolved Hide resolved
feature/manager.go Show resolved Hide resolved
@carlaKC carlaKC force-pushed the 7883-experimental-endorsement branch from d07cd38 to d1bc9f7 Compare May 28, 2024 19:22
@carlaKC carlaKC marked this pull request as ready for review May 29, 2024 16:36
@carlaKC
Copy link
Collaborator Author

carlaKC commented May 29, 2024

Opening this up for a high level conceptual review - code now matches what's outlined in the blip.

@carlaKC carlaKC force-pushed the 7883-experimental-endorsement branch from d1bc9f7 to 0cbce93 Compare June 17, 2024 13:32
@carlaKC
Copy link
Collaborator Author

carlaKC commented Jun 17, 2024

Updated feature bit values to match update to blip.

@PurpleTimez
Copy link

@carlaKC If you have time to have a look on this review comment. I don't know if it's an issue with the PR or the blip, I think it's more the PR implementation which sounds incorrect (apologies if I'm wrong).

@saubyk saubyk added this to the 0.19.0 milestone Jun 27, 2024
@carlaKC carlaKC force-pushed the 7883-experimental-endorsement branch from 0cbce93 to 21af106 Compare June 28, 2024 18:04
@carlaKC carlaKC force-pushed the 7883-experimental-endorsement branch from 21af106 to ab99ae1 Compare August 12, 2024 19:30
@carlaKC carlaKC changed the base branch from 0-19-staging to 0-19-staging-rebased August 12, 2024 19:31
@guggero guggero force-pushed the 0-19-staging-rebased branch 2 times, most recently from b6a20c7 to b6843d9 Compare August 21, 2024 14:59
@guggero guggero changed the base branch from extract-part2-from-staging-branch to master September 5, 2024 18:50
@guggero
Copy link
Collaborator

guggero commented Sep 5, 2024

Oops, deleted the branch too quickly, sorry.

@carlaKC carlaKC force-pushed the 7883-experimental-endorsement branch from 4a20db4 to eff8ab5 Compare September 11, 2024 20:27
@carlaKC
Copy link
Collaborator Author

carlaKC commented Sep 11, 2024

Rebased on master!

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.

the testForwardInterceptorWireRecords itest which tests that custom records are set just needs to be adjusted to account for the new endorsed bit. Either explicitly checking that it is set too or just starting those itest nodes with the protocol.no-experimental-endorsement=false flag.

Other than that, this is g2g!

@ellemouton
Copy link
Collaborator

needs rebase and then we g2g I think

@carlaKC
Copy link
Collaborator Author

carlaKC commented Oct 15, 2024

Haven't abandoned this - just ran into some itest issues, pushed with existing failures

We don't resolve incoming HTLCs if they have any custom records present, which means that on-chain resolution breaks for any HTLC which has an endorsement record attached which is ... bad.

Two possible approaches here:

  1. Wait on completion of blocking TODO so that HTLCs with custom records can resolve
  2. Turn off endorsement on itests

If (1) will be included in 19, I think it's slightly preferable to having to make changes to totally unrelated itests but open to opinions!

@Roasbeef
Copy link
Member

Circling back on this, you can get the CI to pass if you change that check to instead checking for the TapscriptRoot channel type instead. There's an unmerged PR (#9194) that'll remove that block.

@carlaKC
Copy link
Collaborator Author

carlaKC commented Oct 22, 2024

Circling back on this, you can get the CI to pass if you change that check to instead checking for the TapscriptRoot channel type instead. There's an unmerged PR (#9194) that'll remove that block.

Great! By this, do you mean:

  1. Let's wait for the linked PR to merge then follow with this one
    -> If yes, I'll rebase this + happy to help out with review once it's out of draft if that's helpful.
  2. Let's update the CustomRecords check to unblock this PR:
    -> If yes, I went ahead and pulled out the check in contractcourt: only halt resolution for TapscriptRoot channels #9208

Either option works for me!

@lightninglabs-deploy
Copy link

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

@carlaKC
Copy link
Collaborator Author

carlaKC commented Nov 1, 2024

Rebased on new dependent PRs!

Depends on #9240: with this change we need fewer workarounds in itests for the API peculiarity (described in #9166), and the tests that include endorsement give us coverage for testing merging of existing custom records and MODIFY records.

Depends on #9208: workaround to make itests run for channels that have custom records that aren't TapscriptRoot type.

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.

Very nice - g2g once the dependant PRs are in. Also just one question about a case in the link where maybe we need to set the endorsement field (could be a misunderstanding on my part though)

htlcswitch/link.go Show resolved Hide resolved
htlcswitch/link.go Outdated Show resolved Hide resolved
lntest/utils.go Outdated Show resolved Hide resolved
itest/lnd_experimental_endorsement.go Show resolved Hide resolved
Make the check on custom records more specific, so that we can only
halt in the case where we actually hit a channel that needs additional
code. This change allows unrelated changes with custom records included
to pass itests in the meantime.
Before we have sufficient signaling in the network to relay this
signal, set a zero value experimental endorsement value on the sender's
outgoing htlc. Once the network is relaying this signal and a flag day
has been set, we'll be able to set a non-zero value here.
@carlaKC carlaKC force-pushed the 7883-experimental-endorsement branch from 9de1365 to ef51601 Compare November 7, 2024 20:38
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 once dependent PR is in! 🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
channel jamming Issues related to channel jamming mitigation size/kilo medium, proper context needed, less than 1000 lines
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

[feature]: Experimental HTLC Endorsement
8 participants