8000 blip-0004: experimental endorsement signaling in update_add_htlc by carlaKC · Pull Request #27 · lightning/blips · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

blip-0004: experimental endorsement signaling in update_add_htlc #27

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

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

carlaKC
Copy link
Contributor
@carlaKC carlaKC commented Aug 1, 2023

bLIP 0004 for experimental endorsement signalling:

  • Adds TLV number 65555 to update_add_htlc for experimental endorsement signaling
  • Provides instructions for relaying this signal after a flag day

@t-bast
Copy link
Contributor
t-bast commented Aug 8, 2023

ACK, @thomash-acinq does that work for you?

@TheBlueMatt
Copy link
Contributor

A bit weird we have a BLIP reserving a value for a BOLT PR - do we want to include like a timeout on this reservation - "just for testing, after date X this is returned to the available pool"?

@carlaKC
Copy link
Contributor Author
carlaKC commented Aug 15, 2023

A bit weird we have a BLIP reserving a value for a BOLT PR

Yeah .. there just isn't really a better place for reserving the value.

do we want to include like a timeout on this reservation - "just for testing, after date X this is returned to the available pool"?

Can't we just come back and deprecate it once we're done? Because hard setting a date required that folks are upgraded to stop using it by then? Not like we're short of TLV types.

Copy link
@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

Actually, now that I think about it, what's stopping us from placing the HTLC Endorsement inside the BLIP and then deprecating the BLIP itself?

I believe that, in their current state, BLIPs are more like self-contained user stories. However, I don't think it would be problematic to describe an additional TLV type in a BLIP for a BOLTG message, right?

@carlaKC
Copy link
Contributor Author
carlaKC commented Nov 27, 2023

As I understand the line between BLIPs/BOLTS, this is the wrong place for the TLV reservation (because this is something that we intend to deploy to the whole network, so it's a BOLT), so I'd be hesitant to continue further down the BLIP path. I opened this just to flag that the TLV field is being used somewhere public, I'm not sure it even needs merging tbh.

Actually, now that I think about it, what's stopping us from placing the HTLC Endorsement inside the BLIP and then deprecating the BLIP itself?

For example - I could copy the text in, but then would we do a review round on the BLIP and the BOLT? Seems messy.

@vincenzopalazzo
Copy link

For example - I could copy the text in, but then would we do a review round on the BLIP and the BOLT? Seems messy.

Well before all we should decide for what we want to use the BLIPs repository and for what we want to use the BOLT one.

as I see, the jamming research can be a BLIP without touch the BOLT, but this is just my feeling, and I my understand wrong the scope of the BLIPs

@carlaKC carlaKC force-pushed the reserve-htlcendorsement branch from b89b4c8 to 571d52d Compare January 15, 2024 17:41
@carlaKC carlaKC changed the title blip-0002: experimental endorsement TLV reservation for update_add_htlc blip-0004: experimental endorsement signaling in update_add_htlc Jan 15, 2024
Copy link
@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

This experiment is opened as a bLIP because it is not intended to be a permanent part of the lightning specification.

Concept ACK for this. I like that we are giving a meaning to the usage of BLIPs

blip-0004.md Outdated
Comment on lines 54 to 53
* otherwise:
* SHOULD set `endorsed` to `0`.

Choose a reason for hiding this comment

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

I am missing something or this otherwise can be removed? if there is any endorsed inside the update_add_htlc there is no reason to specify one?

Or you are using it to signal the endorsed support?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or you are using it to signal the endorsed support?

Indeed. I think for the purposes of an experiment, it's useful to know the difference between a zero and null (not set) value?

For the real spec, we could just not have the field at all (and likely drop it to just be a regular bool). Just giving us some leeway for the experimental one :)

Choose a reason for hiding this comment

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

yeah, I was just in the code that I was rewriting today, and reading the definition it seems to me that a node should expect 0 also if the endorsed is not supported (e.g: turning off the experimental feature in cln terms)

In the code current if the feature is turned off the value will be set to NULL

@carlaKC carlaKC force-pushed the reserve-htlcendorsement branch from 0c62229 to db9e618 Compare April 8, 2024 18:02
@carlaKC
Copy link
Contributor Author
carlaKC commented Apr 8, 2024

Updated to include Antione's suggestion of including a deprecation_flag_day and @ProofOfKeags suggested rewording for setting endorsement values when actively participating.

Copy link
@ProofOfKeags ProofOfKeags left a comment

Choose a reason for hiding this comment

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

ACK

@carlaKC
Copy link
Contributor Author
carlaKC commented May 14, 2024

Seems like everyone is happy to go ahead with 3 bits of information. While we certainly could bikeshed a more complex scheme, I think that this is good enough for our purposes and strikes a good balance of:

  • Allowing experiments to opt into the full 3 bits
  • By default relaying min/max values (effectively true/false) so that the signal propagates through the network without "step down" privacy concerns

@ProofOfKeags @thomash-acinq @vincenzopalazzo anything outstanding on your end?

Last on my end is picking dates, WDYT about:

  • Leave experiment_start as a TODO when we merge, as it depends on deployment of the experimental flag
  • Set experiment_end to 31 December 2026

Copy link
@ProofOfKeags ProofOfKeags left a comment

Choose a reason for hiding this comment

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

🫡

@carlaKC carlaKC requested a review from vincenzopalazzo May 22, 2024 19:04
@carlaKC carlaKC force-pushed the reserve-htlcendorsement branch from f2c56a6 to 3fce513 Compare May 24, 2024 15:30
@carlaKC
Copy link
Contributor Author
carlaKC commented May 24, 2024

Thanks again for the reviews! Addressed last few nits/clarifications - I think this is ready to go 🚀

@carlaKC
Copy link
Contributor Author
carlaKC commented Jun 17, 2024

Rebased + updated feature bit to not clash with dns_resolver

blip-0004.md Outdated
Comment on lines 36 to 39
The 3 least significant bits of the endorsement TLV are used to represent an
endorsement value. A HTLC is considered to be endorsed if it is received
with `endorsed`=7 and unendorsed otherwise.

Choose a reason for hiding this comment

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

If you want a binary endorsement, less than 4 should be unendorsed and 4 or more should be endorsed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WDYT about only defining the extremes in the blip to allow more flexibility:

  • Endorsed if endorsed =7
  • Unendorsed if endorsed =0
  • Otherwise up to the reputation algorithm's interpretation

Because in the binary scheme Clara and I are working on, we wouldn't want to count something that only got 50% (ie, a 4 in the proposed scheme) as endorsed.

Choose a reason for hiding this comment

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

The problem is that a node that uses the full range 0 - 7 will very rarely set endorsed to 7. I agree that we should not specify what counts or not as endorsed, everyone should use the threshold they're comfortable with, but 7 is extreme.
My idea was that "endorsement" should correspond to the confidence that the HTLC will succeed. I think that's how it should be understood by downstream nodes. And even in a perfect world I would expect a sizeable portion (more than 30%) of HTLCs to fail because of liquidity being on the other side of a channel.

Choose a reason for hiding this comment

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

By "perfect world" I meant everyone being nice, no jamming and no holding HTLCs, because that's what this proposal is about. Having channels balanced is not a goal of this proposal and was not included in my "perfect world".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated this to just specify the interpretation of endorsed=7/endorsed=0 and left the remainder up to implementation's choice.

The problem is that a node that uses the full range 0 - 7 will very rarely set endorsed to 7. I agree that we should not specify what counts or not as endorsed, everyone should use the threshold they're comfortable with, but 7 is extreme.

It's inevitable that we run into this type of interpretation issue with multiple algorithms when we allow a range of endorsement values. This is one of the reasons that I think a binary signal is a better choice. That said, this is a read-only experiment with no impact on traffic, so I think that we should move forward with these permissive interpretation rules and see how the numbers shake out.

| 54/55 | `keysend` | A form of spontaneous payment | N | `var_onion_optin` | [bLIP 3](./blip-0003.md) |
| 256/257 | `hosted_channels` | This node accepts requests for hosted channels | IN | | [bLIP 17](./blip-0017.md) |
| 258/259 | `dns_resolver` | This node accepts DNSSEC proof requests | N | | [bLIP 32](./blip-0032.md) |
| 260/261 | `htlc_endorsement` | This node forwards experimental htlc endorsement signals | N | | [bLIP 4](./blip-004.md) |

Choose a reason for hiding this comment

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

I'm not convinced that it's useful to advertise this feature. Nodes that don't support it will just ignore the endorsement value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Advertising the feature allows us to get an idea of when we should start setting non-zero values as a sender. If we don't have this feature and senders start setting a positive endorsed signal and nobody is relaying yet, we trivially expose them as the sender.

Comment on lines +59 to +62
* if `endorsed`=7 in the incoming `update_add_htlc`:
* SHOULD set `endorsed`=7 on its outgoing `update_add_htlc`
* otherwise:
* SHOULD set `endorsed` to `0`.

Choose a reason for hiding this comment

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

Suggested change
* if `endorsed`=7 in the incoming `update_add_htlc`:
* SHOULD set `endorsed`=7 on its outgoing `update_add_htlc`
* otherwise:
* SHOULD set `endorsed` to `0`.
* SHOULD copy `endorsed` from the incoming `update_add_htlc` to the outgoing one.

But who is going to support the endorsed TLV and not run a reputation algorithm?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LND won't ship a reputation algorithm, just the basic mechanics to relay the signal. The reputation algorithm will be implemented externally using its interceptor APIs, and people can opt-in to running it.

I imagine a similar things will be true for CLN - ship basic mechanic by default and then add reputation as a plugin? cc: @vincenzopalazzo?

Copy link
@thomash-acinq thomash-acinq Jul 18, 2024

Choose a reason for hiding this comment

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

Actually, thinking more about it I think it's a bad idea to copy the endorsement value if you don't run a reputation algorithm. If you copy blindly the incoming endorsement value, attackers will run their attacks through your node to use your reputation instead of theirs.
If you don't assign reputation to your peers, just always set endorsed to the same constant value regardless of the incomming endorsed, or don't set it at all.

Copy link
Contributor Author
@carlaKC carlaKC Jul 26, 2024

Choose a reason for hiding this comment

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

If you copy blindly the incoming endorsement value, attackers will run their attacks through your node to use your reputation instead of theirs.

This BLIP is for a read-only experimental field that allows us to see how reputation algorithms do in the wild. Nobody should be making routing decisions based on this information (MUST NOT use the experimental endorsed field in resource allocation decisions.), so this isn't an issue.

If you don't assign reputation to your peers, just always set endorsed to the same constant value regardless of the incomming endorsed, or don't set it at all.

Certainly agree for when we add a real endorsement signal to the bolts.

I'm assuming that only a small number of nodes will actually run data collection/reputation algorithms for us. If the default behavior is to drop this signal, it'll be a pretty useless experiment.

@carlaKC carlaKC force-pushed the reserve-htlcendorsement branch from 5cc6837 to e4c8241 Compare July 26, 2024 14:54
@carlaKC
Copy link
Contributor Author
carlaKC commented Jul 29, 2024

Summary of discussion from today's call:

  • We'll leave the instructions as-is for interpretation of values: just strictly defining the edges of the range (7=endorsed / 0=unendorsed) in the blip
  • @thomash-acinq will run the numbers with their algo to give a reasonable threshold for interpretation based on existing data (eg: consider >6 endorsed) which I'll use in my impl
  • By default only forward as endorsed if endorsed=7, otherwise set endorsed=0 to prevent any privacy leaks (ofc impls can do what they want, because the node operator is opting in to that)

thomash-acinq added a commit to ACINQ/eclair that referenced this pull request Jul 31, 2024
Implements lightning/blips#27, a subsequent PR will implement a confidence estimator.
@carlaKC
Copy link
Contributor Author
carlaKC commented Aug 7, 2024

Can we go ahead and merge this @t-bast / @thomash-acinq?

It's been sitting for a while and is starting to run into feature bit conflicts.

@carlaKC carlaKC requested a review from thomash-acinq August 7, 2024 18:14
@t-bast
Copy link
Contributor
t-bast commented Aug 8, 2024

Sounds good to me, we've added support for this to eclair (ACINQ/eclair#2884) so let's get this merged!

@t-bast t-bast merged commit 5ea2017 into lightning:master Aug 8, 2024
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.

6 participants
0