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-12-17 18:13:37 +01:00
|
|
|
"coinjoin/server -> core_io -> evo/assetlocktx -> llmq/signing -> net_processing -> coinjoin/server"
|
|
|
|
"coinjoin/coinjoin -> llmq/instantsend -> net_processing -> coinjoin/server -> coinjoin/coinjoin"
|
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/quorums -> llmq/utils -> llmq/quorums"
|
|
|
|
"llmq/chainlocks -> llmq/instantsend -> llmq/chainlocks"
|
2023-12-17 18:13:37 +01:00
|
|
|
"llmq/chainlocks -> llmq/instantsend -> net_processing -> llmq/chainlocks"
|
2021-10-02 19:32:24 +02:00
|
|
|
"llmq/dkgsessionmgr -> net_processing -> llmq/dkgsessionmgr"
|
|
|
|
"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"
|
2023-12-17 18:13:37 +01:00
|
|
|
"core_io -> evo/assetlocktx -> llmq/signing -> net_processing -> governance/governance -> governance/object -> 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"
|
2023-12-17 18:13:37 +01:00
|
|
|
"coinjoin/context -> coinjoin/server -> core_io -> evo/assetlocktx -> llmq/signing -> net_processing -> coinjoin/context"
|
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 -> governance/governance -> bloom"
|
|
|
|
"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
|
|
|
|
2023-12-17 18:13:37 +01:00
|
|
|
"coinjoin/client -> coinjoin/coinjoin -> llmq/instantsend -> net_processing -> coinjoin/client"
|
|
|
|
"coinjoin/client -> coinjoin/coinjoin -> llmq/instantsend -> net_processing -> coinjoin/context -> coinjoin/client"
|
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"
|
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"
|
2022-01-24 15:20:50 +01:00
|
|
|
"evo/specialtxman -> validation -> evo/specialtxman"
|
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
|
|
|
|
2022-11-07 19:09:44 +01:00
|
|
|
"llmq/context -> llmq/dkgsessionmgr -> net_processing -> llmq/context"
|
2022-04-16 16:46:04 +02:00
|
|
|
"llmq/dkgsession -> llmq/dkgsessionmgr -> llmq/quorums -> llmq/dkgsession"
|
|
|
|
"llmq/dkgsessionmgr -> llmq/quorums -> llmq/dkgsessionmgr"
|
|
|
|
"llmq/snapshot -> llmq/utils -> llmq/snapshot"
|
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"
|
|
|
|
"governance/vote -> validation -> validationinterface -> governance/vote"
|
|
|
|
"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"
|
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}
|