-
Notifications
You must be signed in to change notification settings - Fork 491
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
Additional inputs for HTLC txs RBF considered harmful #845
Comments
To be clear, my proposal for that sighash flag would be some form of "don't sign the output amount". |
I don't see how this could be implemented, or would be better than the status quo: if the signature doesn't cover the output then anyone in the network can adjust the output value to whatever they want, including a I seem to be missing one detail: what would be the advantage over the claiming party just adjusting the amounts and re-signing (I'm assuming this concerns the settle and timeout txs not the commitment txs creating the htlc outputs)? |
Please bear in mind that I'm only talking about the remote signature, the local signature will still be a And indeed, it's only for the HTLC transactions (2nd-stage transactions for a local commit). |
The flow I'd like to enable is:
Does that make sense? This flow feels to me vastly superior to having to add additional inputs. |
Already thought a lot about a potential I've never proposed it on the list because AFAICT it doesn't fit Lightning security model. A counterparty will offer a signature not committing to the amount of a revokeable output, opening the door to yet-another fee siphoning attack. Just drain out the whole fee from the amount and capture it with a new output, your honest counterparty won't be able to punish you. Of course, your smarter sighash flag could commit to the output index to prevent fee-siphoning-output addition by your malicious counterparty. But doesn't prevent to act in cooperation with a miner to get confirmed the commitment and HTLC txn and thus bypass the punishment. Note, I'm not saying a coalition of miner, just at least one miner, who is free to generate such malicious block anytime during channel lifetime. |
Good catch, the main issue with this proposal is indeed a fee siphoning attack via a revoked commit tx (with a miner's collaboration). For other readers, here is how the attack would work:
The only way to prevent this kind of attack while allowing malleability on the output amount would be to use a bigger CSV than 1 on HTLC txs, to ensure the honest participant can claim the outputs of the revoked commit tx directly from the commit tx before the attacker can get his HTLC txs confirmed. |
"Considered harmful" suffixes to an argument are to be "considered harmful" ;)
One other benefit of the base HTLC having zero second layer fees as that nodes are acutally able to utilize more of their avaliable channels bandwidth. Consider that before this change each HTLC required the sender to commit both the HTLC amount, as well as the fees for the second-layer transaction. With this change, they only commit the HTLC amount itself, leaving the rest of the channel available for other forwarding/payment/receiving attempts.
In the ideal case, assuming that force closes aren't correlated with each other, they only actually need a single "well sized" UTXO. Ofc, figuring out what the proper size is for your node doesn't have a very straightforward solution.
On the contrary, it can actually let a node reduce the total number of transactions they do on chain given they can now aggregate all time-lock compatible HTLC second level transaction together into a single transaction. These transactions can also further be aggregated with any other trnasactions the node may be making at the time (attach them to a funding transaction as an example). With that said, it seems implementations have 3 options:
From a risk management perspective, it's clear to me that option Independent of this proposal, I'm all for more granular sighash flags tho. IMO the ideal solution would be flexible enough to accomodate this use case and also allow for additional innovation using the set of more flexible sighash flags. Various flavoers of covenents would also help here. |
You're mistaking me, I think having 0-fee HTLC txs is great during the channel lifetime.
I completely agree that we need to do this in the short term, this issue is not questioning that don't worry :). But I was wondering if in the longer term, we could think of a better solution since the HTLC txs should be self-sufficient and on-chain fees could in theory be set by simply updating amounts, which better decouples lightning from the on-chain world. It may be a lost battle, but I think it's worth exploring or at least keep in mind in the design space. |
I definitely think there are smarter ways to do this long term, but in the short term it seems like the zero-fee HTLCs we currently have is the way to go. Longer term perhaps either more flexible sighash flags or covenants could make your proposal possible, but If we have those tools available maybe we don't even need HTLC transactions? The reason for having HTLC txs in the first place was to emulate a covenant IIRC. I'm imagining something like a single CTV output on the commitment for all HTLCs (or PTLCs), that can be spent by transactions that claim a certain amount of the funds by providing preimages, and sending the rest to the other party. You could presign transaction with various fee rates also this way of course. (this needs a lot more research) |
How smart we can be with new sighash/covenant proposals we'll hit a fundamental LN design issue. The chain can't guess a state commitment was honest until the justice period is over and no punishment has shown up. Which means using the channel capacity as "blank check" fees, before justice has been established, will always constitute a fee siphoning attack vector. What an efficient feerate for confirmation was at a given tip is always known after the fact. (In theory you might rely on per-block fee ranges to flag a feerate as a malicious waste, but that sounds like proposing the mempool to be part of the consensus rules, I'm going to die on another hill)
Note that even if you have the HTLC consuming their own capacity as fees, you'll still have to reserve bumping UTXO for the commitment transaction, which must account for the dynamic number of HTLC outputs. If you propose to have the commitment consuming its own capacity you're back to fee siphoning attack, so the fee-bumping/reserve paradigm is here to stay IMHO.
Gonna work on this LN fault-tolerance/mempool-congestion/fee-bumping recommendations research paper. Good opportunity to me to dissect current generation of fee estimators :)
I agree, I would favor HTLCs aggregation in one big block transaction. Already had this conversation with few folks but the design space here is so wide (either taproot, CTV, yet-to-be-designed covenant), so not really a priority IMO. |
I agree that additional utxo are still needed for the commit tx, I was only thinking about HTLC txs here, because it's a great multiplier (you can have I agree that the design space is very large, especially since it seems like |
I'm re-opening this issue to keep it under the spotlight as I still strongly believe anchor outputs would be a lot safer if we didn't have to manage utxo sets for a potentially large number of HTLC txs. I know this isn't feasible today, but I think it's worth keeping in a corner of our minds that this is an important area of research, where more flexibility in bitcoin sighash modes or changes to the channel structure would be very beneficial. |
Note that with our anchor implementation we are somewhat likely to go with a "one UTXO for all anchor spends" model to avoid a lot of the complexity of managing a ton of UTXOs. Indeed this requires package relay/package RBF, but so does anchor today, at least unless you monitor the mempool for counterparty broadcasts, which I don't think anyone does. |
At the risk of being the "eltoo fixes everything" guy... the fee siphoning attack is based on the premise of penalty transactions. The eltoo replaceable transaction scheme would allow tx fees to be allocated from the self-owned outputs of the eltoo settlement transaction at broadcast time without risking a siphoning attack. The problem is that an eltoo update tx must confirm before the settlement tx. An update tx has a single output with the total value in the channel so couldn't use this scheme. AJ Towns' Layered Commitments proposal for eltoo might be a way to solve this problem since it breaks out the to-self, to-other and {H,P}TLC outputs in the first layer transaction instead of just the second (ie. the settlement tx in current eltoo). If we're talking about a sighash solution to this problem, then it might make sense to consider something that is part of a comprehensive anyprevout sighash softfork defined for a new Taproot key version. |
Note that with package relay in bitcoin Core it’s substantially easier to implement BYO fees without needing one-output-per-channel. The current proposal for package relay should allow for one output to at least be used across two channels, and there may be a multi-replacement way of using a simple output for more. |
True, it's better, but fundamentally it would be so much simpler and efficient to just decrease the output amount...we shouldn't need to BYO with external inputs in the first place (in an ideal world)! |
With anchor outputs, we depend on RBF (adding additional inputs) to ensure HTLC transactions can get confirmed in time.
The more I think about it, the more I find it very sad and unsatisfactory, for the following reasons:
It would be a lot better if we could set the feerate of an HTLC transaction by simply updating the output amount at broadcast time (and changing it again if necessary to bump the fees).
Would it be completely unreasonable to devise a sighash flag that allows this?
It feels to me that this could be generally useful for offchain contracts and easily "safe".
There are details to iron out, and it would take a lot of time to get it accepted in bitcoin, so my question right now is: "is this completely unreasonable or short-sighted or does it make sense to explore this seriously?".
I'm interested in your thoughts @ariard @TheBlueMatt @rustyrussell @cdecker @halseth @joostjager @Roasbeef (and of course anyone else who can spare time thinking about this issue).
The text was updated successfully, but these errors were encountered: