-
Notifications
You must be signed in to change notification settings - Fork 492
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
Require to claim revoked local output in its own penalty tx post-anchor #803
Require to claim revoked local output in its own penalty tx post-anchor #803
Conversation
I think we can allow spending them all in a single tx, but perhaps recommend something like "if confirmation doesn't happen within X blocks from expiry, to_local should be swept separately as it might be pinned etc". |
I agree with @halseth, it's worth mentioning this potential attack (good find!) but we should be more permissive with implementers. |
05-onchain.md
Outdated
Note: if `option_anchor_outputs` applies, the cheating node can pin spends of its | ||
HTLC-timeout/HTLC-success outputs thanks to SIGHASH_SINGLE malleability. | ||
Using a single penalty transaction for all revoked outputs is thus unsafe as it | ||
could be blocked to propagate long enough for the `_local node's main output_ 's |
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.
IMO it's worth nothing more of the subtly here. If they're pinning, then in order to even get into the mempool, they're likely paying a relatively high fee, which means that if they do confirm, then there's the CSV period on the second level. Also the defender can mix things up themselves, by only sweeping one of the HTLC outputs, which would then invalidate the entire "tree" (possibly needing to pay high enough fees?) of the attacker.
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.
As usual they might pay a high fee but low-feerate, which isn't a real deterrence. Updated with the reference to CSV period. You can sweep one of the HTLC output thus invalidating the batched pinning of the attacker, but the attacker can pinning each commitment HTLC output at first broadcast as you have full-malleability for each of them. Generally I don't think we should successively "react" compared on guessed attacker moves as our transaction broadcast algorithm is public but not attacker one.
05-onchain.md
Outdated
@@ -513,7 +513,10 @@ A local node: | |||
using the revocation private key. | |||
- SHOULD extract the payment preimage from the transaction input witness, if | |||
it's not already known. | |||
- MAY use a single transaction to *resolve* all the outputs. | |||
- if `option_anchor_outputs` applies: | |||
- MUST *resolve* the _local node's main output_ in its own penalty transaction |
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.
Perhaps this should be "should" instead? As there're other ways to defend against this, for example: sweep every output in its own transaction.
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.
Reworded, it's used now a MAY use a single transaction to *resolve* all the outputs
which by the negative allow to sweep every output in its own transaction as first broadcast to mitigate. I kept the MUST if the confirmation isn't reached near to CSV expiration as suggested by Johan. Thus you're free to aggregate as you like until some point to save on fees but after it's a matter of security and should you care to confirm.
f079142
to
ab2964c
Compare
Updated following Johan suggestion, making the new requirement conditional on reaching a new @Roasbeef I was hesitant to introduce a note on a scorched earth approach as we discussed on IRC. I'm still fearful of this being used as a double-edge by an attacker to burn more of the victim actual balance than it would loss by the punishment of its channel reserve. |
ab2964c
to
788c6db
Compare
OK, lots of good discussion at meeting about this. The spec says MAY, because if you do make one bit tx, you need to split (as HTLC txs can race you), but you also need to split because your big tx might be pinned. It's worth noting this, for sure, but I think we can be simpler; also why pick on the to-local output? In theory any output could be largest, and you want that one. |
fc3bcd5
to
979b80b
Compare
If "you want" designates the cheating party, it's right that you can pin any largest HTLC outputs but those ones must be spent by a 2nd-level HTLC txn sooner or latter. Thus for a profitable attack to makes sense you will target the |
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.
LGTM
979b80b
to
0374aec
Compare
Updated with nit fix. |
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.
ACK
05-onchain.md
Outdated
- MAY use a single transaction to *resolve* all the outputs. | ||
- if confirmation doesn't happen before reaching `security_delay` blocks from | ||
expiry: | ||
- MUST *resolve* revoked outputs in their own, separate penalty transactions. A previous |
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.
Feels like SHOULD
is more correct here, since the sweeping node is aware of the risk and should be allowed to do as it pleases.
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 agree, @ariard I think this is the last pending point before we merge, what do you think?
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.
We've got the ACKs on this, should we wait til this is addressed? paging @ariard
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 good to me, it's up to the implementer to gauge risk-vs-fee-saving.
If `option_anchor_outputs` applies, the cheating node can pin spends of its HTLC-timeout/HTLC-success outputs thanks to SIGHASH_SINGLE malleability. Using a single penalty transaction for all revoked outputs is thus unsafe as it could be blocked to propagate long enough for the `_local node's main output_ 's relative timelock to expire and the cheating party escaping the penalty on this output.
0374aec
to
aeb19de
Compare
Sorry for delay, updated at aeb19de! |
Merging as agreed during the last spec meeting. |
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
If
option_anchor_outputs
applies, the cheating node can pin spends of itsHTLC-timeout/HTLC-success outputs thanks to SIGHASH_SINGLE malleability.
Using a single penalty transaction for all revoked outputs is thus unsafe as it
could be blocked to propagate long enough for the `local node's main output 's
relative timelock to expire and the cheating party escaping the penalty on this
output.
I think we may just make this an unconditional requirement, indifferently of anchors.