Skip to content

Conversation

@ariard
Copy link

@ariard ariard commented May 13, 2021

Contrary to BIP125 or other full-node implementation (e.g btcd), Bitcoin Core's mempool policy doesn't implement inherited signaling.

This PR documents our mempool behavior on this and add a test demonstrating the case.

@ariard
Copy link
Author

ariard commented May 13, 2021

Also, I had a look on the rest of RBF functional test coverage (i.e feature_rbf.py, mempool_accept.py, p2p_invalid_tx.py). AFAICT, the latest check on incremental relay fee increase doesn't seem to have coverage ?

@Sjors
Copy link
Member

Sjors commented May 13, 2021

utACK fb2047b

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good place to refer to the CVE so it's clear the behaviour here is not following BIP125.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes already add a ref in new document, added another here if you think so.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a good idea; few people will read validation.cpp along side this test.

@ariard ariard force-pushed the 2021-05-rbf-noinheritance branch from fb2047b to 3d57b5e Compare May 13, 2021 20:29
@ghost
Copy link

ghost commented May 14, 2021

Concept ACK

Maybe we can mention this in doc/bips.md as well

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 3d57b5eb053c7a34c3621875fa60401782a280b4

Happy to re-ACK if you update per the comments.

@ariard ariard force-pushed the 2021-05-rbf-noinheritance branch from 3d57b5e to 2eb0eed Compare May 14, 2021 18:30
@ariard
Copy link
Author

ariard commented May 14, 2021

Thanks @jonatack and @Sjors, I think I've addressed all your comments at 2eb0eed, but lmk if you've more I'll address them quickly.

@prayank23

Well in fact there is another well-known supplemental check implemented by our logic not mentioned in the BIP, which is the feerate comparison here :

if (newFeeRate <= oldFeeRate)
and absolute fee checks is done on original transactions and their descendants, should we document all of them ?

@ariard
Copy link
Author

ariard commented May 14, 2021

@MarcoFalke I believe you're aware of few mempool-related RPCs which should be updated in consequence as follow-up of this PR?

@jonatack
Copy link
Member

ACK 2eb0eed

@ghost
Copy link

ghost commented May 17, 2021

Well in fact there is another well-known supplemental check implemented by our logic not mentioned in the BIP, which is the feerate comparison here :

if (newFeeRate <= oldFeeRate)

and absolute fee checks is done on original transactions and their descendants, should we document all of them ?

Not sure about this. According to my understanding fee rate and fees both should be higher in replacement transaction.

Example:
Tx1 has only 1 input and two outputs (RBF enabled)
Tx2 is replacement transaction for Tx1 which has 5 inputs and 2 outputs.

It is possible that Tx2 uses a lower fee rate compared to Tx1 but more fees. Miners normally prioritize based on fee rate so a higher fee rate would be better.

However, if there is a difference in BIP and the implementation it should be mentioned in doc/bip.md IMO

@benthecarman
Copy link
Contributor

ACK 2eb0eed

Is a fix for the actual CVE being worked on as well?

@ariard
Copy link
Author

ariard commented May 21, 2021

@prayank23

Yes, unless you have a strong opinion here, I prefer differences between BIPs and the implementation in another PR, like one adding test coverage for incremental relay fee.

@benthecarman

Not really, as a fix, I'm currently studying moving towards full-rbf. If we do so, there wouldn't be any kind of signaling to proceed at all.

IMO, main motivation to not fix it is avoiding increasing the DoS surface of the mempool, where at replacement transaction submission you might have to traverse N * package_ancestor_limits. With N your number of allowed inputs for a MAX_STANDARD_TX_WEIGHT-sized transaction.

@jonatack
Copy link
Member

jonatack commented Jun 8, 2021

This has ACKs by @Sjors, @benthecarman and myself, if anyone would like to have a look.

@maflcko maflcko merged commit 82bc7fa into bitcoin:master Jun 8, 2021
@ajtowns
Copy link
Contributor

ajtowns commented Jun 9, 2021

IMO, main motivation to not fix it is avoiding increasing the DoS surface of the mempool, where at replacement transaction submission you might have to traverse N * package_ancestor_limits. With N your number of allowed inputs for a MAX_STANDARD_TX_WEIGHT-sized transaction.

Adding a bool rbf_enabled to CTxMemPoolEntry that's true if the tx signals for rbf or any of its inputs have rbf_enabled == true would remove that problem fairly easily, as far as I can see.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 9, 2021
… RBF policy

2eb0eed validation: document lack of inherited signaling in RBF policy (Antoine Riard)
906b6d9 test: Extend feature_rbf.py with no inherited signaling (Antoine Riard)

Pull request description:

  Contrary to BIP125 or other full-node implementation (e.g btcd), Bitcoin Core's mempool policy doesn't implement inherited signaling.

  This PR documents our mempool behavior on this and add a test demonstrating the case.

ACKs for top commit:
  jonatack:
    ACK 2eb0eed
  benthecarman:
    ACK 2eb0eed

Tree-SHA512: d41453d3b49bae3c1eb532a968f43bc047084913bd285929d4d9cba142777ff2be38163d912e28dfc635f4ecf446de68effad799c6e71be52f81e83410c712fb
@maflcko
Copy link
Member

maflcko commented Jun 10, 2021

@MarcoFalke I believe you're aware of few mempool-related RPCs which should be updated in consequence as follow-up of this PR?

Sure, filed as #22209

@ariard
Copy link
Author

ariard commented Jun 13, 2021

@ajtowns

IIUC we would have to re-order RBF opt-in checks after fetching parents coins from the cache in PreChecks, but I don't believe such re-order would change anything in DoS prevention strategy around mempool acceptance. Any CTxMemPoolEntry would inherit rbf_enable == true if one of its parent entries have the flag sets so, that way you only check first-depth of ancestors of the replaced transactions.

At first sight, I don't see any blocker for this approach, though I was planning to propose soon moving towards full-rbf. Beyond simplifying a bit PreChecks code sanity, opt-in RBF raises issues for multi-party funded transactions. If full-rbf turns as a flames war like last time, we can consider again this approach to fix the discrepancy between the spec and our code.

gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
Adds a new test which is broken, but which will be fixed in a few PRs.
Disabled it for now.
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants