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: bitcoin#16551, #20288, #20329, #20451, #20491, #20512, #20587, #20588, #20611, #21112 #5963

Merged
merged 10 commits into from
Apr 3, 2024

Conversation

knst
Copy link
Collaborator

@knst knst commented Mar 30, 2024

Issue being fixed or feature implemented

Just regular backports from v19 and v22

What was done?

How Has This Been Tested?

Run unit/functional tests

Breaking Changes

N/A

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

@knst knst added this to the 21 milestone Mar 30, 2024
PastaPastaPasta
PastaPastaPasta previously approved these changes Apr 2, 2024
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.

utACK 243b038

Copy link

github-actions bot commented Apr 2, 2024

This pull request has conflicts, please rebase.

@UdjinM6
Copy link

UdjinM6 commented Apr 2, 2024

Looks good but needs rebase

laanwj and others added 10 commits April 3, 2024 14:11
961f148 doc: update contrib/seeds/README dnspython installation info (Jon Atack)
dd7b5f4 script: fix deprecation warning in makeseeds.py (Jon Atack)

Pull request description:

  Seen while reviewing bitcoin#20237.

  1. Fix a deprecation warning in `contrib/seeds/makeseeds.py`
  ```
      makeseeds.py:139: DeprecationWarning: please use dns.resolver.resolve() instead
        asn = int([x.to_text() for x in dns.resolver.query('.'.join(
  ```
    - Per https://dnspython.readthedocs.io/en/latest/whatsnew.html, `dns.resolver.query()` was deprecated in `dnspython` version 2.0.0.

    - See https://dnspython.readthedocs.io/en/latest/resolver-class.html for more info on the resolver class.

  2. Update the `dnspython` dependency installation instructions in `contrib/seeds/README`

    - The markdown rendering can be seen here: https://github.com/jonatack/bitcoin/tree/contrib-seeds-fixups/contrib/seeds

ACKs for top commit:
  laanwj:
    code review ACK 961f148

Tree-SHA512: f9c4f318a1a0d35b8de147d24b72c534a1f58eece31e7cfa00b4149a63b6a618d8ca0312f52fd8056f3c645cf2ee68574ca02319fddffdad919a70cd33395d33
…he path after xpub

dc80a7d docs/descriptors.md: Remove hardened marker in the path after xpub (Dmitry Petukhov)

Pull request description:

  As described in "Key origin identification" section, a descriptor
  that has hardened derivation after xpub does not let you compute scripts
  without access to the corresponding private keys. Such a descriptor is
  practically useless.

  The text after the descriptor said "with child key *1'/2* of the
  specified xpub", and clearly an xpub cannot have "child key" with
  hardened derivation. Therefore it makes sense to fix this inconsistency
  to not confuse the reader of the doc

Top commit has no ACKs.

Tree-SHA512: 9f35951d90868585303681c27ea2ef9d36d4036181e337cfbd48730de0c346320b08dd089350b116d4c8542f3b506868cf318796bb713e5f80600ccbd96f9970
830ddf4 Drop noop gcc version checks (Hennadii Stepanov)

Pull request description:

  Since bitcoin#20413 the minimum required GCC version is 7.

ACKs for top commit:
  fanquake:
    ACK 830ddf4

Tree-SHA512: 36264661d6ced1683a0c907efba7c700502acaf8e9fd50d9066bc9c7b877b25165b0684c2d7fe74bd58e500a77d7702bdbdd53691c274f29e4abccd241c10964
1d578c0 doc: Add bash as an OpenBSD dependency (Emil Engler)

Pull request description:

  If we require Python for the test framework, we should also require
  bash. It is required for the linters and other scripts and does not
  comes in a default OpenBSD installation.

ACKs for top commit:
  practicalswift:
    ACK 1d578c0
  RiccardoMasutti:
    ACK 1d578c0
  theStack:
    ACK 1d578c0

Tree-SHA512: ef14e801983093a99d4c28d134adbc589ca06e5437bf1ff34f8e593968c59793e9d99e8a48f577f847acdfc5185e193276526894b4c632c59d66d87939977910
32045bb [doc] Tidy up Tor doc (more stringent) (wodry)

Pull request description:

  This is a follow up to bitcoin#19638 that left two deprecated "hidden service/server" naming occurences.

  It also shall make the chapter titles regarding creation of onion services stringent and easy to read and distinguish.

  It removes the one and only reference to the testnet (here the testnet onion service port), as it is not explained that it references to the testnet and I do not know why it is mentioned there. It is only confusing. Also, as said, the testnet is not referenced at any other place in this document.

ACKs for top commit:
  practicalswift:
    ACK 32045bb
  laanwj:
    Review ACK 32045bb
  RiccardoMasutti:
    ACK 32045bb

Tree-SHA512: c623387b76d68845c0fa47f67a6f8ef70c9c560e3f8f8754e45a4f51e43198c2092be789588acd4ada607f42fbe62d51a4b1888d81b225df19b6557a081835c0
…ctor

fac39c1 wallet: document that tx in CreateTransaction is purely an out-param (MarcoFalke)
faac315 Remove unused and confusing CTransaction constructor (MarcoFalke)

Pull request description:

  The constructor is confusing and dangerous (as explained in the TODO), fix that by removing it.

ACKs for top commit:
  laanwj:
    Code review ACK fac39c1
  promag:
    Code review ACK fac39c1.
  theStack:
    Code review ACK fac39c1

Tree-SHA512: e0c8cffce8d8ee0166b8e1cbfe85ed0657611e26e2af0d69fde70eceaa5d75cbde3eb489af0428fe4fc431360b4c791fb1cc21b8dee7d4c7a4f17df00836229d
fade619 Move TX_MAX_STANDARD_VERSION to policy (MarcoFalke)

Pull request description:

  `primitives` should only be used for the raw datastructures (parsing and format). It is not the right place to document relay policy.

ACKs for top commit:
  laanwj:
    Code review ACK fade619
  lontivero:
    Concept ACK bitcoin@fade619

Tree-SHA512: f809c4aecd14d7e9feaa7b50b9c0697232991eef36190cd960bcfb0ad6e20c71a4f6aab48c7747cf8a681eb14feda60c55b09a37f128673d519567224f29cd97
…ected

Backport notice:
 - data have real blocks from testnet
 - due to big gap in blocks before checkpoints (half-year) for sack of this test is added one more checkpoint, otherwise blocks are not accepted due to non-mockable time for other chains except regtest
 - data for 2 blocks in split chain are generated locally for testnet
--------------
333317c test: Test that low difficulty chain fork is rejected (MarcoFalke)
fa31dc1 test: Pass down correct chain name in tests (MarcoFalke)

Pull request description:

  To prevent OOM, Bitcoin Core will reject chain forks at low difficulty by default. This is the only use-case of checkpoints, so add a test for it to make sure the feature works as expected. If it didn't work, checkpoints would have no use-case and we might as well remove them

ACKs for top commit:
  Sjors:
    Thanks for adding the node 1 example. Code review ACK 333317c

Tree-SHA512: 90dffa540d0904f3cffb61d2382b1a26f84fe9560b7013e4461546383add31a8757b350616a6d43217c59ef7b8b2a1b62bb3bab582c679cbb2c660a782ce7be1
1ef2138 lint: run mypy over contrib/devtools (fanquake)

Pull request description:

  wumpus mentioned on IRC that we don't currently run `mypy` over the `contrib/devtools` directory, and that it would likely be worthwhile given bitcoin#20434. This just adds that dir to the linter, as well as some missing annotations to fix existing errors. Note that now we require Python 3.6 we can make use of variable annotations.

  master (patched to check contrib devtools):
  ```bash
  test/lint/lint-python.sh
  contrib/devtools/symbol-check.py:154: error: Incompatible types in assignment (expression has type "List[str]", variable has type "str")
  contrib/devtools/circular-dependencies.py:35: error: Need type annotation for 'deps' (hint: "deps: Dict[<type>, <type>] = ...")
  contrib/devtools/circular-dependencies.py:67: error: Need type annotation for 'closure' (hint: "closure: Dict[<type>, <type>] = ...")
  Found 4 errors in 3 files (checked 187 source files)
  ```

  I haven't quite gone as far as to add annotations like
  ```python
  CHECKS: Dict[str, List[Tuple[str, Callable[[Any], bool]]]] = {...
  ```
  to `symbol-check.py`.

ACKs for top commit:
  laanwj:
    ACK 1ef2138

Tree-SHA512: a58c2ece588c640289dc1d35dad5b1b8732788272daa0965d6bf44ee8a7f7c8e8585f94d233ac41c84b9ffcfc97841a00fe2c9acba41f58fd164f01de4b6512b
ac24af4 ci: use Ubuntu Focal for macOS cross build (fanquake)

Pull request description:

  I had assumed Cirrus was spinning up Docker containers to run the CI,
  however we are actaully running on the Cirrus machines themselves. See
  `DANGER_RUN_CI_ON_HOST` and in the logs:
  ```bash
  Running on host system without docker wrapper
  ```

  So with this change we will actually be using Focal for the macOS cross build.

  Follow up to bitcoin#21036.

  This originally contained Windows changes, and an attempt to get Cirrus running without `DANGER_RUN_CI_ON_HOST`, however that seems non-trival, so Windows changes have been dropped from here for now.

ACKs for top commit:
  MarcoFalke:
    cr ACK ac24af4

Tree-SHA512: 587ba5acf741bcefecf1bc262fa1177f565ebfa9de56125eca19ed3c7db7b9aabfb96866e9c140681b88cb7015a3ded2bc6b4b1b235543d6f6e9dfc6984d569f
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

// Changing the default transaction version requires a two step process: first
// adapting relay policy by bumping TX_MAX_STANDARD_VERSION, and then later
// allowing the new transaction version in the wallet/RPC.
static constexpr decltype(CTransaction::nVersion) TX_MAX_STANDARD_VERSION{3};
Copy link

@UdjinM6 UdjinM6 Apr 3, 2024

Choose a reason for hiding this comment

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

20611: nit: could probably use CTransaction::SPECIAL_VERSION here

Suggested change
static constexpr decltype(CTransaction::nVersion) TX_MAX_STANDARD_VERSION{3};
static constexpr decltype(CTransaction::nVersion) TX_MAX_STANDARD_VERSION{CTransaction::SPECIAL_VERSION};

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that's not dash code but backported, I'd prefer to keep as it is.

They do not re-use definitions:

static const int32_t CURRENT_VERSION=2;
static constexpr decltype(CTransaction::nVersion) TX_MAX_STANDARD_VERSION{2};

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.

utACK c865338

@PastaPastaPasta PastaPastaPasta merged commit 49e480f into dashpay:develop Apr 3, 2024
4 of 11 checks passed
@knst knst deleted the bp-v22-p3 branch April 3, 2024 14:40
PastaPastaPasta added a commit that referenced this pull request Aug 9, 2024
, bitcoin#24178, bitcoin#24171, bitcoin#25404, bitcoin#25514, bitcoin#25720, partial bitcoin#23832, bitcoin#24169, bitcoin#25454 (headers backports)

c92b0f5 merge bitcoin#25720: Reduce bandwidth during initial headers sync when a block is found (Kittywhiskers Van Gogh)
0f9ece0 merge bitcoin#25514: Move CNode::nServices and CNode::nLocalServices to Peer (Kittywhiskers Van Gogh)
c9923ca partial bitcoin#25454: Avoid multiple getheaders messages in flight to the same peer (Kittywhiskers Van Gogh)
26d477b revert: Fix duplicate initial headers sync (Kittywhiskers Van Gogh)
abccb2d test: drop genesis block from `blockheader_testnet3` (Kittywhiskers Van Gogh)
0574a7d merge bitcoin#25404: Use MAX_BLOCKS_TO_ANNOUNCE consistently (Kittywhiskers Van Gogh)
ed871d2 merge bitcoin#24171: Sync chain more readily from inbound peers during IBD (Kittywhiskers Van Gogh)
a04290f merge bitcoin#24178: Respond to getheaders if we have sufficient chainwork (Kittywhiskers Van Gogh)
bcafa28 merge bitcoin#24909: Move and rename pindexBestHeader, fHavePruned (Kittywhiskers Van Gogh)
70485cb partial bitcoin#24169: Add --enable-c++20 option (Kittywhiskers Van Gogh)
27e885d merge bitcoin#23880: Serialize cmpctblock at most once in NewPoWValidBlock (Kittywhiskers Van Gogh)
9f7ac69 merge bitcoin#24024: Remove cs_main lock annotation from ChainstateManager.m_blockman (Kittywhiskers Van Gogh)
9399f90 partial bitcoin#23832: Changes time variables from int to chrono (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * Dependent on #6085

  * Dependency for #6098

  * ~~[bitcoin#25514](bitcoin#25514) removes `peers.spvNodeConnections` and `peers.fullNodeConnections` reporting from `CalculateNumConnectionsChangedStats` as the services flags used to distingush between the two have been moved to the `Peer` struct, accessable only through `PeerManager`.~~

    ~~As `PeerManager` isn't accessable to `CConnman`, even if a new public function was exposed through `PeerManger` (as we have for `IsInvInFilter` and others or we try to access the value through `GetNodeStateStats`), `CConnman` would be unable to leverage it.~~ Resolved with patch by UdjinM6, thanks!

  * [bitcoin#23880](bitcoin#23880) introduces code that is not valid C++20 (but valid C++17) and therefore, required a partial backport of [bitcoin#24169](bitcoin#24169) (fae6790) to make the code C++20 legal.

  * [bitcoin#25454](bitcoin#25454) introduces a 10-point penalty for remitting more than `MAX_BLOCKS_TO_ANNOUNCE` unconnected block headers. `blockheader_testnet3.hex` (introduced in [bitcoin#16551](bitcoin#16551), part of [dash#5963](#5963)), unlike in Bitcoin, includes the genesis block.

    By definition of a genesis block, there is no block before it that connects to, which causes the 10-point penalty to trip and `p2p_dos_header_tree.py` to fail (see below). This has been remedied by removing the genesis block from the test data to match upstream and also because no node has a good reason to ever broadcast the genesis block as-is over P2P.

    <details>

    <summary>Test Failure</summary>

    ```
    dash@6a2649cc721f:/src/dash$ ./test/functional/p2p_dos_header_tree.py
    2024-06-17T17:59:35.874000Z TestFramework (INFO): Initializing test directory /tmp/dash_func_test_h5hfluy1
    2024-06-17T17:59:36.892000Z TestFramework (INFO): Read headers data
    2024-06-17T17:59:36.895000Z TestFramework (INFO): Feed all non-fork headers, including and up to the first checkpoint
    2024-06-17T17:59:38.411000Z TestFramework (ERROR): Assertion failed
    Traceback (most recent call last):
      File "/src/dash/test/functional/test_framework/test_framework.py", line 158, in main
        self.run_test()
      File "./test/functional/p2p_dos_header_tree.py", line 53, in run_test
        assert {
    AssertionError
    2024-06-17T17:59:38.913000Z TestFramework (INFO): Stopping nodes
    2024-06-17T17:59:39.917000Z TestFramework (WARNING): Not cleaning up dir /tmp/dash_func_test_h5hfluy1
    2024-06-17T17:59:39.917000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/dash_func_test_h5hfluy1/test_framework.log
    2024-06-17T17:59:39.917000Z TestFramework (ERROR):
    2024-06-17T17:59:39.917000Z TestFramework (ERROR): Hint: Call /src/dash/test/functional/combine_logs.py '/tmp/dash_func_test_h5hfluy1' to consolidate all logs
    2024-06-17T17:59:39.917000Z TestFramework (ERROR):
    2024-06-17T17:59:39.917000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    2024-06-17T17:59:39.917000Z TestFramework (ERROR): https://github.com/dashpay/dash/issues
    2024-06-17T17:59:39.917000Z TestFramework (ERROR):
    ```

    </details>

  * [bitcoin#25454](bitcoin#25454) has a goal similar to [dash#2032](#2032) (and its predecessor, [dash#1589](#1589)), namely, avoiding `getheaders`(`2`) duplication to the same peer. Unfortunately, Dash's mitigation seems to conflict with Bitcoin's mitigation and this results in `feature_minchainwork.py` failing (see below). This has been remedied by partially reverting [dash#2032](#2032).

    <details>

    <summary>Test Failure</summary>

    ```
    dash@1bebec413839:/src/dash$ ./test/functional/feature_minchainwork.py
    2024-08-01T17:29:41.116000Z TestFramework (INFO): Initializing test directory /tmp/dash_func_test_co8xkx43
    2024-08-01T17:29:42.145000Z TestFramework (INFO): Testing relay across node 1 (minChainWork = 101)
    2024-08-01T17:29:42.145000Z TestFramework (INFO): Generating 49 blocks on node0
    [...]
    2024-08-01T17:29:51.707000Z TestFramework (INFO): Generating one more block
    2024-08-01T17:29:51.709000Z TestFramework (INFO): Verifying nodes are all synced
    2024-08-01T17:30:51.989000Z TestFramework (ERROR): Assertion failed
    Traceback (most recent call last):
      File "/src/dash/test/functional/test_framework/test_framework.py", line 159, in main
        self.run_test()
      File "./test/functional/feature_minchainwork.py", line 101, in run_test
        self.sync_all()
      File "/src/dash/test/functional/test_framework/test_framework.py", line 811, in sync_all
        self.sync_blocks(nodes)
      File "/src/dash/test/functional/test_framework/test_framework.py", line 777, in sync_blocks
        raise AssertionError("Block sync timed out after {}s:{}".format(
    AssertionError: Block sync timed out after 60s:
      '00ab061e30aebd2f97153d26cd72f921af896f05c6469ad73c7de4fc283d9590'
      '00ab061e30aebd2f97153d26cd72f921af896f05c6469ad73c7de4fc283d9590'
      '000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e'
    2024-08-01T17:30:52.490000Z TestFramework (INFO): Stopping nodes
    2024-08-01T17:30:53.495000Z TestFramework (WARNING): Not cleaning up dir /tmp/dash_func_test_co8xkx43
    2024-08-01T17:30:53.495000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/dash_func_test_co8xkx43/test_framework.log
    2024-08-01T17:30:53.495000Z TestFramework (ERROR):
    2024-08-01T17:30:53.495000Z TestFramework (ERROR): Hint: Call /src/dash/test/functional/combine_logs.py '/tmp/dash_func_test_co8xkx43' to consolidate all logs
    2024-08-01T17:30:53.495000Z TestFramework (ERROR):
    2024-08-01T17:30:53.495000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    2024-08-01T17:30:53.495000Z TestFramework (ERROR): https://github.com/dashpay/dash/issues
    2024-08-01T17:30:53.495000Z TestFramework (ERROR):
    ```

    </details>

  * [bitcoin#25720](bitcoin#25720) introduces a new test, `p2p_initial_headers_sync.py`, to validate that when a client has a stale tip, it will only engage in headers sync with one peer (emit a `getheaders2`\* message).

    Unmodified, this test fails (see below) as while the backport deals with one source of `getheaders2` messages, the test setup unwittingly triggers another ([source](https://github.com/dashpay/dash/blob/2379462294da884d925b5a80acec20fbc360309f/src/net_processing.cpp#L5446-L5448)), specifically, allowing the `pindexBestHeader->GetBlockTime() > GetAdjustedTime() - nMaxTipAge` condition to evaluate `true`.

    This is because, unlike in Bitcoin test suite's `setup_chain()` ([source](https://github.com/bitcoin/bitcoin/blob/22d96d76ab02fc73e7fe0d810bacee4c982df085/test/functional/test_framework/test_framework.py#L379-L385)), Dash sets the mocktime to match the mock chain ([source](https://github.com/dashpay/dash/blob/2379462294da884d925b5a80acec20fbc360309f/test/functional/test_framework/test_framework.py#L408-L416)) during setup, while the test assumes that the mock chain is stale enough to not trigger this source of `getheaders2` messages.

    As the tip is barely stale, it emits the `getheaders2` message, which is detected, causing the test to fail. This has been remedied by overriding `setup_chain()` to behave more like Bitcoin's test suite.

    _\* - `getheaders2` is a Dash-specific message that is courtesy of compressed headers, Bitcoin would be checking for `getheaders`_

    <details>

    <summary>Test Failure</summary>

    ```
    dash@6a2649cc721f:/src/dash$ ./test/functional/p2p_initial_headers_sync.py
    2024-06-17T21:24:09.921000Z TestFramework (INFO): Initializing test directory /tmp/dash_func_test_3gypo3ab
    2024-06-17T21:24:10.681000Z TestFramework (INFO): Adding a peer to node0
    2024-06-17T21:24:11.684000Z TestFramework (INFO): Connecting two more peers to node0
    2024-06-17T21:24:13.689000Z TestFramework (INFO): Verify that peer2 and peer3 don't receive a getheaders after connecting
    2024-06-17T21:24:15.193000Z TestFramework (ERROR): Assertion failed
    Traceback (most recent call last):
      File "/src/dash/test/functional/test_framework/test_framework.py", line 158, in main
        self.run_test()
      File "./test/functional/p2p_initial_headers_sync.py", line 60, in run_test
        assert "getheaders2" not in peer2.last_message
    AssertionError
    2024-06-17T21:24:15.695000Z TestFramework (INFO): Stopping nodes
    2024-06-17T21:24:16.698000Z TestFramework (WARNING): Not cleaning up dir /tmp/dash_func_test_3gypo3ab
    2024-06-17T21:24:16.698000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/dash_func_test_3gypo3ab/test_framework.log
    2024-06-17T21:24:16.699000Z TestFramework (ERROR):
    2024-06-17T21:24:16.699000Z TestFramework (ERROR): Hint: Call /src/dash/test/functional/combine_logs.py '/tmp/dash_func_test_3gypo3ab' to consolidate all logs
    2024-06-17T21:24:16.699000Z TestFramework (ERROR):
    2024-06-17T21:24:16.699000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    2024-06-17T21:24:16.699000Z TestFramework (ERROR): https://github.com/dashpay/dash/issues
    2024-06-17T21:24:16.699000Z TestFramework (ERROR):
    ```

    </details>

  ## Checklist:

  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas
  - [x] I have added or updated relevant unit/integration/functional/e2e tests
  - [x] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

Top commit has no ACKs.

Tree-SHA512: 16b7c42195e197e8b6800c3425b4ff15a124b0e3e0da5c98ca6e22486b52c4ea82f2f05b83e28e838860b1ce76daa1e435c5eae4fb7591a161f26a5fff6189cc
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.

6 participants