Commit graph

41887 commits

Author SHA1 Message Date
Ryan Ofsky
1a7d20509f
Merge bitcoin/bitcoin#30526: doc: Correct uint256 hex string endianness
73e3fa10b4 doc + test: Correct uint256 hex string endianness (Hodlinator)

Pull request description:

  This PR is a follow-up to #30436.

  Only changes test-code and modifies/adds comments.

  Byte order of hex string representation was wrongfully documented as little-endian, but are in fact closer to "big-endian" (endianness is a memory-order concept rather than a numeric concept). `[arith_]uint256` both store their data in arrays with little-endian byte order (`arith_uint256` has host byte order within each `uint32_t` element).

  **uint256_tests.cpp** - Avoid using variable from the left side of the condition in the right side. Credits to @maflcko: https://github.com/bitcoin/bitcoin/pull/30436#discussion_r1688273553

  **setup_common.cpp** - Skip needless ArithToUint256-conversion. Credits to @stickies-v: https://github.com/bitcoin/bitcoin/pull/30436#discussion_r1688621638

  ---

  <details>
  <summary>

  ## Logical reasoning for endianness

  </summary>

  1. Comparing an `arith_uint256` (`base_uint<256>`) to a `uint64_t` compares the beginning of the array, and verifies the remaining elements are zero.
  ```C++
  template <unsigned int BITS>
  bool base_uint<BITS>::EqualTo(uint64_t b) const
  {
      for (int i = WIDTH - 1; i >= 2; i--) {
          if (pn[i])
              return false;
      }
      if (pn[1] != (b >> 32))
          return false;
      if (pn[0] != (b & 0xfffffffful))
          return false;
      return true;
  }
  ```
  ...that is consistent with little endian ordering of the array.

  2. They have the same endianness (but `arith_*` has host-ordering of each `uint32_t` element):
  ```C++
  arith_uint256 UintToArith256(const uint256 &a)
  {
      arith_uint256 b;
      for(int x=0; x<b.WIDTH; ++x)
          b.pn[x] = ReadLE32(a.begin() + x*4);
      return b;
  }
  ```

  ### String conversions

  The reversal of order which happens when converting hex-strings <=> uint256 means strings are actually closer to big-endian, see the end of `base_blob<BITS>::SetHexDeprecated`:
  ```C++
      unsigned char* p1 = m_data.data();
      unsigned char* pend = p1 + WIDTH;
      while (digits > 0 && p1 < pend) {
          *p1 = ::HexDigit(trimmed[--digits]);
          if (digits > 0) {
              *p1 |= ((unsigned char)::HexDigit(trimmed[--digits]) << 4);
              p1++;
          }
      }
  ```
  Same reversal here:
  ```C++
  template <unsigned int BITS>
  std::string base_blob<BITS>::GetHex() const
  {
      uint8_t m_data_rev[WIDTH];
      for (int i = 0; i < WIDTH; ++i) {
          m_data_rev[i] = m_data[WIDTH - 1 - i];
      }
      return HexStr(m_data_rev);
  }
  ```
  It now makes sense to me that `SetHexDeprecated`, upon receiving a shorter hex string that requires zero-padding, would pad as if the missing hex chars where towards the end of the little-endian byte array, as they are the most significant bytes. "Big-endian" string representation is also consistent with the case where `SetHexDeprecated` receives too many hex digits and discards the leftmost ones, as a form of integer narrowing takes place.

  ### How I got it wrong in #30436

  Previously I used the less than (`<`) comparison to prove endianness, but for `uint256` it uses `memcmp` and thereby gives priority to the *lower* bytes at the beginning of the array.
  ```C++
      constexpr int Compare(const base_blob& other) const { return std::memcmp(m_data.data(), other.m_data.data(), WIDTH); }
  ```

  `arith_uint256` is different in that it begins by comparing the bytes from the end, as it is using little endian representation, where the bytes toward the end are more significant.
  ```C++
  template <unsigned int BITS>
  int base_uint<BITS>::CompareTo(const base_uint<BITS>& b) const
  {
      for (int i = WIDTH - 1; i >= 0; i--) {
          if (pn[i] < b.pn[i])
              return -1;
          if (pn[i] > b.pn[i])
              return 1;
      }
      return 0;
  }
  ```
  (The commit documents that `base_blob::Compare()` is doing lexicographic ordering unlike the `arith_*`-variant which is doing numeric ordering).

  </details>

ACKs for top commit:
  paplorinc:
    ACK 73e3fa10b4
  ryanofsky:
    Code review ACK 73e3fa10b4

Tree-SHA512: 121630c37ab01aa7f7097f10322ab37da3cbc0696a6bbdbf2bbd6db180dc5938c7ed91003aaa2df7cf4a4106f973f5118ba541b5e077cf3588aa641bbd528f4e
2024-08-04 22:27:10 -04:00
Ryan Ofsky
55d19945ef
Merge bitcoin/bitcoin#29798: Logging cleanup
a7432dd6ed logging: clarify -debug and -debugexclude descriptions (Anthony Towns)
74dd33cb0a rpc: make logging method reject "0" category and correct the help text (Vasil Dimov)
8c6f3bf163 logging, refactor: minor encapsulation improvement and use BCLog::NONE instead of 0 (Vasil Dimov)
160706aa38 logging, refactor: make category special cases explicit (Ryan Ofsky)

Pull request description:

  * Move special cases from `LOG_CATEGORIES_BY_STR` to `GetLogCategory()` (suggested [here](https://github.com/bitcoin/bitcoin/pull/29419#discussion_r1547990373)).

  * Remove `"none"` and `"0"` from RPC `logging` help because that help text was wrong. `"none"` resulted in an error and `"0"` was ignored itself (contrary to what the help text suggested).

  * Remove unused `LOG_CATEGORIES_BY_STR[""]` (suggested [here](https://github.com/bitcoin/bitcoin/pull/29419#discussion_r1548018694)).

  This is a followup to https://github.com/bitcoin/bitcoin/pull/29419, addressing leftover suggestions + more.

ACKs for top commit:
  LarryRuane:
    ACK a7432dd6ed
  ryanofsky:
    Code review ACK a7432dd6ed. Only changes since last review are removing dead if statement and adding AJ's suggested -debug and -debugexclude help improvements, which look accurate and much more clear.

Tree-SHA512: 41b997b06fccdb4c1d31f57d4752c83caa744cb3280276a337ef4a9b7012a04eb945071db6b8fad24c6a6cf8761f2f800fe6d8f3d8836f5b39c25e4f11c85bf0
2024-08-04 21:05:08 -04:00
Hennadii Stepanov
eb85cacd29
Merge bitcoin-core/gui#826: OptionsDialog: Allow Maximize of window
3dbd94b661 GUI/OptionsDialog: Allow Maximize of window (Luke Dashjr)

Pull request description:

ACKs for top commit:
  hebasto:
    ACK 3dbd94b661.

Tree-SHA512: 24a94840d97510ce5760c3099a765fb2f5d107d99a8f72757f509eefdaf35cb2d4d7f3243866bf6dc635fe83bb73b422e3cae2bd161d9b4b6f2e3d77bfd27353
2024-08-04 16:29:31 +01:00
Anthony Towns
a7432dd6ed
logging: clarify -debug and -debugexclude descriptions 2024-08-04 06:43:01 +02:00
Vasil Dimov
74dd33cb0a
rpc: make logging method reject "0" category and correct the help text
Current logging RPC method documentation claims to accept "0" and "none"
categories, but the "none" argument is actually rejected and the "0"
argument is ignored. Update the implementation to refuse both
categories, and remove the help text claiming to support them.
2024-08-04 06:43:00 +02:00
Vasil Dimov
8c6f3bf163
logging, refactor: minor encapsulation improvement and use BCLog::NONE instead of 0
* Make the standalone function `LogCategoryToStr()` private inside
  `logging.cpp` (aka `static`) - it is only used in that file.

* Make the method `Logger::GetLogPrefix()` `private` - it is only
  used within the class.

* Use `BCLog::NONE` to initialize `m_categories` instead of `0`.
  We later check whether it is `BCLog::NONE` (in
  `Logger::DefaultShrinkDebugFile()`).
2024-08-04 06:42:59 +02:00
Ryan Ofsky
160706aa38
logging, refactor: make category special cases explicit
Make special cases explicit in GetLogCategory() and LogCategoryToStr()
functions. Simplify the LOG_CATEGORIES_BY_STR and LOG_CATEGORIES_BY_FLAG
mappings and LogCategoriesList() function.

This makes the maps `LOG_CATEGORIES_BY_STR` and `LOG_CATEGORIES_BY_FLAG`
consistent (one is exactly the opposite of the other).
2024-08-04 06:42:59 +02:00
Hodlinator
73e3fa10b4
doc + test: Correct uint256 hex string endianness
Follow-up to #30436.

uint256 string representation was wrongfully documented as little-endian due to them being reversed by GetHex() etc, and base_blob::Compare() giving most significance to the beginning of the internal array. They are closer to "big-endian", but this commit tries to be even more precise than that.

uint256_tests.cpp - Avoid using variable from the left side of the condition in the right side.

setup_common.cpp - Skip needless ArithToUint256-conversion.
2024-08-03 21:59:54 +02:00
glozow
2aff9a36c3
Merge bitcoin/bitcoin#30352: policy: Add PayToAnchor(P2A), OP_1 <0x4e73> as a standard output script for spending
75648cea5a test: add P2A ProduceSignature coverage (Greg Sanders)
7998ce6b20 Add release note for P2A output feature (Greg Sanders)
71c9b02a04 test: add P2A coverage for decodescript (Greg Sanders)
1349e9ec15 test: Add anchor mempool acceptance test (Greg Sanders)
9d89209937 policy: stop 3rd party wtxid malleability of anchor spend (Greg Sanders)
b60aaf8b23 policy: make anchor spend standard (Greg Sanders)
455fca86cf policy: Add OP_1 <0x4e73> as a standard output type (Greg Sanders)

Pull request description:

  This is a sub-feature taken out of the original proposal for ephemeral anchors #30239

  This PR makes *spending* of `OP_1 <0x4e73>` (i.e. `bc1pfeessrawgf`) standard. Creation of this output type is already standard.

  Any future witness output types are considered relay-standard to create, but not to spend. This preserves upgrade hooks, such as a completely new output type for a softfork such as BIP341.  It also gives us a bit of room to use a new output type for policy uses.

  This particular sized witness program has no other known use-cases (https://bitcoin.stackexchange.com/a/110664/17078), s it affords insufficient cryptographic security for a secure commitment to data, such as a script or a public key. This makes this type of output "keyless", or unauthenticated.

  As a witness program, the `scriptSig` of the input MUST be blank, by BIP141. This helps ensure txid-stability of the spending transaction, which may be required for smart contracting wallets. If we do not use segwit, a miner can simply insert an `OP_NOP` in the `scriptSig` without effecting the result of program execution.

  An additional relay restriction is to disallow non-empty witness data, which an adversary may use to penalize the "honest" transactor when RBF'ing the transaction due to the incremental fee requirement of RBF rules.

  The intended use-case for this output type is to "anchor" the transaction with a spending child to bring exogenous CPFP fees into the transaction package, encouraging the inclusion of the package in a block. The minimal size of creation and spending of this output makes it an attractive contrast to outputs like `p2sh(OP_TRUE)` and `p2wsh(OP_TRUE)` which
  are significantly larger in vbyte terms.

  Combined with TRUC transactions which limits the size of child transactions significantly, this is an attractive option for presigned transactions that need to be fee-bumped after the fact.

ACKs for top commit:
  sdaftuar:
    utACK 75648cea5a
  theStack:
    re-ACK 75648cea5a
  ismaelsadeeq:
    re-ACK 75648cea5a via [diff](e7ce6dc070..75648cea5a)
  glozow:
    ACK 75648cea5a
  tdb3:
    ACK 75648cea5a

Tree-SHA512: d529de23d20857e6cdb40fa611d0446b49989eaafed06c28280e8fd1897f1ed8d89a4eabbec1bbf8df3d319910066c3dbbba5a70a87ff0b2967d5205db32ad1e
2024-08-02 15:49:44 +01:00
Hennadii Stepanov
ec8b38c7b9
Merge bitcoin-core/gui#626: Showing Local Addresses in Node Window
189c987386 Showing local addresses on the Node Window (Jadi)
a5d7aff867 net: Providing an interface for mapLocalHost (Jadi)

Pull request description:

  This change adds a new row to the Node Window (debugwindow.ui)
  under the Network section which shows the LocalAddresses.

  fixes #564

  <!--
  *** Please remove the following help text before submitting: ***

  Pull requests without a rationale and clear improvement may be closed
  immediately.

  GUI-related pull requests should be opened against
  https://github.com/bitcoin-core/gui
  first. See CONTRIBUTING.md
  -->

  <!--
  Please provide clear motivation for your patch and explain how it improves
  Bitcoin Core user experience or Bitcoin Core developer experience
  significantly:

  * Any test improvements or new tests that improve coverage are always welcome.
  * All other changes should have accompanying unit tests (see `src/test/`) or
    functional tests (see `test/`). Contributors should note which tests cover
    modified code. If no tests exist for a region of modified code, new tests
    should accompany the change.
  * Bug fixes are most welcome when they come with steps to reproduce or an
    explanation of the potential issue as well as reasoning for the way the bug
    was fixed.
  * Features are welcome, but might be rejected due to design or scope issues.
    If a feature is based on a lot of dependencies, contributors should first
    consider building the system outside of Bitcoin Core, if possible.
  * Refactoring changes are only accepted if they are required for a feature or
    bug fix or otherwise improve developer experience significantly. For example,
    most "code style" refactoring changes require a thorough explanation why they
    are useful, what downsides they have and why they *significantly* improve
    developer experience or avoid serious programming bugs. Note that code style
    is often a subjective matter. Unless they are explicitly mentioned to be
    preferred in the [developer notes](/doc/developer-notes.md), stylistic code
    changes are usually rejected.
  -->

  <!--
  Bitcoin Core has a thorough review process and even the most trivial change
  needs to pass a lot of eyes and requires non-zero or even substantial time
  effort to review. There is a huge lack of active reviewers on the project, so
  patches often sit for a long time.
  -->

ACKs for top commit:
  pablomartin4btc:
    re-ACK 189c987386
  furszy:
    utACK 189c987

Tree-SHA512: 93f201bc6d21d81b27b87be050a447b841f01e3efb69b9eca2cc7af103023d7cd69eb5e16e2875855573ef51a5bf74a6ee6028636c1b6798cb4bb11567cb4996
2024-08-02 14:19:02 +01:00
merge-script
df241970a3
Merge bitcoin/bitcoin#30554: test: Avoid CScript() as default function argument
fa46a1b74b test: Avoid CScript() as default function argument (MarcoFalke)
fadf621825 test: Make leaf_script mandatory when scriptpath is set in TaprootSignatureMsg (MarcoFalke)

Pull request description:

  Unlike other function calls in default arguments, CScript should not cause any issues in the tests, because they are const.

  However, this change allows to enable the "function-call-in-default-argument (B008)" lint rule, which will help to catch severe test bugs, such as https://github.com/bitcoin/bitcoin/issues/30543#issuecomment-2259260024 .

  The lint rule will be enabled in a follow-up, when all violations are fixed.

ACKs for top commit:
  instagibbs:
    utACK fa46a1b74b
  theStack:
    lgtm ACK fa46a1b74b
  ismaelsadeeq:
    Tested ACK fa46a1b74b

Tree-SHA512: bc68b15121d50ead0fc70ad772360a7829908aedeaff8426efcb8a67f33117f67d26b4f5da94fa735dd8de9c9ff65fc10a29323f1b12f238b75486fa7cc32a89
2024-08-02 14:02:04 +01:00
merge-script
9c6c667bc2
Merge bitcoin/bitcoin#30574: test: Disable known broken USDT test for now
faed533743 test: Disable known broken USDT test for now (MarcoFalke)

Pull request description:

  (cherry picked from commit faf8be7c32)

  Sadly, it still happens: https://github.com/bitcoin/bitcoin/issues/27380#issuecomment-2265205214

ACKs for top commit:
  fanquake:
    ACK faed533743

Tree-SHA512: 7108c468efd31a1f062646b7b21d69ddaaa9808cdc44db75c78d7a840830f85d016d4a95571c239402f0b6639b714224720182bcda8f53b147a0be06cfbd2b25
2024-08-02 13:26:18 +01:00
MarcoFalke
faed533743
test: Disable known broken USDT test for now
(cherry picked from commit faf8be7c32)
2024-08-02 14:02:42 +02:00
merge-script
357f195391
Merge bitcoin/bitcoin#30567: qt, build: Drop QT_STATICPLUGIN macro
7231c7630e qt: Replace deprecated LogPrintf with LogInfo in GUIUtil::LogQtInfo() (Hennadii Stepanov)
b3d3ae0680 qt, build: Drop `QT_STATICPLUGIN` macro (Hennadii Stepanov)

Pull request description:

  Broken out of https://github.com/bitcoin/bitcoin/pull/30454.

  Our `QT_STATICPLUGIN` macro is effectively equivalent to the Qt's `QT_STATIC` macro.

  It is easy to see in the `_BITCOIN_QT_IS_STATIC` macro implementation: ebd82fa9fa/build-aux/m4/bitcoin_qt.m4 (L269-L292)

  No need to handle both macros.

ACKs for top commit:
  maflcko:
    re-ACK 7231c7630e
  TheCharlatan:
    ACK 7231c7630e

Tree-SHA512: abbf21859b7ac2aaf47c5b0e075403e4cc9bc540b1565d23f51650b8932dde314586aca67fd4ed5daadebc89268baf8c18f65348fa2b836078ac24543c14cfd6
2024-08-02 11:31:29 +01:00
merge-script
8e1bd17252
Merge bitcoin/bitcoin#30544: rpc: fix maybe-uninitialized compile warning in getchaintxstats
2e86f2b201 rpc: fix maybe-uninitialized compile warning in getchaintxstats (Michael Dietz)

Pull request description:

  This resolves the compiler warning about potential uninitialized use of window_tx_count introduced in fa2dada.

  The warning:
  ```
  CXX      rpc/libbitcoin_node_a-blockchain.o
  rpc/blockchain.cpp: In function ‘getchaintxstats()::<lambda(const RPCHelpMan&, const JSONRPCRequest&)>’:
  rpc/blockchain.cpp:1742:38: warning: ‘*(std::_Optional_payload_base<unsigned int>::_Storage<unsigned int, true>*)((char*)&window_tx_count + offsetof(const std::optional<unsigned int>,std::optional<unsigned int>::<unnamed>.std::_Optional_base<unsigned int, true, true>::<unnamed>)).std::_Optional_payload_base<unsigned int>::_Storage<unsigned int, true>::_M_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   1742 |                 ret.pushKV("txrate", double(*window_tx_count) / nTimeDiff);
        |
  ```

ACKs for top commit:
  maflcko:
    lgtm ACK 2e86f2b201
  theStack:
    ACK 2e86f2b201
  tdb3:
    ACK 2e86f2b201

Tree-SHA512: c087e8f1cd68dd8df734a8400d30a95abe57ebd56cd53aef4230e425b33a23aa55b3af42abfd162e3be8c937a4c27e56abb70a4fedb10e2df64d52d577e0f262
2024-08-02 10:50:34 +01:00
Jadi
189c987386 Showing local addresses on the Node Window
Adds a new row to the Node Window (debugwindow.ui)
under the Network section which shows the LocalAddresses.

fixes #564
2024-08-02 10:40:42 +03:30
Jadi
a5d7aff867 net: Providing an interface for mapLocalHost
Contributes to #564 by providing an interface for mapLocalHost
through net -> node interface -> clientModel. Later this value can be
read by GUI to show the local addresses.
2024-08-02 10:40:33 +03:30
Hennadii Stepanov
9774a958b5
Merge bitcoin/bitcoin#30548: release: Update translations for v28.0 soft translation string freeze
be419674da qt: Update translation source file (Hennadii Stepanov)
e49d858aab qt: Bump Transifex slug for 28.x (Hennadii Stepanov)
31b33019b7 qt: Pull recent translations from Transifex (Hennadii Stepanov)

Pull request description:

  This PR follows our [Release Process](4c62f4b535/doc/release-process.md).

  Note: (possible) vandalism/damage has been prevented by reverting the deletion of `bitcoin_af`, `bitcoin_es_MX`, and `bitcoin_ru` translations.

  Required to open Transifex translations for v28.0 as it's scheduled in https://github.com/bitcoin/bitcoin/issues/29891.

  The previous similar PR: https://github.com/bitcoin/bitcoin/pull/29397.

ACKs for top commit:
  stickies-v:
    ACK be419674da

Tree-SHA512: 76f7947af9c156c2aaf24c7f926f82e4d8e2664beb5ebde5c7cda8dd7a8dbf672b4a886302c8d189e0cb2145c0ed755f45f9cdb545e29d38bb1ec90ca18fa539
2024-08-01 16:26:10 +01:00
Hennadii Stepanov
7231c7630e
qt: Replace deprecated LogPrintf with LogInfo in GUIUtil::LogQtInfo() 2024-08-01 14:37:36 +01:00
Hennadii Stepanov
b3d3ae0680
qt, build: Drop QT_STATICPLUGIN macro
Our `QT_STATICPLUGIN` macro is effectively equivalent to the Qt's
`QT_STATIC` macro. No need to handle both of them.
2024-08-01 14:01:07 +01:00
glozow
ebd82fa9fa
Merge bitcoin/bitcoin#30532: refactor: remove deprecated TxidFromString() in favour of transaction_identifier::FromHex()
f553e6d86f refactor: remove TxidFromString (stickies-v)
285ab50ace test: replace WtxidFromString with Wtxid::FromHex (stickies-v)
9a0b2a69c4 fuzz: increase FromHex() coverage (stickies-v)
526a87ba6b test: add uint256::FromHex unittest coverage (stickies-v)

Pull request description:

  Since fab6ddbee6, `TxidFromString()` has been deprecated because it is less robust than the `transaction_identifier::FromHex()` introduced in [the same PR](https://github.com/bitcoin/bitcoin/pull/30482). Specifically, it tries to recover from length-mismatches, recover from untrimmed whitespace, 0x-prefix and garbage at the end, instead of simply requiring exactly 64 hex-only characters.

  In this PR, `TxidFromString` is removed completely to clean up the code and prevent further unsafe usage. Unit and fuzz test coverage on `uint256::FromHex()` and functions that wrap it is increased.

  Note: `TxidFromSring` allowed users to prefix strings with "0x", this is no longer allowed for `transaction_identifier::FromHex()`, so a helper function for input validation may prove helpful in the future _(this overlaps with the `uint256::uint256S()` vs `uint256::FromHex()` future cleanup)_. It is not relevant to this PR, though, besides the fact that this unused (except for in tests) functionality is removed.

  The only users of `TxidFromString` are:
  - `test`, where it is straightforward to drop in the new `FromHex()` methods without much further concern
  - `qt` coincontrol. There is no need for input validation here, but txids are not guaranteed to be 64 characters. This is already handled by the existing code, so again, using `FromHex()` here seems quite straightforward.

  Addresses @maflcko's suggestion: https://github.com/bitcoin/bitcoin/pull/30482#discussion_r1691826934

  Also removes `WtxidFromString()`, which is a test-only helper function.

  ### Testing GUI changes

  To test the GUI coincontrol affected lines, `regtest` is probably the easiest way to quickly get some test coins, you can use e.g.

  ```
  alias cli="./src/bitcoin-cli -regtest"
  cli createwallet "coincontrol"
  # generate 10 spendable outputs on 1 address
  cli generatetoaddress 10 $(cli -rpcwallet=coincontrol getnewaddress)
  # generate 10 spendable outputs on another address
  cli generatetoaddress 10 $(cli -rpcwallet=coincontrol getnewaddress)
  # make previous outputs spendable
  cli generatetoaddress 100 $(cli -rpcwallet=coincontrol getnewaddress)
  ```

ACKs for top commit:
  maflcko:
    re-ACK f553e6d86f 🔻
  hodlinator:
    ACK f553e6d86f
  paplorinc:
    ACK f553e6d86f
  TheCharlatan:
    Nice, ACK f553e6d86f

Tree-SHA512: c1c7e6ea4cbf05cf660ba178ffc4f35f0328f7aa6ad81872e2462fb91a6a22e4681ff64b3d0202a5a9abcb650c939561585cd309164a69ab6081c0765ee271ef
2024-08-01 12:02:52 +01:00
merge-script
dc605cf6e6
Merge bitcoin/bitcoin#30565: depends: Fix zeromq build on OpenBSD
89b1d5c818 depends: Fix `zeromq` build on OpenBSD (Hennadii Stepanov)

Pull request description:

  On the master branch @ 66e82dc90c, the `zeromq` package fails to build on OpenBSD 7.5:
  ```
  [ 19%] Building CXX object CMakeFiles/objects.dir/src/io_thread.cpp.o
  /home/hebasto/bitcoin/depends/work/build/amd64-unknown-openbsd7.5/zeromq/4.3.5-df5b1b9f936/src/io_thread.cpp:14:22: error: static_cast from 'std::nullptr_t' to 'poller_t::handle_t' (aka 'int') is not allowed
      _mailbox_handle (static_cast<poller_t::handle_t> (NULL))
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  ```

  This [regression](https://github.com/bitcoin/bitcoin/pull/29723#issuecomment-2261513105) was overlooked by me in https://github.com/bitcoin/bitcoin/pull/29723.

  This PR fixes the issue by backporting an upstream commit from https://github.com/zeromq/libzmq/pull/4659.

ACKs for top commit:
  theStack:
    tACK 89b1d5c818

Tree-SHA512: 48d22ea99dfd44c5adf858c74e64082390da27b8ccad8c0d5a91d4dabfa3d12267cef98e4bb8c088e4cd0ec477c242cb1d47aace5c88cd86f796715bba957ed8
2024-08-01 11:27:32 +01:00
glozow
b8755164cf
Merge bitcoin/bitcoin#30413: p2p: Lazy init some bloom filters; fuzz version handshake
afd237bb5d [fuzz] Harness for version handshake (dergoegge)
a90ab4aec9 scripted-diff: Rename lazily initialized bloom filters (dergoegge)
82de1bc478 [net processing] Lazily initialize m_recent_confirmed_transactions (dergoegge)
fa0c87f19c [net processing] Lazily initialize m_recent_rejects_reconsiderable (dergoegge)
662e8db2d3 [net processing] Lazily initialize m_recent_rejects (dergoegge)

Pull request description:

  This adds a fuzzing harness dedicated to the version handshake. To avoid determinism issues, the harness creates necessary components each iteration (addrman, peerman, etc). A harness like this would have easily caught https://bitcoincore.org/en/2024/07/03/disclose-timestamp-overflow/.

  As a performance optimization, this PR includes a change to `PeerManager` to lazily initialize various filters (to avoid large unnecessary memory allocations each iteration).

ACKs for top commit:
  brunoerg:
    ACK afd237bb5d
  marcofleon:
    Tested ACK afd237bb5d. I compared the coverage  of `net_processing` from this harness to the `process_message` and `process_messages` harnesses to see the differences. This target hits more specific parts of the version handshake. The stability looks good as well, at about 94%.
  glozow:
    utACK afd237bb5d lazy blooms look ok
  mzumsande:
    Code Review ACK afd237bb5d

Tree-SHA512: 62bba20aec0cd220e62368354891f9790b81ad75e8adf7b22a76a6d4663bd26aedc4cae8083658a75ea9043d60aad3f0e58ad36bd7bbbf93ff1d16e317bf15cc
2024-08-01 09:48:24 +01:00
Hennadii Stepanov
89b1d5c818
depends: Fix zeromq build on OpenBSD 2024-07-31 23:37:50 +01:00
merge-script
66e82dc90c
Merge bitcoin/bitcoin#30556: doc: multisig-tutorial: remove obsolete mention and link to closed PR
3cd24aadb2 doc: remove obsolete mention and link to closed PR (Marnix)

Pull request description:

  Remove the mention and link as the PR (https://github.com/bitcoin/bitcoin/pull/22341) is closed and the description is wrong/outdated anyway.

ACKs for top commit:
  BrandonOdiwuor:
    ACK 3cd24aadb2
  tdb3:
    ACK 3cd24aadb2

Tree-SHA512: 5cd97029337f0cdfe81b6be9401adc4fe51ae2868f8fcadcb03828531a38380a587c32840850a924b6428f62df7d20a1e16ef7414d4078e7bb2c4e359b1fae40
2024-07-31 17:25:22 +01:00
stickies-v
f553e6d86f
refactor: remove TxidFromString
TxidFromString was deprecated due to missing 64-character length-check
and hex-check, replace it with the more robust Txid::FromHex.
2024-07-31 16:47:39 +01:00
stickies-v
285ab50ace
test: replace WtxidFromString with Wtxid::FromHex
The newly introduced Wtxid::FromHex is more robust and removes
the need for a WtxidFromString helper function
2024-07-31 16:47:39 +01:00
stickies-v
9a0b2a69c4
fuzz: increase FromHex() coverage 2024-07-31 16:47:38 +01:00
stickies-v
526a87ba6b
test: add uint256::FromHex unittest coverage
Simultaneously cover transaction_identifier::FromHex()
2024-07-31 16:47:37 +01:00
merge-script
9eb57d1ab6
Merge bitcoin/bitcoin#30559: test: Try previously intermittently broken USDT test again
fa2269dd65 test: Try previously intermittently broken USDT test again (MarcoFalke)

Pull request description:

  Seems fine to try it again, given that the infra changed in the meantime.

  Should be trivial to disable again, on the first failure.

  Ref: https://github.com/bitcoin/bitcoin/issues/27380#issuecomment-1637971779

ACKs for top commit:
  fanquake:
    ACK fa2269dd65 - seems fine to re-try this now.

Tree-SHA512: e203625b49019517def8e92cc465dd947d5aa85a080d370aabce7a45442efc3900b5c3783f6cc15720f81e5aaa3ff193a26be3d33048f20a73cd7b1fce320118
2024-07-31 15:25:33 +01:00
MarcoFalke
fa46a1b74b
test: Avoid CScript() as default function argument
This does not cause any issues, because CScript in the tests are const.
However, this change allows to enable the
"function-call-in-default-argument (B008)" lint rule.
2024-07-31 15:19:10 +02:00
merge-script
174bedd8d9
Merge bitcoin/bitcoin#30547: doc: Update work in progress section in doc/design/libraries.md
f70eb0eeef doc: Remove reference to resolved issue (Daniela Brozzoni)
b27ef8ec7f doc: Update issue reference for libbitcoinkernel (Daniela Brozzoni)

Pull request description:

  - The discussion of libbitcoinkernel has moved from 24303 to 27587
  - Issue 15732 has been resolved, removing it from the document

ACKs for top commit:
  maflcko:
    ACK f70eb0eeef

Tree-SHA512: 11b597d9710504010945aae66f7e488403895aa8e1e091f3a8f6737dc128a4fde185daff8d4709cbbb69f454d3a649c4217e82a6bfc8ee2b25c8a1c047b57f1b
2024-07-31 13:38:21 +01:00
dergoegge
afd237bb5d [fuzz] Harness for version handshake 2024-07-31 13:25:52 +01:00
dergoegge
a90ab4aec9 scripted-diff: Rename lazily initialized bloom filters
-BEGIN VERIFY SCRIPT-
sed -i 's/m_recent_confirmed_transactions/m_lazy_recent_confirmed_transactions/g' $(git grep -l 'm_recent_confirmed_transactions')
sed -i 's/m_recent_rejects_reconsiderable/m_lazy_recent_rejects_reconsiderable/g' $(git grep -l 'm_recent_rejects_reconsiderable')
sed -i 's/m_recent_rejects/m_lazy_recent_rejects/g' $(git grep -l 'm_recent_rejects')
-END VERIFY SCRIPT-
2024-07-31 13:23:46 +01:00
Daniela Brozzoni
f70eb0eeef
doc: Remove reference to resolved issue
Issue #15732 has been resolved, this commit removes it from
the WIP section of the libraries document.
2024-07-31 14:22:57 +02:00
dergoegge
82de1bc478 [net processing] Lazily initialize m_recent_confirmed_transactions 2024-07-31 13:09:55 +01:00
dergoegge
fa0c87f19c [net processing] Lazily initialize m_recent_rejects_reconsiderable 2024-07-31 13:09:44 +01:00
dergoegge
662e8db2d3 [net processing] Lazily initialize m_recent_rejects 2024-07-31 13:08:20 +01:00
MarcoFalke
fa2269dd65
test: Try previously intermittently broken USDT test again
This reverts commit faf8be7c32.
2024-07-31 14:06:51 +02:00
merge-script
c6b4718112
Merge bitcoin/bitcoin#30537: kernel: Only setup kernel context globals once
93fb0e7897 kernel: Only setup kernel context globals once (TheCharlatan)

Pull request description:

  The globals setup by the function calls when creating a new kernel context only need to be setup once. Calling them multiple times may be wasteful and has no apparent benefit.

  Besides kernel users potentially creating multiple contexts, this change may also be useful for tests creating multiple setups.

ACKs for top commit:
  stickies-v:
    re-ACK 93fb0e7897
  maflcko:
    ACK 93fb0e7897 👝
  tdb3:
    re ACK 93fb0e7897

Tree-SHA512: c8418c23b34883b9b6af2b93c48760a931c246c9190fae372fb808f573408d332f53ca43b9c783eef561c4a6681e2fb63f215c939b40a87d597c0518dabea22a
2024-07-31 12:17:14 +01:00
merge-script
33884e7e60
Merge bitcoin/bitcoin#30545: test: fix intermittent failures in feature_proxy.py
a6efc7e16e test: fix intermittent failures in feature_proxy.py (Martin Zumsande)

Pull request description:

  Fixes #29871

  If addnode connections are made with v2transport and the peer immediately disconnects us, reconnections with v1 are scheduled. This could interfere with later checks depending on timing. Avoid this by using `v2transport=False` in the addnode rpc - this test isn't about the message layer anyway, so running it with v2 would add no value.

ACKs for top commit:
  maflcko:
    ACK a6efc7e16e
  tdb3:
    cr re ACK a6efc7e16e

Tree-SHA512: 39353a392e75e4c6257d971ceecb65fb76ec6d3b121a087869831c24b767a18f57e2ae2968da445c7fa731cb03053c90df37dd2cd6e86f786ad4121bc68ca235
2024-07-31 12:03:22 +01:00
merge-script
be969292db
Merge bitcoin/bitcoin#30552: test: fix constructor of msg_tx
ec5e294e4b test: fix constructor of msg_tx (Martin Zumsande)

Pull request description:

  In python, if the default value is a mutable object (here: a class) it is shared over all instances, so that one instance being changed would affect others to be changed as well.
  This was the source of #30543, and possibly various other intermittent bugs in the functional tests, see
  https://github.com/bitcoin/bitcoin/issues/29621#issuecomment-1999298224.

  Fixes #30543
  Fixes #29621
  Fixes #25128

ACKs for top commit:
  sipa:
    utACK ec5e294e4b. I believe some linters even warn about doing this.
  maflcko:
    ACK ec5e294e4b
  vasild:
    ACK ec5e294e4b ❤️
  theStack:
    ACK ec5e294e4b

Tree-SHA512: a6204fb1a326de3f9aa965f345fd658f6a4dcf78731db25cc905ff6eb8d4eeb65d14cc316305eebd89387aec8748c57c3a4f4ca62408f8e5ee53f535b88b1411
2024-07-31 12:01:33 +01:00
Marnix
3cd24aadb2 doc: remove obsolete mention and link to closed PR 2024-07-31 12:38:29 +02:00
merge-script
2ed82060b9
Merge bitcoin/bitcoin#30551: doc: mention optional dependencies (qrencode, zmq) in OpenBSD build docs
903def1ffd doc: mention optional dependencies (qrencode, zmq) in OpenBSD build docs (Sebastian Falbesoner)

Pull request description:

  The wording is taken from the FreeBSD build docs.

  Tested on OpenBSD 7.5. See the following links for the package names:
  - https://openbsd.app/?search=libqrencode
  - https://openbsd.app/?search=zeromq

  Thanks to hebasto for noticing that this was missing.

ACKs for top commit:
  maflcko:
    review ACK 903def1ffd
  hebasto:
    ACK 903def1ffd, I can successfully build with the `libqrencode` and `zeromq` packages on my OpenBSD 7.5 installation.

Tree-SHA512: 955e4892948a7703627d304a41a774f7cca0e4c672bdfa0edf531587d6970444aa49195b0f6f531ce375c8e7c2af6bbfa1a12e0612ae7a65f3e454fb17958672
2024-07-31 09:50:38 +01:00
merge-script
2401a24387
Merge bitcoin/bitcoin#30452: guix: bump time-machine to efc26826400762207cde9f23802cfe75a737963c
6ee000e56f guix: bump time-machine to efc26826400762207cde9f23802cfe75a737963c (fanquake)
cbeb2c20e1 guix: patch /gnu/store paths out of winpthreads (fanquake)

Pull request description:

  Needed for https://github.com/bitcoin/bitcoin/issues/30210. This doesn't switch runtimes, because upstream is
  still configured to use the old runtime. See:
  https://git.savannah.gnu.org/cgit/guix.git/commit/?id=17188be0f723e00377b21b767f5447d7938a116e.

  git-mimimal `2.45.1` -> `2.45.2`
  Kernel Headers `6.1.92` -> `6.1.100`
  LLVM `18.1.6` -> `18.1.8`
  mingw-w64 `11.0.1` -> `12.0.0`
  NSIS `3.09` -> `3.10`
  patch `2.7.6` -> `2.7.6-0.f144b35`

ACKs for top commit:
  TheCharlatan:
    ACK 6ee000e56f

Tree-SHA512: f4f99d16dd8cab5b2b7c5d82111af86de20e1669cc3b4054d72ab4a67b2956757df170f0df28c96d18653c1c9d2ebdd0ecc441005726a20cd963d98513b4a851
2024-07-31 09:50:10 +01:00
MarcoFalke
fadf621825
test: Make leaf_script mandatory when scriptpath is set in TaprootSignatureMsg
This removes the default value, because there should not be a use-case
to fall back to a an empty leaf_script by default. (If there was, it
could trivially be added back)
2024-07-31 09:57:42 +02:00
Martin Zumsande
ec5e294e4b test: fix constructor of msg_tx
In python, if the default value is a mutable object (here: a class)
its shared over all instances, so that one instance being changed
would affect others to be changed as well.
This was likely the source of various intermittent bugs in the
functional tests.
2024-07-30 17:49:07 -04:00
Sebastian Falbesoner
903def1ffd doc: mention optional dependencies (qrencode, zmq) in OpenBSD build docs
The wording is taken from the FreeBSD build docs.

See the following links for the package names:
- https://openbsd.app/?search=libqrencode
- https://openbsd.app/?search=zeromq

Thanks to hebasto for noticing that this was missing.
2024-07-30 22:34:35 +02:00
Greg Sanders
75648cea5a test: add P2A ProduceSignature coverage 2024-07-30 14:06:58 -04:00
Greg Sanders
7998ce6b20 Add release note for P2A output feature 2024-07-30 14:06:58 -04:00