Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport: Merge bitcoin#22568, 21800, (partial)22707 #6064

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

vijaydasmp
Copy link

bitcoin backports

@vijaydasmp vijaydasmp changed the title backport : Merge bitcoin#19801 backport : Merge bitcoin#19801, 22490, 22098, 22597, 22577, 22630 Jun 17, 2024
@vijaydasmp vijaydasmp force-pushed the bp23_99 branch 2 times, most recently from 9b85a54 to e5ab16f Compare June 17, 2024 23:07
@vijaydasmp vijaydasmp changed the title backport : Merge bitcoin#19801, 22490, 22098, 22597, 22577, 22630 backport: Merge bitcoin#19801, 22490, 22098, 22597, 22577, 22630 Jun 21, 2024
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#19801, 22490, 22098, 22597, 22577, 22630 backport: Merge bitcoin#22490, 22098, 22597, 22577, 22630 Jun 21, 2024
Copy link

This pull request has conflicts, please rebase.

@vijaydasmp vijaydasmp force-pushed the bp23_99 branch 2 times, most recently from 0e14cee to a1b3d55 Compare July 7, 2024 07:22
@vijaydasmp vijaydasmp force-pushed the bp23_99 branch 2 times, most recently from e0518bf to 2b460db Compare July 19, 2024 00:14
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#22490, 22098, 22597, 22577, 22630 backport: Merge bitcoin#22490, 22098 Jul 19, 2024
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#22490, 22098 backport: Merge bitcoin#22098 Jul 19, 2024
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#22098 backport: Merge bitcoin#22686, 22732, 22742, 22568, 22707 Jul 20, 2024
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#22686, 22732, 22742, 22568, 22707 backport: Merge bitcoin#22686, 22742, 22568, 22707 Jul 21, 2024
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#22686, 22742, 22568, 22707 backport: Merge bitcoin#22568, 22707 Jul 21, 2024
@vijaydasmp vijaydasmp marked this pull request as ready for review July 24, 2024 02:40
@@ -68,8 +68,7 @@ def run_test(self):
self.log.info("Add unbroadcasted tx to mempool on new node and shutdown")
unbroadcasted_tx_hash = new_wallet.send_self_transfer(from_node=new_node)['txid']
assert unbroadcasted_tx_hash in new_node.getrawmempool()
mempool = new_node.getrawmempool(True)
assert mempool[unbroadcasted_tx_hash]['unbroadcast']
assert new_node.getmempoolentry(unbroadcasted_tx_hash)['unbroadcast']
Copy link
Collaborator

Choose a reason for hiding this comment

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

22707 - partial due to missing changes for test/functional/mempool_package_limits.py (which is introduced by bitcoin#21800)

Copy link
Author

Choose a reason for hiding this comment

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

adding bitcoin#21800

Copy link

This pull request has conflicts, please rebase.

@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#22568, 22707 backport: Merge bitcoin#22568, 21800, 22707 Jul 26, 2024
…imeout coverage

f8d8eb5 test: add addr-fetch timeout connection coverage in p2p_addrfetch.py (Jon Atack)
9321086 test: add assert_getpeerinfo method and coverage in p2p_addrfetch.py (Jon Atack)

Pull request description:

  This patch adds additional addr-fetch peer connection state and timeout coverage as a follow-up to bitcoin#22096.

ACKs for top commit:
  Saviour1001:
    Tested ACK <code>[f8d8eb5](https://github.com/bitcoin/bitcoin/pull/22568/commits/f8d8eb5fdaa93b6e5b77fd901b94927dc3a0473e)</code>
  mzumsande:
    Code review ACK f8d8eb5

Tree-SHA512: 9a13a705d1da6b308d6dcbc6930575205e2e88bfe9f2e7cb4e0c4c40d26538430e6b02c6c772d0cee64e534777348291469a139f99afbf9d4f93f31b9e7b0818
Copy link
Member

@PastaPastaPasta PastaPastaPasta 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

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

CI fails because 21800 needs dashification, pls see 84cdd18

@@ -86,7 +86,7 @@ def transaction_graph_test(self, size, n_tx_to_mine=None, start_input_txid='', e
unsigned_raw_tx = self.nodes[0].createrawtransaction(inputs, outputs)
signed_raw_tx = self.nodes[0].signrawtransactionwithwallet(unsigned_raw_tx)
tx_id.append(self.nodes[0].sendrawtransaction(signed_raw_tx['hex']))
tx_size.append(self.nodes[0].getrawmempool(True)[tx_id[-1]]['vsize'])
tx_size.append(self.nodes[0].getmempoolentry(tx_id[-1])['vsize'])
Copy link

Choose a reason for hiding this comment

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

22707: missing changes in test/functional/mempool_unbroadcast.py (to code introduced in 22261)

fanquake and others added 2 commits July 29, 2024 17:35
…limits for packages

accf3d5 [test] mempool package ancestor/descendant limits (glozow)
2b6b26e [test] parameterizable fee for make_chain and create_child_with_parents (glozow)
313c09f [test] helper function to increase transaction weight (glozow)
f8253d6 extract/rename helper functions from rpc_packages.py (glozow)
3cd663a [policy] ancestor/descendant limits for packages (glozow)
c6e016a [mempool] check ancestor/descendant limits for packages (glozow)
f551841 [refactor] pass size/count instead of entry to CalculateAncestorsAndCheckLimits (glozow)
97dd1c7 MOVEONLY: add helper function for calculating ancestors and checking limits (glozow)
f95bbf5 misc package validation doc improvements (glozow)

Pull request description:

  This PR implements a function to calculate mempool ancestors for a package and enforces ancestor/descendant limits on them as a whole. It reuses a portion of `CalculateMemPoolAncestors()`; there's also a small refactor to move the reused code into a generic helper function. Instead of calculating ancestors and descendants on every single transaction in the package and their ancestors, we use a "worst case" heuristic, treating every transaction in the package as each other's ancestor and descendant. This may overestimate everyone's counts, but is still pretty accurate in the our main package use cases, in which at least one of the transactions in the package is directly related to all the others (e.g. 1 parent + 1 child, multiple parents with 1 child, or chains).

  Note on Terminology: While "package" is often used to describe groups of related transactions _within_ the mempool, here, I only use package to mean the group of not-in-mempool transactions we are currently validating.

  #### Motivation

  It would be a potential DoS vector to allow submission of packages to mempool without a proper guard for mempool ancestors/descendants. In general, the purpose of mempool ancestor/descendant limits is to limit the computational complexity of dealing with families during removals and additions. We want to be able to validate multiple transactions on top of the mempool, but also avoid these scenarios:

  - We underestimate the ancestors/descendants during package validation and end up with extremely complex families in our mempool (potentially a DoS vector).
  - We expend an unreasonable amount of resources calculating everyone's ancestors and descendants during package validation.

ACKs for top commit:
  JeremyRubin:
    utACK accf3d5
  ariard:
    ACK accf3d5.

Tree-SHA512: 0d18ce4b77398fe872e0b7c2cc66d3aac2135e561b64029584339e1f4de2a6a16ebab3dd5784f376e119cbafc4d50168b28d3bd95d0b3d01158714ade2e3624d
… functional tests for efficiency

47c48b5 test: only use verbose for getrawmempool when necessary in functional tests (Michael Dietz)
7734971 test: use getmempoolentry instead of getrawmempool in functional tests when appropriate (Michael Dietz)
86dbd54 test: improve mempool_updatefrom efficiency by using getmempoolentry for specific txns (Michael Dietz)

Pull request description:

  I don't think this changes the intention of the test. But it does shave ~30 seconds off the time it takes to run. From what I've seen our CI `macOS 11 native [gui] [no depends]` runs `mempool_updatefrom.py` in ~135 seconds. After this PR it should run in ~105 seconds

  I noticed this improvement should probably be made when testing performance/runtimes of bitcoin#22698. But I wanted to separate this out from that PR so the affects of each is decoupled

  Edit: The major change in this PR is improving mempool_updatefrom.py's runtime as this is a very long running test. Then made the same efficiency improvements across all the functional tests as it made since to do that here

ACKs for top commit:
  theStack:
    Tested ACK 47c48b5

Tree-SHA512: 40f553715f3d4649dc18c2738554eafaca9ea800c4b028c099217896cc1c466ff457ae814d59cf8564c782a8964d8fac3eda60c1b6ffb08bbee1439b2d34434b
UdjinM6
UdjinM6 previously approved these changes Jul 29, 2024
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK a9dbf0c

@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#22568, 21800, 22707 backport: Merge bitcoin#22568, 21800, (partial)22707 Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants