Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

backport: merge bitcoin#23496, #26272, #23443, #26381, #26396, #26448, #26359, #26686, #23670, partial bitcoin#19953 (Erlay support) #6333

Merged
merged 11 commits into from
Oct 28, 2024

Conversation

kwvg
Copy link
Collaborator

@kwvg kwvg commented Oct 20, 2024

Additional Information

Breaking Changes

None expected.

Checklist

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

Copy link

This pull request has conflicts, please rebase.

PastaPastaPasta added a commit that referenced this pull request Oct 24, 2024
, bitcoin#26373 (add `sipa/minisketch` as vendored dependency)

e56482b merge bitcoin#26373: Update minisketch subtree to latest upstream (Kittywhiskers Van Gogh)
1c94f1a Squashed 'src/minisketch/' changes from 47f0a2d26f..a571ba20f9 (Kittywhiskers Van Gogh)
94f81fa merge bitcoin#25502: update minisketch subtree (Kittywhiskers Van Gogh)
4655944 Squashed 'src/minisketch/' changes from 7eeb778fef..47f0a2d26f (Kittywhiskers Van Gogh)
807f09a merge bitcoin#24262: Update minisketch subtree (Kittywhiskers Van Gogh)
2a7b57f Squashed 'src/minisketch/' changes from 89629eb2c7..7eeb778fef (Kittywhiskers Van Gogh)
a6b26b5 merge bitcoin#23114: Add minisketch subtree and integrate into build/test (Kittywhiskers Van Gogh)
d71dfab Squashed 'src/minisketch/' content from commit 89629eb2c7 (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * Dependency for #6333

  ## Breaking Changes

  None expected

  ## Checklist

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

ACKs for top commit:
  PastaPastaPasta:
    utACK e56482b
  UdjinM6:
    utACK e56482b

Tree-SHA512: a13dbfb4eefbf43917df9ae1a154758120dc8e3d511e846311fce46b1c81b878dadcea07476600b406f94201c677706366ce5984a3466e75744f823a529fc622
@kwvg kwvg changed the title backport: merge bitcoin#23491, #23496, #26272, #22778, #23443, #26381, #26396, #26448, #25156, #26359, #26686, #23670, partial bitcoin#19953 (Erlay support) backport: merge bitcoin#23496, #26272, #23443, #26381, #26396, #26448, #26359, #26686, #23670, partial bitcoin#19953 (Erlay support) Oct 26, 2024
Copy link

This pull request has conflicts, please rebase.

PastaPastaPasta added a commit that referenced this pull request Oct 27, 2024
, bitcoin#27213, bitcoin#28189, bitcoin#28155, bitcoin#28895, partial bitcoin#26396 (networking backports: part 9)

09504bd merge bitcoin#28895: do not make automatic outbound connections to addnode peers (Kittywhiskers Van Gogh)
6cf206c merge bitcoin#28155: improves addnode / m_added_nodes logic (Kittywhiskers Van Gogh)
11d654a merge bitcoin#28189: diversify network outbounds release note (Kittywhiskers Van Gogh)
5dc52b3 merge bitcoin#27213: Diversify automatic outbound connections with respect to networks (Kittywhiskers Van Gogh)
291305b merge bitcoin#26497: Make ConsumeNetAddr always produce valid onion addresses (Kittywhiskers Van Gogh)
6a37934 partial bitcoin#26396: Avoid SetTxRelay for feeler connections (Kittywhiskers Van Gogh)
221a78e merge bitcoin#25156: Introduce PeerManagerImpl::RejectIncomingTxs (Kittywhiskers Van Gogh)
cc694c2 merge bitcoin#22778: Reduce resource usage for inbound block-relay-only connections (Kittywhiskers Van Gogh)
6e6de54 net: use `Peer::m_can_relay_tx` when we mean `m_tx_relay != nullptr` (Kittywhiskers Van Gogh)
77526d2 net: rename `Peer::m_block_relay_only` to `Peer::m_can_tx_relay` (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * Dependency for #6333
  * When backporting [bitcoin#22778](bitcoin#22778), the `m_tx_inventory_known_filter.insert()` call in  `queueAndMaybePushInv()` had to be moved out as `EXCLUSIVE_LOCKS_REQUIRED` does not seem to work with lambda parameters list (though it does work with capture list, [source](https://github.com/dashpay/dash/blob/4b5e39290c8f1c78305e597312408c84e2b06b64/src/net_processing.cpp#L5781)), see error below

    <details>

    <summary>Compiler error:</summary>

    ```
    net_processing.cpp:5895:21: note: found near match 'tx_relay->m_tx_inventory_mutex'
    net_processing.cpp:5955:21: error: calling function 'operator()' requires holding mutex 'queueAndMaybePushInv.m_tx_inventory_mutex' exclusively [-Werror,-Wthread-safety-precise]
                        queueAndMaybePushInv(tx_relay, CInv(nInvType, hash));
                        ^
    net_processing.cpp:5955:21: note: found near match 'tx_relay->m_tx_inventory_mutex'
    net_processing.cpp:5977:17: error: calling function 'operator()' requires holding mutex 'queueAndMaybePushInv.m_tx_inventory_mutex' exclusively [-Werror,-Wthread-safety-precise]
                    queueAndMaybePushInv(inv_relay, inv);
                    ^
    ```

    </details>

    * Attempting to remove the `EXCLUSIVE_LOCKS_REQUIRED` or the `AssertLockHeld` are not options due to stricter thread sanitization checks being applied since [dash#6319](#6319) (and in general, removing annotations being inadvisable regardless)

    * We cannot simply lock `peer->GetInvRelay()->m_tx_inventory_mutex` as a) the caller already has a copy of the relay pointer (which means that `m_tx_relay_mutex` was already held) that b) they used to lock `m_tx_inventory_mutex` (which we were already asserting) so c) we cannot simply re-lock `m_tx_inventory_mutex` as it's already already held, just through a less circuitous path.

      * The reason locking is mentioned instead of asserting is that the compiler treats `peer->GetInvRelay()->m_tx_inventory_mutex` and `tx_relay->m_tx_inventory_mutex` as separate locks (despite being different ways of accessing the same thing) and would complain similarly to the error above if attempting to assert the former while holding the latter.

  * As `m_tx_relay` is always initialized for Dash, to mimic the behaviour _expected_ upstream, in [bitcoin#22778](bitcoin#22778), `SetTxRelay()` will _allow_ `GetTxRelay()` to return `m_can_tx_relay` (while Dash code that demands unconditional access can use `GetInvRelay()` instead) with the lack of `SetTxRelay()` resulting in `GetTxRelay()` feigning the absence of `m_can_tx_relay`.

    This allows us to retain the same style of checks used upstream instead of using proxies like `!CNode::IsBlockOnlyConn()` to determined if we _should_ use `m_tx_relay`.

  * Speaking of proxies, being a block-only connection is now no longer the only reason not to relay transactions

    In preparation for [bitcoin#26396](bitcoin#26396), proxy usage of `!CNode::IsBlockOnlyConn()` and `!Peer::m_block_relay_only` was replaced with the more explicit `Peer::m_can_tx_relay` before being used to gate the result of `GetTxRelay()`, to help it mimic upstream semantics.

  ## Breaking Changes

  None expected

  ## Checklist

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

ACKs for top commit:
  UdjinM6:
    utACK 09504bd

Tree-SHA512: f4f36f12f749b697dd4ad5521ed15f862c93ed4492a047759554aa80a3ce00dbd1bdc0242f7a4468f41f25925d5b79c8ab774d8489317437b1983f0a1277eecb
@kwvg kwvg marked this pull request as ready for review October 28, 2024 10:34
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 cc98f9e

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 cc98f9e

@PastaPastaPasta PastaPastaPasta merged commit 75fd7b5 into dashpay:develop Oct 28, 2024
35 checks passed
PastaPastaPasta added a commit that referenced this pull request Nov 26, 2024
, bitcoin#24830, bitcoin#24464, bitcoin#24757, bitcoin#25202, bitcoin#25217, bitcoin#25292, bitcoin#25614, partial bitcoin#22766 (logging backports)

1621696 log: restore `LogPrintLevel` messages from prior backports (Kittywhiskers Van Gogh)
52a1263 merge bitcoin#25614: Severity-based logging, step 2 (Kittywhiskers Van Gogh)
21470fd merge bitcoin#25292: Add LogPrintLevel to lint-format-strings, drop LogPrint-vs-LogPrintf section in dev notes (Kittywhiskers Van Gogh)
026409e merge bitcoin#25217: update lint-logs.py to detect LogPrintLevel, mention WalletLogPrintf (Kittywhiskers Van Gogh)
b046e09 merge bitcoin#25202: Use severity-based logging for leveldb/libevent messages, reverse LogPrintLevel order (Kittywhiskers Van Gogh)
7697b73 revert dash#2794: Disable logging of libevent debug messages (Kittywhiskers Van Gogh)
ff6304f merge bitcoin#24757: add `DEBUG_LOCKCONTENTION` to `--enable-debug` and CI (Kittywhiskers Van Gogh)
88592f3 merge bitcoin#24464: Add severity level to logs (Kittywhiskers Van Gogh)
d3e837a merge bitcoin#24830: Allow -proxy="" setting values (Kittywhiskers Van Gogh)
0e01d5b partial bitcoin#22766: Clarify and disable unused ArgsManager flags (Kittywhiskers Van Gogh)
a9cfbd1 fix: don't use non-existent `PrintLockContention` in `SharedEnter` (Kittywhiskers Van Gogh)
f331cbe merge bitcoin#24770: Put lock logging behind DEBUG_LOCKCONTENTION preprocessor directive (Kittywhiskers Van Gogh)
d9cc2ea merge bitcoin#23104: Avoid breaking single log lines over multiple lines in the log file (Kittywhiskers Van Gogh)
479ae82 merge bitcoin#23235: Reduce unnecessary default logging (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * This pull request's primary purpose is to restore `LogPrintLevel`s from backports in [dash#6333](#6333) that were changed to `LogPrint`s as they were backported before `LogPrintLevel` was backported.
  * ~~`clang-format` suggestions for `LogPrintLevel` have to be ignored in order to prevent the linter from tripping due to a "missing newline" ([build](https://gitlab.com/dashpay/dash/-/jobs/8398818860#L54)).~~ Resolved by applying diff ([source](#6399 (comment))).
  * `SharedLock` was introduced in [dash#5961](#5961) and `PrintLockContention` was removed in [dash#6046](#6046) but the changes in the latter were not extended to the former. This has been corrected as part of this pull request.

  ## Breaking Changes

  None expected.

  ## Checklist

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

Top commit has no ACKs.

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

3 participants