Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Commitment delay asymmetry

12 messages, Apr 12 to 16, 2018. Started by Jim Posen.

Jim Posen (4), Daniel McNally (3), ZmnSCPxj (3), Rusty Russell, Ariel Lorenzo-Luaces

Permalink First message in the Wayback Machine

Jim Posen permalink original

As specified in BOLT 3, in the commitment transactions the to_local output is time-locked with OP_CSV while the to_remote is a simple P2WPKH. The to_local output must be time-locked in order to allow the other party to come online and sweep funds from a published revoked commitment. In the case of an honest unilateral close, however, this wastes the time-value of capital locked in the channel for the publisher but not the other party.

This seems to create perverse incentives where a party that goes offline and forces a unilateral close is not penalized and only the party that broadcasts is. I see this as a problem in both normal operation and attack scenarios. Consider cases where the peer is misbehaving and the node needs to broadcast to chain. Concretely, consider a case where the other party does not send an update_fail_htlc after it expires. A rational node might decide to just become unresponsive instead of broadcasting the commitment in the hopes that the other party publishes instead. Or if the value of the HTLC is sufficient, it would want to claim the time-locked output ASAP in which case the misbehaving peer is not punished and gets access to its funds immediately.

I find it easier to analyze the game theory of these situations if the to_remote output is also time-locked by the to_remote_delay. Making the consequence of an on-chain settlement symmetric changes the game from chicken [1] to a tragedy of the commons [2]. I'm curious how other people think about this.

-jimpo

[1] https://en.wikipedia.org/wiki/Chicken_(game)
[2] https://en.wikipedia.org/wiki/Tragedy_of_the_commons
Rusty Russell in reply to Jim Posen permalink original

Jim Posen <jim.posen at gmail.com> writes:

Quoted text (5 lines)
> I find it easier to analyze the game theory of these situations if the
> to_remote output is also time-locked by the to_remote_delay. Making the
> consequence of an on-chain settlement symmetric changes the game from
> chicken [1] to a tragedy of the commons [2]. I'm curious how other people
> think about this.

It does increase incentive to mutual close, and it makes some kinds of sense: A tells B what the delay is, so having A subject to it too is fair.

By extension, perhaps both sides should use the maximum delay either one asks for?

I don't think it's urgent, but please put it into the brainstorming part of the wiki so we don't lose track?[1]

Cheers, Rusty. [1] Which someone should organize into a new "proposals" page..

Jim Posen in reply to Rusty Russell permalink original
Quoted text (3 lines)
> By extension, perhaps both sides should use the maximum delay either one
> asks for?
>

I'm not sure that is necessary. As long as both parties have to wait the same amount of time regardless of whether they publish the commitment or the other side does, that would resolve the issue.

Quoted text (3 lines)
> I don't think it's urgent, but please put it into the brainstorming part
> of the wiki so we don't lose track?[1]
>

I don't have access to add to the wiki. I'd write a section like:

# Symmetric CSV Delay

Change the script of the remote output of all commitment transactions to require the full CSV delay. This acts as further incentive for both parties to mutually close instead of waiting for the other side to unilaterally close, and serves as punishment to misbehaving or unresponsive nodes that force the other endpoint to go to chain.

Daniel McNally in reply to Jim Posen permalink original

This makes a lot of sense to me as a way to correct the incentives for closing channels. I figure that honest nodes that have truly gone offline will not require (or be able to take advantage of) immediate access to their balance, such that this change shouldn't cause too much inconvenience.

I was trying to think if this could open up a DOS vector - dishonest nodes performing unilateral closes even when mutual closes are possible just to lock up the other side's coins - but it seems like not much of a concern. I figure it's hard to pull off on a large scale.

Daniel

On Fri, Apr 13, 2018, 6:10 PM Jim Posen <jim.posen at gmail.com> wrote:

