Commit Graph

71 Commits

Author SHA1 Message Date
Kittywhiskers Van Gogh
8c9f57dac4
refactor: trim and document assumptions for GetQuorum and friends
Some portions of the codebase make implicit assumptions that `GetQuorum`
will not return a `nullptr` by not performing checking for it or make
explicit assumptions by `assert`ing not-`nullptr`.

Let's document explicit assumptions, document implicit assumptions and
soften some hard assumptions where softening is possible.
2024-11-14 10:07:34 +00:00
Kittywhiskers Van Gogh
e544d3c741
fmt: apply clang-format-diff.py suggestions, satisfy linter
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2024-09-12 06:36:44 +00:00
Kittywhiskers Van Gogh
e82559516c
merge bitcoin#25619: avoid overriding non-virtual ToString() in CService and use better naming 2024-09-11 16:18:46 +00:00
Kittywhiskers Van Gogh
208b1c079b
refactor: drop usage of chainstate globals in masternode logic 2024-06-26 13:50:49 +00:00
Kittywhiskers Van Gogh
5b86df6ca3
refactor: reduce llmq::CQuorumManager globals use, use args 2024-05-29 08:20:57 +00:00
Vijay
7b52349b11
Revert "merge #855: Fix bad mn sig ipv6" 2024-05-24 13:33:26 -05:00
Kittywhiskers Van Gogh
f8d1853903
refactor: even more passing CDeterministicMNManager by ref 2024-03-19 15:21:01 +00:00
Konstantin Akimov
097a8e7196
non-scripted-diff: bump copyright year to 2023
that's a result of:
contrib/devtools/copyright_header.py update ./

it is not scripted diff, because it works differentlly on my localhost and in CI:
CI doesn't want to use git commit date which is mocked to 30th Dec of 2023
2024-02-24 11:05:37 -06:00
Konstantin Akimov
3133be10f9
test: multiple linter warnings to suppress or fix (#5880)
## Issue being fixed or feature implemented
On my local kubuntu linters have way too much spam

## What was done?
See each commit

## How Has This Been Tested?
Run locally. Amount of warnings decreased from thousands to fewer
amount. Excluding typos, they are:
```
src/coinjoin/client.cpp:1420:5: warning: Consider using std::any_of algorithm instead of a raw loop. [useStlAlgorithm]
src/coinjoin/client.cpp:1426:5: warning: Consider using std::any_of algorithm instead of a raw loop. [useStlAlgorithm]
src/coinjoin/client.cpp:655:26: warning: Consider using std::copy_if algorithm instead of a raw loop. [useStlAlgorithm]
src/coinjoin/server.cpp:593:33: warning: Consider using std::any_of algorithm instead of a raw loop. [useStlAlgorithm]
src/coinjoin/server.cpp:630:106: warning: Consider using std::any_of algorithm instead of a raw loop. [useStlAlgorithm]
src/governance/governance.cpp:1057:9: warning: C-style pointer casting [cstyleCast]
src/governance/governance.cpp:1068:9: warning: C-style pointer casting [cstyleCast]
src/governance/governance.cpp:1079:13: warning: C-style pointer casting [cstyleCast]
src/governance/governance.cpp:1086:9: warning: C-style pointer casting [cstyleCast]
src/governance/governance.cpp:1094:9: warning: C-style pointer casting [cstyleCast]
src/governance/governance.cpp:1099:5: warning: C-style pointer casting [cstyleCast]
src/governance/governance.cpp:1486:34: warning: Consider using std::copy_if algorithm instead of a raw loop. [useStlAlgorithm]
src/llmq/commitment.cpp:102:5: warning: Consider using std::all_of or std::none_of algorithm instead of a raw loop. [useStlAlgorithm]
src/llmq/instantsend.cpp:820:38: warning: Consider using std::any_of algorithm instead of a raw loop. [useStlAlgorithm]
src/llmq/quorums.cpp:831:102: warning: Consider using std::any_of algorithm instead of a raw loop. [useStlAlgorithm]
src/llmq/quorums.h:300:17: warning: C-style pointer casting [cstyleCast]
src/llmq/quorums.h:301:17: warning: C-style pointer casting [cstyleCast]
src/llmq/quorums.h:302:17: warning: C-style pointer casting [cstyleCast]
src/llmq/quorums.h:303:17: warning: C-style pointer casting [cstyleCast]
src/spork.cpp:119:58: warning: Consider using std::any_of algorithm instead of a raw loop. [useStlAlgorithm]
src/statsd_client.cpp:234:63: warning: C-style pointer casting [cstyleCast]

Advice not applicable in this specific case? Add an exception by updating
IGNORED_WARNINGS in test/lint/lint-cppcheck-dash.sh
^---- failure generated from test/lint/lint-cppcheck-dash.sh
Consider install flake8-cached for cached flake8 results.
test/functional/data/invalid_txs.py: error: Source file found twice under different module names: "invalid_txs" and "data.invalid_txs"
test/functional/data/invalid_txs.py: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules for more info
test/functional/data/invalid_txs.py: note: Common resolutions include: a) adding `__init__.py` somewhere, b) using `--explicit-package-bases` or adjusting MYPYPATH
Found 1 error in 1 file (errors prevented further checking)
^---- failure generated from test/lint/lint-python.s
```
 


## Breaking Changes
N/A

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] 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
2024-02-20 08:22:37 -06:00
PastaPastaPasta
ca77d06a25
refactor: make GetTxPayload return an Optional T instead of taking in a T& return (#5733)
## Issue being fixed or feature implemented
We should avoid return by reference; especially return by reference with
a bool flag indicating validity.

## What was done?
Instead we use a std::optional

## How Has This Been Tested?
Unit tests pass

## Breaking Changes
Should be none

## Checklist:
_Go over all the following points, and put an `x` in all the boxes that
apply._
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] 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)_

---------

Co-authored-by: Konstantin Akimov <knstqq@gmail.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2024-01-11 21:43:01 -06:00
Konstantin Akimov
377d929edc refactor: drop dependency evo/simplifiedmns on llmq/utils 2023-12-21 23:02:31 -06:00
UdjinM6
6e49e2f3d9
refactor: introduce CbTx version enum class, adjust version names (#5725)
## Issue being fixed or feature implemented
- The name `CB_V19_VERSION` is confusing because CbTx v2 was introduced
in v14, not v19
https://github.com/dashpay/dash/blob/master/doc/release-notes/dash/release-notes-0.14.0.md#dip0004---coinbase-payload-v2
- There are magic numbers instead of constants in some places
- `CheckCbTx` should check whatever the upper limit is, not
`CB_V20_VERSION` specifically

## What was done?
Turn CbTx versions into enum using self-describing names

## How Has This Been Tested?
Run tests

## Breaking Changes
n/a

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] 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)_
2023-11-24 11:25:30 -06:00
Konstantin Akimov
e6391b606a refactor: use emplace_back in simplifiedmns constructors 2023-11-18 02:43:47 +07:00
PastaPastaPasta
b27765f358
refactor: further spanification of Dash code (#5586)
## Issue being fixed or feature implemented
Use Spans instead of const std::vector<T>&

## What was done?
Replaced with Span

## How Has This Been Tested?
Building, ran a few tests

## Breaking Changes
Should be none, please review potential lifetime issues in bls_worker;
it scares me a bit and I don't understand how we know these won't
dangle.

## 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
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] 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)_
2023-10-03 09:52:33 -05:00
PastaPastaPasta
8eda85a451
refactor: make all ToJson functions return a UniValue instead of return by reference; add nodiscard (#5592)
## Issue being fixed or feature implemented
Return by reference is generally not ideal, and especially as there is
only one return path per function, all returns will be done via NRVO.
Additionally, call sites are simpler now.

## What was done?
Refactored to return by value


## How Has This Been Tested?
Building

## Breaking Changes
Should be 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
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] 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)_
2023-09-29 12:56:52 -05:00
Konstantin Akimov
3443630a8c
ci: adds flag -Werror=reorder for arm target (#5540)
## Issue being fixed or feature implemented
The order of members in a class/struct definition and the order of their
initialization should match. This ensures that the code is more
error-proof in cases where the order of member initializations is
important, as they may depend on each other.


Instead manual checking of member initialization better let CI handle
it.
Last PR where it's noticed:
https://github.com/dashpay/dash/pull/5531#discussion_r1299404387

## What was done?
New flag "-Werror=reorder" for `configure.ac` and fixes existing code.

## How Has This Been Tested?
Build code with `--enable-werror`



## Breaking Changes
N/A

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] 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
2023-08-22 23:19:48 +03:00
Odysseas Gabrielides
93f8df1c31
refactor: Global renaming from hpmn to evo (#5508)
## Issue being fixed or feature implemented

## What was done?
Renaming of all classes/variables/functions/rpcs from `hpmn` to `evo`.

## How Has This Been Tested?
All unit and func tests are passing.
Sync of Testnet.

## Breaking Changes
All protx RPCs ending with `_hpmn` were converted to `_evo`.
`_hpmn` RPCs are now deprecated.
Although, they can still be enabled by adding `-deprecatedrpc=hpmn`.


## Checklist:
- [x] I have performed a self-review of my own code
- [ ] 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 _(for repository
code-owners and collaborators only)_

---------

Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-08-17 14:01:12 -05:00
Kittywhiskers Van Gogh
b1643e7c86 merge bitcoin#21575: Create blockstorage module 2023-07-28 00:18:27 -05:00
Odysseas Gabrielides
494b5c744c
feat: mnlistdiff v20 CL sig quorums (#5377)
## Issue being fixed or feature implemented
Implementation of Randomness Beacon Part 3.

Starting from v20 activation fork, members for quorums are sorted using
(if available) the best CL signature found in Coinbase.
If no CL signature is present yet, then the usual way is used (By using
Blockhash instead)

The actual new way to shuffle is already implemented in
https://github.com/dashpay/dash/pull/5366.

SPV clients also need to calculate members, but they only know block
headers.
Since Coinbase is in the actual block, then they lack the required
information to correctly calculate quorum members.

## What was done?
- Message `MNLISTIDFF` is enriched with a new field `quorumsCLSigs`.
This field holds the Chainlock Signature required for each set of
indexes corresponding to quorums in field `newQuorums`.
-  Protocol version has been bumped to `70230`.
- Clients with protocol version greater or equal to `70230` will receive
the new field `quorumsCLSigs`.
- The same field is returned in `protx diff` RPC.

Note:
- Field `quorumsCLSigs` will populated only after v20 activation
- If for one or more quorums, no non-null CL sig was found in CbTx then
a null signature is returned in `quorumsCLSigs`.

## How Has This Been Tested?
- Functional test mininode's protocol version was bumped to `70230`.
- `feature_llmq_rotation.py` checks that `quorumsCLSigs` match in both
P2P and RPC messages.

## Breaking Changes
No

## 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 _(for repository
code-owners and collaborators only)_

---------

Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: pasta <pasta@dashboost.org>
2023-07-10 11:23:09 -05:00
UdjinM6
b3f1d1cdd8
chore: prettify json representations of CSimplifiedMNListEntry and CSimplifiedMNListDiff (#5434)
## Issue being fixed or feature implemented
Should fix
https://github.com/dashpay/dash/pull/5424#discussion_r1228654939 and
make `CSimplifiedMNListEntry`'s json a bit more human-friendly (imo) by
having `nVersion` and `nType` at the top of it.

Move `nVersion` up for `CSimplifiedMNListDiff` too.

NOTE: `nVersion` wasn't actually duplicated in rpc results, it was
simply assigned twice inside. still not nice though.

Thanks @thephez ! 👍 

## What was done?

## How Has This Been Tested?


## Breaking Changes
n/a

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] 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)_
2023-06-17 10:50:26 -05:00
UdjinM6
a760e33236
feat: store protx version in CSimplifiedMNListEntry and use it to ser/deser pubKeyOperator (#5397)
## Issue being fixed or feature implemented
Mobile wallets would have to convert 4k+ pubkeys at the V19 fork point
and it's a pretty hard job for them that can easily take 10-15 seconds
if not more. Also after the HF, if a masternode list is requested from
before the HF, the operator keys come in basic scheme, but the
merkelroot was calculated with legacy. From mobile team work it wasn't
possible to convert all operator keys to legacy and then calculate the
correct merkleroot.

~This PR builds on top of ~#5392~ #5403 (changes that belong to this PR:
26f7e966500bdea4c604f1d16716b40b366fc707 and
4b42dc8fcee3354afd82ce7e3a72ebe1659f5f22) and aims to solve both of
these issues.~

cc @hashengineering @QuantumExplorer 

## What was done?
Introduce `nVersion` on p2p level for every CSimplifiedMNListEntry. Set
`nVersion` to the same value we have it in CDeterministicMNState i.e.
pubkey serialization would not be via basic scheme only after the V19
fork, it would match the way it’s serialized on-chain/in
CDeterministicMNState for that specific MN.

## How Has This Been Tested?
run tests

## Breaking Changes
NOTE: `testnet` is going to re-fork at v19 forkpoint because
`merkleRootMNList` is not going to match

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [ ] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
2023-06-11 12:29:00 -05:00
UdjinM6
cc2479ab0c
fix: multiple 5403 followups (#5424)
## Issue being fixed or feature implemented
- CBLSLazyWrapper is doing to much and not enough at the same time
- nVersion assignment in CDeterministicMNState(Diff) is incomplete
- pubKeyOperator deserialization needs nVersion but nVersion is deser-ed
much later
- protx rpcs are implicitly converting pubKeyOperator (by forcing
nVersion=2), they shouldn't do that

## What was done?
pls see individual commits

## How Has This Been Tested?
- [x] run tests locally 
- [x] reindex on testnet:
  - [x] with and without `--assumevalid=0` to the tip
  - [x] with 19.1 almost to the forkpoint, then with this version
- [x] reindex on mainnet:
  - [x] with and without `--assumevalid=0` to the tip
  - [x] with 19.1 to height 1100000+, then with this version

## Breaking Changes
might need reindexing if you were running develop on testnet already

## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] 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)_
2023-06-11 10:00:10 +03:00
UdjinM6
3edc876f99
refactor: move BuildSimplifiedDiff to src/evo/simplifiedmns.cpp to resolve 3 circular dependencies (#5380)
## Issue being fixed or feature implemented
Move `BuildSimplifiedDiff` to the place it's actually used. This also
resolves 3 circular dependencies we have atm.

## What was done?
mostly trivial move-only changes

## How Has This Been Tested?
it compiles and linter is happy locally

## Breaking Changes
n/a

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] 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)_
2023-05-18 12:03:19 -05:00
PastaPastaPasta
b0136fd657
refactor: misc refactoring (#5260)
## Issue being fixed or feature implemented
Converts some CCriticalSections with Mutexes; other minor refactoring

in
0fce09d1f0
see before
<img width="771" alt="image"
src="https://user-images.githubusercontent.com/6443210/225969163-bb4cee62-3e6a-4224-980a-11b2e0024a60.png">
and after
<img width="766" alt="image"
src="https://user-images.githubusercontent.com/6443210/225969245-e8afcbf6-c112-40c4-9504-82830b005a53.png">


## What was done?


## How Has This Been Tested?

## Breaking Changes
None

## Checklist:
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] 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
2023-04-15 12:24:02 -05:00
Kittywhiskers Van Gogh
9d55bd8d1c merge bitcoin#20749: Prune g_chainman usage related to ::LookupBlockIndex 2023-04-04 12:41:45 -05:00
PastaPastaPasta
0ee3974d1f
refactor: implement c++23 inspired ToUnderlying (#5210)
## Issue being fixed or feature implemented
Avoid lots of static_cast's from enums to underlying types. Communicate
intention better

## What was done?
implement c++23 inspired ToUnderlying, then see std::to_underlying and
https://en.cppreference.com/w/cpp/types/underlying_type; Then, we use
this instead of static_casts for enums -> underlying type


## How Has This Been Tested?
make check

## Breaking Changes
None

## 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

**For repository code-owners and collaborators only**
- [x] I have assigned this pull request to a milestone

---------

Co-authored-by: Konstantin Akimov <knstqq@gmail.com>
2023-02-20 13:12:12 +03:00
Konstantin Akimov
7681d63934
refactor: using C++11/14/17 features in dash specifict code (#5190)
## Issue being fixed or feature implemented
This refactoring helps to make code more specific and clear.
There's using syntax feature from modern C++ such as 'enum class',
structure bindings in loops, declaration variables inside if/switch
statements, etc.


## What was done?
This PR is based on @PastaPastaPasta 's PR
https://github.com/dashpay/dash/pull/4472

There excluded changes related to using std::optional. Let's decide
firstly about `Result` class: https://github.com/dashpay/dash/pull/5109


## How Has This Been Tested?
Run unit/functional tests

## Breaking Changes
No breaking changes

## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have assigned this pull request to a milestone

---------

Co-authored-by: Pasta <pasta@dashboost.org>
2023-02-19 17:04:57 -06:00
Konstantin Akimov
2083380bc3
refactor: introduce enum class for MnType and clean up implementation accordingly (#5200)
## Issue being fixed or feature implemented
expressions like `nType == MnType::HighPerformance.index` look pretty
confusing in current implementation of 4k HPMN.

Changing `uint8_t` index to `enum class MnType : uint8_t` give pros:
- switch inside GetMnType() and any similar code will show a compiler
warning if any type is missing.
- instead "MnType::HighPerformance.index" you can write
MnType::HighPerformance
 - you can remove confusing `.index` from MnType

But also Cons:
- instead `log("%d", nType)` you need to write `log("%d",
static_cast<int>(nType))`;

## What was done?
Introduced new enum class MnType and rewritten generating
Regular/HighPerformance objects with params (description, collateral
amount, etc).

Also were added attributes [[no_discard]] for related code.

## How Has This Been Tested?
Run unit/functional tests

## Breaking Changes
No breaking changes.

## Checklist:
- [x] I have performed a self-review of my own code
- [x] I have assigned this pull request to a milestone

---------

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-02-16 14:05:01 +02:00
Odysseas Gabrielides
aa8462b060
feat!: 4k collateral high performance masternode implementation (#5039)
## Issue being fixed or feature implemented


## What was done?
Implementation of 4k collateral HPMN.

## How Has This Been Tested?

## Breaking Changes

## 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

**For repository code-owners and collaborators only**
- [x] I have assigned this pull request to a milestone

---------

Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: pasta <pasta@dashboost.org>
Co-authored-by: PastaPastaPasta <6443210+pastapastapasta@users.noreply.github.com>
Co-authored-by: UdjinM6 <1935069+Udjinm6@users.noreply.github.com>
Co-authored-by: Konstantin Akimov <545784+knst@users.noreply.github.com>
2023-02-14 12:48:33 -06:00
Wladimir J. van der Laan
2d13a4b190 Merge #15452: Replace CScriptID and CKeyID in CTxDestination with dedicated types
78e407ad0c26190a22de1bc8ed900164a44a36c3 GetKeyBirthTimes should return key ids, not destinations (Gregory Sanders)
70946e7fee54323ce6a5ea8aeb377e2c7c790bc6 Replace CScriptID and CKeyID in CTxDestination with dedicated types (Gregory Sanders)

Pull request description:

  The current usage seems to be an overloading of meanings. `CScriptID` is used in the wallet as a lookup key, as well as a destination, and `CKeyID` likewise. Instead, have all destinations be dedicated types.

  New types:
  `CScriptID`->`ScriptHash`
  `CKeyID`->`PKHash`

ACKs for commit 78e407:
  ryanofsky:
    utACK 78e407ad0c26190a22de1bc8ed900164a44a36c3. Only changes are removing extra CScriptID()s and fixing the test case.
  Sjors:
    utACK 78e407a
  meshcollider:
    utACK 78e407ad0c

Tree-SHA512: 437f59fc3afb83a40540da3351507aef5aed44e3a7f15b01ddad6226854edeee762ff0b0ef336fe3654c4cd99a205cef175211de8b639abe1130c8a6313337b9
2023-02-10 23:34:57 +03:00
Odysseas Gabrielides
e7e48329f7
fix: Merklerootmnlist calc bls scheme (#5157)
## Issue being fixed or feature implemented
Code was still using legacy scheme for `pubKeyOperator` of each
`CSimplifiedMNListEntry` while calculating `MerklerootMNList` while v19
HF was active.

## What was done?
When building `CSimplifiedMNList` for `MerklerootMNList`, this PR adds
the correct set of `nVersion` for `CSimplifiedMNListEntry` so that basic
scheme will be used instead of legacy.

Furthermore, DIP3 unit tests suites for v19 will test for 1000 blocks
instead of 900 to cover v19 activated period.

## How Has This Been Tested?

## Breaking Changes

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] 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

**For repository code-owners and collaborators only**
- [x] I have assigned this pull request to a milestone
2023-01-12 16:51:14 -06:00
Odysseas Gabrielides
78d057dd7a
feat!: BLS scheme upgrade (#5021)
Tracking issue is:
[(https://github.com/dashpay/dash/issues/5001)](https://github.com/dashpay/dash/issues/5001)

Co-authored-by: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: pasta <pasta@dashboost.org>
2022-12-29 23:45:31 -06:00
Kittywhiskers Van Gogh
a35245653c
refactor: pass references to objects instead of using global definitions (#4988)
* fix: move chain activation logic downward to succeed LLMQ initialization

* fix: change order of initialization to reflect dependency

* llmq: pass all global pointers invoked as CDSNotificationInterface arguments

* llmq: pass reference to quorumDKGDebugManager instead of invoking global

* llmq: pass reference to quorumBlockProcessor instead of invoking global

* llmq: pass reference to quorumDKGSessionManager instead of invoking global

* llmq: pass reference to quorumManager instead of invoking global

Co-authored-by: "UdjinM6 <UdjinM6@users.noreply.github.com>"

* llmq: pass reference to quorumSigSharesManager within CSigningManager and networking

* llmq: pass reference to quorumSigSharesManager instead of invoking global

* llmq: pass reference to chainLocksHandler instead of querying global

* llmq: pass reference to quorumInstantSendManager instead of querying global

* trivial: accept argument as const where possible

* style: remove an unneeded const_cast and instead pass by const reference

* style: use const where possible

Co-authored-by: pasta <pasta@dashboost.org>
2022-09-22 15:14:48 +04:00
UdjinM6
bdfa322f1f
fix: Restore caching in CalcCbTxMerkleRootMNList (#4951) 2022-08-06 11:45:02 +03:00
PastaPastaPasta
f7f70d61de
feat: add scriptPayout and scriptOperatorPayout to protx diff / CSimplifiedMNListEntry (#4740)
* feat: add scriptPayout and scriptOperatorPayout to `protx diff` / CSimplifiedMNListEntry

* mem-only

* tweak BuildSimplifiedDiff

* add "extended" to "protx diff"

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-06-24 21:35:23 +03:00
PastaPastaPasta
d64b7229cd
chore: bump copyrights (#4873)
* chore: bump copyright in configure.ac

* chore: bump copyright via copyright_header.py

ran command `python3 contrib/devtools/copyright_header.py update .`
2022-06-08 02:36:46 +03:00
PastaPastaPasta
8ef0231166
refactor: break circular dependencies(-16, +2) (#4670)
* refactor: break circular dependencies(-13, +2)

introduces specialtxman, which handles validation of special transactions, specialtx is now simply the primitive underlying type. This breaks a lot of the circular depends

Also removes an unneeded `#include <masternode/payments.h>` in net_processing.cpp, which resolves a circular dependency. (we know it's okay to remove b/c masternode/payments.h isn't included in any header files, and removing it doesn't break compilation)

* format: make clang-format happy

* remove unrelated change

* remove some unneeded includes to `evo/deterministicmns.h`, explicitly include some previously implicitly included includes.

Resolves two circular dependencies

* refactor: remove circular depend, unused include
2022-01-24 17:20:50 +03:00
PastaPastaPasta
002dc46cc1
refactor: numerous changes to avoid passing around a const ref to shared_ptr of CDeterministicMNC when not needed. (#4653)
* refactor: numerous changes to avoid passing around a const ref to shared_ptr of CDeterministicMNC when not needed.

Introduces ForEachMNShared, a version of ForEachMN that uses a shared_ptr, and may extend the lifetime of the underlying shared_ptr. This is not preferred, should prefer ForEachMN. See docs.

Adjusts ForEachMN to pass a reference. This is preferred for use over ForEachMNShared. See docs. A reference should be used since in usage we assume it's non-null anyway. Additionally, it allows us to know that the lifespan of the dmn is not being being extended (if lifespan needs to be extended, should use ForEachMNShared.

IsMNValid, IsMNPoSeBanned, UpdateMN, UpdateMN, AddUniqueProperty, DeleteUniqueProperty, UpdateUniqueProperty now take a const reference to CDeterministicMN instead of a const reference to shared_ptr<CDeterministicMN>. All of these functions previously assumed (or would've crashed) a non-null ptr, and non extended lifetime, as such converting to ref is appropriate.

CompareByLastPaid ptr overload now takes raw ptr instead of a const ref to shared. Since we simply dereference them, a raw ptr makes the most sense. This also avoids a potential expensive and implicit raw ptr -> shared ptr conversion if the function was called with raw ptrs.

rpcevo BuildDMNListEntry now takes a const ref for reasons as stated above

Signed-off-by: Pasta <pasta@dashboost.org>

* make stuff const

Signed-off-by: Pasta <pasta@dashboost.org>

* refactor/llmq: use ranges count_if

Signed-off-by: Pasta <pasta@dashboost.org>
2022-01-04 19:13:38 +03:00
PastaPastaPasta
7b78390015
refactor: Include adjustments (#4526)
* include adjustments

* fix macOs build failure

Signed-off-by: pasta <pasta@dashboost.org>

* expcitly include array in spork.h

* sort includes in most files
2021-10-25 16:55:34 +03:00
Kittywhiskers Van Gogh
1f436f8aee merge bitcoin#15948: rename chainActive
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-10-22 08:15:22 +05:30
Kittywhiskers Van Gogh
f22be5a16b refactor: llmq/quorums_*[cpp/h] --> llmq/*.[cpp/h] 2021-10-06 09:04:45 +05:30
PastaPastaPasta
f87d62d677
refactor: misc bls, evo, include refactoring (#4305)
* refactor/bls: misc refactoring and spelling/grammar fixes in bls code

* refactor/evo: misc refactoring and spelling/grammar fixes in evo code

* refactor: some include changes

* refactor: remove redundant `public`

* fix linter

Signed-off-by: pasta <pasta@dashboost.org>

* Sort includes

* Move `class CTxDSIn;`

* Drop unused functions in CBLSWorker

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-07-31 21:29:12 +03:00
Kittywhiskers Van Gogh
01272b159d Merge #19373: Replace HexStr(o.begin(), o.end()) with HexStr(o) 2021-05-20 10:15:17 +05:30
PastaPastaPasta
c5b919d084
Update copyright (#4115)
* run: `python3 contrib/devtools/copyright_header.py update .`

* bump copyright year
2021-04-20 22:33:02 +03:00
PastaPastaPasta
5074e6df9e
Extensive include refactoring (#4095)
* Simple changes, mostly just includes

* Continued include changes combined with using pointers to avoid including more than necessary in headers

* remove dup include

* masternode-utils.cpp include net.h in all builds

* resolve linter -7 +11

* drop quorums.h from dkgsessionhandler.cpp

* Add `<utilstrencodings.h>`

* Initialize lastMNListForVotingKeys

* Refactor GetMinedCommitment to return sharedptr

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-04-15 23:41:16 -04:00
PastaPastaPasta
df138d7346
typo: blockHash -> basBlockHash
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2020-12-15 17:00:05 -06:00
Wladimir J. van der Laan
0efc03deb0
Merge bitcoin#11041 Add LookupBlockIndex
Contains both the changes done upstream and changes done in Dash codebase

Signed-off-by: pasta <pasta@dashboost.org>
2020-12-15 11:20:19 -06:00
PastaPastaPasta
96fdd0cfa5
Apply (mostly)trivial clang-tidy in evo folder (#3644)
Signed-off-by: pasta <pasta@dashboost.org>
2020-08-10 00:34:26 +03:00
PastaPastaPasta
32c5064356
Adjust CDeterministicMNState, add helper methods (#3643)
* Adjust CDeterministicMNState, add helper methods

Changes all setting of `nPoSeBanHeight` into a call to `BanIfNotBanned`

Adds a helper method `IsBanned` that just is `return nPoSeBanHeight != -1`
In my opinion this makes the code generally more readable and easy to understand

Adds `Revive` helper method
I don't feel too strongly about this, because from what I have seen, this revive code is only done in one place,
but I generally think it makes sense to be a helper method of it's own

Signed-off-by: pasta <pasta@dashboost.org>

* Add `!` that was accidentally not added

Signed-off-by: pasta <pasta@dashboost.org>

* Make nPoSeBanHeight private

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-08-04 14:36:02 +03:00
PastaPastaPasta
3f8a7b2068
Merge #12193: RPC: Consistently use UniValue.pushKV instead of push_back(Pair()) (karel-3d) (#3532)
* Begin Merge 12193 Squashed 'src/univalue/' changes from 07947ff2da..51d3ab34ba

51d3ab34ba Merge #10: Add pushKV(key, boolean) function (replaces #5)
129bad96d5 [tests] test pushKV for boolean values
b3c44c947f Pushing boolean value to univalue correctly

git-subtree-dir: src/univalue
git-subtree-split: 51d3ab34ba2857f0d03dc07250cb4a2b5e712e67

* scripted-diff: Use UniValue.pushKV instead of push_back(Pair()) (end #12193)

-BEGIN VERIFY SCRIPT-
git grep -l "push_back(Pair" | xargs sed -i "s/push_back(Pair(\(.*\)));/pushKV(\1);/g"
-END VERIFY SCRIPT-

Signed-off-by: pasta <pasta@dashboost.org>

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2020-06-18 12:17:23 +03:00