Commit Graph

15 Commits

Author SHA1 Message Date
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
7ca61abed0
refactor: remove some now unneeded cppcheck suppressions (#5589)
## Issue being fixed or feature implemented
Unneeded suppressions were present

## What was done?
Removed them

## How Has This Been Tested?
Running linter

## Breaking Changes
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 07:53:22 -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
Konstantin Akimov
c0ba1e3269 Merge #18234: refactor: Replace boost::mutex,condition_var,chrono with std equivalents in scheduler 2023-05-31 18:14:23 -05:00
PastaPastaPasta
770eefcd08
ci: upgrade cppcheck to 2.10; fix / suppress reported issues (#5328)
## Issue being fixed or feature implemented
Upgraded version of cppcheck

## What was done?

## How Has This Been Tested?
Ran cppcheck

## Breaking Changes
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)_
2023-04-16 12:08:33 -05:00
Kittywhiskers Van Gogh
835f2baf86 refactor: remove leftover rpc prefix from filename (evo, quorum) 2022-10-21 21:51:45 +05:30
PastaPastaPasta
afbc817220
refactor/chore: update cppcheck to 2.8 with needed refactoring (#4926)
* refactor/chore: update cppcheck to 2.8 with needed refactoring

* use probably invalid index for default

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

* trivial: rename skContributions -> m_sk_contributions and skContributions2 -> skContributions

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-08-11 02:05:44 +03:00
MarcoFalke
a3a7a22268
Merge #20223: build: Drop the leading 0 from the version number
8f7b93047581c67f2133cdb8c7845471de66c30f Drop the leading 0 from the version number (Andrew Chow)

Pull request description:

  Removes the leading 0 from the version number. The minor version, which we had been using as the major version, is now the major version. The revision, which we had been using as the minor version, is now the minor version. The revision number is dropped. The build number is promoted to being part of the version number. This also avoids issues where it was accidentally not included in the version number.

  The CLIENT_VERSION remains the same format as previous as previously, as the Major version was 0 so it never actually got included in it.

  The user agent string formatter is updated to follow this new versioning.

  ***

  Honestly I'm just tired of all of the people asking for "1.0" that maybe this'll shut them up. Skip the whole 1.0 thing and go straight to version 22.0!

  Also, this means that the terminology we commonly use lines up with how the variables are named. So major versions are actually bumping the major version number, etc.

ACKs for top commit:
  jnewbery:
    Code review ACK 8f7b930475
  MarcoFalke:
    review ACK 8f7b93047581c67f2133cdb8c7845471de66c30f 🎻

Tree-SHA512: b5c3fae14d4c0a9c0ab3b1db7c949ecc0ac3537646306b13d98dd0efc17c489cdd16d43f0a24aaa28e9c4a92ea360500e05480a335b03f9fb308010cdd93a436
2022-04-28 13:47:53 +03:00
PastaPastaPasta
b421cfacae
perf: enable more multi-threading and caching in linters (#4807)
* perf: enable more multi-threading and caching in linters

20s -> 6s

* ci: add multiprocess to ci dockerfile

* Update test/lint/lint-cppcheck-dash.sh

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-04-27 21:14:40 +03:00
PastaPastaPasta
80d97381c2
refactor: implement irange::range and use it (#4788)
* refactor: implement irange::range and use it

* misc fixes

* Apply suggestions from code review

* compilation fixes

* suggestions

* fix: fix linter

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-04-26 02:40:41 +03:00
Odysseas Gabrielides
83ef1c6c66
feat: implement quorum rotation and updated LLMQ parameters (#4752)
* Added GET_SNAPSHOT_INFO message handling

* Quorum members by rotation

* Quorum utils functions

* Handle GET_QUORUM_ROTATION_INFO with baseBlockHash from client

* Storing QuorumSnaphots in evoDB when requesting them

* Added DIP Enforcement param

* quorumIndex cache

* Quorum Rotation deployment control

* Usage of Bitsets for storing CQuorumSnapshots

* Correct handling of early quorum quarters

* More asserts

* Corrections

* Handling of quorumIndex

* Refactoring of truncate mechanism

* Various fixes

* Interface correction

* Added template type for indexed cache

* Added quorumIndex into commitmenHash

* Various changes

* Needs to update maqQuorumsCache along with indexedQuorumsCache

* Added CFinalCommitment version 2

* Renamed variables

* Fixes

* Refactoring & correct caching of quorumMembers by rotation

* Added assertions

* Refactoring

* Interface change

* Handling of previous DKG session failure

* Applied refactoring

* Build quarter members improvments

* Merge Quorum Rotation and Decreased fee into one deployment (DIP24)

* Added new LLMQ Type

* Added functional tests + refactoring

* Refactoring

* Spreaded Quorum creation and Quorum Index adaptation

* quorumIndex adaptations

* Added quorumIndex in CFinalCommitment

* Latest work

* Final refactoring

* Batch of refactoring

* Fixes for tests

* Fix for CFinalCommitment

* Fix for Quorums

* Fix

* Small changes

* Thread sync fic

* Safety changes

* Reuse mns when needed

* Refactoring

* More refactoring

* Fixes for rotationinfo handling

* Fix for rotation of members

* Correct order of MNs lists in Quorum Snapshots

* Adding extra logs

* Sync rotation quorums + qrinfo changes

* Fix + extra logs

* Removed redundant field

* Fix for null final commitment + refactoring

* Added timers in tests

* Fix for qrinfo message: quorumdiff and merkleRootQuorums

* Small changes for rotation test

* Remove reading from scanQuorumCache

* Added quorum list output

* Crash fix

* Experimental commit

* apply changes to specialtxman.cpp from specialtx.cpp

* all the changes

* substancially speed up feature_llmq_rotation.py

* reenable asserts, add check for reorgs

* Refactoring

* Added extra logs

* format

* trivial

* drop extra boost includes

* drop ContainsMN

* fix ScanQuorums

* check quorum hash and index in CFinalCommitment::Verify

* fix/tweak tests

* IsQuorumRotationEnabled should be aware of the context

* Calculating members based on earlier block.

* Fix for Quorum Members Cache

* Removed duplicate size of baseBlockHashes

* Adaptations of qrinfo to -8 mn lists

* Introduction of llmqTypeDIP24InstantSend

* Adaptation for llmqTypeDIP24InstantSend

* Adaptations for IS

* bump protocol version

* Added feature_llmq_is_migration test

* Various cleanups

* use unordered_lru_cache for quorumSnapshotCache

* trivial refactor ComputeQuorumMembersByQuarterRotation

* Reduced CFinalCommitment::quorumIndex from 32 to 16 bits

* Keep verified LLMQ relay connections

* Experimental Relay connection fix

* Fix for EnsureQuorumConnections rotation

* Using only valid Mns for checking

* Override of nPowTargetSpacing (devnet only)

* Show penalty score in masternode rpc

* fixups

* Rotation refactoring

* Update src/chainparams.cpp

* Replaced LogPrintf with LogPrint

* IS locking fix once DIP24 activation

* Various cleanup

* Updated MIN_MASTERNODE_PROTO_VERSION

* Introduce LLMQ_TEST_INSTANTSEND reg-test only quorum and actually test switching to dip0024 quorums

* Renamed field lastQuorumHashPerIndex

* Renamed to DIP0024

* chore: update nStartTime and nTimeout for mainnet / testnet for DEPLOYMENT_DIP0024

Co-authored-by: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com>
Co-authored-by: pasta <pasta@dashboost.org>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-04-16 17:46:04 +03:00
PastaPastaPasta
f503a7edc1
refactor: Fix warnings from cppcheck (#4625)
* src/evo/evodb.cpp:57:29: warning: Assert statement calls a function which may have desired side effects: 'IsClean'. [assertWithSideEffect]

* src/llmq/quorums.cpp:635:37: note: Null pointer dereference

src/llmq/quorums.cpp:635:37: warning: Either the condition 'pFrom==nullptr' is redundant or there is possible null pointer dereference: pFrom. [nullPointerRedundantCheck]
src/llmq/quorums.cpp:636:81: note: Assuming that condition 'pFrom==nullptr' is not redundant

* fix a bunch of cppcheck warnings

* cppcheck: run on many more files. Enable all checks except a few ignored ones.

ignored
```
    "Consider using std::transform algorithm instead of a raw loop."
    "Consider using std::accumulate algorithm instead of a raw loop."
```

* ci: build specific version of cppcheck instead of install from apt

* ci: use cppcheck 2.4, remove commented out line, fix symlink

cppcheck 2.6 is latest, however causes issues
```
src/spork.cpp:135:51: warning: Analysis failed. If the code is valid then please report this failure. [cppcheckError]
```
cppcheck 2.5 appears to get into an infinite loop

* no need to check presence before insertion

* use if-init, remove redundant check

* remove redundant check

* don't remove cmake? fix macOs depends build?

* cppcheck: one per line, alphabetize

* remove duplicate cmake install
2021-12-29 00:54:50 +03:00
Kittywhiskers Van Gogh
f22be5a16b refactor: llmq/quorums_*[cpp/h] --> llmq/*.[cpp/h] 2021-10-06 09:04:45 +05:30
PastaPastaPasta
9da186bb61
refactor: Various small improvements (#4471)
* bls: use constexpr int instead of #define

* lint: bump c++ version to 17

* test: use BOOST_CHECK_EQUAL instead of BOOST_ASSERT, call boost assert in another location

* coinjoin: fix typo

* drop redundant LLMQType cast

* use numeric_limits instead of magic value

* net_processing.cpp whitespace fixes

* Add some const

* use std::all_of instead of raw for loop

* Introduce UNINITIALIZED_SESSION_ID and use it instead of a magic number

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-10-01 14:44:40 +03:00
pasta
277c2093d7
lint: add dash extended cpp linter
Signed-off-by: pasta <pasta@dashboost.org>
2021-09-01 14:08:52 -04:00