2018-07-20 15:57:08 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2023-08-16 19:27:31 +02:00
|
|
|
# Copyright (c) 2018-2020 The Bitcoin Core developers
|
2018-07-20 15:57:08 +02:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#
|
|
|
|
# Check for circular dependencies
|
|
|
|
|
|
|
|
export LC_ALL=C
|
|
|
|
|
|
|
|
EXPECTED_CIRCULAR_DEPENDENCIES=(
|
2021-06-27 08:33:13 +02:00
|
|
|
"chainparamsbase -> util/system -> chainparamsbase"
|
2023-07-24 20:42:13 +02:00
|
|
|
"node/blockstorage -> validation -> node/blockstorage"
|
|
|
|
"index/blockfilterindex -> node/blockstorage -> validation -> index/blockfilterindex"
|
|
|
|
"index/base -> validation -> index/blockfilterindex -> index/base"
|
2023-07-30 13:49:32 +02:00
|
|
|
"index/coinstatsindex -> node/coinstats -> index/coinstatsindex"
|
2018-07-20 15:57:08 +02:00
|
|
|
"policy/fees -> txmempool -> policy/fees"
|
|
|
|
"qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel"
|
|
|
|
"qt/bitcoingui -> qt/walletframe -> qt/bitcoingui"
|
|
|
|
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel"
|
|
|
|
"qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel"
|
|
|
|
"txmempool -> validation -> txmempool"
|
|
|
|
"wallet/fees -> wallet/wallet -> wallet/fees"
|
|
|
|
"wallet/wallet -> wallet/walletdb -> wallet/wallet"
|
2023-06-01 16:57:52 +02:00
|
|
|
"node/coinstats -> validation -> node/coinstats"
|
2021-02-04 01:48:30 +01:00
|
|
|
# Dash
|
2023-07-24 20:42:13 +02:00
|
|
|
"dsnotificationinterface -> llmq/chainlocks -> node/blockstorage -> dsnotificationinterface"
|
2021-02-04 01:48:30 +01:00
|
|
|
"evo/cbtx -> evo/simplifiedmns -> evo/cbtx"
|
2021-10-02 19:32:24 +02:00
|
|
|
"evo/deterministicmns -> llmq/commitment -> evo/deterministicmns"
|
|
|
|
"evo/deterministicmns -> llmq/utils -> evo/deterministicmns"
|
2021-10-01 21:19:08 +02:00
|
|
|
"governance/classes -> governance/governance -> governance/classes"
|
|
|
|
"governance/governance -> governance/object -> governance/governance"
|
|
|
|
"governance/governance -> masternode/sync -> governance/governance"
|
2021-10-02 19:32:24 +02:00
|
|
|
"llmq/chainlocks -> llmq/instantsend -> llmq/chainlocks"
|
2024-02-14 19:32:54 +01:00
|
|
|
"llmq/dkgsessionhandler -> net_processing -> llmq/dkgsessionmgr -> llmq/dkgsessionhandler"
|
2021-10-02 19:32:24 +02:00
|
|
|
"llmq/instantsend -> net_processing -> llmq/instantsend"
|
|
|
|
"llmq/instantsend -> txmempool -> llmq/instantsend"
|
|
|
|
"llmq/instantsend -> validation -> llmq/instantsend"
|
|
|
|
"llmq/signing -> llmq/signing_shares -> llmq/signing"
|
|
|
|
"llmq/signing -> net_processing -> llmq/signing"
|
|
|
|
"llmq/signing_shares -> net_processing -> llmq/signing_shares"
|
2021-06-27 08:33:13 +02:00
|
|
|
"logging -> util/system -> logging"
|
2021-10-01 21:19:08 +02:00
|
|
|
"masternode/payments -> validation -> masternode/payments"
|
refactor: begin to de-globalize masternodeSync (#5103)
<!--
*** Please remove the following help text before submitting: ***
Provide a general summary of your changes in the Title above
Pull requests without a rationale and clear improvement may be closed
immediately.
Please provide clear motivation for your patch and explain how it
improves
Dash Core user experience or Dash 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 Dash Core, if possible.
-->
## Issue being fixed or feature implemented
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
minimizing global uses
## What was done?
<!--- Describe your changes in detail -->
Started the deglobalization, a future PR should be done to continue this
deglobalization
## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
## Breaking Changes
<!--- Please describe any breaking changes your code introduces -->
none
## 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
**For repository code-owners and collaborators only**
- [x] I have assigned this pull request to a milestone
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-01-04 21:37:20 +01:00
|
|
|
"masternode/sync -> validation -> masternode/sync"
|
2021-02-04 01:48:30 +01:00
|
|
|
"net -> netmessagemaker -> net"
|
|
|
|
"netaddress -> netbase -> netaddress"
|
|
|
|
"qt/appearancewidget -> qt/guiutil -> qt/appearancewidget"
|
|
|
|
"qt/bitcoinaddressvalidator -> qt/guiutil -> qt/bitcoinaddressvalidator"
|
|
|
|
"qt/bitcoingui -> qt/guiutil -> qt/bitcoingui"
|
|
|
|
"qt/guiutil -> qt/optionsdialog -> qt/guiutil"
|
|
|
|
"qt/guiutil -> qt/qvalidatedlineedit -> qt/guiutil"
|
|
|
|
"core_io -> evo/cbtx -> evo/simplifiedmns -> core_io"
|
2021-10-02 19:32:24 +02:00
|
|
|
"llmq/dkgsession -> llmq/dkgsessionmgr -> llmq/dkgsessionhandler -> llmq/dkgsession"
|
2021-06-27 08:33:13 +02:00
|
|
|
"logging -> util/system -> sync -> logging"
|
|
|
|
"logging -> util/system -> stacktraces -> logging"
|
2022-01-03 20:10:02 +01:00
|
|
|
"logging -> util/system -> util/getuniquepath -> random -> logging"
|
2021-02-04 01:48:30 +01:00
|
|
|
"qt/appearancewidget -> qt/guiutil -> qt/optionsdialog -> qt/appearancewidget"
|
|
|
|
"qt/guiutil -> qt/optionsdialog -> qt/optionsmodel -> qt/guiutil"
|
2021-03-26 13:21:41 +01:00
|
|
|
|
2023-08-02 17:08:39 +02:00
|
|
|
"bloom -> evo/assetlocktx -> llmq/quorums -> net -> bloom"
|
2023-12-17 18:13:37 +01:00
|
|
|
"bloom -> evo/assetlocktx -> llmq/signing -> net_processing -> merkleblock -> bloom"
|
2023-08-02 17:08:39 +02:00
|
|
|
"banman -> bloom -> evo/assetlocktx -> llmq/quorums -> net -> banman"
|
2023-12-17 18:13:37 +01:00
|
|
|
"banman -> bloom -> evo/assetlocktx -> llmq/signing -> net_processing -> banman"
|
2023-08-02 17:08:39 +02:00
|
|
|
|
2021-10-02 19:32:24 +02:00
|
|
|
"llmq/dkgsession -> llmq/dkgsessionmgr -> llmq/dkgsession"
|
2022-04-05 09:22:15 +02:00
|
|
|
"llmq/chainlocks -> validation -> llmq/chainlocks"
|
2021-10-02 19:32:24 +02:00
|
|
|
"coinjoin/coinjoin -> llmq/chainlocks -> net -> coinjoin/coinjoin"
|
2024-01-18 02:56:41 +01:00
|
|
|
"evo/deterministicmns -> llmq/utils -> llmq/snapshot -> evo/simplifiedmns -> evo/deterministicmns"
|
2021-10-25 15:55:34 +02:00
|
|
|
"evo/deterministicmns -> llmq/utils -> net -> evo/deterministicmns"
|
2022-01-03 20:10:02 +01:00
|
|
|
"policy/policy -> policy/settings -> policy/policy"
|
2023-07-24 18:39:38 +02:00
|
|
|
"consensus/tx_verify -> evo/assetlocktx -> validation -> consensus/tx_verify"
|
2023-12-17 18:13:37 +01:00
|
|
|
"consensus/tx_verify -> evo/assetlocktx -> llmq/signing -> net_processing -> txmempool -> consensus/tx_verify"
|
|
|
|
"evo/assetlocktx -> llmq/signing -> net_processing -> txmempool -> evo/assetlocktx"
|
2022-04-16 16:46:04 +02:00
|
|
|
|
2024-01-18 02:56:41 +01:00
|
|
|
"evo/simplifiedmns -> llmq/blockprocessor -> llmq/utils -> llmq/snapshot -> evo/simplifiedmns"
|
|
|
|
"llmq/blockprocessor -> llmq/utils -> llmq/snapshot -> llmq/blockprocessor"
|
|
|
|
"llmq/commitment -> llmq/utils -> llmq/snapshot -> llmq/commitment"
|
2022-08-26 23:52:53 +02:00
|
|
|
"spork -> validation -> spork"
|
|
|
|
"governance/governance -> validation -> governance/governance"
|
2020-01-09 20:37:09 +01:00
|
|
|
"evo/deterministicmns -> validationinterface -> governance/vote -> evo/deterministicmns"
|
2024-03-17 17:39:29 +01:00
|
|
|
"governance/vote -> masternode/node -> validationinterface -> governance/vote"
|
2020-01-09 20:37:09 +01:00
|
|
|
"llmq/signing -> masternode/node -> validationinterface -> llmq/signing"
|
2023-08-03 22:54:54 +02:00
|
|
|
"evo/mnhftx -> validation -> evo/mnhftx"
|
2023-11-16 19:36:46 +01:00
|
|
|
"evo/deterministicmns -> validation -> evo/deterministicmns"
|
2024-06-26 15:50:48 +02:00
|
|
|
"evo/specialtxman -> validation -> evo/specialtxman"
|
|
|
|
"evo/chainhelper -> evo/specialtxman -> validation -> evo/chainhelper"
|
2024-03-21 13:20:57 +01:00
|
|
|
"evo/deterministicmns -> validationinterface -> evo/deterministicmns"
|
Merge bitcoin/bitcoin#22736: log, sync: change lock contention from preprocessor directive to log category
7e698732836121912f179b7c743a72dd6fdffa72 sync: remove DEBUG_LOCKCONTENTION preprocessor directives (Jon Atack)
9b08006bc502e67956d6ab518388fad6397cac8d log, sync: improve lock contention logging and add time duration (Jon Atack)
3f4c6b87f1098436693c4990f2082515ec0ece26 log, timer: add timing macro in usec LOG_TIME_MICROS_WITH_CATEGORY (Jon Atack)
b7a17444e0746c562ae97b26eba431577947b06a log, sync: add LOCK logging category, apply it to lock contention (Jon Atack)
Pull request description:
To enable lock contention logging, `DEBUG_LOCKCONTENTION` has to be defined at compilation. Once built, the logging is not limited to a category and is high frequency, verbose and in all-caps. With these factors combined, it seems likely to be rarely used.
This patch:
- adds a `lock` logging category
- adds a timing macro in microseconds, `LOG_TIME_MICROS_WITH_CATEGORY`
- updates `BCLog::LogMsg()` to omit irrelevant decimals for microseconds and skip unneeded code and math
- improves the lock contention logging, drops the all-caps, and displays the duration in microseconds
- removes the conditional compilation directives
- allows lock contentions to be logged on startup with `-debug=lock` or at run time with `bitcoin-cli logging '["lock"]'`
```
$ bitcoind -signet -debug=lock
2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1920 started
2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1920 completed (4μs)
2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1302 started
2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1302 completed (4μs)
2021-09-01T12:40:02Z LockContention: cs_vNodes, net.cpp:2242 started
2021-09-01T12:40:02Z LockContention: cs_vNodes, net.cpp:2242 completed (20μs)
2021-09-01T12:43:04Z LockContention: ::cs_main, validation.cpp:4980 started
2021-09-01T12:43:04Z LockContention: ::cs_main, validation.cpp:4980 completed (3μs)
$ bitcoin-cli -signet logging
"lock": true,
$ bitcoin-cli -signet logging [] '["lock"]'
"lock": false,
$ bitcoin-cli -signet logging '["lock"]'
"lock": true,
```
I've tested this with Clang 13 and GCC 10.2.1, on Debian, with and without `--enable-debug`.
ACKs for top commit:
hebasto:
re-ACK 7e698732836121912f179b7c743a72dd6fdffa72, added a contention duration to the log message since my [previous](https://github.com/bitcoin/bitcoin/pull/22736#pullrequestreview-743764606) review.
theStack:
re-ACK 7e698732836121912f179b7c743a72dd6fdffa72 🔏 ⏲️
Tree-SHA512: c4b5eb88d3a2c051acaa842b3055ce30efde1f114f61da6e55fcaa27476c1c33a60bc419f7f5ccda532e1bdbe70815222ec2b2b6d9226f29c8e94e598aacfee7
2021-09-06 10:31:05 +02:00
|
|
|
"logging -> util/system -> sync -> logging/timer -> logging"
|
2024-04-18 12:45:13 +02:00
|
|
|
|
2024-07-24 05:59:05 +02:00
|
|
|
"coinjoin/client -> net_processing -> coinjoin/client"
|
|
|
|
"coinjoin/client -> net_processing -> coinjoin/context -> coinjoin/client"
|
2024-04-18 12:54:57 +02:00
|
|
|
"coinjoin/context -> coinjoin/server -> net_processing -> coinjoin/context"
|
2024-04-18 12:45:13 +02:00
|
|
|
"coinjoin/server -> net_processing -> coinjoin/server"
|
|
|
|
"llmq/context -> llmq/ehf_signals -> net_processing -> llmq/context"
|
2024-04-09 21:51:13 +02:00
|
|
|
"llmq/blockprocessor -> net_processing -> llmq/blockprocessor"
|
|
|
|
"llmq/chainlocks -> net_processing -> llmq/chainlocks"
|
2024-04-25 13:52:57 +02:00
|
|
|
"llmq/dkgsession -> net_processing -> llmq/quorums -> llmq/dkgsession"
|
2024-04-09 21:51:13 +02:00
|
|
|
"net_processing -> spork -> net_processing"
|
|
|
|
"evo/simplifiedmns -> llmq/blockprocessor -> net_processing -> evo/simplifiedmns"
|
2024-04-25 13:52:57 +02:00
|
|
|
"governance/governance -> net_processing -> governance/governance"
|
2024-04-09 21:51:13 +02:00
|
|
|
"llmq/blockprocessor -> net_processing -> llmq/context -> llmq/blockprocessor"
|
|
|
|
"llmq/blockprocessor -> net_processing -> llmq/quorums -> llmq/blockprocessor"
|
|
|
|
"llmq/chainlocks -> net_processing -> llmq/context -> llmq/chainlocks"
|
2024-04-19 00:13:31 +02:00
|
|
|
"rpc/blockchain -> rpc/server -> rpc/blockchain"
|
2018-07-20 15:57:08 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
EXIT_CODE=0
|
|
|
|
|
|
|
|
CIRCULAR_DEPENDENCIES=()
|
|
|
|
|
|
|
|
IFS=$'\n'
|
|
|
|
for CIRC in $(cd src && ../contrib/devtools/circular-dependencies.py {*,*/*,*/*/*}.{h,cpp} | sed -e 's/^Circular dependency: //'); do
|
2019-07-05 03:00:44 +02:00
|
|
|
CIRCULAR_DEPENDENCIES+=( "$CIRC" )
|
2018-07-20 15:57:08 +02:00
|
|
|
IS_EXPECTED_CIRC=0
|
|
|
|
for EXPECTED_CIRC in "${EXPECTED_CIRCULAR_DEPENDENCIES[@]}"; do
|
|
|
|
if [[ "${CIRC}" == "${EXPECTED_CIRC}" ]]; then
|
|
|
|
IS_EXPECTED_CIRC=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [[ ${IS_EXPECTED_CIRC} == 0 ]]; then
|
|
|
|
echo "A new circular dependency in the form of \"${CIRC}\" appears to have been introduced."
|
|
|
|
echo
|
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for EXPECTED_CIRC in "${EXPECTED_CIRCULAR_DEPENDENCIES[@]}"; do
|
|
|
|
IS_PRESENT_EXPECTED_CIRC=0
|
|
|
|
for CIRC in "${CIRCULAR_DEPENDENCIES[@]}"; do
|
|
|
|
if [[ "${CIRC}" == "${EXPECTED_CIRC}" ]]; then
|
|
|
|
IS_PRESENT_EXPECTED_CIRC=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [[ ${IS_PRESENT_EXPECTED_CIRC} == 0 ]]; then
|
|
|
|
echo "Good job! The circular dependency \"${EXPECTED_CIRC}\" is no longer present."
|
|
|
|
echo "Please remove it from EXPECTED_CIRCULAR_DEPENDENCIES in $0"
|
|
|
|
echo "to make sure this circular dependency is not accidentally reintroduced."
|
|
|
|
echo
|
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
exit ${EXIT_CODE}
|