-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor: move C{ActiveMasternode, DeterministicMN}Manager, CMasternode{MetaMan, Sync} to NodeContext #5980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM f967c16
(CI is not finished yet)
src/governance/governance.cpp
Outdated
| LogPrint(BCLog::GOBJECT, "CGovernanceManager::UpdateCachesAndClean -- Checking object for deletion: %s, deletion time = %d, time since deletion = %d, delete flag = %d, expired flag = %d\n", | ||
| strHash, pObj->GetDeletionTime(), nTimeSinceDeletion, pObj->IsSetCachedDelete(), pObj->IsSetExpired()); | ||
| LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- Checking object for deletion: %s, deletion time = %d, time since deletion = %d, delete flag = %d, expired flag = %d\n", | ||
| __func__, strHash, pObj->GetDeletionTime(), nTimeSinceDeletion, pObj->IsSetCachedDelete(), pObj->IsSetExpired()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: After dca7ae2 get merged no need more __func__ here.
So far as function is not actually renamed and it still has a correct name, consider removing this refactoring from PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are introduced in #5966 and have been remedied over there in the latest push.
| CChainLocksHandler::CChainLocksHandler(CChainState& chainstate, CConnman& _connman, CQuorumManager& _qman, | ||
| CSigningManager& _sigman, CSigSharesManager& _shareman, CSporkManager& sporkman, | ||
| CTxMemPool& _mempool) : | ||
| CTxMemPool& _mempool, const CMasternodeSync& mn_sync) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: 😢
|
|
||
| using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: that's still forward declaration, not sure that empty line here is reasonable but nevermind
| using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>; | |
| using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>; |
|
Marked as draft to avoid confusion with dependency PR |
…s use in net and net processing, move CheckSpecialTx into CSpecialTxProcessor 191b3de refactor: move CheckSpecialTx into CSpecialTxProcessor (Kittywhiskers Van Gogh) 91f4588 refactor: const the pointer of type `const CActiveMasternodeManager` (Kittywhiskers Van Gogh) 1d9b7fa refactor: trim globals use in net processing functions (Kittywhiskers Van Gogh) 2a4fdbf refactor: trim globals use in net threads and functions (Kittywhiskers Van Gogh) ff825ac init: load databases of governance dependencies before loading its own (Kittywhiskers Van Gogh) cf940e8 init: decouple CMasternodeMetaMan construction from initialization (Kittywhiskers Van Gogh) fae5696 init: move CActiveMasternodeManager construction before PeerManager (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Dependency for #5980 * `CActiveMasternodeManager` construction is moved upwards (_before_ `PeerManager` construction) to avoid having to pass it as a `std::unique_ptr` const-ref. Shouldn't have any effect since _initialization_ is done in `ThreadImport`. * `CConnman::SetNetworkActive` will require a pointer to `CMasternodeSync` in order to call `CMasternodeSync::Reset()`. As it is no longer available as a global, it will need to be manually called through for the effect to happen as the `CConnman` constructor will simply pass a `nullptr` when calling `SetNetworkActive`, bypassing the `Reset()` call. `CMasternodeSync` is appropriately passed through in RPC (`setnetworkactive`) and interfaces. * `CheckSpecialTx` was moved into `CSpecialTxProcessor` to avoid having to expose `CDeterministicMNManager` to `MemPoolAccept` (though it has been exposed to `CChainstateHelper` through a helper, `CChainState::ChainHelper()` that was introduced in this PR). * As a drawback, some RPC functions that otherwise only needed access to `CDeterministicMNManager`, will also be accessing `CChainstateHelper`. ## Concerns * ~~Some tests seem to sporadically fail (fail as part of a suite but succeed when run individually, no changes in this PR should worsen resource contention) but attempting to reproduce them reliably hasn't succeeded so far.~~ It appears the sporadic failure is shown in `p2p_node_network_limited.py` during TSan runs (see [failed run](https://gitlab.com/dashpay/dash/-/jobs/6529052189) for commit f95ffa7 that then succeeded in a [second attempt](https://gitlab.com/dashpay/dash/-/jobs/6530402585) versus a similar [failed run](https://gitlab.com/dashpay/dash/-/jobs/6546952668) for e210cb7 that also succeeded on [second try](https://gitlab.com/dashpay/dash/-/jobs/6549470339)). Similar behaviour has not been observed on `develop` (as of this writing is 27c0813). ## Breaking changes `CMasternodeSync::Reset()` will not be called on every `CConnman` entity instantiated. Behaviour changes as a result of that are not substantiated. Protocol, networking or interface changes are not expected, changes are primarily refactoring. ## 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 **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK 191b3de Tree-SHA512: 73a79818b0a79e3f26f079019c078ec8f81b2dae17638f695243b87fa76e9bed906a33ad7dd4e600f699100c5e994628cbb596e78a7802fa630c91f4d69cce4c
The merge-base changed after approval.
|
This pull request has conflicts, please rebase. |
…Manager presence Despite removeUnchecked not explicitly requiring CDeterministicMNManager, it has also been made conditional due to addUnchecked requiring the manager and allowing for some operations but not others when pertaining to a transaction type could allow inconsistencies to arise. Better to treat as one unit and skip both if manager isn't present.
52ba288 to
a5be37c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK a5be37c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM a5be37c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
…er pointers, check before `queueman` access, update P2P message map in tests 24f9357 fix: update P2P message map in functional test framework (Kittywhiskers Van Gogh) a432a95 fix: check if `queueman` is initialized before accessing it (Kittywhiskers Van Gogh) 0444e59 trivial: use `std::atomic` to protect connected manager pointers (Kittywhiskers Van Gogh) b7700b3 trivial: use `std::atomic` to protect connected signer pointers (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Dependency for #6838 This pull request contains the following: * Minor follow-up to [dash#6828](#6828) based on feedback received during review also extended to similar connections introduced in [dash#5980](#5980) ([commit](a5be37c#diff-c065d4cd2398ad0dbcef393c5dfc53f465bf44723348892395fffd2fb3bac522R350-R355)) and [dash#6030](#6030) ([commit](805537e#diff-59f8e9f1b35c1428332caab753a818e3b2146e73bb6c998a2aed5f7eddbc6fa1R357-R363)) * A bugfix to avoid potential crash caused by missing `nullptr` check after `CCoinJoinClientQueueManager` was conditionally initialized in [dash#5163](#5163) ([commit](2d2814e#diff-b1e19192258d83199d8adaa5ac31f067af98f63554bfdd679bd8e8073815e69dR2308-R2310)) * Updating the Python mapping of Dash-specific P2P messages to avoid unexpected test failures ([build](https://github.com/dashpay/dash/actions/runs/17707917238/job/50323243018#step:6:328)), observed when working on [dash#6838](#6838) ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 24f9357 Tree-SHA512: 90b0b2536a7704e3f3da4ece05b6ad09c393a4348aaff87682b7547f6a7d6ffede504176fa1f63bd9ad88961fb1e3b113aae5df357c0dfb70df2fc55500c2b5f
Additional Information
Depends on refactor: rearrange database initialization, trim globals use in net and net processing, move CheckSpecialTx into CSpecialTxProcessor #5966
CTxMemPool's ProTx logic took the presence ofCDeterministicMNManagerfor granted. To account forCTxMemPoolinstances that aren't seeded with the pointer to the manager (usually because the unit test doesn't call for them), refactoring was done to make ProTx code paths conditional on the manager pointer being set to something.Setting the manager pointer is done through
CTxMemPool::Init(), to avoid having to pass anotherstd::unique_ptrconst-ref and also becauseCTxMemPoolcan technically work without the manager if ProTx logic is not needed (andCTxMemPool::existsProviderTxConflict()isn't called)CTxMemPool::Init()doesn't allow overwriting a not-nullptrmanager pointer. If that is desired, thenCTxMemPool::Reset()should be called first. This was done to avoid unintentional double-initialization/overwriting.Breaking Changes
None. Changes are limited to refactoring.
Checklist: