Hi Dave,
Apologies for the late answer, I was hiking in nature over the past few days.
> Before I address your full point, I think there are two separate things
> we want to reason about when considering a proposal like TRUC:
>
> - How does it affect operators of full nodes, including miners and
> volunteer relay node operators?
>
> - How does it affect existing and future protocol users?
>
> By "easy to reason about", I'm mainly referring to how TRUC will affect
> operators of full nodes. IMO, it's critical to get that part right. In
> comparing TRUC to RBFR, it seems to me that it's much easier to reason
> about TRUC's effect on relay behavior and mining profitability.
I think it's a correct categorization, with the observation that it can be more
interesting to dissociate miners from volunteer relay node operators in the analysis
of a proposal like TRUC. Miners have the ability to discretely mine non-standard
transactions in their block template, contrary of relay nodes. This observation
matters practically e.g w.r.t dust HTLC exposure where miners have an edge to
launch that type of attacks.
> When it comes to reasoning about pinning attacks against LN, this is
> almost fundamentally difficult owing to the difficulty of reasoning
> about any complex state protocol, especially one that interacts with
> multiple layers of multiple other protocol (e.g., TCP/IP, Bitcoin P2P,
> Bitcoin consensus). Whether we're talking about CPFP, CPFP-CO, opt-in
> RBF, full-RBF, pure-RBFR, one-shot RBFR, APO, CTV, CAT, TRUC, or
> anything else, reasoning about the full implications of a change for LN
> users will be difficult.
I don't deny it, with the addition that you have to reason on how the LN
game-theory incentives can play out, in a system where all the balances
are denominated in satoshis, a scarce ressource under the max money consensus
limit. And I'll keep the conversation simple, as there is always the risk
when you're designing second-layers protocol extensions to have backfire
coupling effects on the base-layer (-- one of the main technical reason
we never actually rolled out forward the proof-of-UTXO ownership designed
with naumenkogs as a channel jamming mitigation is the base-layer spam
risks introduced to bypass it).
> IMO, when Bitcoin Core developers ship an opt-in feature like BIP431
> TRUC, it is not their responsibility to ensure that it is perfectly safe
> for downstream projects. That onus falls on the downstream developers
> (e.g., LN devs). Of course, Bitcoin Core devs want to produce useful
> tools and that incentivizes them to produce actual safety improvements;
> however, it's unreasonable IMO to expect Bitcoin Core devs to understand
> a downstream protocol as well as the devs who work directly on that
> protocol.
This is where we have a strong divergence, with all my appreciation of your viewpoint.
In my opinion this shall be the responsibility of the Bitcoin Core developers
to ensure there is a reasonable safety of the design and implemented mechanism
for downstream projects.
Experience of the last years, most notably the half of dozen of security weakness
loss of funds found in the design or implementation of anchor outputs (the lack of
carve out support at first, the revocation escape, the new pinning vector due to
legacy merging of second-stage transactions, the parsing error of core lightning /
lnd...) can only point out to seasoned technical observers that weakness arises because
of the poor understanding of protocols operational inter-dependency.
That practical bitcoin experience is matching some observations documented by the IETF
in decades of design and development of the TCP / IP stack (RFC 3439) [0]. Under the coupling
principle, that as things gets larger, they often exhibit increased inter-dependence between
components, and with unforseen feature interaction. In the bitcoin space a good incarnation
is all the bip125 rule 3 based economical pinnings, that I don't believe were clearly expected
by their bip authors.
[0]
https://www.rfc-editor.org/rfc/rfc3439Obviously, there is a sense of proportion to guard and that all Bitcoin Core devs
shall understand downstream protocols as well as the devs who work directly on that
protocol does not appear realistic, given the wider variety of other subsystems
such as builds, graphic interface or p2p block-relay protocol.
_However_, I strongly believe that Bitcoin Core devs working in the subsystem
interfacing with downstream protocols such as the mempool or the transaction-relay
protocol should have an understood as good as the downstream devs of said protocol
inner workings. Otherwise, by designing, implementing and deploying weak proposals
such as TRUC in its earlier versions they might cause more harms than good, on the
_long term_.
One cannot said there was technical consensus with the merge of TRUC, in the sense
of lack of standing grounded objections, be it by the RBFR author, or myself directly
on the PR / issues implementing this design in Bitcoin Core.
> For something like imbued TRUC, it probably shouldn't be used to replace
> an existing mechanism that downstream devs depend on (see subsequent
> arguments) unless the downstream devs agree (or there's another very
> compelling reason). Again, the onus falls on the downstream developers
> to audit the mechanism's safety because they're the ones with
> theoretical and operational experience using the downstream protocol.
One should not forget that downstream protocol devs and contributors e.g for lightning
are mostly working for commercial companies, with for some on short business timelines.
This is very likely to induce them to pick up an expedient mechanism, without fully
auditing it, more than jeopardizing the end-users funds safety (and the crypto space
at large does not miss spectacular vulnerabilities exploitation).
Sadly, one cannot expect that Bitcoin Core devs contributors to be immune of short-term
external factors in the design of better mempool mechanism as in 2020 while I was advocating
to build a better understanding of cross-layers security among contributors [1]. Yet,
at the very same time the current author of TRUC and bip331 was doing a round of the
medias to "sell" the idea and correspondingly attract open-source funding before there
was even the lineaments of a technical consensus among contributors to the Bitcoin Core project,
or what you call the downstream devs like lightning [2].
[1]
https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-October/002856.html[2]
https://bitcoinmagazine.com/technical/gloria-zhao-and-brink-are-set-to-give-bitcoin-mempools-an-upgrade(It's not like there has been a precedent in bitcoin development with the extension
block bip idea from joseph poon...which was proposed in 2017 in a fashion less than usual
w.r.t traditional communication channels...)
So yes, I think there should be a cultural change in terms of design and deployment
of p2p or mempool policy mechanisms supporting downstream protocols. In my opinion,
which is backed by my first code review of the imbuance mechanism, current development
process is still on the same pace, heading us in nurturing more cross-layer vectors
of attacks like pinning due to complex misinterfacing or mempoolfullrbf default-like
difficult campaigns of deprecation.
> If you or anoyone think TRUC as an alternative to the CPFP as a
> transsction pinning mitigation as argued in its merged BIP is easy to
> reason on, thanks to communicate your lightning node pubkey, with TRUC
> patch applied and a GPG-signed message authorizing me to demonstrate
> the security properties of this solutions have not been submitted to a
> fully contradictory evaluation.
> How would that work? AFAIK, there's no LN software using TRUC, very few
> relay nodes are using it (since it isn't yet enabled by default in a
> release version), and no miners are using it (again, since it hasn't
> been released). I'm willing to put money at stake to settle a
> disagreement that can't be settled with words, but I want to at least
> learn something from the process.
Thank you for the offer of setting up a demo infrastructure for pinning attacks experiment.
I'll describe more what is the minimal setup needed in another public email thread
or on delving bitcoin. Less than the funds in the channel, it's interesting to have
a full vanilla configuration on mainnet to avoid running in the myriad of cases with
policy standardss and the mempool congestion roallcoaster on whatever is the testnet /
signet of the day. I can even put the satosis for funding the channnels if it's really
needed.
It's correct that TRUC is not implemented in LN in where commitments transactions
are nVersion field updated to be pre-signed with TRUC semantics... I can always
write a patch in C or rust to have test code ? Though here I would play both the
attacker and defender role in the experiment. At least, I think it would be worthwile
on its own to test current bip125 rule 3-based economic pinnings, without TRUC usage.
The assumption is correct that Mallory makes a prediction on a level of
mempool congestion for a target feerate group, and this is a factor or
success or not of the attack.
It should be noted, there is no need to revoke the state or not in this
pinning, one can use the non-revoked consensus valid transaction, I think
this is the main difference with my scenario where non-revoked transactions
are used to do the "staggering" package (i.e the one at 60,000 sat in your
example), before to be "unstagged" by the same absolute fee, higher feerate,
penalty-paying package.
The parallelization can allow the attacker to not pay the cost, there is
no necessity that it is happening on parallel channels, as one can double-spend
from the CPFP of a "batching transaction, whatever else it is doing.
> Given the first point and the last point, I'm not sure how viable the
> attack is (but, as I said, I'm not sure I understand it). Estimating or
> manipulating feerates correctly for over 144 blocks in a row sounds
> difficult. Counterparties being able to deprive Mallory of profit seems
> like a major weakness.
On the first point, if I'm understanding correctly it's about predicting
mempool congestion as a factor of success of the attack. It's not a perfect
art though it's quite practical for an attacker as it is what mempool fee
estimation algorithms are all about.
On the last point, i.e the HTLC-Failure transaction paying the full value
to the fees, this HTLC-Failure confirmation should happen only after the
double-spend of the inbound HTLC by a puppet of Mallory. Until this on-chain
confirmation of the malicious inbound HTLC-failure, the Alice's outbound
HTLC-failure is blocked by the pinning.
Note, this is _not_ a replacement cycling attack, as it's all relying on the
Mallory's package being on an absolute fee / feerate too high to be replaced
by a Alice's package.
I understand it's hard to understand, and it sounds your attack layout could
benefit from adding lightning topology on the left / right side of Alice as
the attack victim. Note, how mempool congestion could play as a pinning vector
was slightly surveyed in the discussion of package relay design in 2020, though
no more fleshed-out write-up or blog post has been made available since then until
my comment on the Bitcoin Core PR, to the best of my knowledge [4].
[4]
https://github.com/bitcoin/bitcoin/issues/14895#issuecomment-665907792
> Looking at other proposed improvements: one-shot RBFR with its
> requirement that fee bumps enter the top portion of the mempool may
> avoid this type of pinning; ideas for expanded versions of TRUC that
> also require entering the top portion of the mempool may also avoid this
> type of pinning, e.g. "TRUC v3.0.5".[2].
I have not yet analyzed one-shot RBFR in more detailed, though I believe
a better long-term fix is actually _not_ to entangle the mempool states with
transaction-relay propagation rules. A full-node mempoool is a stateful
cache with public write allowed.
> If it looked like RBFR was going to be widely deployed, I think its
> effect on LN would definitely warrant more research.
If mempool acceptance was more modular in Bitcoin Core, we could have
more fine-grained transaction acceptance policy module embedded in
the `AcceptToMemoryPool` flow and easier to experiment the effects of
alternative policy like RBFR on LN.
> You described several attacks against anchor outputs using CPFP-CO, some
> of which sound quite plausible to me, but none of them is certain to
> succeed in any particular instance. By comparison, disabling CPFP-CO
> would leave all users of anchor outputs immediately vulnerable to the
> original pinning attack that has an expected ~100% success rate and
> barely any cost if executed against multiple channels simultaneously.
>
> Given that, it makes no sense to disable CPFP-CO until a successor is
> available.
In a world where revoked lightning transactions are still consensus-valid
and where any of them can be used to blind the lightning node of the correct
CPFP to proceed with, the carve-out is ineffective.
I'll let you indicate me where in the bolt spec it is indicated how lightning
software should implement correctly CPFP of the carve-out, as it is implemented
and deployed in Bitcoin Core since circa 2019.
I won't say the carve-out mechanism has been "fast" shipped in 2019 and that
its authors might really not know how lightnning was working at the time.
However, I believe there has never been a bip or other document informing how it
should be used by downtream protocols.
> Thank you for your opinion. I too think TRUC is a good solution until
> we find something better, and any significant improvements may indeed
> require consensus changes.
Thank too for your opinion. I think TRUC is an acceptable temporary solution
to minimize lightning pinning surface, however I'm still worried on the long-term
it can have undesirable side-effect, in a world where miners are running "heretic"
transaction acceptance policy.
And it's making a false security guarantee for lightning nodes, as uniform policy
is not a network reality, and an associated full-node could be paired with peers
not respecting TRUC semantics -- I know I've advocated uniform policy w.r.t package relay
to improve lightning safety in the past, though after finding vulnerability vectors arising
from a policy rule like opt-in RBF and asymmetrically affecting use-cases (0conf vs LN), I'm
far more skeptical in grounding downstream protocols safety on mechanism like TRUC.
Best,
Antoine
ots hash: 42407994c5e58123bf2535ba420517f83b95977052b4bde4ff9e115b91e2b598