Commit Graph

18373 Commits

Author SHA1 Message Date
PastaPastaPasta
e8e34b836a
docs: Adjust developer-notes.md to use signed ints normally (#3663)
* Adjust developer-notes.md to use signed ints normally

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

* Adjust wording in dev-notes

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

* remove trailing whitespace

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

* Remove trailing whitespace

* maybe fix linter

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-08-30 17:22:51 +03:00
PastaPastaPasta
8baf69d448
Harden spork6 logic then remove spork6 (#3662)
* Harden Spork6

Spork6 was previously activated on testnet, but we then developed an alternative fix for the issue and never activated spork6 on mainnet. At this point, Spork6 will not be activated on mainnet.
As such, it makes sense to harden Spork6 and ensure that spork6 will never be activated on mainnet. So, we just change from checking Spork6 to checking if we are on testnet. If we are on testnet, use spork6 logic, else don't.

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

* remove now unused SPORK_6_NEW_SIGS

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

* force fSporkSixActive to be correct, otherwise return

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

* Harden spork6 even more

* Add TODO in chainparams as a reminder to drop all spork6 related code on next testnet reset

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-08-30 17:22:21 +03:00
PastaPastaPasta
533b2fe9f1
privatesend: Implement Random Round Mixing (#3661)
* Use GetRealOut... instead of Capped

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

* Add "ps_salt" value to walletdb

This value is used to deterministically pick a random number of rounds to mix, between N and N + GetRandomRounds. A salt is needed in addition to the inputs hash to ensure that an attacker learns nothing from looking at the blockchain.

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

* Implement Random Round Mixing

This implements "Random Round Mixing." Previously, attempted attacks on PrivateSend assumed that all inputs had been mixed for the same number of rounds. Noramlly assuming 2,4,8 or 16.

While none of these attacks have been successful, they still teach what we can do to make our system more robust, and one of those ways is to implement "Random Round Mixing".

Under the previous system, inputs were mixed up until N rounds (configured by user). At this point, the input was considered mixed, and could be private-sent. Under this new system, an input will be mixed to N rounds like prior. However, at this point, Sha256d(input, salt) will be calculated (note: this likely could be a more efficient hash function than double sha256, but that can be done in another PR / version if needed). If (hash % 2 == 0), then the input will be mixed again.
This results in an exponential decay where if you mix a set of inputs, half of those inputs will be mixed for N rounds, 1/4 will be mixed N+1, 1/8 will be mixed N+2, etc. This current implementation caps it at N+2. This results in mixing an average of N+0.875 rounds. If you removed the cap, you would mix on average N+1 rounds.

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

* Make PS salt a private member of CWallet, tweak the way it's initialized

* Introduce `CWallet::IsFullyMixed` and use it everywhere instead of comparing rounds directly to ensure consistency between coin selection logic, balance calculations and gui

* Tweak `GetRealOutpointPrivateSendRounds` to respect random rounds

* Tweak IsFullyMixed to make decision on a per-outpoint basis instead of a per-tx one

* make a comment doxygen

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

* Rename GetPrivateSendSalt InitPrivateSendSalt, since it is not a getter

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

* move the comment below GetRounds call

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

* don't use GetCappedOutpointPrivateSendRounds when printing to RPC

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

* Simplify hashing in IsFullyMixed

Uses just 1 sha256 instead of 3 (1 in SerializeHash + 2 in Hash)

* undo comment change

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-08-30 17:21:45 +03:00
PastaPastaPasta
404014d31a
change argument name to reflect the fact that it's a return value (#3673)
Signed-off-by: pasta <pasta@dashboost.org>
2020-08-27 12:51:31 +03:00
PastaPastaPasta
e75c18a60b
trivial/docs: minor adjustments to PrivateSend help text (#3669)
Signed-off-by: pasta <pasta@dashboost.org>
2020-08-24 18:17:13 +03:00
dustinface
997e79439b
Merge #13007: test: Fix dangling wallet pointer in vpwallets (#3666)
* test: Fix importwallet_rescan test

The wallet should be removed after the dumpwallet() call otherwise it 
may lead to unepexted behaviour in other wallet tests since the wallet 
stays in vpwallets then.

* tests: Change where RemoveWallet call is to be more in line with upstream

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

Co-authored-by: pasta <pasta@dashboost.org>
2020-08-24 18:16:42 +03:00
PastaPastaPasta
91724d29e6
trivial: clang-tidy changes in privatesend (#3665)
Signed-off-by: pasta <pasta@dashboost.org>
2020-08-24 18:15:57 +03:00
PastaPastaPasta
28b7395ec5
trivial: don't mix unsigned int with int (#3664)
Signed-off-by: pasta <pasta@dashboost.org>
2020-08-24 18:15:29 +03:00
PastaPastaPasta
7c4e5122cf
trivial: return bool instead of int in CPrivateSendClientOptions (#3660)
Signed-off-by: pasta <pasta@dashboost.org>
2020-08-24 18:15:05 +03:00
PastaPastaPasta
0dc2017248
trivial: don't compare pointer to zero (#3659)
Signed-off-by: pasta <pasta@dashboost.org>
2020-08-24 18:14:41 +03:00
UdjinM6
81e25e01e0
Print exception origin in crash messages (#3653)
* Print exception origin in crash messages

We use `PrintExceptionContinue` in many places and we pass crash origin to it as a param but we never use it. Also, change the param name to better match its meaning.

* Update src/util.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2020-08-14 14:43:22 +03:00
UdjinM6
e86b1ec7ed
Implement a safer version of GetCrashInfoFromException (#3652)
* Implement a safer version of GetCrashInfoFromException

`abi::__cxa_current_exception_type()` can return `null`, handle this properly

* Update src/stacktraces.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Update src/stacktraces.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2020-08-14 14:42:42 +03:00
PastaPastaPasta
7725e6fa4b
p2p: remove some old protocol version checks/dead code (#3647)
Signed-off-by: pasta <pasta@dashboost.org>
2020-08-14 14:42:15 +03:00
UdjinM6
2429a21b36
Update src/stacktraces.cpp
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2020-08-11 12:07:56 +03:00
UdjinM6
d12137b9c2
Fix some translation issues (#3656)
* Avoid translating "PrivateSend"

* Make some strings translatable
2020-08-10 00:37:08 +03:00
dustinface
2f83b6ae25
llmq: Fix spork check in CSigSharesManager::ForceReAnnouncement (#3650)
It seems like the idea here was to avoid announcing already available sigshares for a signhash to everyone if concentrated recovery is enabled. But by returning there if `IsAllMembersConnectedEnabled` equals to `false` we disable the re-announcements prior to the spork activation, where we want to still have them and re-enable if the spork is enabled where we don't want to have them.
2020-08-10 00:36:52 +03:00
Akshay CM
e542c49f70
[RPC] Show address of fundDest when no funds (#3649) 2020-08-10 00:36:38 +03:00
PastaPastaPasta
9f0f388eca
Apply (mostly)trivial clang-tidy in masternode folder (#3646)
* Mostly trivial clang-tidy changes in masternode

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

* uint -> size_t

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

* Make GetSyncStatus const not static and ProcessMessage const

Signed-off-by: pasta <pasta@dashboost.org>
2020-08-10 00:35:42 +03:00
PastaPastaPasta
82c3aaaf5f
Apply (mostly)trivial clang-tidy in llmq folder (#3645)
* ixlock -> islock

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

* Mostly trivial clang-tidy changes in llmq

Signed-off-by: pasta <pasta@dashboost.org>
2020-08-10 00:35:02 +03: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
UdjinM6
d8b676d630
Update src/stacktraces.cpp
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
2020-08-09 19:28:34 +03:00
UdjinM6
98f19e4442
Fetch chia_bls from dashpay github repo (#3654) 2020-08-06 12:08:00 +03:00
UdjinM6
462a8e5164
Stage specific Travis job names (#3651)
For some reason Travis doesn't seem to like having the same name on different stages and ignores the cache that was built earlier. Making job names stage specific fixes cache issues.
2020-08-06 12:07:38 +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
UdjinM6
a1bcb82e3d
Include protocol version into MNAUTH (#3631)
* Include protocol version into MNAUTH

* Introduce MNAUTH_NODE_VER_VERSION = 70218
2020-08-04 14:35:32 +03:00
dustinface
c84624827f
qt: Give PrivateSend separate instances of SendCoinsDialog + CCoinControl (#3625)
Prior to this commit there are (imo) flaws in the behaviour of the PrivateSend tab.

- If you enter an address, label, add a recipient, do whatever in the normal Send tab its also reflected in
the PrivateSend tab
- If you select fully mixed coins in the Send tab's CoinControl they are also selected
in the PrivateSend tab if you switch over.
- If you select non-fully mixed coins in the Send tab's CoinControl you
get a warning when switching over to PrivateSend tab due to non-fully
mixed coins selected in CoinControl.

With giving the private send tab separate instances of `SendCoinsDialog` and `CCoinControl` they are independent
from each other which just makes more sense imo and by doing this the points above are solved.

I would say this just better reflects the actual behaviour of a tab.
2020-08-04 14:34:51 +03:00
UdjinM6
bc1d711dfb Implement a safer version of GetCrashInfoFromException
`abi::__cxa_current_exception_type()` can return `null`, handle this properly
2020-08-03 13:36:23 +03:00
PastaPastaPasta
7a5d407563
replace inter-quorum with intra-quorum (#3642)
Inter means between two groups, intra means inside of a group.

Signed-off-by: pasta <pasta@dashboost.org>
2020-08-01 23:08:30 +03:00
PastaPastaPasta
7223a7b3c3
doc: Update README after filename change (Replicates bitcoin 12363) (#3637)
wallet-hd -> wallet_hd

Signed-off-by: pasta <pasta@dashboost.org>
2020-08-01 23:04:13 +03:00
PastaPastaPasta
95625df193
ci: Introduce FAST_MODE Gitlab variable (#3635)
* Introduce FAST_MODE Gitlab variable

Default: "false". When "true", only run linter on arm and unit/functional tests on linux64, skip everything else.

* fix ordering I accidentially somehow changed

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

* remove x86_64-unknown-linux-gnu

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

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-08-01 23:03:35 +03:00
UdjinM6
b7b4f06638
Show names for Travis jobs instead of env vars (#3632)
Currently Travis displays env vars which make it hard to identify individual jobs by simply looking at the list because all env vars start with the same strings.
2020-08-01 23:02:38 +03:00
UdjinM6
e7f4501069
Merge pull request #3636 from PastaPastaPasta/backports-0.17-pr18
Backports 0.17 pr18
2020-08-01 23:02:00 +03:00
UdjinM6
db206a0e7c
Fix test_integrationtests.sh 2020-07-30 10:51:51 -05:00
UdjinM6
f7218d1899 Make shellcheck happy 2020-07-29 11:20:12 -05:00
UdjinM6
bdb479db4b Update lint-locale-dependence.sh 2020-07-29 11:06:10 -05:00
UdjinM6
2910bf0d49 Update lint-format-strings.py 2020-07-29 11:05:06 -05:00
UdjinM6
6029f290b8 Add missing encoding="utf8" 2020-07-29 11:04:42 -05:00
UdjinM6
35fbb5992f More of "export LC_ALL=C" 2020-07-29 11:04:30 -05:00
practicalswift
2e7f07ebeb Fix warnings introduced in shellcheck v0.6.0 (Partial Merge: #15166) 2020-07-29 11:02:55 -05:00
MarcoFalke
27aef40091 Merge #15534: [test] lint-format-strings: open files sequentially (fix for OS X)
21be609b49 In lint-format-strings, open files sequentially (Glenn Willen)

Pull request description:

  In lint-format-strings, we use python argparse to read our file arguments. In
  this mode, argparse opens all the files simultaneously. On OS X, where the
  default filehandle limit is 128, this causes the lint to fail. Instead, ask
  argparse for our filename arguments as strings, and open them one at a time
  using 'with open'.

Tree-SHA512: 4c7dabf98818a7c5d83ab10c61b89a26957fe399e39e933e30c561cb45c5e8ba6f6aedcde8343da0c32ee340289a8897db6a33708e35ee381334ee27e3f4d356
2020-07-29 11:01:38 -05:00
MarcoFalke
481254c86d Merge #14115: lint: Make all linters work under the default macOS dev environment (build-osx.md)
341f7c7b0e macOS fix: Check for correct version of flake8 to avoid spurious warnings. The brew installed flake8 version is Python 2 based and does not work. (practicalswift)
908a559f33 macOS fix: Add excludes for checks added in the newer shellcheck version installed by brew (practicalswift)
ec4d57bbb3 macOS fix: Work around empty (sub)expression error when using BSD grep (practicalswift)
b57d7d92fe macOS fix: Avoid mapfile due to ancient version of bash shipped with macOS (practicalswift)

Pull request description:

  The linters are thoroughly tested under Ubuntu which is what we use in Travis. When reading #14041 I understood that some developers were experiencing problems when running the linters on their local machines.

  Assuming these local machines were running macOS I installed a fresh macOS VM, followed the instructions in `build-osx.md` and ran the linters.

  This PR contains the changes needed to make `lint-all.sh` run as expected.

  Ideally the linters would continuously run also under a Travis macOS environment to make sure we catch these kind of issues before merge.

Tree-SHA512: b39c9a970d14d27db1fb592539923c0bc676b5217f415d02fda3f17bf54d46faa172376e8a3ecab07ca68a3acba9aebe00b2b1b2161b2a36b85fbb672e7efb5c
2020-07-29 10:59:39 -05:00
Wladimir J. van der Laan
7be2b2456a Merge #13281: test: Move linters to test/lint, add readme
fa3c910bfeab00703c947c5200a64c21225b50ef test: Move linters to test/lint, add readme (MarcoFalke)

Pull request description:

  This moves the checks and linters from `devtools` to a subfolder in `test`. (Motivated by my opinion that the dev tools are mostly for generating code and updating the repo whereas the linters are read-only checks.)

  Also, adds a readme to clarify that checks and linters are only meant to prevent bugs and user facing issues, not merely stylistic preference or inconsistencies. (This is motivated by the diversity in developers and work flows as well as existing code styles. It would be too disruptive to change all existing code to a single style or too burdensome to force all developers to adhere to a single style. Also note that our style guide is changing, so locking in at the wrong style "too early" would only waste resources.)

Tree-SHA512: 9b10e89f2aeaf0c8a9ae248aa891d74e0abf0569f8e5dfd266446efa8bfaf19f0ea0980abf0b0b22f0d8416ee90d7435d21a9f9285b66df43f370b7979173406
2020-07-29 10:59:04 -05:00
UdjinM6
a4fa69a264 Fix after 13214 2020-07-29 10:57:48 -05:00
MarcoFalke
79999469e4 Merge #13214: Enable Travis checking for two Python linting rules we are currently not violating
506c5785fb Enable Travis checking for two Python linting rules we are currently not violating (practicalswift)

Pull request description:

  Enable Travis checking for two Python linting rules we are currently not violating:
  * E101: indentation contains mixed spaces and tabs
  * E129: visually indented line with same indent as next logical line

Tree-SHA512: 955ea5ce4576a5bdd561f9d2bbcfaa82f66a23391c84ddb806830ed15e321e4742457ccc801f457819f626d4a66a1ffcaecee28c3b9f3f907ab8401323743485
2020-07-29 10:57:27 -05:00
MarcoFalke
18eebe5251 Merge #13210: Enable W191 indentation contains tabs and W291 trailing whitespace flake8 checks for Python files
0d31ef4762 Enable W191 and W291 flake8 checks. Remove trailing whitespace from Python files. Convert tabs to spaces. (John Bampton)

Pull request description:

Tree-SHA512: d062434310d6232469d7ca8e5f2ddb7db7e85cb2a299e609d98bacc318368e43e0777c9f4966df03d50f526bbe27207faa87a7464e62e14671194459a06ad969
2020-07-29 10:57:08 -05:00
UdjinM6
ffc38301f7 More of 13153 (fix LogPrintf-s) -- TODO: backport to 0.16 2020-07-29 10:56:26 -05:00
UdjinM6
d514668f5e More of 13153 ("Continued") 2020-07-29 10:56:10 -05:00
Wladimir J. van der Laan
2af1c8d6e7 Merge #13153: Add missing newlines to debug logging
4b75dcf devtools: Make linter check LogPrint calls (MarcoFalke)
ff2ad2d Add missing newlines to LogPrint debug logging (Wladimir J. van der Laan)

Pull request description:

  ~~Don't we have a linter that should catch these?~~

Tree-SHA512: 1a58eca01ded9c1719e943c09447deeb59bb06dba00528cf460eefe857fdf95b42671fbdebc87cdd2f51e931e86942d06587ffd097cbb0d8dd9eb7a0ba17a8f0
2020-07-29 10:55:33 -05:00
Wladimir J. van der Laan
036125c9a5 Merge #13705: build: Add format string linter
bcd4b0f5cdde2a1b562a612c78ec1ef1fe47d3dd Add linting of WalletLogPrintf(...) format strings (practicalswift)
a3e455694901a887e0feef69bd63e3aa122ea44b build: Add format string linter (practicalswift)

Pull request description:

  Add format string linter.

  This linter checks that the number of arguments passed to each variadic format string function matches the number of format specifiers in the format string.

  Example output:

  ```
  $ test/lint/lint-format-strings.sh
  src/init.cpp: Expected 2 argument(s) after format string but found 1 argument(s):
    LogPrintf("We have a mismatch here: foo=%s bar=%d\n", foo)
  src/init.cpp: Expected 1 argument(s) after format string but found 2 argument(s):
    LogPrint(BCLog::RPC, "RPC stopped. This is a mismatch: %s\n", s1, s2)
  $ echo $?
  1
  ```

Tree-SHA512: 19ab844a63f04bf193d66682ca42745a1c7d6c454b30222491b9fe8dc047054c4a6d3ee7921ec0676fb9ca2e7f6f93bd6c97996fb09667269bd491cb875349f3
2020-07-28 21:35:31 -05:00
MarcoFalke
bd8f48820e Merge #13696: Add aarch64 qt depends support for cross compiling bitcoin-qt
00db418176 Add aarch64 qt depends support for cross compiling bitcoin-qt (TheCharlatan)

Pull request description:

  This also adds a generic qt linux target in packages.mk . I am a bit confused by the existing docs for the RISC addition. Are there boards that would support running bitcoin-qt, or at the very least forwarding X over ssh? Is everybody building depends with `NO_QT=1` when targeting RISC? If not, I will revert the change for a generic qt linux package definition back to the piecemeal solution.

  This pull request should close #13495

Tree-SHA512: 519b951bf50f214ad725e5330094582a212333cd85b0ae442c67f9afec5629995dfad130258c7706a61f7b7cccbfa49bce69b9931f7e30cf12b382cd9a0a4749
2020-07-28 21:35:31 -05:00