RBF as it is currently implemented compares the feerates of transactions, not their mining scores, and the replacement does increase the feerate: tx_HS has a higher feerate than tx_RBFr. The overall fees increased in the mempool, as well as the overall feerate in the mempool. While your expectation that the mining score (or effective feerate) of all transactions should increase, that’s not how it works at this time. It turns out that calculating a transaction’s mining score is a non-trivial amount of computational work that requires the entire cluster of the transaction as context. See e.g. the work Gloria Zhao and I did here last year: Implement Mini version of BlockAssembler to calculate mining scores. Also, you will probably really like the ClusterMempool project, since it will allow us to only accept replacements that strictly improve the mempool including in the manner that you describe.
As far as I can tell, tx_HS is a valid replacement of tx_RBFr and tx_LS as it:
  1. Only includes unconfirmed inputs that were included by one of the directly conflicting transactions:
    Yes, tx_HS only uses the unconfirmed output of tx_LL that was previously spent by tx_LS.
  2. The replacement transaction pays an absolute fee of at least the sum of the replacements:
    Yes, 105,000 sats ≥ 100 sats + 2000 s.
  3. The additional fees (difference between absolute fee paid by replacement and originals) pays for the transaction’s bandwidth at or above incremental relay feerate:
    Yes, 105,000 sats – (2000 sats + 100 sats) = 102,900 sats ≥ 5000 vB × 1 s/vB.
  4. The number of original transactions does not exceed 100:   Yes.
  5. The replacement transaction’s feerate is greater than the feerate of all directly conflicting transactions:  Yes, 21 s/vB ≥ 20 s/vB ≥ 1 s/vB.
RBF as it is currently implemented compares the feerates of transactions, not their mining scores, and the replacement does increase the feerate
That's not really true though. It's increasing the fee-rate of a transaction in isolation. But from the point of view of miners it is not increasing the fee-rate of the immediately mineable mempool, because you have to mine a low fee-rate transaction first to access the high fee-rate.
In my replace-by-fee-rate post, I called this kind of concept the highest minable fee-rate. The situation itself is similar to the argument as to why replace-by-fee-rate is miner incentive compatible in the first place: we'd almost always rather mine a high fee-rate transaction now, than have a higher total fee transaction that can't be mined any time soon.
As I mentioned on bitcoin-dev, IIUC Suhas identified this issue with RBF and has a draft pull-req intended to fix it. An even simpler fix could be to require that all unconfirmed inputs to a replacement come from the same transaction; currently they're allowed to come from different transactions. The whole point of the unconfirmed input rule was to avoid this type of situation in the first place; turns out we needed a stronger version of that rule.
reply
In my replace-by-fee-rate post, I called this kind of concept the highest minable fee-rate.
Yes, and the people that have been working on this topic in the past few years speak of "mining score" and "feerate diagram comparison" in this context.
It's increasing the fee-rate of a transaction in isolation. But from the point of view of miners it is not increasing the fee-rate of the immediately mineable mempool, because you have to mine a low fee-rate transaction first to access the high fee-rate.
While that might have been the intention, it is not how RBF is implemented today. I would expect you to know this, given your involvement in the original work and your recent advocacy for mempoolfullrbf. If you have not read them yet, you may find Suhas’s overview of Cluster Mempool and Gloria’s numerous write-ups for RBF, package relay, v3 transactions, etc. interesting.
reply
Yes, and the people that have been working on this topic in the past few years speak of "mining score" and "feerate diagram comparison" in this context.
I know. If you'd gone to the link I provided you'd see that I used a different term because for use in replace-by-fee-rate, I proposed an simpler algorithm that is not identical to mining score.
While that might have been the intention, it is not how RBF is implemented today. I would expect you to know this
I'm aware. I was responding your confusing way of explaining this stating that "the replacement does increase the feerate" by explaining how from a miner's perspective the feerate has not been increased. Your reply was glossing over the fact that RBF as implemented right now is clearly broken in the circumstance that your replacement cycle exploits, as @shafemtol pointed out.
reply
Yes, it doesn’t improve the best mining score among the transactions in the example. It does increase the overall fees per vsize across the set of transactions we are examining. It depends on the size of the mempool and the overall position in the mempool of the examined set of transactions to determine which of those two are more attractive to miners. If there are few transactions available for mining, increasing the total fees may be preferable over a higher feerate transaction with a lower total fee.
What you are describing in the context of "highest minable fee-rate" is equivalent to the concept of mining score. If the (ancestorless) parent has a higher feerate, the parent’s mining score matches its own feerate as does the child’s mining score match the child’s feerate. If the child has a higher feerate, they share a mining score that falls between the parent’s feerate and the child’s feerate.
reply