dash/test/lint/lint-circular-dependencies.sh
pasta f93c763ac6
Merge #6318: refactor: remove circular dependency governance/object over governance/classes
2e36832982 refactor: drop circular dependency governance/classes over governance/governance (Konstantin Akimov)
39f18ab154 refactor: move CGoveranceManager code from classes.cpp to governace.cpp (Konstantin Akimov)
350a5ca47c refactor: drop CSuperblock::GetGovernanceObject to simplify thread safety analysis over FindGovernanceObject (Konstantin Akimov)
5031f29441 refactor: add couple missing `const` for CGovernanceManager (Konstantin Akimov)
b240d08e09 refactor: move GetBestSuperblock to CGovernanceManager (Konstantin Akimov)
3641653174 refactor: move CSuperblockManager::IsValid to CGoveranceManager::IsValidSuperblock (Konstantin Akimov)
de8969f463 refactor: move ExecuteBestSuperblock to CGovernanceManager (Konstantin Akimov)
107d5b4941 refactor: move GetSuperblockPayments to CGovernanceManager (Konstantin Akimov)
7a470c441e refactor: move IsSuperblockTriggered to CGovernanceManager (Konstantin Akimov)
9638fdce6d refactor: pass mn_sync to CGovernanceManager ctor as a reference (UdjinM6)
7eb1634686 refactor: drop alias that is used only once (Konstantin Akimov)
1570a02c89 refactor: move ScopedLockBool from header to cpp file (Konstantin Akimov)
7aafb5a393 fix: add one more file to list of non-backported (flat-database.h) (Konstantin Akimov)
41f1a43236 fix: add missing const for member functions of CRateCheckBuffer (Konstantin Akimov)
982fc9a069 fix: avoid lock annotation for govman.cs in voteraw (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  This PR is preparation for bitcoin#19668, otherwise impossible to make lock annotations for CGovernanceManager properly.

  ## What was done?
  1. object mn_sync and peerman is pass to many methods of CGovernanceManager instead passing it to constructor.
  2. methods of class CSuperblockManager moved to CGovernanceManager where they belongs to.
  3. removed `CSuperblock::GetGovernanceObject` which makes a lot of mess with annotations of `govman.cs`

  And minor relevant improvements: moved ScopedLockBool from header to implementation, added multiple `const` for methods, added one more file `flat-database.h` to non-backported list

  ## How Has This Been Tested?
  Run unit and functional tests.

  ## Breaking Changes
  N/A

  ## Checklist:
  - [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
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  UdjinM6:
    utACK 2e36832982
  PastaPastaPasta:
    utACK 2e36832982

Tree-SHA512: 59842c208f7ece46c9381fc3f9fc838d9ed1cf0fd2404eebf7fbd656c5df1fa5fd339410da83088089e2d954a017efb518cba290f6c5d45b5bcb91818041f931
2024-10-08 17:12:24 -05:00

136 lines
6.7 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Copyright (c) 2018-2020 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=(
"chainparamsbase -> util/system -> chainparamsbase"
"node/blockstorage -> validation -> node/blockstorage"
"index/blockfilterindex -> node/blockstorage -> validation -> index/blockfilterindex"
"index/base -> validation -> index/blockfilterindex -> index/base"
"index/coinstatsindex -> node/coinstats -> index/coinstatsindex"
"policy/fees -> txmempool -> policy/fees"
"qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel"
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel"
"qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel"
"wallet/fees -> wallet/wallet -> wallet/fees"
"wallet/wallet -> wallet/walletdb -> wallet/wallet"
"node/coinstats -> validation -> node/coinstats"
# Dash
"dsnotificationinterface -> llmq/chainlocks -> node/blockstorage -> dsnotificationinterface"
"evo/cbtx -> evo/simplifiedmns -> evo/cbtx"
"evo/deterministicmns -> llmq/commitment -> evo/deterministicmns"
"evo/deterministicmns -> llmq/utils -> evo/deterministicmns"
"governance/governance -> governance/object -> governance/governance"
"governance/governance -> masternode/sync -> governance/governance"
"llmq/chainlocks -> llmq/instantsend -> llmq/chainlocks"
"llmq/dkgsessionhandler -> net_processing -> llmq/dkgsessionmgr -> llmq/dkgsessionhandler"
"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"
"logging -> util/system -> logging"
"masternode/payments -> validation -> masternode/payments"
"masternode/sync -> validation -> masternode/sync"
"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"
"llmq/dkgsession -> llmq/dkgsessionmgr -> llmq/dkgsessionhandler -> llmq/dkgsession"
"logging -> util/system -> sync -> logging"
"logging -> util/system -> stacktraces -> logging"
"logging -> util/system -> util/getuniquepath -> random -> logging"
"qt/appearancewidget -> qt/guiutil -> qt/optionsdialog -> qt/appearancewidget"
"qt/guiutil -> qt/optionsdialog -> qt/optionsmodel -> qt/guiutil"
"bloom -> evo/assetlocktx -> llmq/quorums -> net -> bloom"
"bloom -> evo/assetlocktx -> llmq/signing -> net_processing -> merkleblock -> bloom"
"banman -> bloom -> evo/assetlocktx -> llmq/quorums -> net -> banman"
"banman -> bloom -> evo/assetlocktx -> llmq/signing -> net_processing -> banman"
"llmq/chainlocks -> validation -> llmq/chainlocks"
"coinjoin/coinjoin -> llmq/chainlocks -> net -> coinjoin/coinjoin"
"evo/assetlocktx -> validation -> txmempool -> evo/assetlocktx"
"evo/deterministicmns -> llmq/utils -> llmq/snapshot -> evo/simplifiedmns -> evo/deterministicmns"
"evo/deterministicmns -> llmq/utils -> net -> evo/deterministicmns"
"evo/deterministicmns -> validation -> txmempool -> evo/deterministicmns"
"policy/policy -> policy/settings -> policy/policy"
"consensus/tx_verify -> evo/assetlocktx -> validation -> consensus/tx_verify"
"consensus/tx_verify -> evo/assetlocktx -> validation -> txmempool -> consensus/tx_verify"
"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"
"governance/governance -> validation -> governance/governance"
"evo/deterministicmns -> validationinterface -> governance/vote -> evo/deterministicmns"
"governance/vote -> masternode/node -> validationinterface -> governance/vote"
"llmq/signing -> masternode/node -> validationinterface -> llmq/signing"
"evo/mnhftx -> validation -> evo/mnhftx"
"evo/deterministicmns -> validation -> evo/deterministicmns"
"evo/specialtxman -> validation -> evo/specialtxman"
"evo/chainhelper -> evo/specialtxman -> validation -> evo/chainhelper"
"evo/deterministicmns -> validationinterface -> evo/deterministicmns"
"logging -> util/system -> sync -> logging/timer -> logging"
"coinjoin/client -> net_processing -> coinjoin/client"
"coinjoin/client -> net_processing -> coinjoin/context -> coinjoin/client"
"coinjoin/context -> coinjoin/server -> net_processing -> coinjoin/context"
"coinjoin/server -> net_processing -> coinjoin/server"
"llmq/context -> llmq/instantsend -> net_processing -> llmq/context"
"llmq/chainlocks -> llmq/instantsend -> net_processing -> llmq/chainlocks"
"net_processing -> spork -> net_processing"
"governance/governance -> net_processing -> governance/governance"
"rpc/blockchain -> rpc/server -> rpc/blockchain"
)
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
CIRCULAR_DEPENDENCIES+=( "$CIRC" )
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}