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#19698, #20079, #20566, #20715, #20868, #21012, #21188, #21200, #21205, #21211, #21293 #6069

Merged
merged 11 commits into from
Jun 21, 2024

Conversation

knst
Copy link
Collaborator

@knst knst commented Jun 20, 2024

What was done?

Backports from bitcoin v22

How Has This Been Tested?

Run unit and 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

MarcoFalke added 2 commits June 20, 2024 02:25
fac7ab1 refactor: Use C++17 std::array where possible (MarcoFalke)

Pull request description:

  Using the C++11 std::array with explicit template parameters is problematic because overshooting the size will fill the memory with default constructed types.

  For example,

  ```cpp
  #include <array>
  #include <iostream>

  int main()
  {
      std::array<int, 3> a{1, 2};
      for (const auto& i : a) {
          std::cout << i << std::endl;  // prints "1 2 0"
      }
  }
  ```

ACKs for top commit:
  jonasschnelli:
    Code Review ACK fac7ab1
  practicalswift:
    cr ACK fac7ab1
  vasild:
    ACK fac7ab1
  promag:
    Code review ACK fac7ab1.

Tree-SHA512: ef7e872340226e0d6160e6fd66c6ca78b2ef9c245fa0ab27fe4777aac9fba8d5aaa154da3d27b65dec39a6a63d07f1063c3a8ffb667a98ab137756a1a0af2656
…ssage

faaad1b p2p: Ignore version msgs after initial version msg (MarcoFalke)
fad68af p2p: Ignore non-version msgs before version msg (MarcoFalke)

Pull request description:

  Handshake misbehaviour doesn't cost us more than any other unknown message, so it seems odd to treat it differently

ACKs for top commit:
  jnewbery:
    utACK faaad1b
  practicalswift:
    ACK faaad1b: patch looks correct

Tree-SHA512: 9f30c3b5c1f6604fd02cff878f10999956152419a3dd9825f8267cbdeff7d06787418b41c7fde8a00a5e557fe89204546e05d5689042dbf7b07fbb7eb95cddff
@knst knst added this to the 21 milestone Jun 20, 2024
MarcoFalke added 2 commits June 20, 2024 12:19
faff399 ci: Fuzz with integer sanitizer (MarcoFalke)

Pull request description:

  Otherwise the suppressions file will go out of sync

ACKs for top commit:
  practicalswift:
    cr ACK faff399: patch looks correct

Tree-SHA512: 349216d071a2c5ccf24565fe0c52d7a570ec148d515d085616a284f1ab9992ce10ff82eb17962dddbcda765bbd3a9b15e8b25f34bdbed99fc36922d4161d307c
c943282 validation: remove redundant check on pindex (jarolrod)

Pull request description:

  This removes a redundant check on `pindex` being a `nullptr`. By the time we get to this step `pindex` is always a `nullptr` as the branch where it has been set would have already returned.

  Closes bitcoin#19223

ACKs for top commit:
  Zero-1729:
    re-ACK c943282
  ajtowns:
    ACK c943282 - code review only
  MarcoFalke:
    review ACK c943282 📨
  theStack:
    re-ACK c943282

Tree-SHA512: d2dc58206be61d2897b0703ee93af67abed492a80e84ea03dcfbf7116833173da3bdafa18ff80422d5296729d5254d57cc1db03fdaf817c8f57c62c3abef673c
MarcoFalke and others added 7 commits June 20, 2024 12:23
…n bitcoin-wallet

fa61b9d util: Add ArgsManager::GetCommand() and use it in bitcoin-wallet (MarcoFalke)
7777105 refactor: Move all command dependend checks to ExecuteWalletToolFunc (MarcoFalke)
fa06bce test: Add tests (MarcoFalke)
fac05cc wallet: [refactor] Pass ArgsManager to WalletAppInit (MarcoFalke)

Pull request description:

  This not only moves the parsing responsibility out from the wallet tool, but it also makes it easier to implement bitcoin-util bitcoin#19937

  Fixes: bitcoin#20902

ACKs for top commit:
  ajtowns:
    ACK fa61b9d
  fjahr:
    Code review ACK fa61b9d

Tree-SHA512: 79622b806e8bf9dcd0dc24a8a6687345710df57720992e83a41cd8d6762a6dc112044ebc58fcf6e8fbf45de29a79b04873c5b8c2494a1eaaf902a2884703e47b
… in net processing

fafddfa scripted-diff: Remove shadowing lock annotations (MarcoFalke)

Pull request description:

  Would be good to not redundantly copy the lock annotation from the class declaration to the member implementation. Otherwise it may not result in a compile failure if a new lock requirement is added to the member implementation, but not the class declaration.

ACKs for top commit:
  amitiuttarwar:
    ACK `fafddfadda`, confirmed that the annotations removed were all redundant. confirmed the claim of potential issue :)
  hebasto:
    ACK fafddfa
  jonatack:
    Light utACK fafddfa verified that the removed annotations in the definitions correspond to those in their respective declarations

Tree-SHA512: ea095c6d4e0bedd70d4e2d8a42b06cfd90c161ebfcaac13558c5dc065601a732e5f812f332104b7daa087aa57b8b0242b177799d22eef7628d77d4d87f443bf2
c5da274 build: actually stop configure if Boost isn't available (fanquake)
cad8b52 build: explicitly install libboost-dev package (fanquake)

Pull request description:

  If Boost is not found via AX_BOOST_BASE, we don't actually stop
  configuring, only a warning is emitted:
  ```bash
  checking for boostlib >= 1.58.0 (105800)... configure: We could not detect the boost libraries (version MINIMUM_REQUIRED_BOOST or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.
  ```

  Instead we usually fail when one of the other AX_BOOST_* macros fails to find a library. These macros are slowly being
  removed, and in any case, it makes more sense to fail earlier if Boost is missing.

  If Boost is unavailable, the failure now looks like:
  ```bash
  checking for boostlib >= 1.58.0 (105800)... configure: We could not detect the boost libraries (version 1.58.0 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.
  configure: error: Boost is not available!
  ```

  Note that we now just pass the version into AX_BOOST_BASE, which fixes it's display in the output (rather than showing `MINIMUM_REQUIRED_BOOST`).

  This PR also has a commit that adds `libboost-dev` to our install instructions and CI. This package is currently installed as a side-effect of installing our other libboost-*-dev packages. However as those continue to disappear, it makes sense to install boost-dev explicitly.

ACKs for top commit:
  laanwj:
    Code review ACK c5da274
  MarcoFalke:
    Concept ACK c5da274

Tree-SHA512: f866062f9d7d3a2316b6c887f17c664b9cfff41fdc0cb99ca79d641240fb01a5ae0d34140e515bc465219e1b43d5ca84f7c55f48b9c5b45a80ff2795dafd072b
22220ef test: Move P2WSH_OP_TRUE to shared test library (MarcoFalke)

Pull request description:

  Otherwise it can't be used in other tests (unit, fuzz, bench, ...)

ACKs for top commit:
  darosior:
    ACK 22220ef

Tree-SHA512: 1b636e751281291f7c21ac51c3d014f6a565144c9482974391c516228e756442b077655eda970eb8bdb12974b97855a909b2b60d518026a8d5f41aa15ec7cbc8
…ction tests and assert backwards compatibility

5786a81 Verify that all validation flags are backward compatible (gzhao408)
b10ce9a [test] check verification flags are minimal/maximal (gzhao408)
a260c22 [test] Check for invalid flag combinations (gzhao408)
a7098a2 [refactor] use CheckTxScripts, TrimFlags, FillFlags (gzhao408)
7a77727 Apply minimal validation flags to tx_invalid tests (gzhao408)
9532591 [test] add BADTX setting for invalid txns that fail CheckTransaction (gzhao408)
4c06ebf [test] fix two witness tests in invalid tests with empty vout (gzhao408)
158a0b2 Apply maximal validation flags to tx_valid tests (gzhao408)
0a76a39 [test] fix CSV test missing OP_ADD (gzhao408)
19db590 [test] remove unnecessary OP_1s from CSV and CLTV tests (gzhao408)

Pull request description:

  This uses the first 4 commits of bitcoin#15045, rebased and added some comments. The diff is quite large already and I want to make it easy to review, so I'm splitting it into 2 PRs (transaction and script). Script one is WIP, I'll link it when I open it.

  Interpretation of scripts is dependent on the script verification flags passed in.
  In tests, we should always apply **maximal** verification flags when checking that a transaction is **valid**; any additional flags should invalidate the transaction. A transaction should not be valid because we forgot to include a flag, and we should apply all flags by default.
  We should apply **minimal** verification flags when asserting that a transaction is **invalid**; if verification flags are applied, removing any one of them should mean the transaction is valid.
  New verify flags must be backwards compatible; tests should check backwards compatibility and apply the new flags by default. All `tx_invalid` tests should continue to be invalid with the exact same verify flags. All `tx_valid` tests that don't pass with new flags should _explicitly_ indicate that the flags need to be excluded, and fail otherwise.

  1. Flip the meaning of `verifyFlags` in tx_valid.json to mean _excluded_ verification flags instead of included flags. Edit the test data accordingly.
  2. Trim unneeded flags from tx_invalid.json.
  3. Add check to verify that tx_valid tests have maximal flags and tx_invalid tests have minimal flags.
  4. Add checks to verify that flags are soft forks (bitcoin#10699) i.e. adding any flag should only decrease the number of acceptable scripts. Test by adding/removing random flags.

ACKs for top commit:
  achow101:
    ACK 5786a81
  laanwj:
    ACK 5786a81

Tree-SHA512: 19195d8cf3299e62f47dd3443ae4a95430c5c9d497993a18ab80de9e24b1869787af972774993bf05717784879bc4592fdabaae0fddebd437963d8f3c96d9a73
…gical-OR

df8f2a1 test: Replace accidentally placed bit-OR with logical-OR (Hennadii Stepanov)

Pull request description:

  This PR is a follow up of bitcoin#19698.

ACKs for top commit:
  glozow:
    utACK bitcoin@df8f2a1

Tree-SHA512: 36aba3e952850deafe78dd39775a568e89e867c8a352f511f152bce7062f614f5bb4f23266dbb33da5292c9ee6da5ccefce117e3168621c71d2140c8e7f58460
…iwallet.generate()

faa137e test: Speed up rpc_blockchain.py by removing miniwallet.generate() (MarcoFalke)
fa1fe80 test: Change address type from P2PKH to P2WSH in rpc_blockchain (MarcoFalke)
fa4d8f3 test: Cache 25 mature coins for ADDRESS_BCRT1_P2WSH_OP_TRUE (MarcoFalke)
fad2515 test: Remove unused bug workaround (MarcoFalke)
faabce7 test: Start only the number of nodes that are needed (MarcoFalke)

Pull request description:

  Speed up various tests:

  * Remove unused nodes, which only consume time on start/stop
  * Remove unused "bug workarounds"
  * Remove the need for `miniwallet.generate()` by adding `miniwallet.scan_blocks()`. (On my system, with valgrind, generating 105 blocks takes 3.31 seconds. Rescanning 5 blocks takes 0.11 seconds.)

ACKs for top commit:
  laanwj:
    Code review ACK faa137e

Tree-SHA512: ead1988d5aaa748ef9f8520af1e0bf812cf1d72e281ad22fbd172b7306d850053040526f8adbcec0b9a971c697a0ee7ee8962684644d65b791663eedd505a025
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 4e81732; LGTM

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 4e81732

@PastaPastaPasta PastaPastaPasta merged commit 91e9dd4 into dashpay:develop Jun 21, 2024
5 of 8 checks passed
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.

5 participants