Commit 38f02de
committed
Merge #7330: refactor: separate governance from consensus code
58ab8b3 fix: register NetGovernance unconditionally and tie SuperblockManager lifetime to govman (UdjinM6)
28f339e refactor: move validators to governance/object.h; remove lonely empty header and cpp (Konstantin Akimov)
8d4989f refactor: replace class CProposalValidator with a simple function (Konstantin Akimov)
7b08205 refactor: drop friend CGovernanceObject from CGovernanceManager (Konstantin Akimov)
853c81d refactor: pass reference to CDeterministicMNManager instead of reference to unique_ptr (Konstantin Akimov)
abced0f refactor: simplify after governance refactoring: drop unused forward declarations & includes, move more network code to NetGovernance (Konstantin Akimov)
c08fcae refactor: merge governance/exceptions into governance/object where it is used (Konstantin Akimov)
2366761 refactor: move code from governance/classes to governance/superblock where it belongs (Konstantin Akimov)
8579a1a refactor: cleanup governance/governance includes and forward declarations (Konstantin Akimov)
b7baf0b fmt: clang-apply (Konstantin Akimov)
9237c62 refactor: break circular dependency between governance/object <-> governance/governance (Konstantin Akimov)
95d5dcc refactor: extract SuperblockManager from CGovernanceManager (Konstantin Akimov)
57ba90f refactor: drop useless GovernanceSignerParent (Konstantin Akimov)
Pull request description:
## Issue being fixed or feature implemented
The `dash-chainstate` (see #7234) requires as dependency full governance implementation, even if it is not functional or relevant to dash-chainstate (the governance uses off-chain objects and they can't be retrieved without p2p communication).
It brings extra files to compilation unit of kernel / dash-chainstate:
governance/classes.cpp \
governance/common.cpp \
governance/exceptions.cpp \
governance/governance.cpp \
governance/object.cpp \
governance/validators.cpp \
governance/vote.cpp \
governance/votedb.cpp \
Also, Governance blocks backporting https://github.com/bitcoin/bitcoin/pull/25064/files because it uses timedata.cpp
Also, Governance requires extra dependency of node/txindex (and recursively index/base which is out-of-scope for kernel)
## What was done?
The only usage of governance in coinsensus code is a validation of superblocks (CMNPaymentsProcessor); superblock validator has been extracted from CGovernanceManager to own file and class `governance::SuperblockManager`.
It can be simply replaced to stub NullSuperblockmanager, same as `class NullNodeSyncNotifier final : public NodeSyncNotifier` for kernel project.
There are also several relevant refactorings:
- governance/exception files are removed; `CGovernanceException` moved to `governance/object.h` where it's used
- governance/validators files are removed; the class `CProposalValidator` is replaced by a simple helper `governance::ValidateProposal` and moved to `governance/object.h'
- the dependency CGovermentManager -> GovernanceSigner is reverted; `CGovermentManager` should not know anything about signer if it's not a masternode. Abstract interface `GovernanceSignerParent` is removed.
## How Has This Been Tested?
2 circular dependencies disappeared:
- "governance/classes -> governance/object -> governance/governance -> governance/classes",
- "governance/governance -> governance/signing -> governance/object -> governance/governance",
Unit & functional tests succeed.
Mock proposal is created on testnet with Dash-Qt.
## 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
- [ ] 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 58ab8b3
Tree-SHA512: 1090981c656d4ba98e8676bf38a8e22d837b7830837406f58532208021d212662028899348e474436a06262be4548bb48e6433ec10f2a6e105e41434fdeae40645 files changed
Lines changed: 1167 additions & 1260 deletions
File tree
- src
- active
- evo
- governance
- masternode
- node
- qt
- rpc
- test
- util
- wallet
- test
- functional
- lint
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
238 | 237 | | |
239 | | - | |
240 | 238 | | |
241 | 239 | | |
242 | 240 | | |
243 | 241 | | |
244 | | - | |
| 242 | + | |
245 | 243 | | |
246 | 244 | | |
247 | 245 | | |
| |||
525 | 523 | | |
526 | 524 | | |
527 | 525 | | |
528 | | - | |
529 | | - | |
530 | 526 | | |
531 | 527 | | |
532 | 528 | | |
533 | 529 | | |
534 | | - | |
| 530 | + | |
535 | 531 | | |
536 | 532 | | |
537 | 533 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
43 | | - | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
58 | | - | |
| 61 | + | |
| 62 | + | |
59 | 63 | | |
60 | 64 | | |
61 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | 7 | | |
| 8 | + | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | | - | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | | - | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
33 | 50 | | |
34 | 51 | | |
35 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| 43 | + | |
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| 49 | + | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
51 | 56 | | |
52 | | - | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
| 64 | + | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
This file was deleted.
0 commit comments