Commit Graph

25646 Commits

Author SHA1 Message Date
Kittywhiskers Van Gogh
81b1247e6d
refactor: remove CActiveMasternodeManager global, move to NodeContext 2024-04-12 17:01:24 +00:00
Kittywhiskers Van Gogh
c99fb42ddf
refactor: remove CMasternodeSync global, move to NodeContext 2024-04-12 17:01:24 +00:00
Kittywhiskers Van Gogh
a247a63d70
refactor: make CTxMemPool ProTx paths conditional on CDeterministicMNManager presence
Despite removeUnchecked not explicitly requiring CDeterministicMNManager,
it has also been made conditional due to addUnchecked requiring the manager
and allowing for some operations but not others when pertaining to a
transaction type could allow inconsistencies to arise. Better to treat as
one unit and skip both if manager isn't present.
2024-04-12 17:01:24 +00:00
Kittywhiskers Van Gogh
1fedf470cd
test: add type annotation for ADDRS in p2p_addrv2_relay
Required to avoid unhappy python linter[1] result. Have to use annotation
instead of re-aligning with upstream (where ADDRS is populated in the
global state) due to reliance on `self.mocktime`, without which, the test
fails[2]

[1] - https://gitlab.com/dashpay/dash/-/jobs/6594035886
[2] - https://gitlab.com/dashpay/dash/-/jobs/6597322548
2024-04-12 16:55:07 +00:00
Kittywhiskers Van Gogh
022b76f20b
merge bitcoin#23218: Use mocktime for ping timeout 2024-04-12 16:55:07 +00:00
Kittywhiskers Van Gogh
45d9e58023
merge bitcoin#22960: Set peertimeout in write_config 2024-04-12 16:55:06 +00:00
Kittywhiskers Van Gogh
06e909b737
merge bitcoin#22604: address rate-limiting follow-ups 2024-04-12 16:55:06 +00:00
Kittywhiskers Van Gogh
60b3e08ed1
merge bitcoin#22616: address relay fixups 2024-04-12 16:55:06 +00:00
Kittywhiskers Van Gogh
8b8fbc5226
merge bitcoin#22618: Small follow-ups to 21528 2024-04-12 16:55:05 +00:00
Kittywhiskers Van Gogh
18fe765988
merge bitcoin#21528: Reduce addr blackholes 2024-04-12 16:55:05 +00:00
Kittywhiskers Van Gogh
c1874c6615
net_processing: gate m_tx_relay access behind !IsBlockOnlyConn()
In bitcoin#21528, the value of `m_addr_relay_enabled` isn't determined
until the first ADDR/ADDRV2/GETADDR call. Until then, it'll always default
to `false`. This creates a false-negative where a term equivalent to "not
a block connection" no longer reliably means that.

Therefore we need to switch to directly querying "not a block-only
connection".
2024-04-12 16:55:05 +00:00
Kittywhiskers Van Gogh
602d13d2a2
merge bitcoin#22387: Rate limit the processing of rumoured addresses 2024-04-12 16:40:58 +00:00
Kittywhiskers Van Gogh
fe66202c05
merge bitcoin#22211: relay I2P addresses even if not reachable (by us) 2024-04-12 16:38:36 +00:00
Kittywhiskers Van Gogh
7e08db55fe
merge bitcoin#22306: Improvements to p2p_addr_relay.py 2024-04-12 16:38:35 +00:00
Kittywhiskers Van Gogh
ff3497c18b
merge bitcoin#21843: enable GetAddr, GetAddresses, and getnodeaddresses by network
continuation of cf27db8574 from dash#5491

includes:
- 6c98c09
- 3f89c0e
- ce6bca8
2024-04-12 16:38:34 +00:00
Kittywhiskers Van Gogh
51edeb082c
merge bitcoin#21594: add network field to getnodeaddresses 2024-04-12 16:37:49 +00:00
pasta
7aa8f54c0f
Merge #5976: backport: bitcoin#17934, #21338, #21390, #21445, #21602, #21606, #21609, #21676, bitcoin-core/gui#260,
21ad71c578 Merge #21676: test: Use mocktime to avoid intermittent failure in rpc_tests (MarcoFalke)
76a41eb245 Merge #21602: rpc: add additional ban time fields to listbanned (MarcoFalke)
adea52a5fe Merge bitcoin-core/gui#260: Handle exceptions instead of crash (W. J. van der Laan)
7e023c394f Merge #17934: doc: Use CONFIG_SITE variable instead of --prefix option (fanquake)
bc6e3ed6e4 Merge #21606: fuzz: Extend psbt fuzz target a bit (MarcoFalke)
233fb245f7 Merge #21445: cirrus: Use SSD cluster for speedup (fanquake)
a224b800e4 Merge #21609: ci: increase CPU count of sanitizer job to increase memory limit (MarcoFalke)
ad947099a0 test: remove exception for util::Ref which doesn't exist more (Konstantin Akimov)
6674ee85ab Merge #21390: test: Test improvements for UTXO set hash tests (MarcoFalke)
e10eec249b Merge #21338: test: add functional test for anchors.dat (MarcoFalke)
d9c31d6817 Merge #21411: test: add logging, reduce blocks, move sync_all in wallet_ groups (MarcoFalke)

Pull request description:

  ## Issue being fixed or feature implemented
  Regular backports from bitcoin v22

  ## Note for reviewers:
  PRs bitcoin#17934 and bitcoin#21606 have been backported partially in past.

  ## What was done?
  Removed unused sanitizer rules (see bitcoin#21366 and dashpay/dash#5055)
   - bitcoin/bitcoin#21338
   - bitcoin/bitcoin#21390
   - bitcoin/bitcoin#21609
   - bitcoin/bitcoin#21445
   - bitcoin/bitcoin#21606
   - bitcoin/bitcoin#17934
   - bitcoin-core/gui#260
   - bitcoin/bitcoin#21602
   - bitcoin/bitcoin#21676

  ## How Has This Been Tested?
  Run unit/functional tests

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] 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
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  PastaPastaPasta:
    utACK 21ad71c578

Tree-SHA512: 94276d56255300d7d8c056d15b468720ba028d83cc585b16396e8bad90157e9e010490be239e09cccd4362f575f8df2d56dde3fb505745376c7790d70e3635cd
2024-04-12 10:30:27 -05:00
pasta
54ea9260d4
Merge #5974: backport: bitcoin#19522, #19809, #20993, #21075, #21126, #21138, #21221, #21354, #21542
005a6b104a fix: format string in llmq/commitment - mismatched arguments (Konstantin Akimov)
4774e1e8f6 Merge #19809: log: Prefix log messages with function name and source code location if -logsourcelocations is set (Wladimir J. van der Laan)
43a94f0580 fix: adjust functional tests due to dash's support of thread name after v0.12 (Konstantin Akimov)
085120d9f9 Merge #20993: test: store subversion (user agent) as string in msg_version (MarcoFalke)
e866b43160 Merge #21542: ci: Bump macOS VM image to the latest version (fanquake)
a3702534e5 Merge #21354: build, doc: Drop no longer required packages from macOS cross-compiling dependencies (fanquake)
6bcc86ad3b Merge #21221: [tools] Allow argument/parameter bin packing in clang-format (MarcoFalke)
318c7263d0 Merge #19522: build: fix building libconsensus with reduced exports for Darwin targets (Wladimir J. van der Laan)
88a45d4a9a Merge #21138: ci: Re-run wine tests once if they fail (fanquake)
4abb768456 Merge #21126: ci: Properly bump to focal for win cross build (fanquake)
f254f77d75 Merge #21075: doc: Fix markdown formatting (MarcoFalke)

