You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As suggested during the IRC meeting last week (logs), this issue is for discussing recent progress on Erlay, evaluating its trade-offs and goals, and ultimately deciding whether it's worth continuing to pursue.
The current project tracking issue is #30249, though some of the performance research results shown there may be outdated. We can gather updated data here and discuss.
Couple questions on my mind:
What does the bandwidth/latency trade-off look like as we scale the number of connections?
Do the benefits outweigh the added code complexity?
Of course, discussion isn't limited to the above. Feel free to bring up any other points that come to mind.
I'd like to give a refresher and overview of Erlay, and explain some of the details of the experimentation and current approach. I also have a few questions/points that I'd like to discuss with people in the project.
Overview
Erlay is an alternative method of announcing transactions between peers in the Bitcoin P2P network. Erlay’s main goal is to reduce bandwidth utilization when propagating transaction data by minimizing the amount of redundant inventory messages (INV) exchanged between peers.
In our current transaction relaying approach (we'll be calling txflood or fanout from now on), every transaction is announced on every transaction relaying link in the peer-to-peer network at least once. That is, for each transaction relaying connection in the network, each side of the connection will either send or receive an INV message containing the given transaction. Most of these announcements (n-1/n) are actually redundant, but it is impossible for the announcer to know until the announcement has been sent.
Erlay tries to solve this issue by using set reconciliation to work out the transaction differences between two nodes connected to each other instead of just announcing all transactions through all links. To do so, nodes keep a set of transactions to be reconciled (or reconciliation set) between each of their Erlay-enabled peers, and reconciliation is performed at regular intervals. Once it is time to reconcile, peers exchange sketches of their reconciliation sets, which can be used to optimally compute the symmetrical difference between their reconciliation sets and, therefore, identify which transactions need to be sent by each end of the connection.
Erlay works optimally (sketches are smaller and sketch differences are cheaper to compute) when the differences between sets are small. This means that, even if all peers of a given node are Erlay-enabled, some transactions will still be exchanged using fanout. Finally, as we will expand on later on, fanout is more efficient and considerably faster than set reconciliation provided the receiving node does not know about the transaction being announced.
Fanout: The current approach
Before jumping into Erlay, its important to understand how fanout works in Core, so we can reason about the proposed changes and tradeoffs.
Transactions are exchanged between network peers using a 3-step protocol (INV/GETDATA/TX). The first round-trip of this protocol (INV/GETDATA) can be seen as the announcement/request phase, here is where both sides of the connection are made aware of what the other side knows. The last half-round trip (TX) is where the actual transaction is exchanged, if necessary. Given transactions are significantly bigger than transaction ids, the INV/GETDATA part of the protocol is used to minimize the amount of potentially redundant information exchanged between peers. If I don't know if you know something, I'd better make sure first before dumping a lot of data on you. Hence, if the announcement receiver knows about the target transaction, we waste a minimal amount of bandwidth, and if not, we add a minimal amount of overhead to sending the transaction.
Transactions are announced between peers at random intervals following a Poisson process. The expected delay between announcements depends on the type of connection: outbounds have an independent clock per connection with an expected value of 2 seconds, whereas inbounds share a timer with an expected value of 5 seconds. Transactions are queued to be announced until the timer goes off, and then announced using as many inventory messages as needed to clear the queue (each INV message can hold up to 50.000 entries IIRC). These timers are in place to obfuscate when a node learns about a transaction, in order to make it harder for a global network observer to pinpoint the transaction origin.
When a node learns about a new transaction via an inventory message, it may request it back from the announcer. Announcements are requested back in order of arrival, prioritizing outbound peers. If a peer takes too long to respond to a request, we may ask the next peer and so on. Inbound peers are de-prioritized here, by giving them a 2-second delay before requesting. This is to prevent them from stalling us (e.g., sending multiple announcements of the same transaction from different connections to delay us from learning the announced transaction).
Last but not least, when a transaction is being purposely delayed (in the to_be_announced queue), a node will pretend not to know about it, so it won’t reply to GETDATA messages requesting it. This is to prevent probing.
Pros: fast (artificially slower for privacy/DoS protection purposes)
Cons: each transaction is announced at least once per link (too redundant)
Erlay: The second take
Erlay is not a drop-in replacement for fanout, but a protocol that works alongside it. This is obvious for backwards compatibility reasons: nodes are not forced to implement or adopt the change, but it’s not the only reason why. Set reconciliation is really good at fixing small differences between sets (both fast and efficient), but it becomes way less optimal when the differences in the sets to reconcile are big: sketches become big (they grow with the size of the diffs they can compute), and the diffs are expensive to compute. This is why set reconciliation works best alongside fanout, and why our approach to implement Erlay is as a hybrid between both.
Once this becomes clear, the main question to answer when implementing Erlay is: how we partition peers between fanout and reconciliation, and how big is the split? This is the question that has led most of the experimentation in the project and that most of the simulations have tried to answer. To answer this question, we need to understand the properties of each group:
Fanout peers are good at propagating the transaction fast, but too much use of them leads to redundant announcements
Reconciliation peers are good at fixing small differences between peers, but they are, inherently, slower at propagating transactions.
The reason why reconciliation is slower lies in how transaction announcement is implemented in Core. When a transaction is propagated using set reconciliation, we need to go over an additional 1.5 round-trips (REQRECON/SKETCH/RECONDIFF) to learn if the target peer knows about a certain transaction AND THEN, if it doesn’t, default to INV/GETDATA/TX to send it. Therefore, 3 round-trips in total. This may seem a bit counter intuitive, why can we not just send the transaction straightaway once we learn the peer doesn’t have it? Because another peer could have announced the transaction before us, and the target peer may already have selected them for download.
In order to answer this question, I built a discrete-time network event simulator for Bitcoin (you can find it here) so I could quickly iterate over different configurations in significantly big networks.
Experimentation and findings
The initial approach was to simply answer the following question: how small can we keep fanout so that network latency remains similar while maximizing the bandwidth savings of set reconciliation? This proved tricky right out of the bat: set reconciliation is much slower than I originally imagined, and deciding what’s acceptable in terms of latency is hard to assess. As a matter of example, here are some simulation results with no optimizations:
This shows the difference between doing full reconciliation (no fanout involved), doing minimal reconciliation (using similar parameters defined as “best” in the previous Erlay attempt, and full fanout (the current state of things). It becomes pretty clear that the impact on latency is more than significant when no optimizations are being applied, but it also raises the question: What is acceptable in terms of latency and at what cost?
One of the first attempts to reduce latency while maximizing our bandwidth savings was to reduce the previously mentioned expected values for the peer-announcement Poisson process sampling. Halving those artificially reduces latency with almost no effect on bandwidth (if any). This was the approach in the original Erlay implementation, but I never felt too comfortable with it. There is little documentation (if any) of why the broadcast intervals were picked as {5s, 2s}, and if that’s the route we want to take, I think it comes from a well-reasoned discussion.
Fine-tuning the approach
There have been several experiments and theories being tested to try to optimize the aforementioned approach to make it more latency-efficient while preserving the bandwidth savings. For an extended and more detailed explanation of some of these, I’d recommend checking the series I wrote on Delving. Here, I’ll be highlighting the two optimizations that have shown to work in simulation.
Reconcile on trickle
One of the main reasons why Erlay is slow has to do with when data is made available to our peers. As we’ve mentioned earlier, this happens when we trickle for them (their timer has gone off, so we will try to send them whatever we have available). However, adding reconciliation on top of this means that now both need to synchronize; otherwise, if data is being purposely delayed for a peer when they request reconciliation, they will have to wait until the next reconciliation cycle to get it (FYI, this is once every 8 seconds per outbound peer at the moment).
A solution for this problem is not to reply to reconciliation requests straightaway. Instead, the request can be recorded, and replied to when we trickle for that peer, ensuring that they get all transactions we have received up to that point. Here are the simulation results using the same network as before, but applying this optimization:
Recon on trickle
Full recon
Erlay 1 (out), 10%(ins)
Full fanout
T-90%
22.339193s
16.797455s
8.654676s
T-100%
29.805967s
23.903776s
14.878592s
data-volume (reachable)
713.03534 messages (4071.1865 bytes)
562.6937 messages (4548.8276 bytes)
119.527855 messages (6121.74 bytes)
data-volume (unreachable)
59.583134 messages (350.2714 bytes)
47.12237 messages (395.96457 bytes)
10.085797 messages (524.41187 bytes)
INV-based fanout
The second optimization worth mentioning has to do with how we pick nodes for fanout and reconciliation. So far, nodes have been picked as a static split. We select some for reconciliation and some for fanout, making the latter big enough so a big chunk of the network can be reached fast, but not big enough so it starts being redundant, and leave the rest to reconciliation. The specific numbers here come from simulating different partitions and seeing what seems to perform better in random networks.
However, we can do better than this. In an ideal world, if we knew how long the transaction has been propagating and what fraction of the network it has reached, we could use that to turn our fanout/reconciliation up or down. Unfortunately, we don’t have that information, but we know one thing: fanout is faster than reconciliation, therefore if we receive a transaction via fanout, we are likely to be amongst the first peers to receive it, whereas if we receive it via reconciliation, it is likely that we are further down the line.
We can use this to tweak our fanout rates:
When receiving a transaction via fanout, keep fanning out until we reach a certain threshold, and reconcile with the rest of your peers
If a transaction is received via reconciliation, see it as being late and keep reconciling with the rest of your peers
This approach applies to outbound connections only, given that anything learnt from an inbound connection is easy to fake, so it’s better not to be trusted. Applying this optimization on top of the previous one, and simulating for the same network, we obtain:
on-trickle + inv-based-fanout
Full recon
Erlay 1 (out), 10%(ins)
Full fanout
T-90%
21.70218s
14.427859s
8.654676s
T-100%
28.977697s
21.619083s
14.878592s
data-volume (reachable)
695.2272 messages (4085.9502 bytes)
493.16547 messages (4593.411 bytes)
119.527855 messages (6121.74 bytes)
data-volume (unreachable)
58.117065 messages (349.74905 bytes)
41.418915 messages (401.29572 bytes)
10.085797 messages (524.41187 bytes)
Conclusions and questions
With the two presented optimizations, we are able to achieve savings of ~25% in bandwidth for the cost of ~ 67% more latency. Some of these combinations have also been tested on smaller networks with actual Bitcoin nodes implementing Erlay (using Warnet) and the obtained results have been similar. However, things are far harder (and more expensive) to test like that.
I personally think the design space for improvements and optimizations may still be substantial. However, I also think I’d be good to define what is acceptable in terms of bandwidth and latency tradeoffs, and what things are open to change:
Are the expected values for the poisson processes set to stone? Is it OK to reduce them? How can we reason about the implications?
What are acceptable transaction propagation times? Are we OK with increasing them at all? If so, by how much?
What would be acceptable bandwidth savings given the additional complexity brought by this change?
I’ve tried to give as much context and information as possible while keeping this digestible. I’m happy to extend on any of the directions others are curious about, explain things that may have fallen of and provide additional data.
What does the bandwidth/latency trade-off look like as we scale the number of connections?
I'm going to reserve this spot to extend on the tradeoffs when the number of connections is increased, since I did not touch that on the original post, but it's one of the main goals of the project (the write-up was already pretty lengthy). I may need to re-run some of the simulations for it.
Erlay’s main goal is to reduce bandwidth utilization when propagating transaction data by minimizing the amount of redundant inventory messages (INV) exchanged between peers.
I'm not excited about this amount of research and code complexity for having bandwidth reduction as a goal. Bandwidth reduction by itself is nice, and obviously it is something we should improve where possible, but I don't see the current bandwidth consumption as problematic for users who wish to run without blocksonly? Is it possible that, with this project going on for so long and with a couple of reboots, we kinda lost track of why we were doing this in the first place?
It's been a while since I initially read the Erlay paper, but IIRC the reason I found this interesting at the time was that Erlay allows having more connections with acceptable bandwidth trade-offs, improving eclipse attack resistance. Even if it seems we currently already have reasonable eclipse attack resistance, this security benefit to me seems like much more worthy goal of investigating and - if Erlay turns out to be a worthwhile improvement - pursuing? I've not been following this project closely, so apologies if this has been covered already, I'm just not seeing it mentioned in the current write-up.
To add to Stephan's comment: simpler proposals seem to achieve (for the most part at least) the same goal of increased network security: #28463, #28462 and it's not clear to me that the additional benefits that erlay offers over these (increased full-outbound relay connections instead of block-relay-only & bandwidth reduction) are worth the complexity (minisketch, reconciliation module, extra protocol messages).
I think there are two conflicting goals being discussed here. If what we want to achieve is simply increase the network connectivity using any connection type, then sure, blocksonly are always going to be a cheaper and simpler solution. This can make Eclipse harder and will have a way smaller code complexity.
If, on the other hand, we want to be able to scale the network without having to scale it's backbone of reachable nodes (or at least not linearly), then allowing nodes to accept more tx-relaying connections with little to no impact to their bandwidth is important, and what Erlay is trying to achieve.
I think it's important to agree on what the goal is, because that will affect the complexity of the solution.
@stickies-v I'll expand on the network scaling bit on my second comment. I've parked it there for that reason.
As mentioned in IRC, one reason to increase connectivity with Erlay is to increase resistance specifically against transaction censorship (as opposed to only resistance against eclipse attacks).
With the recent attempts to censor valid fee-paying transactions deemed undesirable for ideological reasons, not forwarding them to peers, this has become more relevant than it was in the past.
However, even with the current connectivity, the threshold is quite low (a minority of ~10% of random reachable nodes should suffice to get transactions to miners) - plus there is always the possibility of preferential peering so I'm not sure how important it is to lower that threshold even more.
Let me take a step back, because I think the results don't paint the full picture.
The primary goal is increasing partition-resistance of the network. In what follows I'm going to assume 16 connections per node is the desired number, but this is just for presentation purposes. I'll get back to the number later.
We could add 8 more outbound extra full connections. But that also means simultaneously increasing the number of (default) permitted inbound connections for listening peers (say from 125 to 250), to not make the network run out of connection slots or making it easy for an attacker with tons of inbound slots to grab a large share of them. Unfortunately, with the current transaction relay design, every transaction INV announcement (36 bytes) goes over every connection at least once (and sometimes twice), so it scales with $\mathcal{O}(\mathrm{txrate} \times \mathrm{peers})$. The more tx-carrying connections a node has (including inbound), the larger the percentage of their bandwidth is taken by INVs. And this is in a way accomplishing too much, because in addition to better partition resistance, it'll also reduce the tail latency for transactions to reach nodes in the network - something that isn't actually desired.
It's possible instead just add 8 extra block-only connections. These obviously do not cause a bandwidth increase due to INVs, and additionally impose less memory and CPU usage on the node. However, they also only improve block-relay partition resistance. This means that an eclipse attack on just the tx-carrying connections might be successful still, which would result in bad transaction propagation, potentially bad block reconstruction/propagation if severe, and in extreme cases, transaction censorship.
What if there was something in between the two, that has a lower bandwidth impact than full connections, improves tx-partition-resistance unlike block-only connections, but didn't care about improving tail latency? As a thought experiment, add 8 extra reconciliation-connections. These are not full Erlay as proposed; they're an entirely separate connection class, and exclusively use reconciliation for transaction relay on a slower time schedule than normal transaction propagation (+ normal block/addr relay). These connections should have very low bandwidth usage in non-adversarial settings because the large majority of transaction relay is done by the normal full connections, and reconciliation bandwidth scales with the amount of transactions being reconciled. They don't worse propagation latency at all, because these 8 connections are just added on top of the existing 8 full ones. However, in adversarial settings, rather than transactions not propagating at all, they cause reconciliation to take over when normal relay fails. This will happen at the cost of extra latency as it's a second-stage fallback mechanism, but it's better than not propagating at all.
So where we are at this point is that reconciliation-based connections are an alternative to (some of the) extra block-only connections that also improves tx-partition-resistance, but without the $\mathcal{O}(\mathrm(peers))$ factor in bandwidth effect that full connections have.
The full Erlay idea is to not have these reconciliation connections be separate from the normal full outbound connections, but have both mechanisms (flooding and reconciliation) inside all the normal connections, and intelligently pick between them: use flooding when you guess a peer is unlikely to have already heard of the transaction, and use reconciliation otherwise. This is where I think the majority of the conceptual complexity of Erlay comes in, as it involves intricate relay policy decisions to make these guesses well, and it's also where most of @sr-gi's efforts have been in the past year, because it just feels that with good decisions, you should be able to do better than two entirely separate connection classes.
Back to the number-of-connection question. There is no reason to assume that today, 8 connections is the right number for both tx propagation delay and tx-partition resistance. It's a limitation of the existing technology that forces both numbers to be the same. If we didn't care about partition resistance, would we consider reducing the number of outbound connections to reduce bandwidth (especially for incoming nodes with ~100 connections)? It's not unreasonable to me we might conclude that 4 connections is actually sufficient for transaction propagation purposes; this may be especially true with BIP-153 block template sharing. And if so, we could consider today replacing 4 of the normal outbound connections with Erlay (or similar) connections. It'd worsen propagation delay, but perhaps in an acceptable way, and not worsen partition resistance. Of course, I'm not suggesting actually doing that, but as a demonstration that what reconciliation offers is untangling tx-propagation and tx-partition-resistance from connection-count decisions.
However, with the effort to integrate flooding and reconciliation into one, and thus considering the possibility of replacing (all) normal connections with mixed flood-reconciliation connections, we maybe lost sight of the fact that the goal is increasing partition resistance (without unnecessary bandwidth and propagation-delay improvements), rather than bandwidth reduction per se.
Maybe it's worth reevaluating the need for combining the two. If we already had (say) 8 extra block-only connections, and it was proposed to replace some of those with reconciliation-based ones, I think it would look like a fairly interesting picture: a slight bandwidth increase, extra memory/CPU for the nodes that choose to participate, but we upgrade the partition-resistance offered by them from block-only to also cover transactions. And maybe the complexity of trying to integrate flooding and reconciliation isn't worth it here, as it's an improvement even without it.
Is it possible that, with this project going on for so long and with a couple of reboots, we kinda lost track of why we were doing this in the first place?
However, with the effort to integrate flooding and reconciliation into one, and thus considering the possibility of replacing (all) normal connections with mixed flood-reconciliation connections, we maybe lost sight of the fact that the goal is increasing partition resistance (without unnecessary bandwidth and propagation-delay improvements), rather than bandwidth reduction per se.
My understanding of why the project didn't move along in the previous iteration was that the latency/bandwidth tradeoff was not worth the change. I may have gotten that wrong, and missed the forest for the trees while retaking this, putting too much effort into optimizing the bandwidth/latency improvements instead of focusing on the partition resistance.
Maybe it's worth reevaluating the need for combining the two. If we already had (say) 8 extra block-only connections, and it was proposed to replace some of those with reconciliation-based ones, I think it would look like a fairly interesting picture: a slight bandwidth increase, extra memory/CPU for the nodes that choose to participate, but we upgrade the partition-resistance offered by them from block-only to also cover transactions. And maybe the complexity of trying to integrate flooding and reconciliation isn't worth it here, as it's an improvement even without it.
I agree that this would be an interesting thing to try out, and it would significantly simplify the design of the approach. This would still require the added complexity of minisketch, the set reconciliation module, and the extra network messages, but the design would be much cleaner. For those concerned about the additional complexity, would this be an acceptable tradeoff (@marcofleon, @dergoegge, @stickies-v )?
I'd like to understand the current state of partition resistance and what concrete improvement Erlay would bring (and what metric best captures this). Since the papers cited by Erlay (regarding partitioning attacks) have been published, we've deployed several mitigations (e.g. anchors, asmap, v2 transport, etc.), and the theoretical attacks in the literature often rely on simplifying assumptions that seem to understate the engineering/operational cost to an attacker. Given all that, how much of the gap has already been closed, and how much does Erlay still improve the situation?
If we'd just be doing this to improve partition resistance (because increased connectivity is obviously better in that regard) while it's not clear that improvements are needed, then I'm not sure if I'd make this a priority myself. Given a project of this size, we'd need some momentum and at least a couple dedicated reviewers, otherwise we'll still be discussing this in 5 years.
Still digesting and reading some more, but clarifying Erlay's ultimate goal and walking through the different approaches has already been helpful to me. Thanks sipa.
If, on the other hand, we want to be able to scale the network without having to scale it's backbone of reachable nodes
Interesting, I hadn't thought of this before. This would entail enabling more inbound slots without increasing outbound connections as much. So a listening node would be able to support more than the current ~11 fully-connected nodes and not take a meaningful bandwidth hit.
For those concerned about the additional complexity, would this be an acceptable tradeoff
If the simpler approach, which iiuc could look something like 8 full, 4 reconciliation, and 4 blocks-only, improves the tx relay network's partition resistance without significant drawbacks, then I would prefer that over Erlay. I'm interested in seeing what that implementation would look like in comparison.
I'd still like to see the updated Erlay bandwidth and latency data with increased connection counts (no rush, just clarifying). However, unless there's a compelling reason to take on the extra complexity, I'd rather go with a simpler design that achieves a similar outcome.
Note: I'm not super involved with p2p, so my comments in this thread are a best-effort to contribute to the conversation moving forward, but shouldn't be taken for much more than that.
For those concerned about the additional complexity, would this be an acceptable tradeoff
I think it makes sense to reframe the tradeoff like this. Improving partition resistance (as per sipa's writing) and sustainably scaling the network (as per your writing) both are interesting goals to pursue. Evental project decisions can then be framed as how much we improve on those two domains, for a certain cost (such a code complexity, bandwidth, latency, ...). Having a measure of the current state of partition resistance and network scaling currently would be helpful too, if at all possible.
I generally prefer incremental, meaningful improvements. If separate reconciliation connections address the most important painpoints at minimal complexity, that absolutely seems like a good direction to focus on.
This would still require the added complexity of minisketch
Since minisketch is a separate library, I'm much less concerned about its complexity than I am about complexity in p2p code.
I'd like to understand the current state of partition resistance and what concrete improvement Erlay would bring (and what metric best captures this).
Having a measure of the current state of partition resistance and network scaling currently would be helpful too, if at all possible.
I'm happy to be corrected, but I do not think there is any metric that realistically captures what the current state of network partition resistance is, or that can quantify what would be good enough. Theoretically, we could compute how many /16 groups (or ASes for ASMap) would need to be controlled to have a certain likelihood of a node being eclipsed, but how realistic it is for an attacker capable of doing this to exist feels more speculative to me.
If we'd just be doing this to improve partition resistance (because increased connectivity is obviously better in that regard) while it's not clear that improvements are needed, then I'm not sure if I'd make this a priority myself.
That is fair, but it applies to any network proposal trying to improve partition resistance. I personally think that improving partition resistance is a good goal on its own, especially if it doesn't come with significant tradeoffs with bandwidth and latency.
Given a project of this size, we'd need some momentum and at least a couple dedicated reviewers, otherwise we'll still be discussing this in 5 years.
I agree with you there. I have no interest in pursuing this if there is no sufficient reviewer buy-in
FWIW, I like the idea of reconciliation-only connections -- in thinking about inv2send stuff which is now PRed as #34628 I've been worried about the distinction we make for the inbound vs outbound side of connections (ie, the side that made the connection will send txs at potentially 2.5x the rate the other side will), which will mess up reconciliation while that zone is being hit. Having a dedicated class of connection (or even just a mode switch like the high-bw vs low-bw compact block stuff) would avoid that -- once you decide to make it a reconciliation connection, just have both sides use the lower rate.
FWIW, I think bumping the number of blocks-only connections should be a high priority (and higher pri than erlay), but it keeps slipping off my radar.
FWIW, if you look at erlay as an anti-censorship addition to the network (ie, we're just using it to add connectivity, not replacing the existing INV connectivity with it), then I don't think latency matters very much. If you're getting your tx relayed in five minutes, when without erlay it would not have been relayed at all due to censorship, that's a win, even if uncensored txs take a fraction of that time.
As far as the stats go, I don't think 6-8 significant figures of precision is very realistic...
Are the expected values for the poisson processes set to stone? Is it OK to reduce them? How can we reason about the implications?
The random delays between INVs is to give a little privacy -- if you wait 8s between INVs and txs are coming in at 7tx/s, then you have an anonymity set of 56 txs where your peers can't discern the order in which they arrived. Because it's an exponential/poisson process, the 5s average will mean that 10% of the time it will be less than 0.52s between INVs, so the anonymity set may be 3.7 transactions or less. I think "90% of the time, the anonymity set will be at least ~4 transactions" is the right sort of implication to think about here.
One thing I've been thinking about with template sharing is if the ephemeral connections we make can be used for tx relay -- ie, we do an extra block relay connection every few minutes already, if we share a template on that, that gives us much broader top-of-mempool tx relay capacity than a set of static connections, at least if a there's a high-feerate tx that's getting censored by a majority of the network for an extended period. Maybe doing a one-off "txs from the last few minutes" reconciliation immediately on making a new "blocks-only" connection to a compatible peer would also be feasible and useful. (Or maybe not 🤷♂️)
FWIW, if you look at erlay as an anti-censorship addition to the network (ie, we're just using it to add connectivity, not replacing the existing INV connectivity with it), then I don't think latency matters very much. If you're getting your tx relayed in five minutes, when without erlay it would not have been relayed at all due to censorship, that's a win, even if uncensored txs take a fraction of that time.
In terms of latency requirements: For the operation of the network there is particular reason to get a transaction widely relayed before it would be rationally mined and the network frequently has backlog. Even for the secondary purpose of transaction notification, delays of many seconds should be fine-- consider that even knowing there has been a delay at that time scale means that you have another communication channel to know that the transaction exists, which could just as well be used to give you the transaction. :) For transactions that are being censored even fairly delayed propagation is probably fine (it just has to be fast enough to not make the delay into an exploitable attack against exchange protocols).
These sound like good reasons to move forward with a recon-only version of Erlay to me.
The random delays between INVs is to give a little privacy -- if you wait 8s between INVs and txs are coming in at 7tx/s, then you have an anonymity set of 56 txs where your peers can't discern the order in which they arrived. Because it's an exponential/poisson process, the 5s average will mean that 10% of the time it will be less than 0.52s between INVs, so the anonymity set may be 3.7 transactions or less. I think "90% of the time, the anonymity set will be at least ~4 transactions" is the right sort of implication to think about here.
Oh, this is really interesting. I never thought about this in terms of the anonymity set that it provides based on the expected transaction throughput. So if I got this right, reducing the expected values to {2s, 1s} would yield an "anonymity set of 4 transactions ~78% and ~61% of the times, respectively" which is much more undesirable.
I went ahead and implemented the reconciliation-only connections approach to my simulator and tested out how adding more of these connections would look like.
I have increased the reconciliation request interval from 8s to 30s (a node reconciles with all its recon peers on that frequency), as this connections as supposed to be used as a fallback.
For a single transaction on a network with 110000 nodes, 10000 reachable and 100000 unreachable:
Prop.time (90%)
Prop. time
Reachable data vol. (msgs)
Reachable data vol. (bytes)
Unreachable data vol. (msgs)
Unreachable data vol. (bytes)
Fanout (8 outbounds)
8.642229s
14.764164s
119.508965
6119.6494
10.087511
524.6146
Erlay (12 outbounds: 8 fanout + 4 recon)
8.787569s
14.84624s
279.88312
6277.475
23.455622
537.4601
Fanout (12 outbounds)
6.7492857s
10.919547s
167.86015
7878.1436
14.074832
666.373
Erlay (16 outbounds: 8 fanout + 8 recon)
8.868277s
14.771455s
433.42813
6395.9214
36.256325
547.4048
Fanout (16 outbounds)
6.0131226s
9.151769s
216.23032
9638.907
18.059944
807.8933
We can see how, as it was expected, adding more of these connections has little to no effect on both bandwidth and latency.
@sr-gi Nice results! I'm a bit confused how the 2nd and 4th line can have (slightly) worse propagation times than the 1st, because they have a strict superset of the connections/types. Is this just random noise, or reproducible?
I think it is random noise, from how building these more connected networks is interacting with the rng, sampling additional values, hence making the simulations slightly different. This would be similar to running on different (similar-size) networks.
I think your point is easier to see if the reconciliation request intervals are not changed, given that makes recon connection contribute more towards propagation. Here's an example:
Prop.time (90%)
Prop. time
Reachable data vol. (msgs)
Reachable data vol. (bytes)
Unreachable data vol. (msgs)
Unreachable data vol. (bytes)
Fanout (8 outbounds)
8.279599s
14.759387s
119.50586
6119.4
10.087538
524.6293
Erlay (12 outbounds: 8 fanout + 4 recon)
8.769198s
13.703742s
391.10562
6968.892
32.76539
594.965
Erlay (12 outbounds: 8 fanout + 8 recon)
8.654111s
12.892427s
641.49854
7831.426
53.659935
665.83075
Bear in mind the data volume here is higher because we are reconciling unnecessarily fast.
In any case, I'll take a closer look in case I missed something on the refactor, but I also wanted to cross test this on warnet after porting the changes to Core.
Having stats which show no wins for adding the erlay connections (even with minimal costs) is a bit disappointing. Is there a way we could measure resistance to partitioning/censorship attacks (since that's the underlying benefit we're aiming for with higher tx connectivity)?
Perhaps take the 8 and 8+4 cases and graph tx propagation time / reachability versus percentage of (listening/reachable?) nodes that refuse to relay a transaction?
Maybe a scenario like "10k honest reachable nodes, 100k honest unreachable nodes" versus "20k reachable nodes, 50% dishonest, 100k unreachable nodes, 20% honest" would be interesting? 100k honest unreachable nodes probably (a) makes relay really easy, and (b) perhaps isn't that realistic, with spy nodes and blocks-only nodes and spv nodes and whatever?
Reacted by Sergi Delgado, marcofleon and Antoine Poinsot
I've added some changes to the simulator to include sink nodes: nodes that receive the simulated transaction but do not propagated further. With that, I've run a simulation for the previous case (10K/100K all honest) and the newly proposed case (20K,50% honest/100K,20% honest). In both cases, I've added Fanout (12 outbounds) as a reference of what would it look like to just increase the number of connections to 12 regular full-relay outbounds.
100K/10K all honest
Prop.time (90%)
Prop. time
Reachable data vol. (msgs)
Reachable data vol. (bytes)
Unreachable data vol. (msgs)
Unreachable data vol. (bytes)
Nodes reached
Fanout (8 outbounds)
8.642229s
14.764164s
118.73791
6091.892
10.020533
522.20337
ALL
Erlay (12 outbounds: 8 fanout + 4 recon)
8.787569s
14.84624s
148.17012
6190.4263
12.470456
530.1072
ALL
Fanout (12 outbounds)
6.7492857s
10.919547s
162.90729
7699.8413
13.655588
651.2802
ALL
100K/20K 20%/50% honest
Prop.time (90%)
Prop. time
Reachable data vol. (msgs)
Reachable data vol. (bytes)
Unreachable data vol. (msgs)
Unreachable data vol. (bytes)
Nodes reached
Fanout (8 outbounds)
14.270811s
53.301083s
49.386112
2825.6216
6.88851
411.68457
119630/120000
Erlay (12 outbounds: 8 fanout + 4 recon)
14.881194s
59.68538s
177.39078
3446.92
25.443369
500.63757
119976/120000
Fanout (12 outbounds)
10.830016s
40.68568s
67.51259
3486.868
9.2867155
497.36087
119976/120000
These are the things that stand out the most to me:
Most of the network can be reached in the dishonest case (there are very few isolated nodes). In fact, even under higher percentages of dishonest nodes this remains the case (happy to provide more data if anyone is interested)
Propagation times for the Erlay case remain similar to the base fanout case (fanout-8), even in the dishonest setting1
Data volume of the increase fanout case with all honest nodes (first table, fanout-12) represents a significant increase over the base fanout and Erlay cases
Data volume for the increase fanout and Erlay are really similar in the dishonest setup (second table, erlay-12, fanout-12)
1 Notice how the fanout (8 conn) case reaches less nodes than the Erlay case (there are more isolated nodes in the former), hence why the propagation times are also slightly faster.
PS: if anyone is interested, code for the change can be found at sr-gi/hyperion#56
Hmm, if I'm reading that right, my suggestion was the opposite of that -- 100K unreachable with only 20% honest; 20K reachable with 50% honest. 50k honest unreachable nodes will still do a pretty good job of relaying amongst the honest reachable nodes -- 99% of them will be bridging at least 3 reachable nodes, so >86% will be bridging a couple of /honest/ reachable nodes. I think you want a scenario where the base fanout (8ob only) case has at least some honest reachable nodes not seeing the tx, otherwise the only thing you're testing is "how many honest unreachable nodes making every connection to a dishonest node/sink".
(Oh, if you're not modelling connection capacity limits, there's no point having unreachable sink nodes, btw -- the only way unreachable sink nodes have an impact is if they cause the honest listening nodes they connect to to stop accepting new honest connections. So you could perhaps drop it to 50k unreachable, 10k reachable honest, 10k reachable sink)
Sorry, my bad, I miswrote that. The table shows 100K (20% honest) / 20K (50% honest)
sim runs
> cargo run --release -- -n 100 --seed 1912350820576393175 -r 20000
2026-04-29T13:26:10.235Z INFO [hyper_lib::simulator] Using user provided rng seed: 1912350820576393175
2026-04-29T13:26:10.242Z INFO [hyper_lib::network] Creating nodes (120000: 20000 reachable, 100000 unreachable)
2026-04-29T13:26:10.242Z INFO [hyper_lib::network] Connecting unreachable nodes to reachable (8 outbounds per node)
2026-04-29T13:26:10.376Z INFO [hyper_lib::network] Connecting reachable nodes to reachable (8 outbounds per node)
2026-04-29T13:26:10.450Z INFO [hyper_lib::network] Created a total of 960000 links between nodes
2026-04-29T13:26:10.450Z INFO [hyper_lib::network] The network contains 50% sinks amongst the reachable nodes (10000 nodes)
2026-04-29T13:26:10.450Z INFO [hyper_lib::network] The network contains 80% sinks amongst the unreachable nodes (80000 nodes)
2026-04-29T13:26:10.488Z INFO [hyperion] The simulation will be run 100 times and results will be averaged
2026-04-29T13:27:05.900Z INFO [hyper_lib] Transaction reached 89.72% of nodes in the network in 14.270811s
2026-04-29T13:27:05.900Z INFO [hyper_lib] Transaction reached 99.69% (119630 nodes) in 53.301083s
2026-04-29T13:27:05.900Z INFO [hyper_lib] Reachable nodes data volume: 49.386112 messages (2825.6216 bytes) (avg)
2026-04-29T13:27:05.900Z INFO [hyper_lib] Unreachable nodes data volume: 6.88851 messages (411.68457 bytes) (avg)
> cargo run --release -- -n 100 --seed 1912350820576393175 -r 20000 --erlay
2026-04-29T13:28:46.683Z INFO [hyper_lib::simulator] Using user provided rng seed: 1912350820576393175
2026-04-29T13:28:46.691Z INFO [hyper_lib::network] Creating nodes (120000: 20000 reachable, 100000 unreachable)
2026-04-29T13:28:46.691Z INFO [hyper_lib::network] Connecting unreachable nodes to reachable (12 outbounds per node)
2026-04-29T13:28:46.897Z INFO [hyper_lib::network] Connecting reachable nodes to reachable (12 outbounds per node)
2026-04-29T13:28:46.989Z INFO [hyper_lib::network] Created a total of 1440000 links between nodes
2026-04-29T13:28:46.989Z INFO [hyper_lib::network] The network contains 50% sinks amongst the reachable nodes (10000 nodes)
2026-04-29T13:28:46.990Z INFO [hyper_lib::network] The network contains 80% sinks amongst the unreachable nodes (80000 nodes)
2026-04-29T13:28:47.045Z INFO [hyperion] The simulation will be run 100 times and results will be averaged
2026-04-29T13:32:59.081Z INFO [hyper_lib] Transaction reached 89.98% of nodes in the network in 14.881194s
2026-04-29T13:32:59.081Z INFO [hyper_lib] Transaction reached 99.98% (119976 nodes) in 59.68538s
2026-04-29T13:32:59.081Z INFO [hyper_lib] Reachable nodes data volume: 177.39078 messages (3446.92 bytes) (avg)
2026-04-29T13:32:59.081Z INFO [hyper_lib] Unreachable nodes data volume: 25.443369 messages (500.63757 bytes) (avg)
> cargo run --release -- -n 100 --seed 1912350820576393175 -r 20000 --outbounds 12
2026-04-29T13:34:59.545Z INFO [hyper_lib::simulator] Using user provided rng seed: 1912350820576393175
2026-04-29T13:34:59.553Z INFO [hyper_lib::network] Creating nodes (120000: 20000 reachable, 100000 unreachable)
2026-04-29T13:34:59.553Z INFO [hyper_lib::network] Connecting unreachable nodes to reachable (12 outbounds per node)
2026-04-29T13:34:59.783Z INFO [hyper_lib::network] Connecting reachable nodes to reachable (12 outbounds per node)
2026-04-29T13:34:59.889Z INFO [hyper_lib::network] Created a total of 1440000 links between nodes
2026-04-29T13:34:59.889Z INFO [hyper_lib::network] The network contains 50% sinks amongst the reachable nodes (10000 nodes)
2026-04-29T13:34:59.889Z INFO [hyper_lib::network] The network contains 80% sinks amongst the unreachable nodes (80000 nodes)
2026-04-29T13:34:59.951Z INFO [hyperion] The simulation will be run 100 times and results will be averaged
2026-04-29T13:36:44.114Z INFO [hyper_lib] Transaction reached 89.98% of nodes in the network in 10.830016s
2026-04-29T13:36:44.114Z INFO [hyper_lib] Transaction reached 99.98% (119976 nodes) in 40.68568s
2026-04-29T13:36:44.114Z INFO [hyper_lib] Reachable nodes data volume: 67.51259 messages (3486.868 bytes) (avg)
2026-04-29T13:36:44.114Z INFO [hyper_lib] Unreachable nodes data volume: 9.2867155 messages (497.36087 bytes) (avg)
I think you want a scenario where the base fanout (8ob only) case has at least some honest reachable nodes not seeing the tx, otherwise the only thing you're testing is "how many honest unreachable nodes making every connection to a dishonest node/sink".
Yeah, that makes sense. For a substantial number of nodes to be isolated, I may have to ramp up the amount of dishonest nodes even more. I have results for this setting with 100K (20% honest) / 20K (30% honest) and even there, more than 90% of the nodes receive the transaction in the base case (and over 95% on the 12 con cases). I did not track if those isolated nodes where reachable/unreachable, but that is an easy addition.
Is there any threshold of reachable node not seeing the transaction that you'd like to see? I can see what that would mean in terms of sink percentages
Is there any threshold of reachable node not seeing the transaction that you'd like to see? I can see what that would mean in terms of sink percentages
I guess my question is: "if there was a problem with tx relay on the network (eg, 5%, 10%, 20%, 50%, 90% of nodes not receiving a tx because of too many censoring nodes?), then (a) how much impact would erlay have at mitigating the problem (10% becomes 5% by the sounds of it?), (b) how realistic is it that we'll have that sort of problem?, and maybe (c) are there other, simpler, ways of addressing the problem?"
You could also have the problem be something more along the lines of "20 (mining/lightning) nodes which want to see transaction have had their view of the network badly corrupted, and aren't being connected to by honest nodes, and only have an artificially reduced chance of connecting to an honest node of x% per attempt" perhaps?
(My feeling is that a bunch of additional erlay tx relay connections would be a good thing, but if we're going to implement/maintain it, I think we should be able to explain why it's a good thing fairly concretely)
I create two of these experiments on warnet (h/t @pinheadmz for the quick patches that allowed easy network deployments beyond manual connections).
Experiment 1: how does creating extra connections (relay/recon) affect the bandwidth and latency of the network under normal conditions.
Experiment 2: how does creating extra connections (relay/recon) affect the bandwidth and latency of a node that has had their other connections captured
Experiment 1 aims to show what is the cost of having extra connections under normal circumstances, while Experiment 2 aims to show what is the cost under an attack.
Both experiments have been run over a randomly generate network with 100 nodes, 70 unreachable and 30 reachable. All nodes have 8 outbound-full-relay connections. The experiments are run in three arms, first, a baseline mimicking the current functionality (only 8 full-relay), then, one relay branch, adding 4 extra outbound-full-relay connections, and finally, a recon branch, adding 4 extra outbound-full-recon connections (same topology as full relay).
Experiment 1
For this experiment, we crated 50 transaction from different sources in the network and repeated the experiment 5 times (results are averaged). The code, network and results for the experiment can be found at: sr-gi/erlay-warnet@0d11255.
Making the network more tightly connected using fanout connections comes at a significant increase in redundant INV traffic (+43%). Latency is also significantly reduced (-33%).
Increasing the connectivity using reconciliation-only connections has a minimal affect on bandwidth (~2% increase, reconciliation overhead) and slightly increases latency (~6%, most likely noise).
I expected sketches to almost always success without extension, but about 18% of them needed an extension round. The estimations may need revisiting now that the reconciliation period is significantly higher (30s vs 8s in the previous approach).
Experiment 2
For this experiment, we created a network of 100 nodes, 91 honest (27 reachable), 8 blackholes, 1 victim. The victim has all its connections captured by blackholes. The experiment runs a baseline to confirm that the victim is isolated, where we expect no transactions or blocks received by it. After, the victim's neighborhood is extended by 4 nodes (full-outbound-relay in one arm, full-outbound-recon in the other). Both bandwidth and latency are measured in both cases. The code, network and results for the experiment can be found at: sr-gi/erlay-warnet@f944288
Baseline (8 full-relay connections per node, all blackholes)
transactions received : 0 / 20
time to receive all : never (timeout)
bytes received / msg : None
Full-relay (baseline +4 extra outbound-full-relay for the victim)
transactions received : 20 / 20
time to receive all : 2.4 s
bytes received / msg : inv 742
Full-recon (baseline +4 extra outbound-full-recon for the victim)
transactions received : 20 / 20
time to receive all : 18.7 s
bytes received / msg : inv 742, sketch 34
Conclusions
Both the relay and reconciliation arms of the experiments survived the experiment, as it was expected. Both deployments added a lifeline to the victim.
The is no relevant advantage on bandwidth in this situation. Given the victim is completely isolated, all transactions need to be sent over the extra connections. Same amount of INVs, plus a marginal sketch in the reconciliation case.
When it comes to latency, reconciliation is much slower than fanout, as it was also expected (2.4s vs 18.7). This is due to the high reconciliation period set for this approach (30s). In this case, I'd argue that slow propagation is better than no propagation.
All in all, I think this shows what we expected: eclipse protection is a function of the node connectivity. The more (diverse) peers a node has, the harder it is to eclipse it. Naively increasing the peer degree with full-outbound-relay connections comes with a high bandwidth price, specially under normal operation mode. On the other hand, full-outbound-recon connections are almost free to maintain, and while they are slower to sync than full-outbound-relay under attack scenarios, they do eventually sync up.
PS: The 30s period here is a magic number, something high enough for reconciliation to have minimal effect under normal operation mode, but that is certainly not written in stone. We can play with it to make the worst case not as bad
I've also being attempting a third experiment, deploy randomly placed blackholes across the network capturing different percentages of it. I have partial results for this, but they seem to be pretty noisy at the moment. If there is interest in this kind of experiment to motivate the approach, I'm happy to keep working on it
The PR has been updated. I've covered several untested cases surfaced by @brunoerg mutation testing, and covered several edge cases after giving it some additional rounds of review.
I have left some open questions at the end of the PR that I would appreciate some input on, but I don't expect the approach to change much besides those.
Activity
sr-gi commentedon Feb 11, 2026
Thanks for opening this @marcofleon.
I'd like to give a refresher and overview of Erlay, and explain some of the details of the experimentation and current approach. I also have a few questions/points that I'd like to discuss with people in the project.
Overview
Erlay is an alternative method of announcing transactions between peers in the Bitcoin P2P network. Erlay’s main goal is to reduce bandwidth utilization when propagating transaction data by minimizing the amount of redundant inventory messages (
INV) exchanged between peers.In our current transaction relaying approach (we'll be calling txflood or fanout from now on), every transaction is announced on every transaction relaying link in the peer-to-peer network at least once. That is, for each transaction relaying connection in the network, each side of the connection will either send or receive an
INVmessage containing the given transaction. Most of these announcements (n-1/n) are actually redundant, but it is impossible for the announcer to know until the announcement has been sent.Erlay tries to solve this issue by using set reconciliation to work out the transaction differences between two nodes connected to each other instead of just announcing all transactions through all links. To do so, nodes keep a set of transactions to be reconciled (or reconciliation set) between each of their Erlay-enabled peers, and reconciliation is performed at regular intervals. Once it is time to reconcile, peers exchange sketches of their reconciliation sets, which can be used to optimally compute the symmetrical difference between their reconciliation sets and, therefore, identify which transactions need to be sent by each end of the connection.
Erlay works optimally (sketches are smaller and sketch differences are cheaper to compute) when the differences between sets are small. This means that, even if all peers of a given node are Erlay-enabled, some transactions will still be exchanged using fanout. Finally, as we will expand on later on, fanout is more efficient and considerably faster than set reconciliation provided the receiving node does not know about the transaction being announced.
Fanout: The current approach
Before jumping into Erlay, its important to understand how fanout works in Core, so we can reason about the proposed changes and tradeoffs.
Transactions are exchanged between network peers using a 3-step protocol (
INV/GETDATA/TX). The first round-trip of this protocol (INV/GETDATA) can be seen as the announcement/request phase, here is where both sides of the connection are made aware of what the other side knows. The last half-round trip (TX) is where the actual transaction is exchanged, if necessary. Given transactions are significantly bigger than transaction ids, theINV/GETDATApart of the protocol is used to minimize the amount of potentially redundant information exchanged between peers. If I don't know if you know something, I'd better make sure first before dumping a lot of data on you. Hence, if the announcement receiver knows about the target transaction, we waste a minimal amount of bandwidth, and if not, we add a minimal amount of overhead to sending the transaction.Transactions are announced between peers at random intervals following a Poisson process. The expected delay between announcements depends on the type of connection: outbounds have an independent clock per connection with an expected value of 2 seconds, whereas inbounds share a timer with an expected value of 5 seconds. Transactions are queued to be announced until the timer goes off, and then announced using as many inventory messages as needed to clear the queue (each INV message can hold up to 50.000 entries IIRC). These timers are in place to obfuscate when a node learns about a transaction, in order to make it harder for a global network observer to pinpoint the transaction origin.
When a node learns about a new transaction via an inventory message, it may request it back from the announcer. Announcements are requested back in order of arrival, prioritizing outbound peers. If a peer takes too long to respond to a request, we may ask the next peer and so on. Inbound peers are de-prioritized here, by giving them a 2-second delay before requesting. This is to prevent them from stalling us (e.g., sending multiple announcements of the same transaction from different connections to delay us from learning the announced transaction).
Last but not least, when a transaction is being purposely delayed (in the
to_be_announcedqueue), a node will pretend not to know about it, so it won’t reply toGETDATAmessages requesting it. This is to prevent probing.Pros: fast (artificially slower for privacy/DoS protection purposes)
Cons: each transaction is announced at least once per link (too redundant)
Erlay: The second take
Erlay is not a drop-in replacement for fanout, but a protocol that works alongside it. This is obvious for backwards compatibility reasons: nodes are not forced to implement or adopt the change, but it’s not the only reason why. Set reconciliation is really good at fixing small differences between sets (both fast and efficient), but it becomes way less optimal when the differences in the sets to reconcile are big: sketches become big (they grow with the size of the diffs they can compute), and the diffs are expensive to compute. This is why set reconciliation works best alongside fanout, and why our approach to implement Erlay is as a hybrid between both.
Once this becomes clear, the main question to answer when implementing Erlay is: how we partition peers between fanout and reconciliation, and how big is the split? This is the question that has led most of the experimentation in the project and that most of the simulations have tried to answer. To answer this question, we need to understand the properties of each group:
The reason why reconciliation is slower lies in how transaction announcement is implemented in Core. When a transaction is propagated using set reconciliation, we need to go over an additional 1.5 round-trips (
REQRECON/SKETCH/RECONDIFF) to learn if the target peer knows about a certain transaction AND THEN, if it doesn’t, default toINV/GETDATA/TXto send it. Therefore, 3 round-trips in total. This may seem a bit counter intuitive, why can we not just send the transaction straightaway once we learn the peer doesn’t have it? Because another peer could have announced the transaction before us, and the target peer may already have selected them for download.In order to answer this question, I built a discrete-time network event simulator for Bitcoin (you can find it here) so I could quickly iterate over different configurations in significantly big networks.
Experimentation and findings
The initial approach was to simply answer the following question: how small can we keep fanout so that network latency remains similar while maximizing the bandwidth savings of set reconciliation? This proved tricky right out of the bat: set reconciliation is much slower than I originally imagined, and deciding what’s acceptable in terms of latency is hard to assess. As a matter of example, here are some simulation results with no optimizations:
Network: 110K nodes (100K unreachable, 10K reachable), random topology, 8 outbounds.
This shows the difference between doing full reconciliation (no fanout involved), doing minimal reconciliation (using similar parameters defined as “best” in the previous Erlay attempt, and full fanout (the current state of things). It becomes pretty clear that the impact on latency is more than significant when no optimizations are being applied, but it also raises the question: What is acceptable in terms of latency and at what cost?
One of the first attempts to reduce latency while maximizing our bandwidth savings was to reduce the previously mentioned expected values for the peer-announcement Poisson process sampling. Halving those artificially reduces latency with almost no effect on bandwidth (if any). This was the approach in the original Erlay implementation, but I never felt too comfortable with it. There is little documentation (if any) of why the broadcast intervals were picked as {5s, 2s}, and if that’s the route we want to take, I think it comes from a well-reasoned discussion.
Fine-tuning the approach
There have been several experiments and theories being tested to try to optimize the aforementioned approach to make it more latency-efficient while preserving the bandwidth savings. For an extended and more detailed explanation of some of these, I’d recommend checking the series I wrote on Delving. Here, I’ll be highlighting the two optimizations that have shown to work in simulation.
Reconcile on trickle
One of the main reasons why Erlay is slow has to do with when data is made available to our peers. As we’ve mentioned earlier, this happens when we trickle for them (their timer has gone off, so we will try to send them whatever we have available). However, adding reconciliation on top of this means that now both need to synchronize; otherwise, if data is being purposely delayed for a peer when they request reconciliation, they will have to wait until the next reconciliation cycle to get it (FYI, this is once every 8 seconds per outbound peer at the moment).
A solution for this problem is not to reply to reconciliation requests straightaway. Instead, the request can be recorded, and replied to when we trickle for that peer, ensuring that they get all transactions we have received up to that point. Here are the simulation results using the same network as before, but applying this optimization:
INV-based fanout
The second optimization worth mentioning has to do with how we pick nodes for fanout and reconciliation. So far, nodes have been picked as a static split. We select some for reconciliation and some for fanout, making the latter big enough so a big chunk of the network can be reached fast, but not big enough so it starts being redundant, and leave the rest to reconciliation. The specific numbers here come from simulating different partitions and seeing what seems to perform better in random networks.
However, we can do better than this. In an ideal world, if we knew how long the transaction has been propagating and what fraction of the network it has reached, we could use that to turn our fanout/reconciliation up or down. Unfortunately, we don’t have that information, but we know one thing: fanout is faster than reconciliation, therefore if we receive a transaction via fanout, we are likely to be amongst the first peers to receive it, whereas if we receive it via reconciliation, it is likely that we are further down the line.
We can use this to tweak our fanout rates:
This approach applies to outbound connections only, given that anything learnt from an inbound connection is easy to fake, so it’s better not to be trusted. Applying this optimization on top of the previous one, and simulating for the same network, we obtain:
Conclusions and questions
With the two presented optimizations, we are able to achieve savings of ~25% in bandwidth for the cost of ~ 67% more latency. Some of these combinations have also been tested on smaller networks with actual Bitcoin nodes implementing Erlay (using Warnet) and the obtained results have been similar. However, things are far harder (and more expensive) to test like that.
I personally think the design space for improvements and optimizations may still be substantial. However, I also think I’d be good to define what is acceptable in terms of bandwidth and latency tradeoffs, and what things are open to change:
I’ve tried to give as much context and information as possible while keeping this digestible. I’m happy to extend on any of the directions others are curious about, explain things that may have fallen of and provide additional data.
sr-gi commentedon Feb 11, 2026
I'm going to reserve this spot to extend on the tradeoffs when the number of connections is increased, since I did not touch that on the original post, but it's one of the main goals of the project (the write-up was already pretty lengthy). I may need to re-run some of the simulations for it.
stickies-v commentedon Feb 11, 2026
I'm not excited about this amount of research and code complexity for having bandwidth reduction as a goal. Bandwidth reduction by itself is nice, and obviously it is something we should improve where possible, but I don't see the current bandwidth consumption as problematic for users who wish to run without
blocksonly? Is it possible that, with this project going on for so long and with a couple of reboots, we kinda lost track of why we were doing this in the first place?It's been a while since I initially read the Erlay paper, but IIRC the reason I found this interesting at the time was that Erlay allows having more connections with acceptable bandwidth trade-offs, improving eclipse attack resistance. Even if it seems we currently already have reasonable eclipse attack resistance, this security benefit to me seems like much more worthy goal of investigating and - if Erlay turns out to be a worthwhile improvement - pursuing? I've not been following this project closely, so apologies if this has been covered already, I'm just not seeing it mentioned in the current write-up.
dergoegge commentedon Feb 11, 2026
To add to Stephan's comment: simpler proposals seem to achieve (for the most part at least) the same goal of increased network security: #28463, #28462 and it's not clear to me that the additional benefits that erlay offers over these (increased full-outbound relay connections instead of block-relay-only & bandwidth reduction) are worth the complexity (minisketch, reconciliation module, extra protocol messages).
sr-gi commentedon Feb 11, 2026
Thanks for your comments @stickies-v @dergoegge .
I think there are two conflicting goals being discussed here. If what we want to achieve is simply increase the network connectivity using any connection type, then sure, blocksonly are always going to be a cheaper and simpler solution. This can make Eclipse harder and will have a way smaller code complexity.
If, on the other hand, we want to be able to scale the network without having to scale it's backbone of reachable nodes (or at least not linearly), then allowing nodes to accept more tx-relaying connections with little to no impact to their bandwidth is important, and what Erlay is trying to achieve.
I think it's important to agree on what the goal is, because that will affect the complexity of the solution.
@stickies-v I'll expand on the network scaling bit on my second comment. I've parked it there for that reason.
mzumsande commentedon Feb 11, 2026
As mentioned in IRC, one reason to increase connectivity with Erlay is to increase resistance specifically against transaction censorship (as opposed to only resistance against eclipse attacks).
With the recent attempts to censor valid fee-paying transactions deemed undesirable for ideological reasons, not forwarding them to peers, this has become more relevant than it was in the past.
However, even with the current connectivity, the threshold is quite low (a minority of ~10% of random reachable nodes should suffice to get transactions to miners) - plus there is always the possibility of preferential peering so I'm not sure how important it is to lower that threshold even more.
sipa commentedon Feb 11, 2026
Let me take a step back, because I think the results don't paint the full picture.
The primary goal is increasing partition-resistance of the network. In what follows I'm going to assume 16 connections per node is the desired number, but this is just for presentation purposes. I'll get back to the number later.
We could add 8 more outbound extra full connections. But that also means simultaneously increasing the number of (default) permitted inbound connections for listening peers (say from 125 to 250), to not make the network run out of connection slots or making it easy for an attacker with tons of inbound slots to grab a large share of them. Unfortunately, with the current transaction relay design, every transaction INV announcement (36 bytes) goes over every connection at least once (and sometimes twice), so it scales with$\mathcal{O}(\mathrm{txrate} \times \mathrm{peers})$ . The more tx-carrying connections a node has (including inbound), the larger the percentage of their bandwidth is taken by INVs. And this is in a way accomplishing too much, because in addition to better partition resistance, it'll also reduce the tail latency for transactions to reach nodes in the network - something that isn't actually desired.
It's possible instead just add 8 extra block-only connections. These obviously do not cause a bandwidth increase due to INVs, and additionally impose less memory and CPU usage on the node. However, they also only improve block-relay partition resistance. This means that an eclipse attack on just the tx-carrying connections might be successful still, which would result in bad transaction propagation, potentially bad block reconstruction/propagation if severe, and in extreme cases, transaction censorship.
What if there was something in between the two, that has a lower bandwidth impact than full connections, improves tx-partition-resistance unlike block-only connections, but didn't care about improving tail latency? As a thought experiment, add 8 extra reconciliation-connections. These are not full Erlay as proposed; they're an entirely separate connection class, and exclusively use reconciliation for transaction relay on a slower time schedule than normal transaction propagation (+ normal block/addr relay). These connections should have very low bandwidth usage in non-adversarial settings because the large majority of transaction relay is done by the normal full connections, and reconciliation bandwidth scales with the amount of transactions being reconciled. They don't worse propagation latency at all, because these 8 connections are just added on top of the existing 8 full ones. However, in adversarial settings, rather than transactions not propagating at all, they cause reconciliation to take over when normal relay fails. This will happen at the cost of extra latency as it's a second-stage fallback mechanism, but it's better than not propagating at all.
So where we are at this point is that reconciliation-based connections are an alternative to (some of the) extra block-only connections that also improves tx-partition-resistance, but without the$\mathcal{O}(\mathrm(peers))$ factor in bandwidth effect that full connections have.
The full Erlay idea is to not have these reconciliation connections be separate from the normal full outbound connections, but have both mechanisms (flooding and reconciliation) inside all the normal connections, and intelligently pick between them: use flooding when you guess a peer is unlikely to have already heard of the transaction, and use reconciliation otherwise. This is where I think the majority of the conceptual complexity of Erlay comes in, as it involves intricate relay policy decisions to make these guesses well, and it's also where most of @sr-gi's efforts have been in the past year, because it just feels that with good decisions, you should be able to do better than two entirely separate connection classes.
Back to the number-of-connection question. There is no reason to assume that today, 8 connections is the right number for both tx propagation delay and tx-partition resistance. It's a limitation of the existing technology that forces both numbers to be the same. If we didn't care about partition resistance, would we consider reducing the number of outbound connections to reduce bandwidth (especially for incoming nodes with ~100 connections)? It's not unreasonable to me we might conclude that 4 connections is actually sufficient for transaction propagation purposes; this may be especially true with BIP-153 block template sharing. And if so, we could consider today replacing 4 of the normal outbound connections with Erlay (or similar) connections. It'd worsen propagation delay, but perhaps in an acceptable way, and not worsen partition resistance. Of course, I'm not suggesting actually doing that, but as a demonstration that what reconciliation offers is untangling tx-propagation and tx-partition-resistance from connection-count decisions.
However, with the effort to integrate flooding and reconciliation into one, and thus considering the possibility of replacing (all) normal connections with mixed flood-reconciliation connections, we maybe lost sight of the fact that the goal is increasing partition resistance (without unnecessary bandwidth and propagation-delay improvements), rather than bandwidth reduction per se.
Maybe it's worth reevaluating the need for combining the two. If we already had (say) 8 extra block-only connections, and it was proposed to replace some of those with reconciliation-based ones, I think it would look like a fairly interesting picture: a slight bandwidth increase, extra memory/CPU for the nodes that choose to participate, but we upgrade the partition-resistance offered by them from block-only to also cover transactions. And maybe the complexity of trying to integrate flooding and reconciliation isn't worth it here, as it's an improvement even without it.
sr-gi commentedon Feb 12, 2026
My understanding of why the project didn't move along in the previous iteration was that the latency/bandwidth tradeoff was not worth the change. I may have gotten that wrong, and missed the forest for the trees while retaking this, putting too much effort into optimizing the bandwidth/latency improvements instead of focusing on the partition resistance.
I agree that this would be an interesting thing to try out, and it would significantly simplify the design of the approach. This would still require the added complexity of minisketch, the set reconciliation module, and the extra network messages, but the design would be much cleaner. For those concerned about the additional complexity, would this be an acceptable tradeoff (@marcofleon, @dergoegge, @stickies-v )?
dergoegge commentedon Feb 12, 2026
I'd like to understand the current state of partition resistance and what concrete improvement Erlay would bring (and what metric best captures this). Since the papers cited by Erlay (regarding partitioning attacks) have been published, we've deployed several mitigations (e.g. anchors, asmap, v2 transport, etc.), and the theoretical attacks in the literature often rely on simplifying assumptions that seem to understate the engineering/operational cost to an attacker. Given all that, how much of the gap has already been closed, and how much does Erlay still improve the situation?
If we'd just be doing this to improve partition resistance (because increased connectivity is obviously better in that regard) while it's not clear that improvements are needed, then I'm not sure if I'd make this a priority myself. Given a project of this size, we'd need some momentum and at least a couple dedicated reviewers, otherwise we'll still be discussing this in 5 years.
marcofleon commentedon Feb 12, 2026
Still digesting and reading some more, but clarifying Erlay's ultimate goal and walking through the different approaches has already been helpful to me. Thanks sipa.
Interesting, I hadn't thought of this before. This would entail enabling more inbound slots without increasing outbound connections as much. So a listening node would be able to support more than the current ~11 fully-connected nodes and not take a meaningful bandwidth hit.
If the simpler approach, which iiuc could look something like 8 full, 4 reconciliation, and 4 blocks-only, improves the tx relay network's partition resistance without significant drawbacks, then I would prefer that over Erlay. I'm interested in seeing what that implementation would look like in comparison.
I'd still like to see the updated Erlay bandwidth and latency data with increased connection counts (no rush, just clarifying). However, unless there's a compelling reason to take on the extra complexity, I'd rather go with a simpler design that achieves a similar outcome.
stickies-v commentedon Feb 18, 2026
Note: I'm not super involved with p2p, so my comments in this thread are a best-effort to contribute to the conversation moving forward, but shouldn't be taken for much more than that.
I think it makes sense to reframe the tradeoff like this. Improving partition resistance (as per sipa's writing) and sustainably scaling the network (as per your writing) both are interesting goals to pursue. Evental project decisions can then be framed as how much we improve on those two domains, for a certain cost (such a code complexity, bandwidth, latency, ...). Having a measure of the current state of partition resistance and network scaling currently would be helpful too, if at all possible.
I generally prefer incremental, meaningful improvements. If separate reconciliation connections address the most important painpoints at minimal complexity, that absolutely seems like a good direction to focus on.
Since minisketch is a separate library, I'm much less concerned about its complexity than I am about complexity in p2p code.
sr-gi commentedon Feb 18, 2026
I'm happy to be corrected, but I do not think there is any metric that realistically captures what the current state of network partition resistance is, or that can quantify what would be good enough. Theoretically, we could compute how many /16 groups (or ASes for ASMap) would need to be controlled to have a certain likelihood of a node being eclipsed, but how realistic it is for an attacker capable of doing this to exist feels more speculative to me.
That is fair, but it applies to any network proposal trying to improve partition resistance. I personally think that improving partition resistance is a good goal on its own, especially if it doesn't come with significant tradeoffs with bandwidth and latency.
I agree with you there. I have no interest in pursuing this if there is no sufficient reviewer buy-in
ajtowns commentedon Feb 20, 2026
FWIW, I like the idea of reconciliation-only connections -- in thinking about inv2send stuff which is now PRed as #34628 I've been worried about the distinction we make for the inbound vs outbound side of connections (ie, the side that made the connection will send txs at potentially 2.5x the rate the other side will), which will mess up reconciliation while that zone is being hit. Having a dedicated class of connection (or even just a mode switch like the high-bw vs low-bw compact block stuff) would avoid that -- once you decide to make it a reconciliation connection, just have both sides use the lower rate.
FWIW, I think bumping the number of blocks-only connections should be a high priority (and higher pri than erlay), but it keeps slipping off my radar.
FWIW, if you look at erlay as an anti-censorship addition to the network (ie, we're just using it to add connectivity, not replacing the existing INV connectivity with it), then I don't think latency matters very much. If you're getting your tx relayed in five minutes, when without erlay it would not have been relayed at all due to censorship, that's a win, even if uncensored txs take a fraction of that time.
As far as the stats go, I don't think 6-8 significant figures of precision is very realistic...
The random delays between INVs is to give a little privacy -- if you wait 8s between INVs and txs are coming in at 7tx/s, then you have an anonymity set of 56 txs where your peers can't discern the order in which they arrived. Because it's an exponential/poisson process, the 5s average will mean that 10% of the time it will be less than 0.52s between INVs, so the anonymity set may be 3.7 transactions or less. I think "90% of the time, the anonymity set will be at least ~4 transactions" is the right sort of implication to think about here.
One thing I've been thinking about with template sharing is if the ephemeral connections we make can be used for tx relay -- ie, we do an extra block relay connection every few minutes already, if we share a template on that, that gives us much broader top-of-mempool tx relay capacity than a set of static connections, at least if a there's a high-feerate tx that's getting censored by a majority of the network for an extended period. Maybe doing a one-off "txs from the last few minutes" reconciliation immediately on making a new "blocks-only" connection to a compatible peer would also be feasible and useful. (Or maybe not 🤷♂️)
Anyway, just some thoughts.
1 remaining item
sr-gi commentedon Feb 25, 2026
Thanks for chiming in @ajtowns @gmaxwell
These sound like good reasons to move forward with a recon-only version of Erlay to me.
Oh, this is really interesting. I never thought about this in terms of the anonymity set that it provides based on the expected transaction throughput. So if I got this right, reducing the expected values to
{2s, 1s}would yield an "anonymity set of 4 transactions ~78% and ~61% of the times, respectively" which is much more undesirable.sr-gi commentedon Apr 21, 2026
I went ahead and implemented the reconciliation-only connections approach to my simulator and tested out how adding more of these connections would look like.
I have increased the reconciliation request interval from 8s to 30s (a node reconciles with all its recon peers on that frequency), as this connections as supposed to be used as a fallback.
For a single transaction on a network with 110000 nodes, 10000 reachable and 100000 unreachable:
We can see how, as it was expected, adding more of these connections has little to no effect on both bandwidth and latency.
sipa commentedon Apr 21, 2026
@sr-gi Nice results! I'm a bit confused how the 2nd and 4th line can have (slightly) worse propagation times than the 1st, because they have a strict superset of the connections/types. Is this just random noise, or reproducible?
sr-gi commentedon Apr 21, 2026
I think it is random noise, from how building these more connected networks is interacting with the rng, sampling additional values, hence making the simulations slightly different. This would be similar to running on different (similar-size) networks.
I think your point is easier to see if the reconciliation request intervals are not changed, given that makes recon connection contribute more towards propagation. Here's an example:
Bear in mind the data volume here is higher because we are reconciling unnecessarily fast.
In any case, I'll take a closer look in case I missed something on the refactor, but I also wanted to cross test this on warnet after porting the changes to Core.
ajtowns commentedon Apr 22, 2026
Having stats which show no wins for adding the erlay connections (even with minimal costs) is a bit disappointing. Is there a way we could measure resistance to partitioning/censorship attacks (since that's the underlying benefit we're aiming for with higher tx connectivity)?
Perhaps take the 8 and 8+4 cases and graph tx propagation time / reachability versus percentage of (listening/reachable?) nodes that refuse to relay a transaction?
sr-gi commentedon Apr 22, 2026
That's a fair point. I'll add tx withholding logic to the simulator and compare how pure fanout and fanout + fallback recon behave in these cases
ajtowns commentedon Apr 22, 2026
Maybe a scenario like "10k honest reachable nodes, 100k honest unreachable nodes" versus "20k reachable nodes, 50% dishonest, 100k unreachable nodes, 20% honest" would be interesting? 100k honest unreachable nodes probably (a) makes relay really easy, and (b) perhaps isn't that realistic, with spy nodes and blocks-only nodes and spv nodes and whatever?
sr-gi commentedon Apr 30, 2026
I've added some changes to the simulator to include sink nodes: nodes that receive the simulated transaction but do not propagated further. With that, I've run a simulation for the previous case (10K/100K all honest) and the newly proposed case (20K,50% honest/100K,20% honest). In both cases, I've added Fanout (12 outbounds) as a reference of what would it look like to just increase the number of connections to 12 regular full-relay outbounds.
100K/10K all honest
100K/20K 20%/50% honest
These are the things that stand out the most to me:
1 Notice how the fanout (8 conn) case reaches less nodes than the Erlay case (there are more isolated nodes in the former), hence why the propagation times are also slightly faster.
PS: if anyone is interested, code for the change can be found at sr-gi/hyperion#56
ajtowns commentedon May 1, 2026
Hmm, if I'm reading that right, my suggestion was the opposite of that -- 100K unreachable with only 20% honest; 20K reachable with 50% honest. 50k honest unreachable nodes will still do a pretty good job of relaying amongst the honest reachable nodes -- 99% of them will be bridging at least 3 reachable nodes, so >86% will be bridging a couple of /honest/ reachable nodes. I think you want a scenario where the base fanout (8ob only) case has at least some honest reachable nodes not seeing the tx, otherwise the only thing you're testing is "how many honest unreachable nodes making every connection to a dishonest node/sink".
(Oh, if you're not modelling connection capacity limits, there's no point having unreachable sink nodes, btw -- the only way unreachable sink nodes have an impact is if they cause the honest listening nodes they connect to to stop accepting new honest connections. So you could perhaps drop it to 50k unreachable, 10k reachable honest, 10k reachable sink)
sr-gi commentedon May 1, 2026
Sorry, my bad, I miswrote that. The table shows 100K (20% honest) / 20K (50% honest)
sim runs
Yeah, that makes sense. For a substantial number of nodes to be isolated, I may have to ramp up the amount of dishonest nodes even more. I have results for this setting with 100K (20% honest) / 20K (30% honest) and even there, more than 90% of the nodes receive the transaction in the base case (and over 95% on the 12 con cases). I did not track if those isolated nodes where reachable/unreachable, but that is an easy addition.
Is there any threshold of reachable node not seeing the transaction that you'd like to see? I can see what that would mean in terms of sink percentages
ajtowns commentedon May 3, 2026
I guess my question is: "if there was a problem with tx relay on the network (eg, 5%, 10%, 20%, 50%, 90% of nodes not receiving a tx because of too many censoring nodes?), then (a) how much impact would erlay have at mitigating the problem (10% becomes 5% by the sounds of it?), (b) how realistic is it that we'll have that sort of problem?, and maybe (c) are there other, simpler, ways of addressing the problem?"
You could also have the problem be something more along the lines of "20 (mining/lightning) nodes which want to see transaction have had their view of the network badly corrupted, and aren't being connected to by honest nodes, and only have an artificially reduced chance of connecting to an honest node of x% per attempt" perhaps?
(My feeling is that a bunch of additional erlay tx relay connections would be a good thing, but if we're going to implement/maintain it, I think we should be able to explain why it's a good thing fairly concretely)
sr-gi commentedon Jun 23, 2026
I just opened a PR with the new approach #35591, and closed the previous PRs.
I'll be testing on Warnet next.
sr-gi commentedon Jul 29, 2026
I create two of these experiments on warnet (h/t @pinheadmz for the quick patches that allowed easy network deployments beyond manual connections).
Experiment 1: how does creating extra connections (relay/recon) affect the bandwidth and latency of the network under normal conditions.
Experiment 2: how does creating extra connections (relay/recon) affect the bandwidth and latency of a node that has had their other connections captured
Experiment 1 aims to show what is the cost of having extra connections under normal circumstances, while Experiment 2 aims to show what is the cost under an attack.
Both experiments have been run over a randomly generate network with 100 nodes, 70 unreachable and 30 reachable. All nodes have 8 outbound-full-relay connections. The experiments are run in three arms, first, a baseline mimicking the current functionality (only 8 full-relay), then, one relay branch, adding 4 extra outbound-full-relay connections, and finally, a recon branch, adding 4 extra outbound-full-recon connections (same topology as full relay).
Experiment 1
For this experiment, we crated 50 transaction from different sources in the network and repeated the experiment 5 times (results are averaged). The code, network and results for the experiment can be found at: sr-gi/erlay-warnet@0d11255.
Baseline (8 full-relay connections per node)
Full-relay (baseline +4 extra outbound-full-relay per node)
Full-recon (baseline +4 extra outbound-full-recon per node)
Conclusions
Experiment 2
For this experiment, we created a network of 100 nodes, 91 honest (27 reachable), 8 blackholes, 1 victim. The victim has all its connections captured by blackholes. The experiment runs a baseline to confirm that the victim is isolated, where we expect no transactions or blocks received by it. After, the victim's neighborhood is extended by 4 nodes (full-outbound-relay in one arm, full-outbound-recon in the other). Both bandwidth and latency are measured in both cases. The code, network and results for the experiment can be found at: sr-gi/erlay-warnet@f944288
Baseline (8 full-relay connections per node, all blackholes)
transactions received : 0 / 20
time to receive all : never (timeout)
bytes received / msg : None
Full-relay (baseline +4 extra outbound-full-relay for the victim)
transactions received : 20 / 20
time to receive all : 2.4 s
bytes received / msg : inv 742
Full-recon (baseline +4 extra outbound-full-recon for the victim)
transactions received : 20 / 20
time to receive all : 18.7 s
bytes received / msg : inv 742, sketch 34
Conclusions
All in all, I think this shows what we expected: eclipse protection is a function of the node connectivity. The more (diverse) peers a node has, the harder it is to eclipse it. Naively increasing the peer degree with full-outbound-relay connections comes with a high bandwidth price, specially under normal operation mode. On the other hand, full-outbound-recon connections are almost free to maintain, and while they are slower to sync than full-outbound-relay under attack scenarios, they do eventually sync up.
PS: The 30s period here is a magic number, something high enough for reconciliation to have minimal effect under normal operation mode, but that is certainly not written in stone. We can play with it to make the worst case not as bad
sr-gi commentedon Jul 29, 2026
I've also being attempting a third experiment, deploy randomly placed blackholes across the network capturing different percentages of it. I have partial results for this, but they seem to be pretty noisy at the moment. If there is interest in this kind of experiment to motivate the approach, I'm happy to keep working on it
sr-gi commentedon Aug 20, 2026
The PR has been updated. I've covered several untested cases surfaced by @brunoerg mutation testing, and covered several edge cases after giving it some additional rounds of review.
I have left some open questions at the end of the PR that I would appreciate some input on, but I don't expect the approach to change much besides those.