Quoted text (28 lines)
>
> By extension, perhaps both sides should use the maximum delay either one
>> asks for?
>>
>
> I'm not sure that is necessary. As long as both parties have to wait the
> same amount of time regardless of whether they publish the commitment or
> the other side does, that would resolve the issue.
>
>
>> I don't think it's urgent, but please put it into the brainstorming part
>> of the wiki so we don't lose track?[1]
>>
>
> I don't have access to add to the wiki. I'd write a section like:
>
> # Symmetric CSV Delay
>
> Change the script of the remote output of all commitment transactions to
> require the full CSV delay. This acts as further incentive for both parties
> to mutually close instead of waiting for the other side to unilaterally
> close, and serves as punishment to misbehaving or unresponsive nodes that
> force the other endpoint to go to chain.
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
ZmnSCPxj in reply to Daniel McNally permalink original

Good morning Daniel,

Quoted text (3 lines)
> This makes a lot of sense to me as a way to correct the incentives for closing channels. I figure that honest nodes that have truly gone offline will not require (or be able to take advantage of) immediate access to their balance, such that this change shouldn't cause too much inconvenience.
>
> I was trying to think if this could open up a DOS vector - dishonest nodes performing unilateral closes even when mutual closes are possible just to lock up the other side's coins - but it seems like not much of a concern. I figure it's hard to pull off on a large scale.

Now that you bring this up, I think, it is indeed a concern, and one we should not take lightly.

As a purely selfish rational being, it matters not to me whether my commitment transaction will delay your output or not; all that matters is that it delays mine, and that is enough for me to prefer a bilateral close if possible. I think we do not need to change commitment transactions to be symmetrical then --- it is enough that the one holding the commitment transaction has its own outputs delayed.

If I had a goal to disrupt rather than cooperate with the Lightning Network, and commitment transactions would also delay the side not holding the commitment transaction (i.e. "symmetrical delay" commitments), I would find it easier to disrupt cheaply if I could wait for a channel to be unbalanced in your favor (i.e. you own more money on it than I do), then lock up both our funds by doing a unilateral transaction. Since it is unbalanced in your favor, you end up losing more utility than I do. Indeed, in the situation where you are funding a new channel to me, I have 0 satoshi on the channel and can perform this attack costlessly.

Now perhaps one may argue, in the case of asymmetric delays, that if I were evil, I could still disrupt the network by misbehaving and forcing the other side to push its commitment transaction. Indeed I could even just accept a channel and then always fail to forward any payment you try to make over it, performing a disruption costlessly too (as I have no money in this). But this attack is somewhat more passive than the above attack under a symmetrical delay commitment transaction scheme.

Regards, ZmnSCPxj

Jim Posen in reply to ZmnSCPxj permalink original

I believe that anyone attempting a DOS by forcing on-chain settlement can do it just as easily with asymmetric delays than with symmetric delays.

If my goal is to waste the time-value of your money in a channel, in a world with symmetric delays, I could just publish the commitment transaction and you would have to wait the full delay for access to your funds. True. But with delays asymmetric as they are now, I can just as easily refuse to participate in a mutual close, forcing you to close on-chain. This is just as bad. In fact, I'd argue that it is worse, because I lose less by doing this (in the sense that I as the attacker get immediate access to my funds). So in my assessment, it is a very active attack and symmetric delays are something of a mitigation. You are right that the balance of funds in the channel becomes a factor too, but note that there is the reserve balance, so I'm always losing access to some funds for some time.

-jimpo

On Sun, Apr 15, 2018 at 6:35 AM, ZmnSCPxj <ZmnSCPxj at protonmail.com> wrote:

Quoted text (46 lines)
> Good morning Daniel,
>
>
> This makes a lot of sense to me as a way to correct the incentives for
> closing channels. I figure that honest nodes that have truly gone offline
> will not require (or be able to take advantage of) immediate access to
> their balance, such that this change shouldn't cause too much inconvenience.
>
> I was trying to think if this could open up a DOS vector - dishonest nodes
> performing unilateral closes even when mutual closes are possible just to
> lock up the other side's coins - but it seems like not much of a concern. I
> figure it's hard to pull off on a large scale.
>
>
>
> Now that you bring this up, I think, it is indeed a concern, and one we
> should not take lightly.
>
> As a purely selfish rational being, it matters not to me whether my
> commitment transaction will delay your output or not; all that matters is
> that it delays mine, and that is enough for me to prefer a bilateral close
> if possible.  I think we do not need to change commitment transactions to
> be symmetrical then --- it is enough that the one holding the commitment
> transaction has its own outputs delayed.
>
> If I had a goal to disrupt rather than cooperate with the Lightning
> Network, and commitment transactions would also delay the side not holding
> the commitment transaction (i.e. "symmetrical delay" commitments), I would
> find it easier to disrupt cheaply if I could wait for a channel to be
> unbalanced in your favor (i.e. you own more money on it than I do), then
> lock up both our funds by doing a unilateral transaction.  Since it is
> unbalanced in your favor, you end up losing more utility than I do.
> Indeed, in the situation where you are funding a new channel to me, I have
> 0 satoshi on the channel and can perform this attack costlessly.
>
> Now perhaps one may argue, in the case of asymmetric delays, that if I
> were evil, I could still disrupt the network by misbehaving and forcing the
> other side to push its commitment transaction.  Indeed I could even just
> accept a channel and then always fail to forward any payment you try to
> make over it, performing a disruption costlessly too (as I have no money in
> this).  But this attack is somewhat more passive than the above attack
> under a symmetrical delay commitment transaction scheme.
>
> Regards,
> ZmnSCPxj
>
Daniel McNally in reply to Jim Posen permalink original

Thanks ZmnSCPxj and Jim,

Quoted text (1 line)
> Indeed, in the situation where you are funding a new channel to me, I have 0 satoshi on the channel and can perform this attack costlessly.

My thinking here is that an attacker would have a hard time getting others to open new channels with them, and that even when others do there are other ways to misbehave as you mentioned.

Otherwise I agree with Jim and the asymmetry seems more of a concern. I haven't fully thought this through yet, but one thought might be to scale the other side's delay according to the balance of the channel. For example, in the case where the side unilaterally closing the channel has zero balance, the other side gets no delay and symmetry as measured by (coins locked) * (duration of lock) equals zero on both sides. When the side closing the channel has at least 50% of the balance, both sides must wait the full delay. Thoughts?

Daniel

Ariel Lorenzo-Luaces in reply to Jim Posen permalink original

Letting the attacker have immediate access to their funds is a null point because the attacker always has the preparation time to unbalance the channel to the honest node's favor. The attacker's 'funds' in this case is trivially reduced to 'reserve balance'. It's hard to argue that forcing the malicious node to wait for the delay before having access to their reserve balance is disincentive enough to not perform the attack.

Cheers Ariel Lorenzo-Luaces

On Apr 15, 2018, 11:37 AM, at 11:37 AM, Jim Posen <jim.posen at gmail.com> wrote:

