Dash - Reinventing Cryptocurrency
Go to file
pasta 533d8e2f11
Merge #5871: refactor: alias Dash-specific globals to NodeContext, reduce globals use in GUI, interface, RPC and test logic
fb272dd8ff refactor: use NodeContext members instead of globals in interface logic (Kittywhiskers Van Gogh)
aba57cecb4 qt: add interface for CGovernanceObject querying (Kittywhiskers Van Gogh)
8d73cec438 refactor: reduce globals use in RPC and bench, use LLMQContext members (Kittywhiskers Van Gogh)
e8270ca91b refactor: use NodeContext members instead of globals in RPC logic (Kittywhiskers Van Gogh)
2efebcac81 refactor: use aliases of globals in unit tests (Kittywhiskers Van Gogh)
89f41fa826 refactor: dereference CDeterministicMNManager instance before use (Kittywhiskers Van Gogh)
d3dfdf353c refactor: use aliases of globals in initialization logic (Kittywhiskers Van Gogh)
bb7fe582f8 refactor: rename creditPoolManager to cpoolman in NodeContext, fix order (Kittywhiskers Van Gogh)
6f08e10540 refactor: remove extraneous creditPoolManager initialization (Kittywhiskers Van Gogh)
d136c407d7 refactor: add aliases for Dash-specific global pointers in NodeContext (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Notes

  * In some limited circumstances, we need to pass a reference to a smart pointer _before_ it is initialized. This is permissible if we know for sure that the pointer will be dereferenced _after_ it is initialized (usually, by `assert`'ing `!= nullptr`). This requires us to pass the const ref of the smart pointer object, to ensure that when dereferenced, we get access to the updated value that is set later on the initialization sequence.

    This means we cannot use the bare pointer alias as an argument as it would remain `nullptr` and will not be updated.

    Currently known examples are:
    * `CChainState` through `ChainstateManager::InitializeChainstate`
      * `llmq::CChainLocksHandler` (as `llmq::chainLocksHandler`)
      * `llmq::CInstantSendManager` (as `llmq::quorumInstantSendManager`)
      * `llmq::CQuorumBlockProcessor` (as `llmq::quorumBlockProcessor`)
    * `CDSNotificationInterface`
      * `CDeterministicMNManager` (as `deterministicMNManager`)
      * `CJContext` (as `NodeContext::cj_ctx`)
      * `LLMQContext` (as `NodeContext::llmq_ctx`)

  * We can verify the absence of globals in GUI, interface, RPC and test logic with the commands below (the above caveat applies)

    ```bash
    $ function make_filter() { echo "$1->|\*$1|::$1"; }
    $ PROHIBITED_TERMS="$(make_filter creditPoolManager)|$(make_filter deterministicMNManager)|$(make_filter dstxManager)|$(make_filter governance)|$(make_filter mmetaman)|$(make_filter netfulfilledman)|$(make_filter sporkManager)";
    $ PROHIBITED_LLMQ_TERMS="$(make_filter quorumBlockProcessor)|$(make_filter quorumManager)|$(make_filter chainLocksHandler)|$(make_filter quorumInstantSendManager)";
    $ grep -E "$PROHIBITED_TERMS|$PROHIBITED_LLMQ_TERMS" src/bench/*.{cpp,h} src/node/interfaces.cpp src/qt/*.{cpp,h} src/qt/test/*.{cpp,h} src/rpc/*.{cpp,h} src/test/*.{cpp,h} src/wallet/rpc*.{cpp,h};
    src/test/validation_chainstate_tests.cpp:    CChainState& c1 = WITH_LOCK(cs_main, return manager.InitializeChainstate(&mempool, *m_node.mnhf_manager, *m_node.evodb, llmq::chainLocksHandler, llmq::quorumInstantSendManager, llmq::quorumBlockProcessor));
    src/test/validation_chainstatemanager_tests.cpp:    CChainState& c1 = WITH_LOCK(::cs_main, return manager.InitializeChainstate(&mempool, *m_node.mnhf_manager, evodb, llmq::chainLocksHandler, llmq::quorumInstantSendManager, llmq::quorumBlockProcessor));
    src/test/validation_chainstatemanager_tests.cpp:        &mempool, *m_node.mnhf_manager, evodb, llmq::chainLocksHandler, llmq::quorumInstantSendManager, llmq::quorumBlockProcessor,
    src/test/validation_chainstatemanager_tests.cpp:    CChainState& c1 = WITH_LOCK(cs_main, return manager.InitializeChainstate(&mempool, *m_node.mnhf_manager, evodb, llmq::chainLocksHandler, llmq::quorumInstantSendManager, llmq::quorumBlockProcessor));
    src/test/validation_chainstatemanager_tests.cpp:    CChainState& c2 = WITH_LOCK(cs_main, return manager.InitializeChainstate(&mempool, *m_node.mnhf_manager, evodb, llmq::chainLocksHandler, llmq::quorumInstantSendManager, llmq::quorumBlockProcessor, GetRandHash()));
    src/test/validation_flush_tests.cpp:    CChainState chainstate(&mempool, blockman, *m_node.mnhf_manager, *m_node.evodb, llmq::chainLocksHandler, llmq::quorumInstantSendManager, llmq::quorumBlockProcessor);
    ```

  * We can also check the usage of globals in (test) initialization logic (it will also include all the actual (de)initialization logic and any usage of the bare pointer alias if the name of the global and the alias are the same, as is the case with `netfulfilledman`)

    ```bash
    $ grep -E "$PROHIBITED_TERMS|$PROHIBITED_LLMQ_TERMS" src/init.cpp src/test/util/setup_common.cpp;
    src/init.cpp:    ::netfulfilledman.reset();
    src/init.cpp:    ::mmetaman.reset();
    src/init.cpp:    ::dstxManager.reset();
    src/init.cpp:    ::sporkManager.reset();
    src/init.cpp:    ::governance.reset();
    src/init.cpp:    assert(!::governance);
    src/init.cpp:    ::governance = std::make_unique<CGovernanceManager>();
    src/init.cpp:    node.govman = ::governance.get();
    src/init.cpp:    assert(!::sporkManager);
    src/init.cpp:    ::sporkManager = std::make_unique<CSporkManager>();
    src/init.cpp:    node.sporkman = ::sporkManager.get();
    src/init.cpp:        *node.connman, *node.mn_sync, ::deterministicMNManager, *node.govman, node.llmq_ctx, node.cj_ctx
    src/init.cpp:                chainman.InitializeChainstate(Assert(node.mempool.get()), *node.mnhf_manager, *node.evodb, llmq::chainLocksHandler, llmq::quorumInstantSendManager, llmq::quorumBlockProcessor);
    src/init.cpp:    assert(!::dstxManager);
    src/init.cpp:    ::dstxManager = std::make_unique<CDSTXManager>();
    src/init.cpp:    node.dstxman = ::dstxManager.get();
    src/init.cpp:    assert(!::mmetaman);
    src/init.cpp:    ::mmetaman = std::make_unique<CMasternodeMetaMan>(fLoadCacheFiles);
    src/init.cpp:    node.mn_metaman = ::mmetaman.get();
    src/init.cpp:    assert(!::netfulfilledman);
    src/init.cpp:    ::netfulfilledman = std::make_unique<CNetFulfilledRequestManager>(fLoadCacheFiles);
    src/init.cpp:    node.netfulfilledman = ::netfulfilledman.get();
    src/init.cpp:    if (!node.netfulfilledman->IsValid()) {
    src/test/util/setup_common.cpp:    ::deterministicMNManager = std::make_unique<CDeterministicMNManager>(chainstate, *node.connman, *node.evodb);
    src/test/util/setup_common.cpp:    node.dmnman = ::deterministicMNManager.get();
    src/test/util/setup_common.cpp:    ::deterministicMNManager.reset();
    src/test/util/setup_common.cpp:    ::sporkManager = std::make_unique<CSporkManager>();
    src/test/util/setup_common.cpp:    m_node.sporkman = ::sporkManager.get();
    src/test/util/setup_common.cpp:    ::governance = std::make_unique<CGovernanceManager>();
    src/test/util/setup_common.cpp:    m_node.govman = ::governance.get();
    src/test/util/setup_common.cpp:    ::dstxManager = std::make_unique<CDSTXManager>();
    src/test/util/setup_common.cpp:    m_node.dstxman = ::dstxManager.get();
    src/test/util/setup_common.cpp:    ::mmetaman = std::make_unique<CMasternodeMetaMan>(/* load_cache */ false);
    src/test/util/setup_common.cpp:    m_node.mn_metaman = ::mmetaman.get();
    src/test/util/setup_common.cpp:    ::netfulfilledman = std::make_unique<CNetFulfilledRequestManager>(/* load_cache */ false);
    src/test/util/setup_common.cpp:    m_node.netfulfilledman = ::netfulfilledman.get();
    src/test/util/setup_common.cpp:    ::netfulfilledman.reset();
    src/test/util/setup_common.cpp:    ::mmetaman.reset();
    src/test/util/setup_common.cpp:    ::dstxManager.reset();
    src/test/util/setup_common.cpp:    ::governance.reset();
    src/test/util/setup_common.cpp:    ::sporkManager.reset();
    src/test/util/setup_common.cpp:    m_node.chainman->InitializeChainstate(m_node.mempool.get(), *m_node.mnhf_manager, *m_node.evodb, llmq::chainLocksHandler, llmq::quorumInstantSendManager, llmq::quorumBlockProcessor);
    ```

  ## Breaking Changes
  None, changes are limited to refactoring and do not logically change behaviour.

  ## 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 **(note: N/A)**
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

Top commit has no ACKs.

Tree-SHA512: f6d1a668728525e7cab7af200858a6ab6e20a24786d691630530a9019e8d2b4f474ed4358f40b76266b938dfe96420e0c64ee66a1a0986a3d3f254670162bb1c
2024-02-27 10:01:42 -06:00
.github Merge bitcoin/bitcoin#24509: doc: Add guix prefix for changes to reproducible builds 2024-02-07 10:14:43 -06:00
.tx fix: follow-up #5393 - should be used [dash.dash_ents] (#5472) 2023-07-01 14:16:50 +03:00
build-aux/m4 Merge #21064: refactor: use std::shared_mutex & remove Boost Thread 2024-01-16 09:29:52 -06:00
ci non-scripted-diff: bump copyright year to 2023 2024-02-24 11:05:37 -06:00
contrib fix: adjust verify-binaries script to properly handle RCs 2024-02-24 11:07:44 -06:00
depends Merge bitcoin/bitcoin#25046: build: Fix libmultiprocess cross-compiling to Linux hosts 2024-02-22 20:58:43 -06:00
doc Merge bitcoin/bitcoin#25359: doc: add distcc to productivity notes 2024-02-22 20:58:44 -06:00
share feat: Set client version for non-release binaries and version in guix based on git tags (#5653) 2024-01-11 21:43:42 -06:00
src refactor: use NodeContext members instead of globals in interface logic 2024-02-27 09:56:08 -06:00
test non-scripted-diff: bump copyright year to 2023 2024-02-24 11:05:37 -06:00
.cirrus.yml Merge bitcoin/bitcoin#24574: test: Actually print TSan tracebacks 2024-02-22 20:58:43 -06:00
.dockerignore build: add dash minimal development environment container 2021-12-21 12:43:37 +05:30
.editorconfig Merge #21123: code style: Add EditorConfig file 2021-07-16 10:04:09 -05:00
.fuzzbuzz.yml Merge #21064: refactor: use std::shared_mutex & remove Boost Thread 2024-01-16 09:29:52 -06:00
.gitattributes
.gitignore merge bitcoin#21336: Make .gitignore ignore src/test/fuzz/fuzz.exe 2024-02-06 08:39:51 -06:00
.gitlab-ci.yml build: disable multiprocess build in gitlab CI 2024-01-16 09:34:28 -06:00
.python-version partial bitcoin#27483: Bump python minimum version to 3.8 2023-05-11 09:18:48 -05:00
.style.yapf Merge #15533: test: .style.yapf: Set column_limit=160 2021-07-10 12:10:51 -05:00
.travis.yml Merge #20339: ci: Run more ci configs on cirrus 2024-02-05 10:20:31 -06:00
autogen.sh Merge #17829: scripted-diff: Bump copyright of files changed in 2019 2023-12-06 11:40:14 -06:00
CMakeLists.txt chore: Added missing sources files in CMake (#5503) 2023-07-25 12:23:56 -05:00
configure.ac Merge bitcoin/bitcoin#25332: build: test for timingsafe_bcmp 2024-02-22 20:58:45 -06:00
CONTRIBUTING.md Merge bitcoin/bitcoin#25165: doc: Explain squashing with merge commits 2024-02-22 20:58:44 -06:00
COPYING docs: update license year range to 2024 (#5890) 2024-02-22 20:56:43 -06:00
INSTALL.md Dashify INSTALL.md and build-unix.md 2018-01-12 16:12:54 +01:00
libdashconsensus.pc.in revert dash#1432: Rename consensus source library and API 2022-08-09 14:16:28 +05:30
Makefile.am Merge #20549: Support make src/bitcoin-node and src/bitcoin-gui 2024-01-16 09:34:27 -06:00
README.md chore: drop version from README.md which is not really useful (#5811) 2024-01-10 12:12:41 -06:00
SECURITY.md Merge bitcoin/bitcoin#23466: doc: Suggest keys.openpgp.org as keyserver in SECURITY.md 2022-04-03 18:46:47 -05:00

Dash Core staging tree

CI master develop
Gitlab Build Status Build Status

https://www.dash.org

For an immediately usable, binary version of the Dash Core software, see https://www.dash.org/downloads/.

Further information about Dash Core is available in the doc folder.

What is Dash?

Dash is an experimental digital currency that enables instant, private payments to anyone, anywhere in the world. Dash uses peer-to-peer technology to operate with no central authority: managing transactions and issuing money are carried out collectively by the network. Dash Core is the name of the open source software which enables the use of this currency.

For more information read the original Dash whitepaper.

License

Dash Core is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT.

Development Process

The master branch is meant to be stable. Development is normally done in separate branches. Tags are created to indicate new official, stable release versions of Dash Core.

The develop branch is regularly built (see doc/build-*.md for instructions) and tested, but is not guaranteed to be completely stable.

The contribution workflow is described in CONTRIBUTING.md and useful hints for developers can be found in doc/developer-notes.md.

Testing

Testing and code review is the bottleneck for development; we get more pull requests than we can review and test on short notice. Please be patient and help out by testing other people's pull requests, and remember this is a security-critical project where any mistake might cost people lots of money.

Automated Testing

Developers are strongly encouraged to write unit tests for new code, and to submit new unit tests for old code. Unit tests can be compiled and run (assuming they weren't disabled in configure) with: make check. Further details on running and extending unit tests can be found in /src/test/README.md.

There are also regression and integration tests, written in Python. These tests can be run (if the test dependencies are installed) with: test/functional/test_runner.py

The Travis CI system makes sure that every pull request is built for Windows, Linux, and macOS, and that unit/sanity tests are run automatically.

Manual Quality Assurance (QA) Testing

Changes should be tested by somebody other than the developer who wrote the code. This is especially important for large or high-risk changes. It is useful to add a test plan to the pull request description if testing the changes is not straightforward.

Translations

Changes to translations as well as new translations can be submitted to Dash Core's Transifex page.

Translations are periodically pulled from Transifex and merged into the git repository. See the translation process for details on how this works.

Important: We do not accept translation changes as GitHub pull requests because the next pull from Transifex would automatically overwrite them again.