Commit Graph

16292 Commits

Author SHA1 Message Date
UdjinM6
075d02b691 fix: DisconnectBlock/RollforwardBlock/ReplayBlocks log fixes 2023-07-17 01:00:48 +03:00
UdjinM6
8a04faea39 fix: Improve CDKGSession logging 2023-07-17 01:00:48 +03:00
UdjinM6
64f39fc345 fix: CDBTransaction::GetMemoryUsage() logging 2023-07-17 01:00:48 +03:00
UdjinM6
e9287f4c02 fix: BuildQuorumRotationInfo logging 2023-07-17 01:00:48 +03:00
UdjinM6
591da75630 chore: Drop unused GetOffsetFromUtc() 2023-07-17 01:00:48 +03:00
UdjinM6
e087a7881a chore: Drop unused unordered_limitedmap::insert_or_update() 2023-07-17 01:00:48 +03:00
PastaPastaPasta
0cf9410d47
perf: actually only process each dsq once (#5484)
5 minute profiling shows previous usage around ~7% and current usage
around ~2%

## Issue being fixed or feature implemented
Due to us rapidly receiving multiple duplicates of DSQueue's, we start
processing them before it's added the the vector of processed ones, we
probably at one point tried to minimize locked time, but that's not
productive here

## What was done?
Expand the locked scope to ensure we don't double process. 

## How Has This Been Tested?
Ran full node for 5-10 minutes

## 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: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-07-16 12:58:08 -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
32a2543faf
refactor: trivial refactorings of llmq/ (#5486)
## Issue being fixed or feature implemented
It splits from https://github.com/dashpay/dash/pull/5150/ by
@PastaPastaPasta request.


## What was done?
See commits

## How Has This Been Tested?
Run unit/functional 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
2023-07-10 10:13:42 -05:00
MarcoFalke
91c6a8ed42
Merge #20462: RPC/Wallet: unloadwallet: Clarify docs/error when both the RPC request and wallet_name parameter specify a wallet
b1f59d55d920d2b35269b474762f94fec87bfb16 RPC/Wallet: unloadwallet: Clarify docs/error when both the RPC endpoint and wallet_name parameter specify a wallet (Luke Dashjr)

Pull request description:

  Just documentation clarifications from #20448

ACKs for top commit:
  MarcoFalke:
    review ACK b1f59d55d920d2b35269b474762f94fec87bfb16
  jonatack:
    re-ACK b1f59d55d920d2b35269b474762f94fec87bfb16  per `git diff e8303a0 b1f59d5`

Tree-SHA512: ac068b0aa7ceed49496367fdd9425b59dbba18b56e89b26afc22a6c8ece51f0b92a169cacd55740b1cadab2b32f4f8e8700e609066ab7e59d3b53c7891da585e
2023-07-09 17:52:51 +05:30
Wladimir J. van der Laan
298b28aae6
Merge #19646: doc: Updated outdated help command for getblocktemplate
c91b241b48d7f97b3e6b39d84ec780f2a3e3a0a7 Updated outdated help command for getblocktemplate (fixes #19625) (Jake Leventhal)

Pull request description:

  **Summary of Changes**
  * Removed coinbasetxn from the help outputs
  * Added the missing name for transactions in the help outputs
  * Added help outputs for longpollid and default_witness_commitment
  * Added more clarity to capabilities, rules, and coinbaseaux

  **Rationale**
  The outputs from the help command for `getblocktemplate` are outdated and don't reflect the actual results from `getblocktemplate` (see #19625 for more details)

  Fixes #19625.

ACKs for top commit:
  laanwj:
    ACK c91b241b48d7f97b3e6b39d84ec780f2a3e3a0a7
  fjahr:
    utACK c91b241b48d7f97b3e6b39d84ec780f2a3e3a0a7

Tree-SHA512: ee443af4bc3b2838dfd92e2705f344256ee785ae720e505fffea9b0ec5b75930e3b1374bae59b36d5da57c85c9aefe4d62504b028b893d6f2914dccf1e34c658
2023-07-09 17:52:51 +05:30
Samuel Dobson
9885228906
Merge #19644: rpc: document returned error fields as optional if applicable
f110b7c722eb150816a26cab161ac2b8c0f58609 rpc: document returned error fields as optional if applicable (Sebastian Falbesoner)

Pull request description:

  The following RPCs return error fields (named `"error"` or `"errors"`) that are optional, but don't show up as optional in the help text yet:
  * `analyzepsbt`
  * `estimatesmartfee`
  * `signrawtransactionwithkey`
  * `signrawtransactionwithwallet`

  The following RPC has the errors field already marked as optional, but doesn't match the usual format in the description (like `"if there are any"` in parantheses):
  * `estimaterawfee`

  This PR adds the missing optional flags and adapts the description strings. Inspired by a recent PR #19634 by justinmoon.

  The instances were found via `git grep "RPCResult.*\"error"`. Note that there is one RPC so far where the return error is not optional (i.e. in case of no error, the field is included in the result, but is just empty), namely `bumpfee`.

ACKs for top commit:
  adaminsky:
    ACK `f110b7c`
  laanwj:
    ACK f110b7c722eb150816a26cab161ac2b8c0f58609, new documentation looks consistent with actual behavior
  achow101:
    ACK f110b7c722eb150816a26cab161ac2b8c0f58609
  meshcollider:
    utACK f110b7c722eb150816a26cab161ac2b8c0f58609

Tree-SHA512: 30c00f78a575b60e32b4536496af986d53a25f33e6ebbf553adcdcf825ad21a44f90267f3d1ea53326dac83bcfa9983fdb3dad6d3126e20f97f3c08ce286e188
2023-07-09 17:52:50 +05:30
fanquake
845ceac4ae
Merge #19634: rpc: Document getwalletinfo's unlocked_until field as optional
f916847d2b56f2935c169e1b95b350a477c804cc rpc: Document getwalletinfo's unlocked_until field as optional (Justin Moon)

Pull request description:

  The `getwalletinfo` RPC command's `unlocked_until` field is [optional in the code](f916847d2b/src/wallet/rpcwallet.cpp (L2397)), but wasn't marked as optional in the docs.

ACKs for top commit:
  theStack:
    ACK f916847d2b
  achow101:
    ACK f916847d2b56f2935c169e1b95b350a477c804cc
  kristapsk:
    ACK f916847d2b56f2935c169e1b95b350a477c804cc

Tree-SHA512: 8d82f0992fdaf8160000acf4a6e7e7f9ff289a90a983be2e078cf754f4b03601637e5f405afa66bd55adef9b347fa5eac5cc1822033b2ac08c587609cf3dfe0f
2023-07-09 17:52:50 +05:30
MarcoFalke
3144f87b15
Merge #19005: doc: Add documentation for 'checklevel' argument in 'verifychain' RPC…
501e6ab4e778d8f4e95fdc807eeb8644df16203b doc: Add documentation for 'checklevel' argument in 'verifychain' RPC call (Calvin Kim)

Pull request description:

  Rationale: When ```bitcoin-cli help verifychain``` is called, the user doesn't get any documentation about the ```checklevel``` argument, leading to issues like #18995.

  This PR addresses that issue and adds documentation for what each level does, and that each level includes the checks of the previous levels.

ACKs for top commit:
  jonatack:
    ACK 501e6ab4e778d8f4e95fdc807eeb8644df16203b `git diff 292ed3c 501e6ab` shows only change since last review is the verifychain RPCHelpMan edit; rebuild and retested manually anyway
  MarcoFalke:
    ACK 501e6ab4e778d8f4e95fdc807eeb8644df16203b 🚝

Tree-SHA512: 09239f79c25b5c3022b8eb1f76198ba681305d7e8775038e46becffe5f6a14c572e0c5d06b0723fe9d4a015ec42c9f7ca7b80a2a93df0b1b66f5a84a80eeeeb1
2023-07-09 17:52:49 +05:30
MarcoFalke
f53f7fb656
Merge #20139: Wallet: do not return warnings from UpgradeWallet()
963696288955dc31b3a4fd136bfb791a9d99755b [upgradewallet] removed unused warning param (Sishir Giri)

Pull request description:

  The `warning` variable was unused in `upgradewallet` so I removed it

ACKs for top commit:
  practicalswift:
    ACK 963696288955dc31b3a4fd136bfb791a9d99755b: diff looks correct
  MarcoFalke:
    review ACK 963696288955dc31b3a4fd136bfb791a9d99755b
  jonatack:
    ACK 963696288955dc31b3a4fd136bfb791a9d99755b

Tree-SHA512: 1d63186ce1e05e86a778340f2d7986c2cee1523de0a11cea39e8d148ac7ee26c49741dfa302b5c1cd1c8d74e67c1f9baee2763720c2d850b57da9a3fdce24565
2023-07-09 17:52:49 +05:30
PastaPastaPasta
24919e794d
perf: avoid rehashing block; use stored hash (#5435)
before 12%
<img width="1538" alt="image"
src="https://github.com/dashpay/dash/assets/6443210/fa5043fb-4e48-4728-bfaf-8636d5c20a8c">
after 10%
<img width="1544" alt="image"
src="https://github.com/dashpay/dash/assets/6443210/1df6aff4-2901-4af1-b421-3604f54df157">

## Issue being fixed or feature implemented
Redundant rehash

## What was done?
Avoid redundant rehash

## How Has This Been Tested?
Reindexed 0-500000 on testnet


## 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-07-08 00:03:55 +03:00
UdjinM6
2d24016150
fix: start client-side CoinJoin scheduler even when CoinJoin is disabled (#5476)
## Issue being fixed or feature implemented
`IsEnabled()` is checked inside anyway. Not starting the scheduler on
init results in no mixing on nodes with dynamically loaded wallets.

## What was done?


## 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
- [ ] 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-07-04 12:28:44 -05:00
Konstantin Akimov
e4c7f383ce
refactor: cleanup CChainParams unused data and functions (#5474)
## Issue being fixed or feature implemented
During implementation #5469 (master node hard-fork) I noticed that some
parts of `CChainParams` are deprecated and can be removed.

## What was done?
1. removed methods from `CChainParams` that have no implementation at
all:
 - UpdateSubsidyAndDiffParams
 - UpdateLLMQChainLocks
 - UpdateLLMQTestParams
 - UpdateLLMQDevnetParams
2. removed method `BIP9CheckMasternodesUpgraded` from `CChainParams` and
a flag `check_mn_protocol` from `versionbitsinfo`.
(to follow-up dashpay/dash#2594)


## How Has This Been Tested?
Run functional/unit 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-07-04 12:25:36 -05:00
Konstantin Akimov
96554c8268
refactor: removed flag checkMalleable from bls's related code (#5462)
## Issue being fixed or feature implemented
Current implementation of BLS wrapper has an unclear interface related
to `checkMalleable` flag.

There are 2 methods Unserialize, that has both default arguments:

```
template
inline void Unserialize(Stream& s, const bool specificLegacyScheme, bool checkMalleable = true);
template
inline void Unserialize(Stream& s, bool checkMalleable = true);
```

Let's assume that I am calling `Unserialize(s, true)` - it's very
non-obvious which one will be called and not error prune at all.

It should be re-implemented, and there should not be default argument. 

Pasta noticed that this flag can be useful from performance point of
view - let's have better new method such as `UnserializeNoMalleable` or
similar and use it when reindexing/etc. It should be specified explicit.

Reverting this change and adding new interface in future won't be
difficult task so far as changes are quite trivial.


## What was done?
Removed flag checkMalleable to simplify code because it's always true.
It splits from https://github.com/dashpay/dash/pull/5443


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

## Breaking Changes
No breaking changes - flag is always true.

## 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-07-03 00:06:09 -05:00
Konstantin Akimov
4251d5a10f
fix: follow-up backport bitcoin#14380 - remove debug logs (#5399)
## Issue being fixed or feature implemented
There are useless debug logs "CDEF" in `wallet_tests` unit tests.

## What was done?
removes it

## How Has This Been Tested?
Run unit/functional 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
2023-07-01 14:16:04 +03:00
UdjinM6
d0d4514508
Merge pull request #5466 from UdjinM6/dashbls_1.3.0
chore: bump `dashbls` subtree to 1.3.0
2023-07-01 14:15:00 +03:00
Konstantin Akimov
07fd889be9
refactor: deglobalization of bls_legacy_scheme 2/N (#5443)
## Issue being fixed or feature implemented
Many usages of `CBLS{Signature,PrivateKey,PublicKey}` assume using
global variable, even if can be specified explicitly.
Some of these usages have been deglobalized in this PR.

Some prior improvements and fixes are here:
[#5403](https://github.com/dashpay/dash/pull/5403)

## What was done?
- Refactored the uses of global variable of `bls_legacy_scheme` from
`SetHex`, `SetByteVector`, some rpc calls.
- Removed flag `checkMalleable` to simplify code because it's always
`true`.
- Removed dependency from `txmempool.h` on `bls.h` to speed up
compilation.

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



## Breaking Changes
No breaking changes assumed. But in theory behaviour of some RPC can be
more explicit and predictable.

## 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
2023-06-30 19:27:39 -05:00
UdjinM6
5e99e3f516
fix(rpc): Improve upgradetohd (#5455)
## Issue being fixed or feature implemented
Allow `upgradetohd` in IBD, better errors, no GUI lock-up

## What was done?
Pls see individual commits. Most of it is changes in whitespaces, might
want to use ?w=1 to review i.e.
https://github.com/dashpay/dash/pull/5455/files?w=1

## How Has This Been Tested?
run tests, try `upgradetohd` on testnet

## 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-30 19:23:49 -05:00
UdjinM6
1bd4449466
fix: Fix trivial validation typo and test (#5465)
## Issue being fixed or feature implemented
`GetVersion` expects `is_basic_scheme_active`, not
`is_bls_legacy_scheme`

## What was done?
see commits

## How Has This Been Tested?
`make check`

## Breaking Changes
luckily only tests are affected

## 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-29 20:12:31 +03:00
Odysseas Gabrielides
13d8f4160f
fix: gcc8 compatibility changes for guix (#5468)
## Issue being fixed or feature implemented

As reported by @kittywhiskers, GCC version 8 complains with `error:
'this' was not captured for this lambda function`

In order to support old GCC compilers, `this` should be captured
explicitly.

## What was done?

Captured `this` explicitly in affected functions: `GetValidMNsCount`,
`GetAllHPMNsCount`, `GetValidHPMNsCount` and `GetValidWeightedMNsCount`.

## How Has This Been Tested?

`feature_llmq_hpmn.py` checks MNs count

## 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
- [ ] 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-29 20:04:00 +03:00
UdjinM6
a891c78654
build: stop tracking cmake dependency relic_conf.h.in
This reverts commit 0b3ab8d5e9.
2023-06-28 23:44:03 +03:00
UdjinM6
c9d4100337
Merge commit '730efde1090ceea4544a68b42e90fa915a80863a' into dashbls_1.3.0 2023-06-28 23:43:42 +03:00
UdjinM6
730efde109 Squashed 'src/dashbls/' changes from 9329803969..795660db76
795660db76 chore: bump version to 1.3.0 (#84)
e8743b0139 Merge pull request #83 from UdjinM6/bp_370_371
72f0ad2d37 fix: add missing destructor for CoreMPL and final for nested classes (#371)
2f05059c60 Fix a typo in class PrivateKey testcase. (#370)
851c2c8f68 fix: reading unitialized memory from Util::HasOnlyZeros in G2Element deserialization (#77)
4dd28e9016 fix: js bindings build (#82)
3697c51521 fix: dash is no more pretending being a 'libdashbls' (#76)
37c53141d3 feat: implement memory-copy only of G1Element and G2Element (#74)
97ac99e8e6 build(bls-dash-sys): ignore wasm32 target arch (#70)
2d494d351e Merge pull request #71 from dashpay/feat/threshold_bindings
67fb70d40b chore: revert permission changes in bcce0b214876c0d9e668baaa30a48542b496cda2
5a58fce0ea fix: resolve rust-bindings compilation failure
8604e03761 build: fix cmake build error
c25957edf0 Merge remote-tracking branch 'dash/develop' into feat/threshold_bindings2
198e246f07 added a helper for verifying a message
a4b8a5dd6e added a helper for verifying a message
2d783c985e added a helper for signing from the private key
16f7873d6a changed to using a slice for recovery
a23d9708c0 feat: clone
0cf8a8eb96 feat: serde
47829e3e75 threshold_recovery functions
a5589e6fc8 fix: bls extended private key size
1ceaab56e3 [add cpp targts]
86eb28e2d7 [fix linker path for cpp]
85debcab29 [include 'src' into build]
f956c66b90 [switch into cc]
9ecb59bf9b [test linker]
3651a0fd79 [linker change]
d8564679eb [fix: iossim]
c829d4b6f1 [fix: aarch64-apple-darwin trigger]
fc3509e901 [chore: silence warning]
79ce6ded50 [feat: apple build for single platform+arch]
e580cb76db [feat: build for apple target]
17b2168955 feat: verifySecure method for BasicSchemeMPL in js bindings (#69)
4613425b60 chore: silence rust warnings
136d762607 [fix: target_arch]
0d8c8e9d41 [try to use ios.toolchain]
bd441623df [back]
8137f48897 [change relic src]
bdcba81d41 test: check patched relic
32b7f56d94 Merge pull request #1 from dashevo/rust-bindings-enhancement
6d359c6201 chore: test for extended private key from short seed
1cbeffe159 chore: add binding
dace793a1a fix: same as previous: BIP32ExtendedPrivateKeyFromSeed with len
65c84d063c fix: ok now add second blank line
24b25bac2d fix: now try from typing import Union
fe16287182 fix: try Union[Fq2, None]
3ffc96d409 fix: None
2d669a2cf8 chore: up version
fbb5a43b19 fix: pass length PrivateKeyFromSeedBIP32
5822076d1a chore: cargo:fmt
a8d3a7e956 test: add keys multiplication test
4b85f08937 fix: exchange keys when multiply
0bcefc68cb chore: add imports
7380332123 [chore: add binding for G1ElementMul]
881e6d7676 patch relic to be compatible with wasm
bcce0b2148 chore: fix mode
02801cf973 add deeper checks to example project
6d25c60ee5 compilation fixes
a4cebb4025 refactor: remove "C" prefix
995ef3796f refactor: bip32 feature
7ea0c34938 style: remove `get` prefix from getters
e316c00f7b add VerifySecure
da5536e1c5 feat: introduce PrivateKey::from_bip32_seed
4f03a1a1ae export legacy scheme
5c19e314d4 add extended private key
cc081c0956 feat: add G1 element's fingerprint and generate methods
f3e85b46d0 refactor: move back re-exports
e8155b4bdb refactor: move legacy code to submodule
f6e173242e add extendedpublickey
4f823249fb feat: legacy serialize and deserialize methods
90fd9f9c2c fix: comparison int with size_t
57237e5e87 Merge branch 'rust-bindings' of github.com:dashevo/bls-signatures into rust-bindings
a1f862480b refactor: implement Deref trait for SecureBox
0b6f94e41f add LegacySchemeMPL
aa19a77a40 refactor: small refactoring
dae8b31042 make schemes public
827d1ed162 add hdkeys
7b4ffae5ec improve agg sig test
18057687be add basic scheme
3e4fdda2bd aggregates
61a4d791c9 elements ser/de
8b5b6301f3 wip
126b7becea wip
c49514176e chore: remove autocxx variant
477c014bb7 refactor: increase `c_err_to_result` readability
5d52d0e59d Merge remote-tracking branch 'dashevo/rust-bindings' into rust-bindings
31724b39d1 chore: add example crate
c04c2941db safe wrappers for simple case
844779cd81 chore: remove cdylib from bls-signatures
d622625de4 chore: move all rust stuff into one
0d3c51106a Merge remote-tracking branch 'dashevo/rust-bindings' into rust-bindings
ecf0271950 revert: bring back necessary c binding files :)
20e1cfe37b wip
654fc5e6a6 chore: remove unnecessary files from c binding
92ffd63c28 refactor: cargo build script
1d4d76fb05 chore: remove wrapper.h
20cc668708 qfix
abb38804c7 Merge remote-tracking branch 'dashevo/rust-bindings' into rust-bindings
760a267ab7 build: fix mac related issues
8b083794a4 add destructors to bls-dash-sys basic test
6c54f0a01a Merge remote-tracking branch 'dashevo/rust-bindings' into rust-bindings
fd526ab0db build: pass gmp lib path to build.rs
a8aaccb510 rust-bindings sign and verify test simple
8447c1c112 wip bindings test
9390162e3c wip add rust-bindings tests
26ab7216c0 revert: bls header path
db55e40cb0 rename to sys
96188a6d52 build qfix
965ac58df4 build: automate build process part 2
05636207a0 build: automate build process part 1
73b146a961 experiment cross compiling with autocxx and bindgen
969e5e2102 experiment cross compiling with autocxx and bindgen
88ee9d0519 chore: WIP
525b4d49d9 feat: rust bindings

git-subtree-dir: src/dashbls
git-subtree-split: 795660db76636c92bea3bfccfee621f1aba371a3
2023-06-28 23:43:42 +03:00
UdjinM6
0b3ab8d5e9
Revert "build: stop tracking cmake dependency relic_conf.h.in"
This reverts commit a82d0efcd0.
2023-06-28 23:37:52 +03:00
UdjinM6
d97ec350f0
feat(wallet): make mnemonic bits tweakable, default to 128 bit / 12 words (#5457)
## Issue being fixed or feature implemented
Allow generating 12, 18, 24 words mnemonics. Default to 12 words as it's
the most popular option/de-facto a standard now imo.

## What was done?
Add `-mnemonicbits` option, add tests

## How Has This Been Tested?
run tests, play with wallets on regtest

## Breaking Changes
n/a, old wallets should not be affected

## 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-28 19:01:24 +03:00
UdjinM6
bfa585d54a
feat(wallet): TopUpKeyPool improvements (#5456)
## Issue being fixed or feature implemented
- make progress calculations sane
- show progress in GUI but only when you need 100+ new keys
- make it stop on shutdown request
- spam less in debug.log

## What was done?


## How Has This Been Tested?
run tests, run `keypoolrefill` with `1100` (add 100 keys, no gui popup)
and `10000` (100+ keys, progress bar) on testnet wallet, check logs,
verify it can be interrupted on shutdown

## 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-28 19:01:00 +03:00
UdjinM6
a65b1fb0f6
fix: Allow tx index to catch up with the block index in TestChainSetup dtor (#5454)
## Issue being fixed or feature implemented
TL;DR: Should hopefully fix crashes like
https://gitlab.com/dashpay/dash/-/jobs/4522256293

In dashd we flush all callbacks first and then destroy `g_txindex`. In
tests we had to move `g_txindex` to `TestChainSetup` and its dtor is
executed first, so the order is broken. It also explains why this crash
happens so rare. In most cases tx index is up to date and you need some
kind of a hiccup for scheduler to lag behind a bit. Basically, between
`g_txindex.reset()` and `FlushBackgroundCallbacks`
`BaseIndex::BlockConnected` finally arrives. But it’s processed on a
(now) null instance hence a crash. If it’s earlier - it’s processed
normally, if it’s later - it’s flushed without execution, so there is a
tiny window to catch this crash.

## What was done?
Give tx index a bit of time to process everything

## How Has This Been Tested?
run tests (but this crash is rare 🤷‍♂️ )

## 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
- [ ] 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-28 19:00:38 +03:00
UdjinM6
7f406829e8
feat(qt): refresh the whole wallet instead of processing individual updates for huge notification queues (#5453)
## Issue being fixed or feature implemented
It's super slow for wallets with 100.000s of txes to process lots of
notifications produced by rescan. Skip them all and simply refresh the
whole wallet instead. In my case (500k+ txes testnet wallet) gui update
after `rescanblockchain` time is down from _forever_ to ~30 seconds.
Same for `wipewallettxes true` (#5451 ). Gui update after
`wipewallettxes`/`wipewallettxes false` is instant (cause there are no
txes anymore) vs _forever_ before the patch.


## What was done?
refresh the whole wallet when notification queue is above 10K operations

actual changes (ignoring whitespaces):
d013cb4f5c

## How Has This Been Tested?
running on top of #5451 and #5452 , wiping and rescanning w/ and w/out
this patch.

## Breaking Changes
should be none


## 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-28 19:00:18 +03:00
UdjinM6
9138ff738a
feat(wallet): try batching multiple wallet db operations when possible, avoid wasting cpu cycles in AddToWalletIfInvolvingMe (#5452)
## Issue being fixed or feature implemented
It's super slow for wallets with 100.000s of keys and txes to reindex
and to rescan. Batching multiple operations fixes it. In my case (300K+
keys and 500k+ txes testnet wallet) `rescanblockchain` time is down from
6+ hours to ~10 minutes.

Re-calculating `block_time` over and over again inside of the loop in
`AddToWalletIfInvolvingMe` is wasteful, move it out.

## What was done?
batch what's possible, optimize `AddToWalletIfInvolvingMe`

## How Has This Been Tested?
running on top of #5451 , wiping and rescanning w/ and w/out this patch.

## Breaking Changes
should be none

## 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-28 18:59:49 +03:00
UdjinM6
78fa019952
feat: introduce wipewallettxes RPC and wipetxes command for dash-wallet tool (#5451)
## Issue being fixed or feature implemented
Given the hard fork that happened on testnet, there is now lots of the
transactions that were made on the fork that is no longer valid. Some
transactions could be relayed and mined again but some like coinjoin
mixing won't be relayed because of 0 fee and transactions spending
coinbases from the forked branch are no longer valid at all.

## What was done?
Introduce `wipewallettxes` RPC and `wipetxes` command for `dash-wallet`
tool to be able to get rid of some/all txes in the wallet.

## How Has This Been Tested?
run tests, use rpc/command on testnet wallet

## 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-27 21:51:40 +03:00
Odysseas Gabrielides
0e53540f64
feat: mnlistdiff move nversion to first position (#5450)
## Issue being fixed or feature implemented

Version field should always be the first field of a message for better
readibility.

## What was done?

- Introduced new protocol version `MNLISTDIFF_VERSION_ORDER` (`70229`).
- `nVersion` serialisation order is changed for clients with protocol
version greater than or equal to `70229`.
- For clients with protocol version >= `70225` and < `70229` the old
order is used: can be deprecated in the future.
- Increased functional test P2P mininode's protocol version to `70229`.

## How Has This Been Tested?
`feature_llmq_rotation.py` with new protocol version.

## 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
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
2023-06-26 00:01:17 -05:00
Odysseas Gabrielides
3e29e8f886
feat(rpc): Ability to filter HPMNs in masternodelist and protx list rpcs (#5447)
## Issue being fixed or feature implemented
Added the filter `hpmn` for both `masternodelist` and `protx list` rpcs.

## What was done?

## How Has This Been Tested?

Calling this RPC on Testnet.

## 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
- [ ] 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: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-06-21 23:27:27 -05:00
UdjinM6
55008b0b01
fix: do not check chainlock state in IsTxSafeForMining (#5444)
## Issue being fixed or feature implemented
Disabled or non-enforced Chainlocks does not mean you can safely mine
non-locked txes, you could end up mining a block that is going to be
rejected by everyone else if a conflicting tx (missing on your node)
would be IS-locked. I can't find any reason why we have this besides "if
Chainlocks are disabled then smth is wrong so let them all be mined" but
we have spork_2 and spork_3 to control IS behaviour and we check them in
`IsTxSafeForMining` already, that would be a much more straightforward
way to deal with a potential issue.

Noticed this while reviewing #5150 and also while testing v19.2 during
recent testnet v19 re-fork.

## What was done?
Drop this check, adjust tests

## How Has This Been Tested?
Run tests locally

## Breaking Changes
Not quote breaking changes but a change in behaviour: with CLs disabled
it will now take 10 minutes for non-locked txes to be mined, same as
when CLs are enabled.

## 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-20 22:49:41 -05:00
UdjinM6
ce60071da1
feat: Allow mining blocks of a specific version on non-mainnet networks (#5433)
## Issue being fixed or feature implemented
Mining blocks with a specific version can be useful on testnet and
devnets too

## What was done?
lift restrictions for `-blockversion`

## How Has This Been Tested?
it should just work :)

## 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-19 22:04:48 +03:00
UdjinM6
5fa9d32083
chore: update chainparams for v19.2 release (#5441)
## Issue being fixed or feature implemented
bump chainparams to some post failed-v19-fork block on mainnet and post
recent-v19-fork block on testnet

## What was done?


## 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
- [ ] 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 11:16:28 -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
35d3cb97f7
chore(rpc): few cleanups in evo rpc help texts (#5439)
## Issue being fixed or feature implemented
fix a couple of issues in help texts

develop:
```
protx register "collateralHash" collateralIndex "ipAndPort" "ownerAddress" "operatorPubKey_register" "votingAddress_register" "operatorReward" "payoutAddress_register" ( "feeSourceAddress" submit )
...
3. ipAndPort                  (string, required) IP and port in the form "IP:PORT".
                              Must be unique on the network. Can be set to 0, which will require a ProUpServTx afterwards.
...
5. operatorPubKey_register    (string, required) The operator BLS public key. The BLS private key does not have to be known.
                              It has to match the BLS private key which is later used when operating the masternode.
6. votingAddress_register     (string, required) The voting key address. The private key does not have to be known by your wallet.
                              It has to match the private key which is later used when voting on proposals.
                              If set to an empty string, ownerAddress will be used.
7. operatorReward             (string, required) The fraction in %% to share with the operator. The value must be
                              between 0.00 and 100.00.
8. payoutAddress_register     (string, required) The dash address to use for masternode reward payments.
...
```
```
protx update_service "proTxHash" "ipAndPort" "operatorKey" ( "operatorPayoutAddress" "feeSourceAddress" )
...
2. ipAndPort                (string, required) IP and port in the form "IP:PORT".
                            Must be unique on the network. Can be set to 0, which will require a ProUpServTx afterwards.
...
```
fe95dfdd7a97ae5150d8e28ea908f619c6080008:
```
protx register "collateralHash" collateralIndex "ipAndPort" "ownerAddress" "operatorPubKey" "votingAddress" "operatorReward" "payoutAddress" ( "feeSourceAddress" submit )
...
3. ipAndPort           (string, required) IP and port in the form "IP:PORT". Must be unique on the network.
                       Can be set to an empty string, which will require a ProUpServTx afterwards.
...
5. operatorPubKey      (string, required) The operator BLS public key. The BLS private key does not have to be known.
                       It has to match the BLS private key which is later used when operating the masternode.
6. votingAddress       (string, required) The voting key address. The private key does not have to be known by your wallet.
                       It has to match the private key which is later used when voting on proposals.
                       If set to an empty string, ownerAddress will be used.
7. operatorReward      (string, required) The fraction in %% to share with the operator.
                       The value must be between 0 and 10000.
8. payoutAddress       (string, required) The dash address to use for masternode reward payments.
...
```
```
protx update_service "proTxHash" "ipAndPort" "operatorKey" ( "operatorPayoutAddress" "feeSourceAddress" )
...
2. ipAndPort                (string, required) IP and port in the form "IP:PORT". Must be unique on the network.
...
```
## What was done?
pls see individual commits

## How Has This Been Tested?
run `dash-qt`, check `help <cmd>` response

## 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:49:37 -05:00
Odysseas Gabrielides
43067a72cd
chore(rpc): remove collateral amount from help (#5438)
## Issue being fixed or feature implemented
Removed collateral amount from help text for `protx register_fund_hpmn`
RPC.

## What was done?

## 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
- [ ] 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:48:39 -05:00
UdjinM6
aa91946e20
fix: off-by-one in the way we use v19 activation helpers (#5431)
## Issue being fixed or feature implemented
Some conditions won't trigger when reorging exactly from the forkpoint

## What was done?
pls see individual commits, tl;dr: you can't get correct results with
`GetAncestor` cause the answer is in the future

## How Has This Been Tested?
reorg to 850000 and back on testnet
```
invalidateblock 0000003eddb94218e7a3f41b2ac6e26143f8a748b50cd26e86bdbbab9ebe50aa
reconsiderblock 0000003eddb94218e7a3f41b2ac6e26143f8a748b50cd26e86bdbbab9ebe50aa
```
this fails on develop and work with this patch

## 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-13 17:24:19 +03:00
UdjinM6
f5ba5f5606
chore: update defaultAssumeValid, nMinimumChainWork, checkpointData and chainTxData for testnet (again) (#5430)
## Issue being fixed or feature implemented
Same as #5428 but with a lower block number this time. This should let
us simply reorg testnet with 18.2.2 at deeper blocks instead of bumping
v19 testnet activation params for 19.2.

## 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-12 21:47:31 +03:00
UdjinM6
492b1c1322
chore: update defaultAssumeValid, nMinimumChainWork, checkpointData and chainTxData for testnet (#5428)
## Issue being fixed or feature implemented
Having these above v19 forkpoint (850100) would result in v19.2 nodes
forking at the wrong height (864000) when reindexing without
`--assumevalid=<0 or some pre-v19 block height>`

## What was done?
Go back to pre-v19 block (850000) in chainparams

## How Has This Been Tested?
reindex

## 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-12 10:58:44 +03:00
UdjinM6
9e862c16d1 fix(test): drop duplicates and add missing test cases in evo_utils_tests 2023-06-12 10:56:10 +03:00
UdjinM6
d2bdc4275e fix(qt): actually open debug console and not info tab
this fix is for tray icon menu
2023-06-12 10:56:10 +03:00
UdjinM6
d8f2fe7d7a fix(qt): disable custom change address on CoinJoin tab 2023-06-12 10:56:10 +03:00
UdjinM6
fba5d06a8c fix(qt): don't crash in options when running with -disablewallet 2023-06-12 10:56:10 +03:00
UdjinM6
d53e657513 fix(wallet): truncate mnemonic passphrase instead of crashing 2023-06-12 10:56:10 +03:00
UdjinM6
6f639ea5f1 fix(wallet): do not count DBKeys::PRIVATESEND_SALT and DBKeys::COINJOIN_SALT keys as unknown
Before: `Unknown wallet records: 2`
After: `Unknown wallet records: 0`
2023-06-12 10:56:10 +03:00
UdjinM6
8a391189cc fix: mark sporkkey and masternodeblsprivkey args as SENSITIVE 2023-06-12 10:56:10 +03:00
UdjinM6
16418d3559 fix: respect fPowNoRetargeting for post-btc algos 2023-06-12 10:56:10 +03:00
UdjinM6
4921903663 fix: off-by-1 in unordered_lru_cache
we should be truncating after (potentially) adding new element, not before we even tried to do so
2023-06-12 10:56:10 +03:00
UdjinM6
62540743ef fix: pass correct params into CHashWriter 2023-06-12 10:56:10 +03: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
86e8556ecc fix: adjust llmq_max_blocks() 2023-06-11 09:57:09 +03:00
UdjinM6
35b0d5f7c8 fix: simplify/fix CleanupCache logic
tip: it was originally designed to be called for every block but 4743 changed that so the old logic no longer applies.
the second condition: well, it's just wrong.
2023-06-11 09:57:09 +03:00
UdjinM6
599fd87723
feat: use m_protxHash instead of masternodeOutpoint for hashing dsq and dstx after v19 activation (#5404)
## Issue being fixed or feature implemented
Should fix #5401 with minimal potential coinjoin service interruption
(~1 minute around v19 fork point) for up to date clients. Fully
backwards compatible prior to v19 activation. Old clients won't be able
to mix after v19 activation though until they implement similar changes.
_EDIT: Actually, this is already the case cause bls sigs are going to
change too._ And I think we should also be able to finally drop
`masternodeOutpoint` from `CCoinJoinQueue` and `CCoinJoinBroadcastTx`
once v19 is active because of that which would be a nice bonus.

cc @HashEngineering

## What was done?
re-use v19 activation to switch `GetSignatureHash` logic

## How Has This Been Tested?
mixing on mainnet

## Breaking Changes
mixing won't work on current testnet until MNs are updated 

## 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-11 00:41:02 -05:00
MarcoFalke
542fbdc545 Merge bitcoin/bitcoin#23128: doc: Remove TODO 'exclude peers with download permission'
2f97c1180b7eba2c48683a553ca166eba84e14c6 doc: Remove TODO 'exclude peers with download permission' (Douglas Chimento)

Pull request description:

  Following from PR https://github.com/bitcoin/bitcoin/pull/23109
  The [TODO](https://github.com/bitcoin/bitcoin/blob/master/src/net.cpp#L2872)  is no longer necessary.
  Removing it to  prevent future confusion.

Top commit has no ACKs.

Tree-SHA512: c2f4c3eae951d13d623e1b4bd9315804ec33473e501367f89edae80fa446674edc71549e145f058fe7126b8588790dc895d6ea3dfb4347ceeca61f5e5f2f95cc
2023-06-10 17:40:23 -05:00
fanquake
a0984bb07c Merge bitcoin/bitcoin#22576: doc: Update high-level addrman description
036d7eadf5dd0e06e0734a5d78dbe28f4bfaa07f doc: Correct description of CAddrMan::Create() (Amiti Uttarwar)
318176aff1ded36d1fbc5977f288ac3bac1d8712 doc: Update high-level addrman description (Martin Zumsande)

Pull request description:

  The high-level description of `addrman` has outdated information with respect to the eviction behavior, both for the New and Tried tables (at least since #5941) - this has confused me in the past.

  This PR corrects this and also adds basic info about the bucket size and position.

ACKs for top commit:
  amitiuttarwar:
    reACK 036d7eadf5dd0e06e0734a5d78dbe28f4bfaa07f
  jnewbery:
    ACK 036d7eadf5dd0e06e0734a5d78dbe28f4bfaa07f

Tree-SHA512: 3f0635d765f5e580a1fae31187742a833cef66ef2286d40eeb28f2253521260038e16e5f1a65741464a2ddfdbeb5c0f1bc38bf73841e600639033d59c3c534e4
2023-06-10 17:40:23 -05:00
MarcoFalke
d117a65f3a Merge #21585: Fix assumeutxo crash due to truncated file
fa73ce6e653d00824eb68f772fd29b7f8fb93d84 Fix assumeutxo crash due to truncated file (MarcoFalke)

Pull request description:

ACKs for top commit:
  jamesob:
    ACK fa73ce6e653d00824eb68f772fd29b7f8fb93d84
  ryanofsky:
    Code review ACK fa73ce6e653d00824eb68f772fd29b7f8fb93d84. Easy fix. It seems like this could have been caught in review, though.

Tree-SHA512: 3a98687c386e3995114ddf0ad7194fadd9520989290681ef703b578e3ca21aee51eadfb83aa38a489bac13d12709ea137b9b184b08e5bfa2919cca177aab90be
2023-06-10 17:40:23 -05:00
Kittywhiskers Van Gogh
110dbf82e8 merge bitcoin#22392: use LIEF for ELF security & symbol checks 2023-06-07 14:42:02 +05:30
Kittywhiskers Van Gogh
d28ba33136 build: run backwards compatibility symbol checks on all builds
courtesy of https://github.com/bitcoin/bitcoin/pull/22405
2023-06-07 14:42:02 +05:30
Kittywhiskers Van Gogh
24a6642b6f partial bitcoin#22381: Test security-check sanity before performing them (with macOS)
excludes:
- d6ef3543ae16847d5a91fa9271acee9bd2164b32
2023-06-07 14:42:02 +05:30
Konstantin Akimov
c35746088e fix: get rid UB from integer overflow in transactionview 2023-06-07 01:50:18 -05:00
Konstantin Akimov
6b87c21f75 fix: rid of UB in qt/rpcconsole.cpp 2023-06-07 01:50:18 -05:00
Kittywhiskers Van Gogh
42f2756ae7 merge bitcoin#22415: Make m_mempool optional in CChainState 2023-06-06 22:40:20 +05:30
Kittywhiskers Van Gogh
6c7bd58eed merge bitcoin#21789: Remove ::Params() global from CChainState 2023-06-06 22:38:56 +05:30
Kittywhiskers Van Gogh
9e60bdff16 merge bitcoin#21525: Followup fixups to bundle 4 2023-06-06 22:38:56 +05:30
Kittywhiskers Van Gogh
6ba54ca251 merge bitcoin#21270: Prune g_chainman usage in validation-adjacent modules 2023-06-06 22:38:56 +05:30
Kittywhiskers Van Gogh
8b41e07aea merge bitcoin#21584: Fix assumeutxo crash due to invalid base_blockhash 2023-06-06 22:38:56 +05:30
Kittywhiskers Van Gogh
7fbda904d2 merge bitcoin#21582: Fix assumeutxo crash due to missing base_blockhash 2023-06-06 22:38:56 +05:30
Kittywhiskers Van Gogh
dc3e259713 merge bitcoin#21592: Remove option to make TestChain100Setup non-deterministic 2023-06-06 22:38:56 +05:30
Kittywhiskers Van Gogh
6bf39d7632 merge bitcoin#19806: UTXO snapshot activation 2023-06-06 22:38:56 +05:30
UdjinM6
87863a68a3
fix: reset chainman to allow reindex on failure (#5405)
## Issue being fixed or feature implemented
current develop fails to reindex whenever there is an issue at node
start (prints `should not be overwriting a chainstate` in `debug.log`)

## What was done?
reset chainman to allow it re-initialize chainstate


## How Has This Been Tested?
simulated an issue with
```
 if (!fReset) {
     strLoadError = _("DEBUG");
     break;
 }
```


## Breaking Changes
should not be any but pls test


## 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-06 19:31:11 +03:00
Konstantin Akimov
e23449aa81
fix: follow-up #5403: remove double serialization in CDeterministicMNState (#5413)
## Issue being fixed or feature implemented
Member obj.keyIDOwner is read & write twice



## What was done?
Fixed: it is serialized once

## How Has This Been Tested?
Unit/functional tests in CI


## Breaking Changes
Data format in database changed in incompatible way

## 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-06-05 23:39:16 -05:00
Kittywhiskers Van Gogh
99b336deba merge bitcoin#22179: Torv2 removal followups 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
31acbf1e2d merge bitcoin#22025: Group and re-order CAddrMan members by access type 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
1ef6322fc2 merge bitcoin#20284: ensure old versions don't parse peers.dat 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
3bfcf7a16b merge bitcoin#20965: return NET_UNROUTABLE as not_publicly_routable, automate helps 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
052b2d0dc1 merge bitcoin#20757: tor.md and -onlynet help updates 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
f003f00e9a merge bitcoin#19638: Replace hidden service with onion service 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
81c686e7db merge bitcoin#20000: fix creation of "std::string"s with \0s 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
01130228f0 merge bitcoin#19697: Improvements on ADDR caching 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
56cd0dd80a merge bitcoin#19658: Allow RPC to fetch all addrman records and add records to addrman 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
1244d59522 merge bitcoin#18991: Cache responses to GETADDR to prevent topology leaks 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
a13b72397b merge bitcoin#19191: Extract download permission from noban 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
91d800dce3 merge bitcoin#18968: noban precludes maxuploadtarget disconnects 2023-06-05 10:11:03 -05:00
Kittywhiskers Van Gogh
8806c7baeb merge bitcoin#19192: Extract net permissions doc 2023-06-05 10:11:03 -05:00
UdjinM6
54fb76f2f1
fix: Resolve mainnet v19 fork issues (#5403)
## Issue being fixed or feature implemented
same as  #5392, alternative solution

~based on #5402 atm, will rebase later~

## What was done?
pls see individual commits

## How Has This Been Tested?
reorg mainnet around forkpoint with a patched client (to allow low
difficulty), run tests

## Breaking Changes
Another evodb migration is required. Going back to an older version or
migrating after the fork requires reindexing.

## 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-04 23:45:56 +03:00
Konstantin Akimov
86dc99f10d
refactor: using reference instead reference to unique_ptr with object (#5381)
## Issue being fixed or feature implemented
Many objects created and functions called by passing `const
std::unique_ptr<Obj>& obj` instead directly passing `Obj& obj`

In some cases it is indeed needed, but in most cases it is just extra
complexity that is better to avoid.

Motivation:
- providing reference to object instead `unique_ptr` is giving warranty
that there's no `nullptr` and no need to keep it in mind
- value inside unique_ptr by reference can be changed externally and
instead `nullptr` it can turn to real object later (or in opposite)
 - code is shorter but cleaner

Based on that this refactoring is useful as it reduces mental load when
reading or writing code.
`std::unique` should be used ONLY for owning object, but not for passing
it everywhere.

## What was done?
Replaced most of usages `std::unique_ptr<Obj>& obj` to `Obj& obj`.
Btw, in several cases implementation assumes that object can be nullptr
and replacement to reference is not possible.
Even using raw pointer is not possible, because the empty
std::unique_ptr can be initialized later somewhere in code.
For example, in `src/init.cpp` there's called `PeerManager::make` and
pass unique_ptr to the `node.llmq_ctx` that would be initialized way
later.
That is out of scope this PR.
List of cases, where reference to `std::unique_ptr` stayed as they are:
- `std::unique_ptr<LLMQContext>& llmq_ctx` in `PeerManagerImpl`,
`PeerManager` and `CDSNotificationInterface`
- `std::unique_ptr<CDeterministicMNManager>& dmnman` in
`CDSNotificationInterface`

Also `CChainState` have 3 references to `unique_ptr` that can't be
replaced too:
 - `std::unique_ptr<llmq::CChainLocksHandler>& m_clhandler;`
 - `std::unique_ptr<llmq::CInstantSendManager>& m_isman;`
- `std::unique_ptr<llmq::CQuorumBlockProcessor>&
m_quorum_block_processor;`


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

## Breaking Changes
No breaking changes, all of these changes - are internal APIs for Dash
Core developers only.

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

---------

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2023-06-04 15:26:23 -05:00
Samuel Dobson
68dfc06916 partial Merge #18224: Make AnalyzePSBT next role calculation simple, correct
1ef28b4f7cfba410fef524def1dac24bbc4086ca Make AnalyzePSBT next role calculation simple, correct (Gregory Sanders)

Pull request description:

  Sniped test and alternative to https://github.com/bitcoin/bitcoin/pull/18220

  Sjors documenting the issue:
  ```
  A PSBT signed by ColdCard was analyzed as follows (see #17509 (comment))

  {
    "inputs": [
      {
        "has_utxo": true,
        "is_final": false,
        "next": "finalizer"
      }
    ],
    "estimated_vsize": 141,
    "estimated_feerate": 1e-05,
    "fee": 1.41e-06,
    "next": "signer"
  }
  I changed AnalyzePSBT so that it returns "next": "finalizer" instead.
  ```

  It makes it much clearer that the role has been decided before hitting the `calc_fee` block, and groups all state-deciding in one spot instead of 2.

  Note that this assumes that PSBT roles are a complete ordering, which for now and in the future seems to be a correct assumption.

ACKs for top commit:
  Sjors:
    ACK 1ef28b4f7cfba410fef524def1dac24bbc4086ca, much nicer. Don't forget to document the bug fix.
  achow101:
    ACK 1ef28b4f7cfba410fef524def1dac24bbc4086ca
  Empact:
    ACK 1ef28b4f7c

Tree-SHA512: 22ba4234985c6f9c1445b14565c71268cfaa121c4ef000ee3d5117212b09442dee8d46d9701bceddaf355263fe25dfe40def2ef614d4f2fe66c9ce876cb49934
2023-05-31 18:14:23 -05:00
Konstantin Akimov
a5778e1db9 Merge #18314: tests: Add deserialization fuzzing of SnapshotMetadata (utxo_snapshot). Increase fuzzing coverage. 2023-05-31 18:14:23 -05:00
MarcoFalke
c2b4dd698c Merge #18292: fuzz: Add assert(script == decompressed_script)
fab0e5ba7f2777b86f1487234ed7cc4be9f72ea8 fuzz: Add assert(script == decompressed_script) (MarcoFalke)

Pull request description:

  Presumably an oversight in https://github.com/bitcoin/bitcoin/pull/17926#discussion_r389262151

ACKs for top commit:
  practicalswift:
    Tested ACK fab0e5ba7f2777b86f1487234ed7cc4be9f72ea8

Tree-SHA512: 6dcec06169df497a540fd6ebbcd89f5db22257241b2bbe756de868742f9bc324b80d38dbababfa07e5f3a830aaae9fc6d168dcc2ca5d75da437bdf4dc4e0f370
2023-05-31 18:14:23 -05:00
MarcoFalke
cedb78e157 Merge #18192: Bugfix: Wallet: Safely deal with change in the address book
b5795a788639305bab86a8b3f6b75d6ce81be083 Wallet: Add warning comments and assert to CWallet::DelAddressBook (Luke Dashjr)
6d2905f57aaeb3ec3b63d31043f7673ca10003f2 Wallet: Avoid unnecessary/redundant m_address_book lookups (Luke Dashjr)
c751d886f499257627b308b11ffaa51c22db6cc0 Wallet: Avoid treating change-in-the-addressbook as non-change everywhere (Luke Dashjr)
8e64b8c84bcbd63caea06f3af087af1f0609eaf5 Wallet: New FindAddressBookEntry method to filter out change entries (and skip ->second everywhere) (Luke Dashjr)
65b6bdc2b164343ec3cc3d32a0297daff9e24fec Wallet: Add CAddressBookData::IsChange which returns true iff label has never been set (Luke Dashjr)
144b2f85da4d51bf7d72b987888ddcaf5b429eed Wallet: Require usage of new CAddressBookData::setLabel to change label (Luke Dashjr)
b86cd155f6f661052042048aa7cfc2a397afe4f7 scripted-diff: Wallet: Rename mapAddressBook to m_address_book (Luke Dashjr)

Pull request description:

  In many places, our code assumes that presence in the address book indicates a non-change key, and absence of an entry in mapAddressBook indicates change.

  This no longer holds true after #13756 (first released in 0.19) since it added a "used" DestData populated even for change addresses. Only avoid-reuse wallets should be affected by this issue.

  Thankfully, populating DestData does not write a label to the database, so we can retroactively fix this (so long as the user didn't see the change address and manually assign it a real label).

  Fixing it is accomplished by:

  * Adding a new bool to CAddressBookData to track if the label has ever been assigned, either by loading one from the database, or by assigning one at runtime.
  * `CAddressBookData::IsChange` and `CWallet::FindAddressBookEntry` are new methods to assist in excluding change from code that doesn't expect to see them.
  * For safety in merging, `CAddressBookData::name` has been made read-only (the actual data is stored in `m_label`, a new private member, and can be changed only with `setLabel` which updates the `m_change` flag), and `mapAddressBook` has been renamed to `m_address_book` (to force old code to be rebased to compile).

  A final commit also does some minor optimisation, avoiding redundant lookups in `m_address_book` when we already have a pointer to the `CAddressBookData`.

ACKs for top commit:
  ryanofsky:
    Code review ACK b5795a788639305bab86a8b3f6b75d6ce81be083. Pretty clever and nicely implemented fix!
  jonatack:
    ACK b5795a788639305bab86a8b3f6b75d6ce81be083 nice improvements -- code review, built/ran tests rebased on current master ff53433fe4ed06893d7c4 and tested manually with rpc/cli
  jnewbery:
    Good fix. utACK b5795a788.

Tree-SHA512: 40525185a0bcc1723f602243c269499ec86ecb298fecb5ef24d626bbdd5e3efece86cdb1084ad7eebf7eeaf251db4a6e056bcd25bc8457b417fcbb53d032ebf0
2023-05-31 18:14:23 -05:00
Samuel Dobson
984aae497d Merge #17585: rpc: deprecate getaddressinfo label
d3bc18408146e91b3836f72360ff6fa2420b6887 doc: update release notes with getaddressinfo label deprecation (Jon Atack)
72af93f36479dc12d795f1d05fa3d8fbd9b293bd test: getaddressinfo label deprecation test (Jon Atack)
d48875fa20d0b71b978cb3d1f85dd9ec14e664cc rpc: deprecate getaddressinfo label field (Jon Atack)
dc0cabeda49a7edbfa71df22846721b6f6224aea test: remove getaddressinfo label tests (Jon Atack)
c7654af6f830577a54df12b5d65df93532db0dc2 doc: address pr17578 review feedback (Jon Atack)

Pull request description:

  This PR builds on #17578 (now merged) and deprecates the rpc getaddressinfo `label` field. The deprecated behavior can be re-enabled by starting bitcoind with `-deprecatedrpc=label`.

  See http://www.erisian.com.au/bitcoin-core-dev/log-2019-11-22.html#l-622 and https://github.com/bitcoin/bitcoin/pull/17283#issuecomment-554458001 for more context.

  Reviewers: This PR may be tested manually by building, then running bitcoind with and without the `-deprecatedrpc=label` flag while verifying the rpc getaddressinfo output and help text.

  Next step: add support for multiple labels.

ACKs for top commit:
  jnewbery:
    ACK d3bc18408146e91b3836f72360ff6fa2420b6887
  laanwj:
    ACK d3bc18408146e91b3836f72360ff6fa2420b6887
  meshcollider:
    utACK d3bc18408146e91b3836f72360ff6fa2420b6887

Tree-SHA512: f954402884ec54977def332c8160fd892f289b0d2aee1e91fed9ac3220f7e5b1f7fc6421b84cc7a5c824a0582eca4e6fc194e4e33ddd378c733c8941ac45f56d
2023-05-31 18:14:23 -05:00
Wladimir J. van der Laan
4e62a8b8e4 Merge #17804: doc: Misc RPC help fixes
fa5c6622c8ecf1954e7177888ad8c97a77b16fb7 doc: Use proper RPC help syntax in importmulti (MarcoFalke)
fab63111bec73859597e6ce0986f76e5e9959091 doc: Remove duplicate "comment" from listsinceblock RPC help (MarcoFalke)
fa04cd6cfc0330b62058ed169d621e08108dc87e doc: Properly document proxy_randomize_credentials as bool in getnetworkinfo (MarcoFalke)
fa9dec7c395897e8dbbb6de7a16ec5185a609d41 doc: Fix syntax error (trailing square bracket) in finalizepsbt (MarcoFalke)
faff5a60ed328d4c5fdef253e8935a351cb57bd0 doc: Fix syntax error (trailing square bracket) in walletprocesspsbt (MarcoFalke)
fa0545901daad32b09511cc61c4af1400c48088d doc: Add missing "optional" to "long" estimaterawfee RPC help (MarcoFalke)

Pull request description:

  This fixes documentation of the following RPCs:

  * estimaterawfee (hidden)
  * https://bitcoincore.org/en/doc/0.19.0/rpc/wallet/walletprocesspsbt/
  * https://bitcoincore.org/en/doc/0.19.0/rpc/rawtransactions/finalizepsbt/
  * https://bitcoincore.org/en/doc/0.19.0/rpc/network/getnetworkinfo/
  * https://bitcoincore.org/en/doc/0.19.0/rpc/wallet/listsinceblock/
  * https://bitcoincore.org/en/doc/0.19.0/rpc/wallet/importmulti/

  <!-- Also, it comes with a scripted diff to normalize whitespace and type names. (Previous attempts: #14601 and #14459)

ACKs for top commit:
  laanwj:
    ACK fa5c6622c8ecf1954e7177888ad8c97a77b16fb7

Tree-SHA512: 5a10956e12f8ce23e93a2ce8bafd6cae759d8a21658f79397e3bfce3e4aabd9658bdbd40acde49323dca958a9befee7166654994208c182dd60f483109621e17
2023-05-31 18:14:23 -05:00