Quoted text (102 lines)
>I believe that anyone attempting a DOS by forcing on-chain settlement
>can
>do it just as easily with asymmetric delays than with symmetric delays.
>
>If my goal is to waste the time-value of your money in a channel, in a
>world with symmetric delays, I could just publish the commitment
>transaction and you would have to wait the full delay for access to
>your
>funds. True. But with delays asymmetric as they are now, I can just as
>easily refuse to participate in a mutual close, forcing you to close
>on-chain. This is just as bad. In fact, I'd argue that it is worse,
>because
>I lose less by doing this (in the sense that I as the attacker get
>immediate access to my funds). So in my assessment, it is a very active
>attack and symmetric delays are something of a mitigation. You are
>right
>that the balance of funds in the channel becomes a factor too, but note
>that there is the reserve balance, so I'm always losing access to some
>funds for some time.
>
>-jimpo
>
>On Sun, Apr 15, 2018 at 6:35 AM, ZmnSCPxj <ZmnSCPxj at protonmail.com>
>wrote:
>
>> Good morning Daniel,
>>
>>
>> This makes a lot of sense to me as a way to correct the incentives
>for
>> closing channels. I figure that honest nodes that have truly gone
>offline
>> will not require (or be able to take advantage of) immediate access
>to
>> their balance, such that this change shouldn't cause too much
>inconvenience.
>>
>> I was trying to think if this could open up a DOS vector - dishonest
>nodes
>> performing unilateral closes even when mutual closes are possible
>just to
>> lock up the other side's coins - but it seems like not much of a
>concern. I
>> figure it's hard to pull off on a large scale.
>>
>>
>>
>> Now that you bring this up, I think, it is indeed a concern, and one
>we
>> should not take lightly.
>>
>> As a purely selfish rational being, it matters not to me whether my
>> commitment transaction will delay your output or not; all that
>matters is
>> that it delays mine, and that is enough for me to prefer a bilateral
>close
>> if possible.  I think we do not need to change commitment
>transactions to
>> be symmetrical then --- it is enough that the one holding the
>commitment
>> transaction has its own outputs delayed.
>>
>> If I had a goal to disrupt rather than cooperate with the Lightning
>> Network, and commitment transactions would also delay the side not
>holding
>> the commitment transaction (i.e. "symmetrical delay" commitments), I
>would
>> find it easier to disrupt cheaply if I could wait for a channel to be
>> unbalanced in your favor (i.e. you own more money on it than I do),
>then
>> lock up both our funds by doing a unilateral transaction.  Since it
>is
>> unbalanced in your favor, you end up losing more utility than I do.
>> Indeed, in the situation where you are funding a new channel to me, I
>have
>> 0 satoshi on the channel and can perform this attack costlessly.
>>
>> Now perhaps one may argue, in the case of asymmetric delays, that if
>I
>> were evil, I could still disrupt the network by misbehaving and
>forcing the
>> other side to push its commitment transaction.  Indeed I could even
>just
>> accept a channel and then always fail to forward any payment you try
>to
>> make over it, performing a disruption costlessly too (as I have no
>money in
>> this).  But this attack is somewhat more passive than the above
>attack
>> under a symmetrical delay commitment transaction scheme.
>>
>> Regards,
>> ZmnSCPxj
>>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Lightning-dev mailing list
>Lightning-dev at lists.linuxfoundation.org
>https://www.learnbitcoin.com/archive/lists/lightning-dev
ZmnSCPxj in reply to Ariel Lorenzo-Luaces permalink original

Good morning all,

It seems to me the below two worlds are possible:

1. Symmetric delays. 1.1. I can attack passively: I force a condition where most funds are in the other side (e.g. forwarding to another node I control, or exchanging BTC for material goods), then stop forwarding payments and generally being a pest. The other side closes unilaterally in frustration (locking its funds) and I get penalized by having my (smaller, in my case) amount locked for some blocks. 1.2. I can attack actively: I force a condition where most funds are in the other side, then unilaterally close the channel (locking my counterparty funds). I get penalized by having my smaller amount locked for some blocks.

2. Asymmetric delays. 2.1. I can attack passively: I force a condition where most funds are in the other side (e.g. forwarding to another node I control, or exchanging BTC for material goods), then stop forwarding payments and generally being a pest. The other side closes unilaterally in frustration (locking its funds) and I do not get penalized.

It seems to me that adding an entire new attack vector in order to only *mitigate* (not eliminate!) another attack vector is not a good enough trade-off. In particular the new attack seems *easier* to perform. The current attack where I annoy the other side until it closes has the risk that the other side may have a high tolerance for annoyance, and decide not to close the channel unilaterally anyway. But in a symmetric-delay world, I do not have to wait for the other side to get annoyed: I just trigger the lockup period immediately in the active attack.

Daniel McNally in reply to ZmnSCPxj permalink original
Quoted text (3 lines)
> Since there is no delay involved in my branch, I can get the money
> immediately without Daniel being able to revoke it.  So I get 1.0BTC and
> 0.99BTC worth of Daniel products.

Perhaps I should have clarified, the side unilaterally closing the channel would always have to wait for the full delay to allow time for revoke transactions to be broadcast, preventing the scenario you bring up. It's a matter of what delay is imposed on the other side.

My understanding is that, currently, each channel has an agreed upon CSV delay and each side's commitment transaction(s) has this delay for their own output only. Jim's suggesting to apply this same delay to the remote output as well. I'm wondering if it would make more sense to scale the delay on the remote output according to the balance distribution (while leaving the local outputs with the full delay) to avoid the situation where a misbehaving node can unilaterally close channels where it has little or no balance, thereby locking up the funds of the remote node at virtually no cost to itself. The delay on the remote output would scale from zero delay (what it always is currently) up to the same delay as the side unilaterally closing the channel. That wouldn't always make it completely symmetric (at least in terms of coins locked * duration of lock), but it seems like an improvement.

Daniel

Jim Posen in reply to ZmnSCPxj permalink original
Quoted text (10 lines)
>
> It seems to me that adding an entire new attack vector in order to only
> *mitigate* (not eliminate!) another attack vector is not a good enough
> trade-off.  In particular the new attack seems *easier* to perform.  The
> current attack where I annoy the other side until it closes has the risk
> that the other side may have a high tolerance for annoyance, and decide not
> to close the channel unilaterally anyway.  But in a symmetric-delay world,
> I do not have to wait for the other side to get annoyed: I just trigger the
> lockup period immediately in the active attack.
>

I don't see the two attacks in the symmetric case as any different from one another. In 1.1, you force a unilateral close by becoming unresponsive and forcing the other side to eventually broadcast the commitment. In this case you waste the other party's channel balance for the full time of the delay PLUS the additional time they wait around to determine if you are ever going to come online. In 1.2, you force a unilateral close by broadcasting yourself. This is actually a weaker attack because the other party only has to wait for the delay period and there is no uncertainty about when they will get access to funds. So basically, I see no reason for an attacker to ever choose 1.2 over 1.1.

So the question is whether 1.1 or 2.1 is a worse DOS. To me it's pretty clear that it is 2.1 because the attacker does not get penalized and can for more quickly use any remaining channel balance to open a new channel with someone else and start over.

I also would not classify 1.1 nor 2.1 as a passive attack -- the attacker is proactively rebalancing the victim's channel balances in order to waste the maximal amount of time-money. Passive attacks [1] are where an attacker does not directly interact with the victim and just eavesdrops or tries to observe and extract information.

Quoted text (14 lines)
> > For example, in the case where the side unilaterally closing the channel
> has zero balance, the other side gets no delay and symmetry as measured by
> (coins locked) * (duration of lock) equals zero on both sides. When the
> side closing the channel has at least 50% of the balance, both sides must
> wait the full delay. Thoughts?
>
> So on channel setup where I am the funder to a 1BTC  channel I make to
> Daniel:
>
> * Daniel holds a commitment transaction with: ZmnSCPxj=1BTC+no delay,
> Daniel=0BTC+no delay
> * I hold a commitment transaction with: ZmnSCPxj=1BTC+no delay,
> Daniel=0BTC+no delay
>

I rather like Daniel's suggestion to scale the delay in proportion to the time-money lost by the broadcasting party. Essentially, the delay just serves as punishment, so we should ensure that the punishment delivered is no greater than the time-value lost by the initiator of the unilateral close.

