Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
draft: HTLC Endorsement to Mitigate Channel Jamming #1071
base: master
Are you sure you want to change the base?
draft: HTLC Endorsement to Mitigate Channel Jamming #1071
Changes from all commits
e53ce2c
80dba2c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this to a new optional/required pair (type 2/3)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - If the receiving peer is also the HTLC recipient, the reputation
algorithm could halt here. Unless the HTLC preimage is unknown to the recipient ?
Normally there is only
keysend
payments, as such types of HTLCs.I don't know if there should be a mention in the "Local Reputation" subsection,
that the reputation algorithm MAY NOT be run if the payment is final and there is
no slow jamming risk. It could be still worthy to score up the reputation of the
sending peer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While immediate failure is an option for the local routing node, an economically
rational one can rather halt the processing and wait for the local ressources
allocated to downstream channels to free up, and then process up the non-endorsed
HTLC.
There is no interactivity needed with the upstream peer after the
commitment_signed
have been exchanged. The "halting time" per the local routing node measurement can
be subtracted from the CLTV delta difference between the
outgoing_cltv_value
andthe current chain height.
In a world where there is economical competition among the routing node, why
the receiving peer would reject a HTLC for free ? It can be more rational to
bet and pockets in the
fee_base_msat
andfee_proportional_millionths
. Youmight offer back to the other routing peer that can fulfill this HTLC forwarding
request, high quality economic traffic.
Especially, if the peer does not meet sufficient local reputation, while not
all the
protected_slot_count
are occupied, there is no economic sense to markan endorsed or non-endorsed HTLC as "general".
One suggestion could be rather to document that a receiving peer can support some
clawback where a HTLC can be upgraded from "general" to
protected_slot_count
assome implementation policy. After reading "Resource Bucketing" subsection, and lrc's
addHTLC
, I don't see that mentioned or implemented, if it's a worthy concern.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - There could be a succinct mention of how the local resource conservation
system behave for honest routing nodes boostrapping their HTLC forwarding in the
network. Such nodes might not have accumulated enough reputation during a steady
state to leverage it in face of slow jamming attack. It can be worthy to be sure
the system works smoothly for marginal peers added to the network topology.
Especially, if there are some negative events happening deeper in the stack of
the routing nodes (e.g a cloud center being taking down by a tsunami). Some
segments of the channels topology could have to be substituted on a short period
of time. The whole graph seen with by concatenating
node_announcement
andchannel_announcement
by not be a bijection with the infrastructure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the implementators, maybe few examples of scoring metrics could be given:
See that presentation about "Lightning network topology, its creation and maintenance
from which the above metrics are inspired from.
Maybe it could be added in this document or in a blip. I know there is the idea of what
is "observable within the protocol" described latter in this subsection, yet even for
the forwarding fees, this is a hard problem. The upstream peer has no visibility on
the local routing node's difference between
amount_msat
andamt_to_forward
, ifonion encryption holds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - This sentence, or the idea behind it, I don't get it.
Let's consider a simple slow jamming, where an attacker forwards a bunch of spammy
HTLCs, which are never resolved successfully and a blank state where no reputation
have been accumulated in the
reputationTracker
.At the moment of reception of the
update_add_htlc
, there is no informational stateby the receiving peer on how the HTLC is resolved, either by a success or a failure.
Marking that in-flight HTLC as having a negative impact on the channel or peer reputation
could lead to reject another concurrent in-flight HTLC, and a fees gain. The final state
of those 2 in-flight HTLCs could be a success. However at the time of processing among
upstream and downstream, the target node has no medium to predict in a deterministic
fashion the HTLC resolution.
Unless it is suggested that a target node should limit the max number of in-flight HTLC
originating from a single upstream peer ? I don't see that idea mentioned more neither
in the "Resource Bucketing" subsection or "Local Reputation" subsection. It could be
interesting as some kind of implementation policy to limit worst-case damage from a
single peer. E.g one that would have build up a high
IncomingReputation
, andthen suddenly engage in a slow jamming on the target node.
Maybe, this could be described in a blip or another document as an implementation policy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds it is the forwarding fees (or profit / volume criteria) that is described
above. I don't know if it would be worthy to introduce a versioning of the forwarding
fees algorithm. Such forwarding fees algorithms as defined by the triade of "Outgoing
Channel Revenue", "Incoming Channel Revenue" and "In-flight HTLCs".
It could be interesting to have versioning, if in the future the others criteras on
which the forwarding evaluations is done are updated, e.g the 2016 blocks or the 60
second MPP timeout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, it could be worthy to say that the local node reputation evaluated on a
per-HTLC basis is attached to the
channel id
andid
as put inupdate_add_htlc
(bolt2).
Normally, if this bolt is correctly implemented that should mean that the node's
reputation is evaluated on a monotonic counter, which is good if there is a need
to rollback the state.
ResourceManager
buildschannelReputation
onShortChannelId
, which is goodas it's an implicit commitment to the chain height and transaction output. As far
as I can see, there is no order check about
InconingIndex
inreputation_tracker.go
,though I might miss something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch...Does it mean that if you have A <-> B <-> C <-> D as peer topology, and A
forwards an endorsed HTLC 123 to D over B and C, A + D can collusion to hold the HTLC
resolution ? Assume both B and C have their own's local
resolution_period
sorespectively
B_resolution_period
andC_resolution_period
, with as default 90seconds.
At time T evaluated within
B_resolution_period
, B adds HTLC 123 on B's commitmenttransaction. This HTLC 123 is evaluated to have been added on C's commitment transaction
at time L within
C_resolution_period
. In a world of non-reliable clocks among lightningpeers, there is no certainty of time T being equivalent to time L.
Under the max value of 2016 blocks for
expiry_too_far
, A can forward the HTLC 123to D, and hold the resolution to inflate the
resolution_time
as evaluated by B aboutthe "good" behavior of C. If onion encryption holds, there is no way for B to guess that
C is not the final HTLC recipient.
It could be that A and D can downgrade C's reputation as evaluated by B's
ResourceManager
.This reputation downgrade happening while neither A and D are owning a key in the funding
utxo backing the B and C chan.
I don't know if it's a correct concern or if there is not some misunderstanding ? Though
if correct, it is hard for B and C to coordinate themselves on spotting that A and D are
acting in collusion. Both B and C, as economically rational forwarding nodes can have a
competing interest to accept traffic from A and D, and attributate the blame on resolultion
to their counterparty.
I could eventually suggest to simplify to remove that idea of
resolution_time
, inthat version of this document...Or use the chain time to evaluate the
resolution_time
within a target node's
resolution_period
? Hmmm...maybe too complicated...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be useful to have an additional indication on the definition of the clock used to tick the
resolution_period
second and from which all theopportunity_cost
computation are scaled on.E.g, the Epoch which is defined on unix systems as "1970-01-01 00:00:00 +0000 (UTC), it's not a perfect clock though it's better than nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment to be re-evaluated in light of finding here: #1071 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well...I believe there might be a variant of the selective reputation attack pointed
out in the precedent comment. Where you would have 2 MPP shard M and N flowing over to
parallel routing path 1st and 2nd and the 2 shards are identified by the same hash. A peer included
on the payment path 2nd would drop on the floor its shard to get the final recipient failing
the MPP resolution, and that way downgrade reputation for the peers along the routing path 1st.
In a world without ptlcs, this sounds it could be a realistic concern...I don't have
good idea on how to solve that, without suggesting heuristics that could negatively affect
MPP payment privacy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - It could be that the equation is modified to add the channel overall liquidity available,
both "protected" and "general". That could represent better the available liquidity that has been
sacrificed by the target node to accept this HTLC, and not another HTLC (i.e the "cost").
As it's about "Effective Fees", that other HTLC could have come from either the same upstream peer,
or an alternative upstream peer. Here comparing an endorsed HTLC of the same
outgoing_cltv_value
and both peers with "sufficient" reputation.
opportunityCost
is already used inreputation_tracker.go
, though one suggestion could beto detail this in another document, or a blip as more an implementation policy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - Minding the comment about on-the-fly HTLC upgrade from "general" to
protected_liquidity_portion
, if all the protected slots are not occupied, one couldsuggest that the HTLC's contribution to the reputation is not purely determined
by the endorsement.
Zooming out,
opportunityCost
is better evaluated at the node level for HTLCs in competitionamong all the available liqudity / slots ressources. If I'm understanding correctly, lrc's
reputationTracker
do no evaluate theopportunityCost
of a HTLC channel for all the targetnode channels (minus the outgoing one).
I don't know if this part wouldn't be better to be documented in another document or a blip
as an implementation policy. Like if you have endorsement value oscillating among 0 and
the experimental endorsement value of
endorsed=7
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - It could be that independently of the clock picked up to evaluate the
resolution_period
,assigning a score of 0 to the
effective_fees
can have a too severe impact on the forwarding nodereputation.
As explained in the rational, the forwading node make no promise about their behavior, though at
the same time they can make little promise on the HTLC final recipient, which can influence
the
resolution_time
, even all under natural condition.One could rather suggested a function of
n^4
wheren
is the difference betweenresolution_period
and
resolution_time
. I don't know about the exact exponent value, this could be something experimentedby implementations as a policy, informing some "natural HTLC failure rate" tolerance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - Let's consider the equation
incoming_channel_revenue - in_flight_risk >= outgoing_channel_revenue
to evaluate a node's "sufficient" reputation. From what I'm understanding, the incoming fees is accounted on the outgoing channel somehow to protect the target node reputation from the view of the downstream peer, if the HTLC would come to fail.Is this way of measurement creating an exploitable by colluding peers ? Hmmmm...if you have A <-> B <-> C, maybe eventually A and C could collusion to have all their "endorsed" HTLCs forwarded through B always solving. Those resolutions could have a success rate above the natural rate of failure of HTLCs from
the remaining "honest" upstream peers.
One result could be for A to build cheap reputation in the view of the target node B. Reputation that
can be consumed to launch slow jamming attacks in the future provoking a higher damage to node B,
that what has been paid previously as
fee_base_msat
andfee_proportional_millionths
.One suggestion could be to clarify the rational, especially on the observation that even without
accruance for many HTLCs fees over a unified measure period, the reputation accumulated on the
outgoing channel in view of the downstream peer could be worthy to protect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor minor - Given block intervals of 10 minute is a poisson distribution, it could be better
to document the
outoing_revenue_window
in block height or block time, rather than seconds.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - One could observe that "unforgeable history" could far from being true given
the
fees
are expressed inmilli-satoshis
. A peer could accumulate a high balance ofmilli-satoshis
under the threshold of a satoshi, and yet this channel revenue is neverpaid is the channel is closed before the balance has materialized over a satoshi.
Hmmm...I don't believe it that serious, unless an upstream peer can boost its reputation
by forwarding a lot of milli-sat satoshis with a high rate of success...Could that pending
balance of milli-satoshis be "siphoned" back by the upstream peer by abusing negative routing
fees ? I.e
fee_base_msat
where more money is given to the routed HTLCs to re-equilibrate liquidity.I would say it's interesting to think more about that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - Is there a rational somewhere about why picking up a rolling window rather
than evaluating
incoming_channel_revenue
since channel opening ? Like there couldbe performance issue if one has to go through all the HTLCs since years and reevaluate
them to build reputation.
On the other hand, picking up a rolling window opens some windows of opportunities for
a slow jamming attacker. If you can guess the periodicity of the traffic of the neighboring
upstream peers, and this periodicity is low, the attacker can make previsions on when
the target node ressources will be more cheaper to preempt them and build reputation.
Hmmmm...I don't think there is a perfect period value to consider, it could be more
interesting to have this documented as implementation policy, or in another document like
blip. Especially testing what different periods yields, at least to avoid building
periodicity over the whole network of forwarding nodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - See the comment above about concurrent "honest" HTLCs, preemptively slashing
the reputation of the HTLC could yield a loss of fees gains for economically rational
forwarding nodes.
Sounds it could be interesting to introduce a sub-versioning of the risk calculation
itself (where the reputation algorithm would be an encompassing version), to let many
versions of a risk algorithm being experimented with or deployed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's consider again the equation
incoming_channel_revenue - in_flight_risk >= outgoing_channel_revenue
. E.g if the incoming channel revenue is 10_000 sats and theoutgoing channel revenue is 5_000 sats, if I'm understanding correctly this means that
the sum of the endorsed HTLCs is subtracted from the incoming channel revenue.
If the result is inferior to the outgoing channel revenue, the upstream peer is
considered as not having a sufficient reputation in the view of the target node.
Isn't that weird that each endorsed HTLC is making more likely for a peer to not be
classified as with sufficient reputation ? Like one could think it should be each
non-endorsed HTLC that is making that outcome more probable. There is something
I don't get here, and the rational is not very clear on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - The ressource bucketing algorithm could be versioned, e.g if the distribution
between the
protected_slot_count
frommax_accepted_htlcs
is made with anotherratio than
0.5
. Good too for implementation to experiment their bucket policy withmany numbers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor minor - The base of the
0.5
could be precised if it's the funding utxoamount, from the
htlc_minimum_msat
, with or without the channel reserve.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above HTLC on-the-fly upgrade from "general" to "protected". This
could be the kind of situation where a high-value HTLC paying good routing fees
is rejected from forward on outgoing channel, because the HTLC
outgoing_htlc_value
is falling just above
protected_liquidity_portion
*max_htlc_value_in_flight
.Of course, all depend if there is high volume of traffic going through
the target node, and that traffic probabilistically should soon occupied the
protected_slot_liquidity
, or if it's more economically interesting to takethe risk of making an exemption.
One could suggest this part could be better left to be described in another
document, or a blip and have implementation experimenting with that. This
could be too "rigid" for low-volume forwarding nodes and the parameters too
"flexible" for high-volume, topologically well-connected forwarding nodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - I believe the overall "Local Resource Conversartion" proposal would gain to
have the implementation notes dried up in its own document or blip, including
some magic values that are referenced in other subsections (e.g the 10 for the
incoming_channel_multiplier
defining the rolling window).Without thoughts really on the decaying average, there could be implementation
alternative such as taking all the HTLCs points since the channel opening and
periodically re-evaluating their score according to the on-chain fees, as one
can see in the blocks, or the total HTLC forwarding traffic that has been through
the target node. Just ideas, more to note the range of rolling windows algorithm
that could be experimented with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - It would deserve its own blip, especially if some nodes tries altnerative
bootstrapping ideas, e.g modulating the no endorsment period in function of
the peers's number of
channel_announcements
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - ....Hmmmmmm, it could be interesting to adopt the communalized reputation assesment
over many channels from a upstream peer on the HTLC timing. Given their lower and
upper bounded by the
height_added
andresolution_window
, a set of slow-jammingHTLCs might have to fit within the same window.
Especially, it could be useful to prevent sudden spikes of slow-jamming HTLCs to
occupy liquidity / slots, when those slow-jamming are triggered with few hops of
depths in the graph. While not downgrading the forwarding of the upstream peers
the rest of the time. It could be a thing.