📅 Original date posted:2022-11-07
📝 Original message:
Hey laolu,
Thanks for your feedback.
> However, I can imagine that if an implementation doesn't have its own
> wallet, then things can be a bit more difficult, as stuff like the
bitcoind
> wallet may not expose the APIs one needs to do things like CPFP properly.
I don't think this is only an issue of wallet management though. I would
bet that most node operators today don't have a good enough utxo reserve
to actually provide safety against a malicious attacker once mempool
backlog starts filling up. Eclair isn't really limited by bitcoind APIs
here, but rather by BIP 125 rules, which creates the same issues for
lnd's internal wallet.
The reason we're not seeing issues today is only because there is no
malicious behavior on the network, but when that happens, there will
be issues (remember, the turkey thinks everything is fine and really
likes that guy who comes everyday to feed it, until Thanksgiving comes).
The issue I'm most concerned with is an attacker filling your outgoing
HTLC slots with HTLCs that timeout at blocks N+1, N+2, ..., N+483. It's
not trivial to batch those HTLCs because they all have different cltv
expiries. If you're low on utxo count, you only have two choices:
1. Re-create a batched transaction at every block to include more utxos
2. Create trees of unconfirmed transactions where the change output of
one HTLC tx is the funding input of another HTLC tx
With option 1, you'll need to increase the overall feerate at every
block to match RBF rules, which means you'll end up greatly overpaying
the fees once you've RBF-ed a hundred times or more...
With option 2, it's even worse, because HTLCs that timeout earlier end
up closer to the root of tree. It will be prohibitively costly to RBF
them because BIP 125 will force you to pay a huge fee for replacing a
high number of unconfirmed descendants. Your only option is to CPFP at
one of the leaves of the tree, which is going to be very costly as well
because it requires setting a high feerate to the *whole* tree, even
though it could contain many HTLCs that still have time available before
the cltv-expiry-delta ends.
The attacker may also regularly claim HTLCs one-by-one by revealing the
preimage just to invalidate your whole batched transaction or tree of
unconfirmed transactions, requiring you to rebuild it at every block and
wait one more block before getting transactions confirmed (until you
reach the point where the attacker can also claim all HTLC outputs and
your only solution is a scorched-earth strategy).
Both options end up with the node operator greatly overpaying fees when
fighting a relatively smart attacker (which means the node operator is
actually losing money).
Also, this is a fairly complex bit of logic to implement, which depends
on bitcoin node's relaying policies and is really hard to test against
enough malicious scenarios. It's thus very likely to have subtle bugs.
This class of attacks are why eclair's default are very conservative:
* 30 accepted HTLCs instead of 483
* 144 blocks of cltv-expiry-delta
I'm afraid this is the only way to tip the odds in the favor of the
honest node operators with the current protocol. It's very frustrating
though!
As for Taproot compatibility, this is perfectly doable: if we're able
to share one nonce, we can just share multiple every time. If we're
able to watch one transaction, we're able to watch multiple. It's more
costly, but it's not a fundamental limitation.
I'm more concerned about limitations of this proposal to tackle dusty
HTLCs kind of attacks and the complexity it introduces, as was raised
in the comments of the spec PR [1]. Granted, this isn't a very *good*
proposal, but it's an attempt at raising awareness that we probably
need to do *something* to get slightly better funds safety.
Thanks,
Bastien
[1] https://github.com/lightning/bolts/pull/1036
Le sam. 5 nov. 2022 à 01:52, Olaoluwa Osuntokun <laolu32 at gmail.com> a écrit
:
>
> Hi tbast,
>
> FWIW, we haven't had _too_ many issues with the additional constraints
> anchor channels bring. Initially users had to deal w/ the UTXO reserve,
but
> then sort of accepted the trade-off for the safety that actually being
able
> to dynamically bump the fee on your commitment transaction and HTLCs.
We're
> also able to re-target the fee level of second level spends on the fly,
and
> even aggregate them into distinct fee buckets.
>
> However, I can imagine that if an implementation doesn't have its own
> wallet, then things can be a bit more difficult, as stuff like the
bitcoind
> wallet may not expose the APIs one needs to do things like CPFP properly.
> lnd has its own wallet (btcwallet), which is what has allowed us to adopt
> default P2TR addresses everywhere so quickly (tho ofc we inherit
additional
> maintenance costs).
>
> > Correctly managing this fee-bumping reserve involves a lot of complex
> > decisions and dynamic risk assessment, because in worst-case scenarios,
a
> > node may need to fee-bump thousands of HTLC transactions in a short
period
> > of time.
>
> IMO these new considerations aren't any worse than needing to predict the
> future fee schedule of the chain to ensure that you can force close in a
> timely manner when you need to. Re fee bumping thousands of HTLCs: anchor
> lets them all be batched in the same transaction, which reduces fees and
> also the worst-case on-chain force close footprint.
>
> > each node can simply sign multiple versions of the HTLC transactions at
> > various feerates
>
> I'm not sure this can be mapped super cleanly to taproot channels that use
> musig2. Today in the spec draft/impl, both sides maintain a pair of nonces
> (one for each commitment transaction). If they need to sign N different
> versions, then they also need to exchange N nonces, both during the
initial
> funding process, and also each time a new commitment transaction is
created.
> Mo signatures means mo transaction latency. Also how would retransmitting
be
> handled? By sending distinct valid signatures for a given fee rate, you're
> effectively creating _even more_ commitments one needs to watch to be able
> to play once they potentially hit the chain.
>
> Ultimately, I'm not sure why implementations that have already rolled out
> anchors by default, and have a satisfactory policy for ensuring fee
bumping
> UTXOs are available at all times would implement this. It's just yet
another
> option defined in the spec, and prescribes a more restrictive solution to
> what's already possible: being able to dynamically fee bump commitment
> transactions, and aggregate second level spends.
>
> -- Laolu
>
> On Thu, Oct 27, 2022 at 6:51 AM Bastien TEINTURIER <bastien at acinq.fr>
wrote:
>>
>> Good morning list,
>>
>> The lightning network transaction format was updated to leverage CPFP
>> carve-out and allow nodes to set fees at broadcast time, using a feature
>> called anchor outputs [1].
>>
>> While desirable, this change brought a whole new set of challenges, by
>> requiring nodes to maintain a reserve of available utxos for fee-bumping.
>> Correctly managing this fee-bumping reserve involves a lot of complex
>> decisions and dynamic risk assessment, because in worst-case scenarios,
>> a node may need to fee-bump thousands of HTLC transactions in a short
>> period of time.
>>
>> This is especially frustrating because HTLC transactions should not need
>> external inputs, as the whole value of the HTLC is already provided in
>> its input, which means we could in theory "simply" decrease the amount of
>> the corresponding output to set the fees to any desired value. However,
>> we can't do this safely because it doesn't work well with the revocation
>> mechanism, unless we find fancy new sighash flags to add to bitcoin.
>> See [2] for a longer rant on this issue.
>>
>> A very low tech and unsatisfying solution exists, which is what I'm
>> proposing today: each node can simply sign multiple versions of the
>> HTLC transactions at various feerates, and at broadcast time if you're
>> lucky you'll have a pre-signed transaction that approximately matches
>> the feerate you want, so you don't need to add inputs from your fee
>> bumping reserve. This reduces the requirements on your on-chain wallet
>> and simplifies transaction management logic. I believe that it's a
>> pragmatic approach, even though not very elegant, to increase funds
>> safety for existing node operators and wallets. I opened a spec PR
>> that is currently chasing concept ACKs before I refine it [3].
>>
>> Please let me know what you think, and if this is something that you
>> would like your implementation to provide.
>>
>> Thanks,
>> Bastien
>>
>> [1] https://github.com/lightning/bolts/pull/688
>> [2] https://github.com/lightning/bolts/issues/845
>> [3] https://github.com/lightning/bolts/pull/1036
>> _______________________________________________
>> Lightning-dev mailing list
>> Lightning-dev at lists.linuxfoundation.org
>> https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20221107/890d4429/attachment.html>