This example is not quite right: the commitment delays do not need to be the same in both commitment transaction with this scaling strategy. So the delay for the local output is ALWAYS the to_local_delay, as it is in the BOLT 3 spec today. When assigning the delay on the remote output, however, instead of using 0 as BOLT specifies now or to_remote_delay as I originally proposed, a better rule might be min(to_remote_delay, to_local_delay * to_local_value / to_remote_value). So the delay is never worse than what the opposite side would get by broadcasting themself, but is the punishment duration is reduced if the attacker broadcasts a commitment transaction in which the balance of funds is skewed towards the victim's end of the channel. However, I'm not sure how much this matters because as I argued above, an attacker should always prefer to become unresponsive rather than broadcast the commitment themself.

[1] https://en.wikipedia.org/wiki/Passive_attack
ZmnSCPxj in reply to Jim Posen permalink original

Good morning Jim,

Quoted text (3 lines)
>> It seems to me that adding an entire new attack vector in order to only *mitigate* (not eliminate!) another attack vector is not a good enough trade-off.  In particular the new attack seems *easier* to perform.  The current attack where I annoy the other side until it closes has the risk that the other side may have a high tolerance for annoyance, and decide not to close the channel unilaterally anyway.  But in a symmetric-delay world, I do not have to wait for the other side to get annoyed: I just trigger the lockup period immediately in the active attack.
>
> I don't see the two attacks in the symmetric case as any different from one another. In 1.1, you force a unilateral close by becoming unresponsive and forcing the other side to eventually broadcast the commitment. In this case you waste the other party's channel balance for the full time of the delay PLUS the additional time they wait around to determine if you are ever going to come online. In 1.2, you force a unilateral close by broadcasting yourself. This is actually a weaker attack because the other party only has to wait for the delay period and there is no uncertainty about when they will get access to funds. So basically, I see no reason for an attacker to ever choose 1.2 over 1.1.

You make a good point there, I understand.

Quoted text (10 lines)
>>> For example, in the case where the side unilaterally closing the channel has zero balance, the other side gets no delay and symmetry as measured by (coins locked) * (duration of lock) equals zero on both sides. When the side closing the channel has at least 50% of the balance, both sides must wait the full delay. Thoughts?
>>
>> So on channel setup where I am the funder to a 1BTC  channel I make to Daniel:
>>
>> * Daniel holds a commitment transaction with: ZmnSCPxj=1BTC+no delay, Daniel=0BTC+no delay
>> * I hold a commitment transaction with: ZmnSCPxj=1BTC+no delay, Daniel=0BTC+no delay
>
> I rather like Daniel's suggestion to scale the delay in proportion to the time-money lost by the broadcasting party. Essentially, the delay just serves as punishment, so we should ensure that the punishment delivered is no greater than the time-value lost by the initiator of the unilateral close.
>
> This example is not quite right: the commitment delays do not need to be the same in both commitment transaction with this scaling strategy. So the delay for the local output is ALWAYS the to_local_delay, as it is in the BOLT 3 spec today. When assigning the delay on the remote output, however, instead of using 0 as BOLT specifies now or to_remote_delay as I originally proposed, a better rule might be min(to_remote_delay, to_local_delay * to_local_value / to_remote_value). So the delay is never worse than what the opposite side would get by broadcasting themself, but is the punishment duration is reduced if the attacker broadcasts a commitment transaction in which the balance of funds is skewed towards the victim's end of the channel. However, I'm not sure how much this matters because as I argued above, an attacker should always prefer to become unresponsive rather than broadcast the commitment themself.

This seems complicated, so perhaps just make delays equal as in the original proposal. Of course, each side has its own `to_self_delay` that currently is applied to the other side. It seems best the rule:

If I impose a specific `to_self_delay`, that applies to your commitment transaction, but for both branches of that.

My commitment transaction will have delays from your `to_self_delay` setting.

Regards, ZmnSCPxj