2018-07-20 15:57:08 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Copyright (c) 2018 The Bitcoin Core developers
|
|
|
|
# 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"
|
2021-05-25 12:48:04 +02:00
|
|
|
"index/txindex -> validation -> index/txindex"
|
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/paymentserver -> qt/walletmodel -> qt/paymentserver"
|
|
|
|
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel"
|
|
|
|
"qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel"
|
|
|
|
"qt/walletmodel -> qt/walletmodeltransaction -> qt/walletmodel"
|
|
|
|
"txmempool -> validation -> txmempool"
|
|
|
|
"wallet/fees -> wallet/wallet -> wallet/fees"
|
|
|
|
"wallet/wallet -> wallet/walletdb -> wallet/wallet"
|
|
|
|
"txmempool -> validation -> validationinterface -> txmempool"
|
2022-08-08 18:05:21 +02:00
|
|
|
"wallet/scriptpubkeyman -> wallet/wallet -> wallet/scriptpubkeyman"
|
2021-02-04 01:48:30 +01:00
|
|
|
# Dash
|
2021-10-01 21:19:08 +02:00
|
|
|
"coinjoin/server -> net_processing -> coinjoin/server"
|
2021-02-04 01:48:30 +01:00
|
|
|
"evo/cbtx -> evo/simplifiedmns -> evo/cbtx"
|
|
|
|
"evo/deterministicmns -> evo/simplifiedmns -> evo/deterministicmns"
|
2021-10-02 19:32:24 +02:00
|
|
|
"evo/deterministicmns -> llmq/commitment -> evo/deterministicmns"
|
|
|
|
"evo/deterministicmns -> llmq/utils -> evo/deterministicmns"
|
2021-02-04 01:48:30 +01:00
|
|
|
"evo/mnauth -> net_processing -> evo/mnauth"
|
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-02-04 01:48:30 +01:00
|
|
|
"governance/governance -> net_processing -> governance/governance"
|
2021-10-01 21:19:08 +02:00
|
|
|
"governance/object -> governance/validators -> governance/object"
|
2021-10-02 19:32:24 +02:00
|
|
|
"llmq/quorums -> llmq/utils -> llmq/quorums"
|
|
|
|
"llmq/blockprocessor -> net_processing -> llmq/blockprocessor"
|
|
|
|
"llmq/chainlocks -> llmq/instantsend -> llmq/chainlocks"
|
|
|
|
"llmq/chainlocks -> net_processing -> llmq/chainlocks"
|
|
|
|
"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"
|
|
|
|
"net_processing -> spork -> net_processing"
|
|
|
|
"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/deterministicmns -> core_io"
|
|
|
|
"core_io -> evo/cbtx -> evo/simplifiedmns -> core_io"
|
2021-10-02 19:32:24 +02:00
|
|
|
"evo/simplifiedmns -> llmq/blockprocessor -> net_processing -> evo/simplifiedmns"
|
|
|
|
"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-10-01 21:19:08 +02:00
|
|
|
"coinjoin/client -> coinjoin/util -> wallet/wallet -> coinjoin/client"
|
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-10-02 19:32:24 +02:00
|
|
|
"evo/deterministicmns -> evo/simplifiedmns -> llmq/blockprocessor -> net_processing -> evo/deterministicmns"
|
2021-03-26 13:21:41 +01:00
|
|
|
|
2021-10-01 21:19:08 +02:00
|
|
|
"coinjoin/client -> net_processing -> coinjoin/client"
|
2021-04-16 05:41:16 +02:00
|
|
|
"llmq/quorums -> net_processing -> llmq/quorums"
|
2021-10-02 19:32:24 +02:00
|
|
|
"llmq/dkgsession -> llmq/dkgsessionmgr -> llmq/dkgsession"
|
2021-04-16 05:41:16 +02:00
|
|
|
"evo/deterministicmns -> validationinterface -> txmempool -> evo/deterministicmns"
|
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"
|
2021-12-12 23:38:01 +01:00
|
|
|
"policy/fees -> txmempool -> validation -> policy/fees"
|
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"
|
2022-04-16 16:46:04 +02:00
|
|
|
|
|
|
|
"evo/simplifiedmns -> llmq/blockprocessor -> net_processing -> llmq/snapshot -> evo/simplifiedmns"
|
2022-11-07 19:09:44 +01:00
|
|
|
"llmq/blockprocessor -> net_processing -> llmq/context -> llmq/blockprocessor"
|
2022-04-16 16:46:04 +02:00
|
|
|
"llmq/blockprocessor -> net_processing -> llmq/snapshot -> llmq/blockprocessor"
|
2022-11-07 19:09:44 +01:00
|
|
|
"llmq/chainlocks -> net_processing -> llmq/context -> llmq/chainlocks"
|
|
|
|
"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"
|
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}
|