Pull request description:

  ## Issue being fixed or feature implemented
  Regular backports from bitcoin v22 and related fixes

  ## What was done?
  Follow-up fixes for  bitcoin#19809
  Backports:
   - bitcoin/bitcoin#21075
   - bitcoin/bitcoin#21126
   - bitcoin/bitcoin#21138
   - bitcoin/bitcoin#19522
   - bitcoin/bitcoin#21221
   - bitcoin/bitcoin#21354
   - bitcoin/bitcoin#21542
   - bitcoin/bitcoin#19809
   - bitcoin/bitcoin#20993

  ## How Has This Been Tested?
  Run unit/functional tests

  ## Breaking Changes
  N/A
  Notice, that function name is included now by default to logs with `-logfunctionnames` and many logs have function name twice now such as:
  ```
   node0 2024-04-06T20:13:56.564123Z (mocktime: 2014-12-04T17:15:38Z) [httpworker.3] [masternode/sync.cpp:331] [NotifyHeaderTip] CMasternodeSync::NotifyHeaderTip -- pindexNew->nHeight: 5 fInitialDownload=0
  ```
  For further development need to take it in account and do not use more direct calls `__func__` from code as well as reduce usages in codebase.

  ## Checklist:
  - [x] 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
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  PastaPastaPasta:
    utACK 005a6b104a

Tree-SHA512: f98949c4605dda7d6dfe790554e1d31a8c8178b57520578fcd58178c68fe7af33c0d66a79865683c1357de9a73fa4f484eb828b28e11ca110b8e1915c1fcf9b3
2024-04-12 10:20:15 -05:00
pasta
938fd23447
Merge #5973: backport: bitcoin#18772, #20690, #20789, #20813, #21531, bitcoin-core/gui#13, #72, 115, #139, #171
a2f190deff Merge bitcoin-core/gui#115: Replace "Hide tray icon" option with positive "Show tray icon" one (Jonas Schnelli)
65b80e76b7 Merge #21531: test: remove qt byteswap compattests (MarcoFalke)
ba883c5da2 Merge bitcoin-core/gui#139: doc: Improve gui/src/qt README.md (MarcoFalke)
368c65d050 Merge bitcoin-core/gui#72: util: Log static plugins meta data and used style (Jonas Schnelli)
317777e7d7 Merge bitcoin-core/gui#171: Use layout manager for Create Wallet dialog (MarcoFalke)
83313a5603 Merge bitcoin#20789: Rework strong and weak net enum fuzzing (MarcoFalke)
4a3e3af6e7 Merge #20813: scripted-diff: Bump copyright headers (MarcoFalke)
e36eacd868 Merge #18772: rpc: calculate fees in getblock using BlockUndo data (MarcoFalke)
41a1e10954 Merge #20690: Clean up logging of outbound connection type (MarcoFalke)
648d6f04fb Merge bitcoin-core/gui#13: Hide peer detail view if multiple are selected (Jonas Schnelli)

Pull request description:

  ## Issue being fixed or feature implemented
  Regular backports from bitcoin v22

  ## What was done?
   - bitcoin-core/gui#13
   - bitcoin-core/gui#115
   - bitcoin/bitcoin#20690
   - bitcoin/bitcoin#18772
   - bitcoin/bitcoin#20813
   - bitcoin/bitcoin#20789
   - bitcoin-core/gui#171
   - bitcoin-core/gui#72
   - bitcoin-core/gui#139
   - bitcoin/bitcoin#21531

  ## How Has This Been Tested?
  Run unit/functional tests

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] 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
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  PastaPastaPasta:
    utACK a2f190deff

Tree-SHA512: 29421e7ca38583c47f49c2605775f34b64ae2fb6aeb45ac42941fbc78598fc26e7f7a248b40fcc2c9fd21154b0a6f2aed64287a8b7cca43de1b99ae3dccd990f
2024-04-12 10:16:32 -05:00
pasta
5fdaa4558c
Merge #5966: refactor: rearrange database initialization, trim globals use in net and net processing, move CheckSpecialTx into CSpecialTxProcessor
191b3de9b4 refactor: move CheckSpecialTx into CSpecialTxProcessor (Kittywhiskers Van Gogh)
91f4588f71 refactor: const the pointer of type `const CActiveMasternodeManager` (Kittywhiskers Van Gogh)
1d9b7fad0f refactor: trim globals use in net processing functions (Kittywhiskers Van Gogh)
2a4fdbff1a refactor: trim globals use in net threads and functions (Kittywhiskers Van Gogh)
ff825acaac init: load databases of governance dependencies before loading its own (Kittywhiskers Van Gogh)
cf940e8d85 init: decouple CMasternodeMetaMan construction from initialization (Kittywhiskers Van Gogh)
fae5696d82 init: move CActiveMasternodeManager construction before PeerManager (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * Dependency for https://github.com/dashpay/dash/pull/5980

  * `CActiveMasternodeManager` construction is moved upwards (_before_ `PeerManager` construction) to avoid having to pass it as a `std::unique_ptr` const-ref. Shouldn't have any effect since _initialization_ is done in `ThreadImport`.

  * `CConnman::SetNetworkActive` will require a pointer to `CMasternodeSync` in order to call `CMasternodeSync::Reset()`. As it is no longer available as a global, it will need to be manually called through for the effect to happen as the `CConnman` constructor will simply pass a `nullptr` when calling `SetNetworkActive`, bypassing the `Reset()` call.

    `CMasternodeSync` is appropriately passed through in RPC (`setnetworkactive`) and interfaces.

  * `CheckSpecialTx` was moved into `CSpecialTxProcessor` to avoid having to expose `CDeterministicMNManager` to `MemPoolAccept` (though it has been exposed to `CChainstateHelper` through a helper, `CChainState::ChainHelper()` that was introduced in this PR).
    * As a drawback, some RPC functions that otherwise only needed access to `CDeterministicMNManager`, will also be accessing `CChainstateHelper`.

  ## Concerns

  * ~~Some tests seem to sporadically fail (fail as part of a suite but succeed when run individually, no changes in this PR should worsen resource contention) but attempting to reproduce them reliably hasn't succeeded so far.~~

    It appears the sporadic failure is shown in `p2p_node_network_limited.py` during TSan runs (see [failed run](https://gitlab.com/dashpay/dash/-/jobs/6529052189) for commit f95ffa7b70d5d20b6321ff11d37ad52425d446d1 that then succeeded in a [second attempt](https://gitlab.com/dashpay/dash/-/jobs/6530402585) versus a similar [failed run](https://gitlab.com/dashpay/dash/-/jobs/6546952668) for e210cb734e16e0ecef9601251fe0e074ed86827e that also succeeded on [second try](https://gitlab.com/dashpay/dash/-/jobs/6549470339)). Similar behaviour has not been observed on `develop` (as of this writing is 27c0813c08).

  ## Breaking changes

  `CMasternodeSync::Reset()` will not be called on every `CConnman` entity instantiated. Behaviour changes as a result of that are not substantiated. Protocol, networking or interface changes are not expected, changes are primarily refactoring.

  ## Checklist:
    _Go over all the following points, and put an `x` in all the boxes that apply._
  - [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 **(note: N/A)**
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    utACK 191b3de9b4

Tree-SHA512: 73a79818b0a79e3f26f079019c078ec8f81b2dae17638f695243b87fa76e9bed906a33ad7dd4e600f699100c5e994628cbb596e78a7802fa630c91f4d69cce4c
2024-04-12 10:15:08 -05:00
Konstantin Akimov
ceefab5226
fix: feature_backwards compatible works now with as expected if no bdb compiled
It is follow-up fixes for bitcoin#20267
2024-04-12 17:34:03 +07:00
Konstantin Akimov
b20f812674
fix: follow-up fixes for functional tests used protx
Since bitcoin#20267 changes default wallet in functional tests from legacy
wallets to descriptor wallets, we need to enforce --legacy-wallets for
functional tests that used protx which doesn't work yet for descriptor wallets
2024-04-12 17:31:57 +07:00
W. J. van der Laan
655146d5e7
Merge #21302: wallet: createwallet examples for descriptor wallets
5039e0e55a7c9dd63a38c12fa60d244592de69e0 test: HelpExampleCliNamed and HelpExampleRpcNamed (Ivan Metlushko)
591735ef0bf13b94643b794518406f981fa5dcb7 rpc: Add HelpExampleCliNamed and use it for `createwallet` doc (Wladimir J. van der Laan)
5d5a90e819d23a302f9bec6b995a3116ead6ae94 rpc: Add HelpExampleRpcNamed (Ivan Metlushko)

Pull request description:

  Rationale: make descriptor wallets more visible and just a bit easier to setup

  `bitcoin-cli help createwallet`

  **Before**:
  ```
  Examples:
  > bitcoin-cli createwallet "testwallet"
  > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createwallet", "params": ["testwallet"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
  ```

  **After**
  ```
  Examples:
  > bitcoin-cli createwallet "testwallet"
  > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createwallet", "params": ["testwallet"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
  > bitcoin-cli createwallet "descriptors" false false "" true true true
  > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createwallet", "params": ["descriptors", false, false, "", true, true, true]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
  ```

ACKs for top commit:
  laanwj:
    Tested ACK 5039e0e55a7c9dd63a38c12fa60d244592de69e0

Tree-SHA512: d37210e6ce639addee881377092d8f6fb2a537a60a259c561899e24cf68a0254d7ff45a213573c938f626677e46770cd21113aae5974f26c66b9a2e137699c14
2024-04-12 12:31:49 +07:00
fanquake
99a8b60393
Merge #21063: wallet, rpc: update listdescriptors response format
2e5f7def22e1b212fbd69e9147145d9d1f408aaf wallet, rpc: update listdescriptors response format (Ivan Metlushko)

Pull request description:

  Update `listdescriptors` response format according to [RPC interface guidelines](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#rpc-interface-guidelines).

  This is a follow up for #20226

  **Before:**
  ```
  Result:
  [                               (json array) Response is an array of descriptor objects
    {                             (json object)
      "desc" : "str",             (string) Descriptor string representation
      "timestamp" : n,            (numeric) The creation time of the descriptor
      "active" : true|false,      (boolean) Activeness flag
      "internal" : true|false,    (boolean, optional) Whether this is internal or external descriptor; defined only for active descriptors
      "range" : [                 (json array, optional) Defined only for ranged descriptors
        n,                        (numeric) Range start inclusive
        n                         (numeric) Range end inclusive
      ],
      "next" : n                  (numeric, optional) The next index to generate addresses from; defined only for ranged descriptors
    },
    ...
  ]
  ```

  **After:**
  ```
  Result:
  {                                 (json object)
    "wallet_name" : "str",          (string) Name of wallet this operation was performed on
    "descriptors" : [               (json array) Array of descriptor objects
      {                             (json object)
        "desc" : "str",             (string) Descriptor string representation
        "timestamp" : n,            (numeric) The creation time of the descriptor
        "active" : true|false,      (boolean) Activeness flag
        "internal" : true|false,    (boolean, optional) Whether this is internal or external descriptor; defined only for active descriptors
        "range" : [                 (json array, optional) Defined only for ranged descriptors
          n,                        (numeric) Range start inclusive
          n                         (numeric) Range end inclusive
        ],
        "next" : n                  (numeric, optional) The next index to generate addresses from; defined only for ranged descriptors
      },
      ...
    ]
  }
  ```

ACKs for top commit:
  achow101:
    re-ACK 2e5f7def22e1b212fbd69e9147145d9d1f408aaf
  meshcollider:
    utACK 2e5f7def22e1b212fbd69e9147145d9d1f408aaf
  jonatack:
    re-ACK 2e5f7def22e1b212fbd69e9147145d9d1f408aaf

Tree-SHA512: 49bf73e46e2a61003ce594a4bfc506eb9592ccb799c2909c43a1a527490a4b4009f78dc09f3d47b4e945d3d7bb3cd2632cf48c5ace5feed5066158cc010dddc1
2024-04-12 12:31:49 +07:00
Wladimir J. van der Laan
6ee2c7cc59
Merge #21277: wallet: listdescriptors uses normalized descriptor form
a69c3b35f8974b378a87a3e42d331bd4147e07df wallet: listdescriptors uses normalized descriptor form (Ivan Metlushko)

Pull request description:

  Rationale: show importable descriptors with `listdescriptors` RPC

  It uses #19136 to derive xpub at the last hardened step.

  **Before**:
  ```
  [
      {
        "desc": "wpkh(tpubD6NzVbkrYhZ4YUQRJL49TWw1VR5v3QKUNYaGGMUfJUm19x5ZqQ2hEiPiYbAQvD2nHoPGQGPg3snLPM8sjmYpvx7XQhkmyfk8xhsUwKbXzyh/84'/1'/0'/0/*)#p4cn3erf",
        "timestamp": 1613982591,
        "active": true,
        "internal": false,
        "range": [
          0,
          999
        ],
        "next": 0
      },
      ...
  ]
  ```

  **After**:
  ```
  [
    {
      "desc": "wpkh([d4ade89c/84'/1'/0']tpubDDUEYcVXy6Vh5meHvcXN3sAr4k3fWwLZGpAHbkAHL8EnkDxp4d99CjNhJHfM2fUJicANvAKnCZS6XaVAgwAeKYc1KesGCN5qbQ25qQHrRxM/0/*)#8wq8rcft",
      "timestamp": 1613982591,
      "active": true,
      "internal": false,
      "range": [
        0,
        999
      ],
      "next": 0
    },
    ...
  ]
  ```

ACKs for top commit:
  achow101:
    ACK a69c3b35f8974b378a87a3e42d331bd4147e07df

Tree-SHA512: 4f92e726cb8245aa0b520729cfd272945f0c66830f0555544e0618883aca516318543fa6ab1862058c64b4e4ed54ad1da953e032f4846eef7454122031c1b005
2024-04-12 12:31:49 +07:00
Samuel Dobson
8bacdbf71f
Merge #19136: wallet: add parent_desc to getaddressinfo
de6b389d5db7b8426313c5be6fbd290f992c5aa8 tests: Test getaddressinfo parent_desc (Andrew Chow)
e4ac869a0a0083e2e3af3b56301bd5c8e0cf650b rpc: Add parent descriptor to getaddressinfo output (Andrew Chow)
bbe4a36152fb8d9c8c3682ca2380f1c88cca61cb wallet: Add GetDescriptorString to DescriptorScriptPubKeyMan (Andrew Chow)
9be1437c49f986e8ed964d5f863b4bbcec340751 descriptors: Add ToNormalizedString and tests (Andrew Chow)

Pull request description:

  Adds `parent_desc` field to the `getaddressinfo` RPC to export a public descriptor. Using the given address, `getaddressinfo` will look up which `DescriptorScriptPubKeyMan` can be used to produce that address. It will then return the descriptor for that `DescriptorScriptPubKeyMan` in the `parent_desc` field. The descriptor will be in a normalized form where the xpub at the last hardened step is derived so that the descriptor can be imported to other wallets. Tests are added to check that the correct descriptor is being returned for the wallet's addresses and that these descriptors can be imported and used in other wallets.

  As part of this PR, a `ToNormalizedString` function is added to the descriptor classes. This really only has an effect on `BIP32PubkeyProvider`s that have hardened derivation steps. Tests are added to check that normalized descriptors are returned.

ACKs for top commit:
  Sjors:
    utACK de6b389d5db7b8426313c5be6fbd290f992c5aa8
  S3RK:
    Tested ACK de6b389
  jonatack:
    Tested ACK de6b389d5db7b8426313c5be6fbd290f992c5aa8 modulo a few minor comments
  fjahr:
    Code review ACK de6b389d5db7b8426313c5be6fbd290f992c5aa8
  meshcollider:
    Tested ACK de6b389d5db7b8426313c5be6fbd290f992c5aa8

Tree-SHA512: a633e4a39f2abbd95afd7488484cfa66fdd2651dac59fe59f2b80a0940a2a4a13acf889c534a6948903d701484a2ba1218e3081feafe0b9a720dccfa9e43ca2b
2024-04-12 12:31:49 +07:00
Konstantin Akimov
f567de007a
chore: release notes for 5965 with wallet tool improvements 2024-04-12 12:31:48 +07:00
Konstantin Akimov
0daf360edf
chore: add TODO to implement mnemonic for descriptor wallets 2024-04-11 02:37:04 +07:00
Konstantin Akimov
5016294307
chore: move functional test wallet_multiwallet from category "slow 5 minutes" to "fast test" 2024-04-11 02:37:03 +07:00
Konstantin Akimov
ef7ce87c1b
fix: remove workarounds introduced due to missing bitcoin#20267 (bdb is not compiled)
This partially reverts commit da8e5639ee.
Also it adds missing changed from bitcoin#16404
2024-04-11 02:37:03 +07:00
Wladimir J. van der Laan
06b2d85bb4
partial Merge #20267: Disable and fix tests for when BDB is not compiled
Backport notice: changes in feature_notification.py are missing due to #18878 is not done yet

49797c3ccfbb9f7ac9c1fbb574d35b315c103805 tests: Disable bdb dump test when no bdb (Andrew Chow)
1194cf9269e6c4bf67b09c4766f42bf173d12c0a Fix wallet_send.py wallet setup to work with descriptors (Andrew Chow)
fbaea7bfe44822710a36601c6b0febbd5e33dfbd Require legacy wallet for wallet_upgradewallet.py (Andrew Chow)
b1b679e0ab7a9981e3e78424fe8836edd59abf6f Explicitly mark legacy wallet tests as such (Andrew Chow)
09514e1bef46444a67cde9ff13e76bd4b9f8c7ac Setup wallets for interface_zmq.py (Andrew Chow)
4d03ef9a73ceb5ef4e9d184a135bca6bdeb8c311 Use MiniWallet in rpc_net.py (Andrew Chow)
4de23824b0c711ece68f9fc007ffac12126710aa Setup wallets for interface_bitcoin_cli.py (Andrew Chow)
7c71c627d28f0cddaf2349a55336278a681c27c2 Setup wallets with descriptors for feature_notifications (Andrew Chow)
1f1bef8dbab7225884d769a45477ee11d0ebf654 Have feature_filelock.py test both bdb and sqlite, depending on compiled (Andrew Chow)
c77975abc0123b29b0eb3481b8916e7c025b7c4c Disable upgrades tests that require BDB if BDB is not compiled (Andrew Chow)
1f20cac9d41e507901a2811d6db7147d7ab0321b Disable wallet_descriptor.py bdb format check if BDB is not compiled (Andrew Chow)
3641597d7ef6f5097a9e93cab3ef7e0f9c820296 tests: Don't make any wallets unless wallet is required (Andrew Chow)
b9b88f57a9b9a28e0f0614c12ae3012cf5050b10 Skip legacy wallet reliant tests if BDB is not compiled (Andrew Chow)
6f36242389bd3e7eacf594ce90491e8ccca70f3a tests: Set descriptors default based on compilation (Andrew Chow)

Pull request description:

  This PR fixes tests for when BDB is not compiled. Tests which rely on or test legacy wallet behavior are disabled and skipped when BDB is not compiled. For the components of some tests that are for legacy wallet things, those parts of the tests are skipped.

  For the majority of tests, changes are made so that they can be run with either legacy wallets or descriptor wallets without materially effecting the test. Most tests only need the wallet for balance and transactions, so the type of wallet is not an important part of those tests. Additionally, some tests are wallet agnostic and modified to instead use the test framework's MiniWallet.

ACKs for top commit:
  laanwj:
    ACK 49797c3ccfbb9f7ac9c1fbb574d35b315c103805
  ryanofsky:
    Code review ACK 49797c3ccfbb9f7ac9c1fbb574d35b315c103805. Only change since last review is dropping last commit. Previous review w/ suggestions for future followup is https://github.com/bitcoin/bitcoin/pull/20267#pullrequestreview-581508843

Tree-SHA512: 69659f8a81fb437ecbca962f4082c12835282dbf1fba7d9952f727a49e01981d749af9b09feda1c8ca737516c7d7a08ef17e782795df3fa69892d5021b41c1ed
2024-04-11 02:37:03 +07:00
MarcoFalke
21ad71c578
Merge #21676: test: Use mocktime to avoid intermittent failure in rpc_tests
fa40d6a1c47ac7f3dc6c11a2e6642cfef95422c1 test: Reset mocktime in the common setup (MarcoFalke)
fa78590a8fffdfc7e98ddb1f81218f05b1935a0a test: Use mocktime to avoid intermittent failure (MarcoFalke)

Pull request description:

  See https://github.com/bitcoin/bitcoin/pull/21602#discussion_r611176103

ACKs for top commit:
  jonatack:
    Code review ACK fa40d6a1c47ac7f3dc6c11a2e6642cfef95422c1
  jarolrod:
    ACK fa40d6a1c47ac7f3dc6c11a2e6642cfef95422c1

Tree-SHA512: 4967e006f3d2c4eb92f03c9086a6abe3190ad54755d251c30d20422c574bb1a154c06f3d5bcb0d4deaa3c4abfd3864d743b71d84897edd358e829bb42233ad12
2024-04-11 02:26:04 +07:00
MarcoFalke
76a41eb245
Merge #21602: rpc: add additional ban time fields to listbanned
d3b0b08b0f04d2f1dbebbafd7ab0384dfe045dec doc: release notes for new listbanned fields (Jarol Rodriguez)
60290d3f5ec8e7e3b8cb1ebae02d5d72f6005184 test: increase listbanned unit test coverage (Jon Atack)
3e978d1a5dbd43f85bd03e759984ab1f209d6e34 rpc: add time_remaining field to listbanned (Jarol Rodriguez)
5456b345312857981cb426712f0665800c682e09 rpc: add ban_duration field to listbanned (Jarol Rodriguez)
c95c61657afd058b46549fb3d65633d7c736f5fc doc: improve listbanned help (Jarol Rodriguez)
dd3c8eaa3399b28dc78a883ff78cbe7cc5c31b5b rpc: swap position of banned_until and ban_created fields (Jarol Rodriguez)

Pull request description:

  This PR adds a `ban_duration` and `time_remaining` field to the `listbanned` RPC command. Thanks to jonatack, this PR also expands the `listbanned` test coverage to include these new fields

  It's useful to keep track of `ban_duration` as this is another data point on which to sort banned peers. I found this helpful in adding additional context columns to the GUI `bantablemodel` as part of a follow-up PR. As [suggested](https://github.com/bitcoin/bitcoin/pull/21602#issuecomment-813486134) by jonatack, `time_remaining` is another useful user-centric data point.

  Since a ban always expires after its created, the `ban_created` field is now placed before the `banned_until` field. This new ordering is more logical.

  This PR also improves the `help listbanned` output by providing additional context to the descriptions of the `address`, `ban_created`, and `banned_until` fields.

  **Master: listbanned**
  ```
  [
    {
      "address": "1.2.3.4/32",
      "banned_until": 1617691101,
      "ban_created": 1617604701
    },
    {
      "address": "135.181.41.129/32",
      "banned_until": 1649140716,
      "ban_created": 1617604716
    }
  ]
  ```

  **PR: listbanned**
  ```
  [
    {
      "address": "1.2.3.4/32",
      "ban_created": 1617775773,
      "banned_until": 1617862173,
      "ban_duration": 86400,
      "time_remaining": 86392
    },
    {
      "address": "3.114.211.172/32",
      "ban_created": 1617753165,
      "banned_until": 1618357965,
      "ban_duration": 604800,
      "time_remaining": 582184
    }
  ]
  ```

ACKs for top commit:
  jonatack:
    re-ACK d3b0b08b0f04d2f1dbebbafd7ab0384dfe045dec
  hebasto:
    ACK d3b0b08b0f04d2f1dbebbafd7ab0384dfe045dec, tested on Linux Mint 20.1 (x86_64).
  MarcoFalke:
    review ACK d3b0b08b0f04d2f1dbebbafd7ab0384dfe045dec 🕙

Tree-SHA512: 5b83ed2483344e546d57e43adc8a1ed7a1fff292124b14c86ca3a1aa2aec8b0f7198212fabff2c5145e7f726ca04ae567fe667b141254c7519df290cf63774e5
2024-04-11 02:26:04 +07:00
W. J. van der Laan
adea52a5fe
Merge bitcoin-core/gui#260: Handle exceptions instead of crash
b8e5d0d3fe3386807d47f50d13ac34fcd2a538fd qt: Handle exceptions in SendCoinsDialog::sendButtonClicked slot (Hennadii Stepanov)
1ac2bc7ac070dfd1df1872d759540b0c92495301 qt: Handle exceptions in TransactionView::bumpFee slot (Hennadii Stepanov)
bc00e13bc800863641b3e1e64732a38418d3022f qt: Handle exceptions in WalletModel::pollBalanceChanged slot (Hennadii Stepanov)
eb6156ba1b4c303eb597e3fc4a9e42ce45e6e78d qt: Handle exceptions in BitcoinGUI::addWallet slot (Hennadii Stepanov)
f7e260a471010e2d656fbc5ea8c310f6d94c26b9 qt: Add GUIUtil::ExceptionSafeConnect function (Hennadii Stepanov)
64a8755af396f1c2791018510e22b58114e68594 qt: Add BitcoinApplication::handleNonFatalException function (Hennadii Stepanov)
af7e365b1516d660d271475fdfe0c20ae09e66a8 qt: Make PACKAGE_BUGREPORT link clickable (Hennadii Stepanov)

Pull request description:

  This PR is an alternative to https://github.com/bitcoin/bitcoin/pull/18897, and is based on Russ' [idea](https://github.com/bitcoin/bitcoin/pull/18897#pullrequestreview-418703664):
  > IMO it would be nice to have a followup PR that eliminated the one-line forwarding methods ...

  Related issues
  - #91
  - https://github.com/bitcoin/bitcoin/issues/18643

  Qt docs: https://doc.qt.io/qt-5.12/exceptionsafety.html#exceptions-in-client-code

  With this PR the GUI handles the wallet-related exception, and:
  - display it to a user:

  ![Screenshot from 2021-04-01 02-55-59](https://user-images.githubusercontent.com/32963518/113226183-33ff8480-9298-11eb-8fe6-2168834ab09a.png)

  - prints a message to `stderr`:
  ```

  ************************
  EXCEPTION: 18NonFatalCheckError
  wallet/wallet.cpp:2677 (IsCurrentForAntiFeeSniping)
  Internal bug detected: '!chain.findBlock(block_hash, FoundBlock().time(block_time))'
  You may report this issue here: https://github.com/bitcoin/bitcoin/issues

  bitcoin in QPushButton->SendCoinsDialog

  ```

  - writes a message to the `debug.log`
  - and, if the exception is a non-fatal error, leaves the main window running.

ACKs for top commit:
  laanwj:
    Code review ACK b8e5d0d3fe3386807d47f50d13ac34fcd2a538fd
  ryanofsky:
    Code review ACK b8e5d0d3fe3386807d47f50d13ac34fcd2a538fd. This is great! I think more improvements are possible but implementation is very clean and I love how targeted each commit is. Changes since last review: adding more explanatory text, making links clickable, reorganizing.

Tree-SHA512: a9f2a2ee8e64b993b0dbc454edcbc39c68c8852abb5dc1feb58f601c0e0e8014dca81c72733aa3fb07b619c6f49b823ed20c7d79cc92088a3abe040ed2149727
2024-04-11 02:26:03 +07:00
fanquake
7e023c394f
Merge #17934: doc: Use CONFIG_SITE variable instead of --prefix option
223b1ba7d90509a47ea07af46f4b9c3b8efbc9f8 doc: Use CONFIG_SITE instead of --prefix (Hennadii Stepanov)

Pull request description:

  The current examples of `--prefix=...` option usage to point `configure` script to appropriate `depends` directory is not [standard](https://www.gnu.org/prep/standards/html_node/Directory-Variables.html). This causes some [confusion](https://github.com/bitcoin/bitcoin/pull/16691) and a bit of inconvenience.

  Consider a CentOS 7 32 bit system. Packages `libdb4-devel`, `libdb4-cxx-devel`, `miniupnpc-devel` and `zeromq-devel` are unavailable from repos. After recommended build with depends:
  ```
  cd depends
  make
  cd ..
  ./autogen.sh
  ./configure --prefix=$PWD/depends/i686-pc-linux-gnu
  make
  ```
  a user is unable to `make install` compiled binaries neither locally (to `~/.local`) nor system-wide (to `/usr/local`) as `--prefix` is set already.

  Meanwhile, the standard approach with using [`config.site`](https://www.gnu.org/software/automake/manual/html_node/config_002esite.html) files allows both possibilities:

  ```
  cd depends
  make
  cd ..
  ./autogen.sh
  CONFIG_SITE=$PWD/depends/i686-pc-linux-gnu/share/config.site ./configure --prefix ~/.local
  make
  make install
  ```

  or

  ```
  CONFIG_SITE=$PWD/depends/i686-pc-linux-gnu/share/config.site ./configure
  make
  sudo make install  # install to /usr/local
  ```

  Moreover, this approach is used in [Gitian descriptors](https://github.com/bitcoin/bitcoin/tree/master/contrib/gitian-descriptors) already.

ACKs for top commit:
  practicalswift:
    ACK 223b1ba7d90509a47ea07af46f4b9c3b8efbc9f8: patch looks correct
  fanquake:
    ACK 223b1ba7d90509a47ea07af46f4b9c3b8efbc9f8

Tree-SHA512: 46d97924f0fc7e95ee4566737cf7c2ae805ca500e5c49af9aa99ecc3acede4b00329bc727a110aa1b62618dfbf5d1ca2234e736f16fbdf96d6ece5f821712f54
2024-04-11 02:26:03 +07:00
MarcoFalke
bc6e3ed6e4
Merge #21606: fuzz: Extend psbt fuzz target a bit
faaf3954e2f0089b6c6b9965f15e7f9af09c6fb0 fuzz: Extend psbt fuzz target a bit (MarcoFalke)

Pull request description:

  Previously it only merged the psbt with itself, now it tries to merge another.

ACKs for top commit:
  practicalswift:
    Tested ACK faaf3954e2f0089b6c6b9965f15e7f9af09c6fb0

Tree-SHA512: e1b1d31a47d35e1767285bc2fda176c79cb0550d6d383fe467104272e61e1c83f6cbc0c7d6bbc0c3027729eec13ae1f289f8950117ee91e0fb3703e66d5e6918
2024-04-11 02:26:03 +07:00
fanquake
233fb245f7
Merge #21445: cirrus: Use SSD cluster for speedup
fa212391ce0bb04669bc5205553a71e653f5ad48 cirrus: Use SSD cluster for speedup (MarcoFalke)

Pull request description:

  Haven't tested, but this might be faster: https://twitter.com/fedor/status/1354505744293502980

ACKs for top commit:
  fanquake:
    ACK fa212391ce0bb04669bc5205553a71e653f5ad48 - going to merge this now given there is a speedup, and it's enough to fix the fuzz task the is continually timing out.

Tree-SHA512: b24161ba2ed16fcf23ac6098100b04f7f6eb8936bb312a35fcd8e632568b877bfc09a1e522836fe298a2cd87a53a91e3b501a7f2e1c81cc0edb57c59aecffb0d
2024-04-11 02:26:02 +07:00
MarcoFalke
a224b800e4
Merge #21609: ci: increase CPU count of sanitizer job to increase memory limit
de3ae78eff257302dd45e57e38067f72e970a123 ci: increase CPU count of sanitizer job to increase memory limit (fanquake)

Pull request description:

  According to the [docs](https://cirrus-ci.org/guide/linux/#linux-containers):
  > For each CPU you can't get more than 4G of memory.

  thus if we want this job to have 24GB of memory, we need to increase the CPU count to 6.

  It's currently [failing with](https://github.com/bitcoin/bitcoin/runs/2273962280):
  >  Requested memory is too high! You can request at most 4G per CPU

Top commit has no ACKs.

Tree-SHA512: 0a4da5649d061425190a373859274c78ca5587cd2d6e27905ec548f124ed114a0133215cb2eff22ffc182f50c3a53df58e7c9832b44db6e37d7ea59ec96a4775
2024-04-11 02:26:02 +07:00
Konstantin Akimov
ad947099a0
test: remove exception for util::Ref which doesn't exist more
This PR is follow-up for dash#5055 and based on bitcoin#21366 which is DNM
2024-04-11 02:26:02 +07:00
MarcoFalke
6674ee85ab
Merge #21390: test: Test improvements for UTXO set hash tests
4f2653a89018fa4d24bd2a551832a7410b682600 test: Use deterministic chain in utxo set hash test (Fabian Jahr)
4973c5175c5fd1f4791ea26e8ddefd6fb11ac1c3 test: Remove wallet dependency of utxo set hash test (Fabian Jahr)
1a27af1d7b5ec18b4248ead1eaf0f381047b4b24 rpc: Improve gettxoutsetinfo help (Fabian Jahr)

Pull request description:

  Follow-ups to #19145:
  - Small improvement on the help text of RPC gettxoutsetinfo
  - Using deterministic blockchain in the test `functional/feature_utxo_set_hash.py`
  - Removing wallet dependency in the test `functional/feature_utxo_set_hash.py`

  Split out of #19521.

ACKs for top commit:
  MarcoFalke:
    review ACK 4f2653a89018fa4d24bd2a551832a7410b682600 👲

Tree-SHA512: 92927b3aa22b6324eb4fc9d346755313dec44d973aa69a0ebf80a8569b5f3a7cf3539721ebdba183737534b9e29b3e33f412515890f0d0b819878032a3bba8f9
2024-04-11 02:26:01 +07:00
MarcoFalke
e10eec249b
Merge #21338: test: add functional test for anchors.dat
581791c62067403fbeb4e1fd88c1d80549627c94 test: add functional test for anchors.dat (bruno)

Pull request description:

  This PR adds a functional test for anchors.dat.

  It creates a node and adds 2 outbound block-relay-only connections and 5 inbound connections.
  When the node is down, anchors.dat should contain the 2 addresses from the outbound block-relay-only connections.

ACKs for top commit:
  MarcoFalke:
    Concept ACK 581791c62067403fbeb4e1fd88c1d80549627c94
  hebasto:
    ACK 581791c62067403fbeb4e1fd88c1d80549627c94

Tree-SHA512: 77038b09e36ee5ae473a26d6f566c0ed283af258c34df8486706a24f72b05abab621a293ac886d03849bc45bc28be7336137252225b25aff393baa6b5238688c
2024-04-11 02:26:01 +07:00
MarcoFalke
d9c31d6817
Merge #21411: test: add logging, reduce blocks, move sync_all in wallet_ groups
c62f9bc0e931f65eef63041d2c53f9a294c0e8d6 test: use fewer blocks in wallet_groups and move sync call (Jon Atack)
3a16b5ef95c1c25f8b78e591f985e80b41a6dbdd test: add missing logging to wallet_groups.py (Jon Atack)

Pull request description:

  - add logging (particularly useful as the tests are somewhat slow)
  - generate 101 blocks instead of 110
  - move `sync_all` call into the loop, so fewer blocks are synced on each call, to hopefully see fewer CI timeouts as in https://bitcoinbuilds.org/index.php?ansilog=88eee99e-1727-44ed-b778-3b9c75c33928.log

  ```
  L2742     File "/home/ubuntu/src/test/functional/wallet_groups.py", line 162, in run_test
  L2743       self.sync_all()
  test_framework.authproxy.JSONRPCException: 'syncwithvalidationinterfacequeue' RPC took longer than 960.000000 seconds. Consider using larger timeout for calls that take longer to return. (-344)
  ```

ACKs for top commit:
  MarcoFalke:
    cr ACK c62f9bc0e931f65eef63041d2c53f9a294c0e8d6

Tree-SHA512: 711deafcd589cb8196cb207ff882e0f2ab6b70828a6abad91f83f535974cc430a56b9e8a960fd233d31d610932a0d48b49ee681aae564d145a3040288ecda8f8
2024-04-11 02:26:01 +07:00
Konstantin Akimov
005a6b104a
fix: format string in llmq/commitment - mismatched arguments 2024-04-11 02:25:09 +07:00
Wladimir J. van der Laan
4774e1e8f6
Merge #19809: log: Prefix log messages with function name and source code location if -logsourcelocations is set
b4511e2e2ed1a6077ae6826a9ee6b7a311293d08 log: Prefix log messages with function name if -logsourcelocations is set (practicalswift)

Pull request description:

  Prefix log messages with function name if `-logfunctionnames` is set.

  Yes, exactly like `-logthreadnames` but for function names instead of thread names :)

  This is a small developer ergonomics improvement: I've found this to be a cheap/simple way to correlate log output and originating function.

  For me it beats the ordinary cycle of 1.) try to figure out a regexp matching the static part of the dynamic log message, 2.) `git grep -E 'Using .* MiB out of .* requested for signature cache'`, 3.) `mcedit filename.cpp` (`openemacs filename.cpp` works too!) and 4.) search for log message and scroll up to find the function name :)

  Without any logging parameters:

  ```
  $ src/bitcoind -regtest
  2020-08-25T03:29:04Z Using RdRand as an additional entropy source
  2020-08-25T03:29:04Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
  2020-08-25T03:29:04Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
  2020-08-25T03:29:04Z Loaded best chain: hashBestChain=0fff88f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e22ff height=0 date=2011-02-02T23:16:42Z progress=1.000000
  2020-08-25T03:29:04Z block tree size = 1
  2020-08-25T03:29:04Z nBestHeight = 0
  2020-08-25T03:29:04Z Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
  2020-08-25T03:29:04Z 0 addresses found from DNS seeds
  ```

  With `-logthreadnames` and `-logfunctionnames`:

  ```
  $ src/bitcoind -regtest -logthreadnames -logfunctionnames
  2020-08-25T03:29:04Z [init] [ReportHardwareRand] Using RdRand as an additional entropy source
  2020-08-25T03:29:04Z [init] [InitSignatureCache] Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
  2020-08-25T03:29:04Z [init] [InitScriptExecutionCache] Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
  2020-08-25T03:29:04Z [init] [LoadChainTip] Loaded best chain: hashBestChain=0fff88f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e22ff height=0 date=2011-02-02T23:16:42Z progress=1.000000
  2020-08-25T03:29:04Z [init] [AppInitMain] block tree size = 1
  2020-08-25T03:29:04Z [init] [AppInitMain] nBestHeight = 0
  2020-08-25T03:29:04Z [loadblk] [LoadMempool] Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
  2020-08-25T03:29:04Z [dnsseed] [ThreadDNSAddressSeed] 0 addresses found from DNS seeds
  ```

ACKs for top commit:
  laanwj:
    Code review ACK b4511e2e2ed1a6077ae6826a9ee6b7a311293d08
  MarcoFalke:
    review ACK b4511e2e2ed1a6077ae6826a9ee6b7a311293d08 🌃

Tree-SHA512: d100f5364630c323f31d275259864c597f7725e462d5f4bdedcc7033ea616d7fc0d16ef1b2af557e692f4deea73c6773ccfc681589e7bf6ba970b9ec169040c7
2024-04-11 02:25:08 +07:00
Konstantin Akimov
43a94f0580
fix: adjust functional tests due to dash's support of thread name after v0.12 2024-04-11 02:25:08 +07:00
MarcoFalke
085120d9f9
Merge #20993: test: store subversion (user agent) as string in msg_version
de85af5cce727981383ac0fe81f635451b331f23 test: store subversion (user agent) as string in msg_version (Sebastian Falbesoner)

Pull request description:

  It seems more natural to treat the "subversion" field (=user agent string, see [BIP 14](https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki#Proposal)) of a node as pure string rather than a bytestring within the test framework. This is also suggested with the naming prefix in `msg_version.strSubVer`: one probably wouldn't expect a field starting with "str" to be a bytestring that needs further decoding to be useful. This PR moves the encoding/decoding parts to the serialization/deserialization routines so that the user doesn't have to bother with that anymore.

  Note that currently, in the master branch the `msg_version.strSubVer` is never read (only in `msg_version.__repr__`); However, one issue that is solved by this PR came up while testing #19509 (not merged yet): A decoding script for binary message capture files takes use of the functional test framework convert it into JSON format. Bytestrings will be convered to hexstrings, while pure strings will (surprise surprise) end up without modification in the file.

  So without this patch, we get:

  ```
  $ jq . out.json | grep -m5 strSubVer
        "strSubVer": "2f5361746f7368693a32312e39392e302f"
        "strSubVer": "2f5361746f7368693a302e32302e312f"
        "strSubVer": "2f5361746f7368693a32312e39392e302f"
        "strSubVer": "2f5361746f7368693a302e32302e312f"
        "strSubVer": "2f5361746f7368693a32312e39392e302f"
  ```

  After this patch:

  ```
  $ jq . out2.json | grep -m5 strSubVer
        "strSubVer": "/Satoshi:21.99.0/"
        "strSubVer": "/Satoshi:0.20.1/"
        "strSubVer": "/Satoshi:21.99.0/"
        "strSubVer": "/Satoshi:0.20.1/"
        "strSubVer": "/Satoshi:21.99.0/"
  ```

ACKs for top commit:
  jnewbery:
    utACK de85af5cce727981383ac0fe81f635451b331f23

Tree-SHA512: ff23642705c858e8387a625537dfec82e6b8a15da6d99b8d12152560e52d243ba17431b602b26f60996d897e00e3f37dcf8dc8a303ffb1d544df29a5937080f9
2024-04-11 02:25:08 +07:00
fanquake
e866b43160
Merge #21542: ci: Bump macOS VM image to the latest version
b8e76479cea448d4e00f698fe39ab3e0228ab22d ci: Bump macOS VM image to the latest version (Hennadii Stepanov)

Pull request description:

  On Cirrus CI bump macOS VM from Catalina to Big Sur.

ACKs for top commit:
  fanquake:
    ACK b8e76479cea448d4e00f698fe39ab3e0228ab22d - I'm always going to question bumping things for the sake of it/when there's no reasoning given. In this case, moving from building on macOS 10.x to 11.x shouldn't really lose us any coverage, and may turn up potential macOS quirks a bit earlier.

Tree-SHA512: ab2daee194683ab0553328020fd2fcb918160f466cd380c542e1a9b44f5bea3664fb40b032f1b611ee0107b0efbe278230e067316e2373c3cb0470b205dd2f9d
2024-04-11 02:25:07 +07:00
fanquake
a3702534e5
Merge #21354: build, doc: Drop no longer required packages from macOS cross-compiling dependencies
f7f3829a68df173c54ab11ecfe162b840afb64e8 build, doc: Drop libbz2-dev from macOS cross-compiling dependencies (Hennadii Stepanov)
d8239362e283107657a5a6577890fdb198a1d334 build, doc: Drop libcap-dev from macOS cross-compiling dependencies (Hennadii Stepanov)

Pull request description:

  The `libcap-dev` and `libbz2-dev` packages are no longer required when cross-compiling for macOS.

ACKs for top commit:
  fanquake:
    ACK f7f3829a68df173c54ab11ecfe162b840afb64e8

Tree-SHA512: 820cdc2724f3346c0942d4d4115fc7206f7bf02889d9fa6cbdbd1d9e3afa03a067c1c3fa64dff596aefdc74898178b7c7d64027a6501486e3b606f4760de04ae
2024-04-11 02:25:07 +07:00
MarcoFalke
6bcc86ad3b
Merge #21221: [tools] Allow argument/parameter bin packing in clang-format
876ac3f6b62087fb5c22b0a477751895915d47b8 [tools] Allow argument/parameter bin packing in clang-format (John Newbery)

Pull request description:

  clang-format documentation for BinPackArguments:

  If `false`, a function call’s arguments will either be all on the same line or will have one line each.

  ```
  true:
  void f() {
    f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
  }

  false:
  void f() {
    f(aaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
  }
  ```

  https://clang.llvm.org/docs/ClangFormatStyleOptions.html#configurable-format-style-options

  There's no reason to forbid this format. Having multiple arguments or parameters per line can be just as readable as having one per line (and is certainly more readable than having extremely long lines).

ACKs for top commit:
  laanwj:
    ACK 876ac3f6b62087fb5c22b0a477751895915d47b8
  MarcoFalke:
    review ACK 876ac3f6b62087fb5c22b0a477751895915d47b8
  vasild:
    ACK 876ac3f6b62087fb5c22b0a477751895915d47b8

Tree-SHA512: 7c401b4551b458c83dd70883860788b4a60e08a5399171fef27a2f5fdc6b933f6454fe0d396c32d826e3ab537791329da3275ae9b5e9ad36630a6dc2c167e88f
2024-04-11 02:25:07 +07:00
Wladimir J. van der Laan
318c7263d0
Merge #19522: build: fix building libconsensus with reduced exports for Darwin targets
de4238f92f4c067f099663f68d9772105de81d75 build: consolidate reduced export checks (fanquake)
012bdec1b7df01906566a6526e56f27d57d1653b build: add building libconsensus to end-of-configure output (fanquake)
8f360e349e365870b40a6873917c81de714ae41a build: remove ax_gcc_func_attribute macro (fanquake)
f054a089ecfbdc4732e6f705a10e93189074f41c build: remove AX_GCC_FUNC_ATTRIBUTE test for dllimport (fanquake)
7cd0a696643a824ab6f6911278f116f01c5af662 build: test for __declspec(dllexport) in configure (fanquake)
1624e17b5430dfe808bb3b1b79dfa53bf45aa053 build: remove duplicate visibility attribute detection (fanquake)

Pull request description:

  Darwin targets do not have a `protected` visibility function attribute, see [LLVM explanation](8e9a505139/clang/lib/Basic/Targets/OSTargets.h (L131)). This means that the `AX_GCC_FUNC_ATTRIBUTE` check for `visibility` fails:
  ```bash
  configure:24513: checking for __attribute__((visibility))
  configure:24537: g++ -std=c++11 -o conftest -g -O2  -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0  -Wl,-headerpad_max_install_names conftest.cpp  >&5
  conftest.cpp:35:56: warning: target does not support 'protected' visibility; using 'default' [-Wunsupported-visibility]
                      int foo_pro( void ) __attribute__((visibility("protected")));
                                                         ^
  1 warning generated.
  configure:24537: $? = 0
  configure:24550: result: no
  ```

  This leads to `EXPORT_SYMBOL` being [defined to nothing](f4de89edfa/src/script/bitcoinconsensus.h (L29)), as `HAVE_FUNC_ATTRIBUTE_VISIBILITY` is not defined, and when building with reduced exports, you end up with a libbitcoinconsensus.dylib that doesn't export any  `_bitcoinconsensus_*` symbols.
  ```bash
  ➜  git:(master) nm -C src/.libs/libbitcoinconsensus.dylib | rg _bitcoinconsensus_
  ➜  git:(master)
  ```

  We do have a [second check](f4de89edfa/configure.ac (L882)) for the `visibility` attribute, which works for Darwin as it's only testing for default visibility, however the result of this check isn't used at all. It was added in #4725, along with the `--enable-reduce-exports` option, however when libbitcoinconsensus was added in #5235, it used the results of the added `AX_GCC_FUNC_ATTRIBUTE` calls.

  This PR removes our usage of the AX_GCC_FUNC_ATTRIBUTE macro entirely, in favour of our own checks in configure. This meant adding a check for `dllexport`, which I've tested as working with both [GCC](https://gcc.gnu.org/onlinedocs/gcc/Microsoft-Windows-Function-Attributes.html) and [Clang](https://releases.llvm.org/10.0.0/tools/clang/docs/AttributeReference.html#dllexport) when building for Windows. I haven't added an equivalent check for `dllimport`, as we weren't actually using the result of that check, we're just testing that `MSC_VER` was defined before using.

  With these changes building a libbitcoinconsensus with reduced exports, when targeting Darwin, works as expected:
  ```bash
  ./autogen.sh
  ./configure --disable-tests --disable-bench --with-utils=no --with-daemon=no --with-gui=no --disable-wallet --with-libs=yes --enable-reduce-exports
  make -j8
  ...
  nm -C src/.libs/libbitcoinconsensus.dylib | rg _bitcoinconsensus_
  000000000000a340 T _bitcoinconsensus_verify_script
  00000000000097e0 T _bitcoinconsensus_verify_script_with_amount
  000000000000a3c0 T _bitcoinconsensus_version
  ```

  ```python
  >>> import ctypes
  >>> consensus = ctypes.CDLL("src/.libs/libbitcoinconsensus.dylib")
  >>> print(consensus.bitcoinconsensus_version())
  1
  >>> exit()
  ```

  TODO: Modify a CI job to compile with --enable-reduce-exports and check for symbols in shared lib?

ACKs for top commit:
  laanwj:
    Code review ACK de4238f92f4c067f099663f68d9772105de81d75

Tree-SHA512: d148f3c55d14dac6e9e5b718cc65bb557bcf6f663218d24bc9044b86281bd5dd3d931ebea79c336a58e8ed50d683218c0a9e75494f2267b91097665043e252ae
2024-04-11 02:25:06 +07:00