Commit Graph

730 Commits

Author SHA1 Message Date
Alexander Block
d2573c43b6 Only return from wait_for_chainlock when the block is actually processed (#2728)
getblock also returns blocks which are not processed yet or in the middle
of processing.
2019-02-27 20:42:06 +03:00
Alexander Block
48d92f116e Implement optional pretty printed stacktraces (#2420)
* Add libbacktrace to depends

This is currently only useful to extract symbols. It fails to gather
stacktraces when compiled with MinGW, so we can only use it to get symbol
information from a stack trace which we gathered outside of libbacktrace.

* Add -mbig-obj to CXXFLAGS for MinGW builds

* Implement stacktraces for C++ exceptions

This is a hack and should only be used for debugging. It works by wrapping
the C++ ABI __wrap___cxa_allocate_exception. The wrapper records a backtrace
and stores it in a global map. Later the stacktrace can be retrieved with
GetExceptionStacktraceStr.

This commit also adds handlers to pretty print uncaught exceptions and
signals.

* Use GetPrettyExceptionStr for all unhandled exceptions

* Use --enable-stacktraces in CI for linux32/linux64

* Register exception translators to pretty print exceptions in unit tests

* Catch and print python exceptions when stopping nodes

Otherwise the code at the bottom is never executed when nodes crash,
leading to no output of debug.log files on Travis.

* Remove now unneeded/unused TestCrash methods
2019-02-21 21:37:15 +03:00
UdjinM6
0b552be20b
Fix file permissions broken in 2682 (#2717) 2019-02-20 12:03:48 +03:00
UdjinM6
a79b928532
Merge pull request #2682 from PastaPastaPasta/backports-0.15-pr6
Backports 0.15 pr6
2019-02-19 13:04:49 +03:00
Pasta
bb90eb4bf0 backports-0.15-pr6 code review 2019-02-16 15:09:51 -06:00
UdjinM6
86fc050495
Drop no longer used code and bump min protos (#2697)
* Drop registry deletion of the old key

* Drop no longer used CGovernanceObjectVoteFile::RemoveOldVotes()

* Drop temporary disconnect code and bump min protos to 70213

* drop comment

* fix
2019-02-12 22:51:21 +03:00
Wladimir J. van der Laan
1be5a72a97
Merge #9853: Fix error codes from various RPCs
adaa281 Update release notes to include RPC error code changes. (John Newbery)
338bf06 Add commenting around JSON error codes (John Newbery)
dab804c Return correct error codes in fundrawtransaction(). (John Newbery)
a012087 Return correct error codes in setban(). (John Newbery)
960bc7f Return correct error codes in removeprunedfunds(). (John Newbery)
c119096 Return correct error codes in blockchain.cpp. (John Newbery)
6d07c62 Return correct error codes in bumpfee(). (John Newbery)

Tree-SHA512: 4bb39ad221cd8c83d98ac5d7ad642f3a8c265522720dc86b2eebc70e74439a85b06d6ddcd6a874e879d986511de3ab0878bb7fe58b50cb0546b78913632ea809
2019-02-05 13:40:40 -06:00
Wladimir J. van der Laan
22cda1a92f Merge #9929: tests: Delete unused function _rpchost_to_args
99fecf8 tests: Delete unused function _rpchost_to_args (Wladimir J. van der Laan)

Tree-SHA512: 40911d048d3fd7b3ce83e9b3caf2a409d55b47cbe08ea4450a16ca72264300bb12d5ef7dbcf335885975119b5977f949e6879546840064138fb506e24494d849
2019-02-04 19:58:09 -06:00
UdjinM6
d343bfa520
Merge pull request #2647 from PastaPastaPasta/backports-0.15-pr5
Backports 0.15 pr5
2019-02-04 21:58:02 +03:00
Pasta
071035b93a
Apply code review suggestions #2647 2019-02-01 13:39:23 -06:00
Wladimir J. van der Laan
b821dfa7dc
Merge #9739: Fix BIP68 activation test
f5aba8a Move tx version 2 standardness check to after bip68 activation (John Newbery)
99c0e81 Fix BIP68 activation test (John Newbery)

Tree-SHA512: 3633d5359705b33a22cd3d8ea28f41abd93ccc6fe9943c8004f6149add991771df9ea12b4e14192e39e14b414bb5ecc7218e516cfeec97e4c5df29778ac57060
2019-02-01 10:50:57 -06:00
Wladimir J. van der Laan
56890f98f2
Merge #9832: [qa] assert_start_raises_init_error
025dec0 [qa] assert_start_raises_init_error (NicolasDorier)

Tree-SHA512: 0fe3ecbd47625b181aed92f15445ac26993e1a8b9843bbc1088c4adcea774e503b870912a18e13dca3f255c22a9964c1c0ca92c758907538143f316c5272ea4a
2019-02-01 10:50:53 -06:00
Alexander Block
18950f923e Optimize DKG debug message processing for performance and lower bandwidth (#2672)
* Allow sub-batch verification in CBLSInsecureBatchVerifier

* Implement batch verification of CDKGDebugStatus messages

* Use uint8_t for statusBitset in CDKGDebugMemberStatus and CDKGDebugSessionStatus

No need to waste one byte per member and per LLMQ type.

* Reserve 4k of buffer for CSerializedNetMsg buffer

Profiling has shown that a lot of time is spent in resizing the data
vector when large messages are involved.

* Remove nHeight from CDKGDebugStatus

This field changes every block and causes all masternodes to propagate
its status for every block, even if nothing DKG related has changed.

* Leave out session statuses when we're not a member of that session

Otherwise MNs which are not members of DKG sessions will spam the network

* Remove receivedFinalCommitment from CDKGDebugSessionStatus

This is not bound to a session and thus is prone to spam the network when
final commitments are propagated in the finalization phase.

* Add "minableCommitments" to "quorum dkgstatus"

* Hold cs_main while calling GetMinableCommitment

* Abort processing of pending debug messages when spork18 gets disabled

* Don't ask for debug messages when we've already seen them

"statuses" only contains the current messages but none of the old messages,
so nodes kept re-requesting old messages.
2019-02-01 10:49:01 +03:00
Alexander Block
54f576ea7c
Fix LLMQ related test failures on Travis (#2666)
* Use fast_dip3_enforcement instead of fast_dip3_activation

DashTestFramework was refactored before ChainLocks got merged, causing tests
to fail now.

* Move updating of DKG debug status into WaitForNextPhase

Otherwise callers of the RPCs might believe that the next phase has already
started and start producing more blocks, which would then cancel the
current session if it happens faster than the phase handler thread can
progress to the next phase.
2019-01-30 14:05:22 +01:00
Alexander Block
f6828b19b6
Merge pull request #2643 from codablock/pr_llmq_chainlocks
Implement LLMQ based ChainLocks
2019-01-29 15:59:05 +01:00
UdjinM6
25cb14b615 Fix confusion between dip3 activation and enforcement (#2651)
* Fix confusion between dip3 activation and enforcement

* drop DIP0003ActivationHeight for now
2019-01-29 15:54:38 +01:00
Alexander Block
15e1c3b080
Merge pull request #2646 from PastaPastaPasta/backports-0.15-pr4
Backports 0.15 pr4
2019-01-29 15:52:03 +01:00
Alexander Block
ad4b3cda30 Instead of asserting signatures once, wait for them to change to the expected state 2019-01-28 14:45:20 +01:00
Alexander Block
08d915dc2d Increase waiting time in LLMQ signing tests 2019-01-28 12:24:15 +01:00
Alexander Block
886299a400 Implement llmq-chainlocks.py integration tests 2019-01-28 12:24:15 +01:00
Wladimir J. van der Laan
afdb0a2677 Merge #9908: Define 7200 second timestamp window constant
e57a1fd Define 7200 second timestamp window constant (Russell Yanofsky)

Tree-SHA512: 449d20e4fd23905cd96be36f717c55a0a2360aba1002aaf55a3699cce4a41f6e94acc2fbe511a93c5cbe8f8e68386995a76cad67620ebb66ba9283e6080ab567
2019-01-24 22:28:29 -06:00
Alexander Block
7ee31cbd65 Speed up integration tests with masternodes (#2642)
* Implement copy_datadir to allow easy copying of state from one node to another

* Instead of starting with a fresh datadir for MNs, reuse a copy of the faucet

* Start masternodes in parallel instead of waiting for the previous to finish

* Allow specifying of window and threshold with -bip9params

* Implement -dip3activationheight for regtests

* Implement fast DIP3 activation in DashTestFramework

* Speed up activation of DIP3 in dip3-deterministicmns.py

* Update qa/rpc-tests/test_framework/test_framework.py

Co-Authored-By: codablock <ablock84@gmail.com>

* Always assign fast_dip3_activation
2019-01-23 19:36:51 +03:00
UdjinM6
fda16f1fea
Fix off-by-1 in phase calculations and the rest of llmq-signing.py issues (#2641)
* Fix off-by-1 in phase calculations

* Fix wait_for_quorum_phase, should look for check_received_messages

* Fix wait_for_quorum_phase for complain phase

* Bump default timeout in wait_for_quorum_phase/wait_for_quorum_commitment to 15
2019-01-23 17:02:56 +03:00
Alexander Block
b595f9e6a1 Fix LLMQ signing integration tests (#2640)
* Fix cleanup of old recovered sigs

When iterating the db, we should also include entries that match exactly
the end time.

* Fix key not found error

* Raise AssertionError in case wait_for_quorum_phase/wait_for_quorum_commitment time out
2019-01-23 11:37:02 +03:00
Alexander Block
b970c20a96 Avoid using immature coinbase UTXOs for dummy TXins 2019-01-21 14:42:08 +01:00
Alexander Block
4d25148c03 Add llmq-signing.py tests 2019-01-21 14:42:08 +01:00
Alexander Block
d020ffa00d Add wait_for_sporks_same and mine_quorum to DashTestFramework 2019-01-21 14:42:08 +01:00
UdjinM6
4671c989d3
Merge pull request #2617 from codablock/pr_llmq_dkg
Implement LLMQ DKG
2019-01-15 15:44:34 +03:00
UdjinM6
02c7932f49
Add owner and voting addresses to rpc output, unify it across different methods (#2618)
* Add `owneraddress` and `votingaddress` to json representation of provider txes and rpc output

* Rearrange/unify things a bit

* Add votingAddress to CSimplifiedMNListEntry json

* Use addresses in error messages too

* More unification

* Swap keyIDOwner/keyIDVoting with corresponding addresses in ToString()

* Drop keyIDOwner/keyIDVoting from json and rpc

* More unification: s/operatorRewardAddress/operatorPayoutAddress/

* More unification/cleanup: use specific name instead of just bitcoinAddress

* Fix dip3 test
2019-01-11 13:05:58 +03:00
Alexander Block
2aed51c559 Give nodes more time per phase when doing PoSe tests
Nodes started randomly voting other members as bad members because
contributions were not received fast enough.
2019-01-10 07:08:51 +01:00
Alexander Block
a1f4853d64 Use LLMQ DKGs for PoSe testing in DIP3 tests 2019-01-09 12:16:12 +01:00
PastaPastaPasta
07dcddb4ca Backports 0.15 pr2 (#2597)
* Merge #9815: Trivial: use EXIT_ codes instead of magic numbers

a87d02a use EXIT_ codes instead of magic numbers (Marko Bencun)

* Merge #9801: Removed redundant parameter from mempool.PrioritiseTransaction

eaea2bb Removed redundant parameter from mempool.PrioritiseTransaction (gubatron)

* remove extra parameter (see 3a3745bb) in dash specific code

* Merge #9819: Remove harmless read of unusued priority estimates

bc8fd12 Remove harmless read of unusued priority estimates (Alex Morcos)

* Merge #9766: Add --exclude option to rpc-tests.py

c578408 Add exclude option to rpc-tests.py (John Newbery)

* Merge #9577: Fix docstrings in qa tests

3f95a80 Fix docstrings in qa tests (John Newbery)

* Merge #9823: qa: Set correct path for binaries in rpc tests

3333ad0 qa: Set correct path for binaries in rpc tests (MarcoFalke)

* Merge #9833: Trivial: fix comments referencing AppInit2

ef9f495 Trivial: fix comments referencing AppInit2 (Marko Bencun)

* Merge #9612: [trivial] Rephrase the definition of difficulty.

dc222f8 Trivial: Rephrase the definition of difficulty in the code. (Karl-Johan Alm)

* Merge #9847: Extra test vector for BIP32

30aedcb BIP32 extra test vector (Pieter Wuille)

* Merge #9839: [qa] Make import-rescan.py watchonly check reliable

864890a [qa] Make import-rescan.py watchonly check reliable (Russell Yanofsky)

Tree-SHA512: ea0e2b1d4fc8f35174c3d575fb751b428daf6ad3aa944fad4e3ddcc9195e4f17051473acabc54203b1d27cca64cf911b737ab92e986c40ef384410652e2dbea1

* Change back file params
2019-01-07 12:55:35 +03:00
Alexander Block
0648496e21 Fix flaky p2p-fullblocktest (#2605)
* Announce blocks as HEADERS instead of INV in comptool

Announcing as INV results in one GETHEADERS message per INV item with
every GETHEADERS containing the same block locator info. This in turn
results in many (1088 in p2p-fullblocktests) replies with each having i+1
headers. As every message is sent in one go, the message processing queue
gets overloaded, leading to GETDATA timeouts for blocks and thus failing
the tests.

Announcing the blocks directly with HEADERS avoids all this and results in
one GETDATA per announced header.

This will later conflict with backported improvements from Bitcoin. When we
get to this point, we can simply ignore changes on Dash's side and take
the improvements from Bitcoin (which also switch to header announcement,
but after some refactorings)

* Give wait_for_pings more time

Large reorgs as in the p2p-fullblocktest can cause very long long delays
for the ping that we're waiting for. This was not a problem before #2593,
as before this wait_until was waiting forever.
2019-01-03 12:21:03 +03:00
Alexander Block
96d4f74592 Try to fix flaky IX tests in DIP3 tests (#2602)
* Send larger amounts for IX

* Don't use node0 as sender of IX transactions

node0 tends to have many small UTXOs which result in TXs with many inputs
and high CPU usage.
2019-01-03 12:20:41 +03:00
UdjinM6
c58f775cc2
De-dashify env vars and dashify help text in tests instead (#2603) 2019-01-03 12:19:46 +03:00
PastaPastaPasta
a49f4123e5 Backports 0.15 pr1 (#2590)
* Merge #9744: Remove unused module from rpc-tests

a432aa0 Remove unused module from rpc-tests (Takashi Mitsuta)

* Merge #9696: [trivial] Fix recently introduced typos in comments

0c9b9b7 [trivial] Fix recently introduced typos in comments (practicalswift)

* Merge #9657: Improve rpc-tests.py

a6a3e58 Various review markups for rpc-tests.py improvements (John Newbery)
3de3ccd Refactor rpc-tests.py (John Newbery)
afd38e7 Improve rpc-tests.py arguments (John Newbery)
91bffff Use argparse in rpc_tests.py (John Newbery)
1581ecb Use configparser in rpc-tests.py (John Newbery)

* Merge #9724: Qt/Intro: Add explanation of IBD process

f6d18f5 Qt/Intro: Explain a bit more what will happen first time (Luke Dashjr)
50c5657 Qt/Intro: Storage shouldn't grow significantly with pruning enabled (Luke Dashjr)
9adb694 Qt/Intro: Move sizeWarningLabel text into C++ code (Luke Dashjr)

* Merge #9794: Minor update to qrencode package builder

1bfe6b4 Use package name variable inside $(package)_file_name variable (Mitchell Cash)

* Merge #9726: netbase: Do not print an error on connection timeouts through proxy

3ddfe29 netbase: Do not print an error on connection timeouts through proxy (Wladimir J. van der Laan)
13f6085 netbase: Make InterruptibleRecv return an error code instead of bool (Wladimir J. van der Laan)

* Merge #9727: Remove fallbacks for boost_filesystem < v3

056aba2 Remove fallbacks for boost_filesystem < v3 (Wladimir J. van der Laan)

* Merge #9485: ZMQ example using python3 and asyncio

b471daf Adddress nits, use asyncio signal handling, create_task (Bob McElrath)
4bb7d1b Add python version checks and 3.4 example (Bob McElrath)
5406d51 Rewrite to not use Polling wrapper for asyncio, link to python2.7 example (Bob McElrath)
5ea5368 ZMQ example using python3 and asyncio (Bob McElrath)

* Merge #9807: RPC doc fix-ups.

851f6a3 [qa][doc] Correct rpc test options in readme (fanquake)
41e7219 [trivial] Add tests_config.ini to .gitignore (fanquake)

* Dashify

Co-Authored-By: PastaPastaPasta <pasta@dashboost.org>

* Change file permissions

* update travis.yml -parallel -> --jobs
2019-01-03 12:18:47 +03:00
Alexander Block
119f1c9d6f
Merge pull request #2593 from codablock/pr_backport_10365
Backport: #10365: [tests] increase timeouts in sendheaders test
2019-01-02 06:57:57 +01:00
Alexander Block
0e28f0aa93
Fix flaky autoix tests by disabling autoix while filling mempool (#2595)
* Increment mocktime before setting new SPORK_16_INSTANTSEND_AUTOLOCKS value

Otherwise nodes will not update sporks as they use the same timestamps.

* Disable autoix while filling mempool

* Retest autoix and regular ix after clearing mempool
2019-01-02 06:57:38 +01:00
MarcoFalke
75024e1173 Merge #10365: [tests] increase timeouts in sendheaders test
56befa0 [tests] increase timeouts in sendheaders test (John Newbery)
b0bfa23 [tests] Make wait_until timeout 60 seconds by default (John Newbery)

Tree-SHA512: ca68ad91a7cabb0673f230631a9f2196a4a394cf7cea7a266b3dad3923f7887d2a192ceedd68f7a4a06d105a7d13870e75e971193b93476f8d72b34639d7c3d1
2018-12-31 09:38:08 +01:00
Alexander Block
82745dd076
Use DIP3 MNs in auto-IX tests (#2588)
* Speed up autoix-mempool tests by making the max mempool smaller

With this less TXs have to be created to fill up the mempool.

* Change DashTestFramework to use DIP3 MNs

* Don't assert disabled bip9 in p2p-autoinstantsend.py
2018-12-31 08:12:36 +01:00
Alexander Block
ce5a511349 Speed up stopping of nodes in tests by splitting up stop and wait (#2587)
Especially speed up MN based tests which currently spend multiple seconds
waiting for nodes to stop.
2018-12-28 19:14:27 +03:00
Alexander Block
0c9fb69687 Harden spork15 on testnet (#2586)
* Replace IsDeterministicMNsSporkActive with IsDIP3Active

IsDIP3Active will now use a fixed parameter from consensus params.
Values for DIP0003Height/DIP0003Hash need to be updated when spork15
activates on mainnet.

Also enforce correct block hash on testnet/mainnet for DIP3 activation
block.

* Remove SPORK_15_DETERMINISTIC_MNS_ENABLED

* Replace all uses of IsDeterministicMNsSporkActive with IsDIP3Active

* Remove DIP3 upgrade-path tests and directly start with DIP3 enabled tests

* Make -masternodeprivkey non-mandatory

This code will vanish later.
2018-12-28 19:13:44 +03:00
UdjinM6
0dce846d5a
Add an option to use specific address as a source of funds in protx rpc commands (otherwise use payoutAddress/operatorPayoutAddress) (#2581)
* Add an option to use specific address as a source of funds in protx rpc commands

* fix typo "must"

* Always use payoutAddress (or operatorPayoutAddress) as a default if no fundAddress was specified

* make sure we actually selected some inputs

* fundAddress -> feeSourceAddress

* Align help text with new logic

* fix protx_update_service

* fix protx_revoke

* Add fRequireAllInputs to CCoinControl and use it in FundSpecialTx

This avoids adding all inputs even though they are not needed.

* Allow to specify empty operator payout address and simplify fee code in update_service

DIP3 tests were failing to call "protx update_service" as it did not accept
an empty "operatorPayoutAddress".

This also simplifies handling of the feeSourceAddr.

* Specify source for funds and fees in DIP3 tests
2018-12-28 12:24:48 +03:00
UdjinM6
378dadd0f7 Ensure EvoDB consistency for quorum commitments by storing the best block hash (#2537)
* Ensure EvoDB consistency by storing the best block hash

This approach is similar to the one used for chainstate currently.
Ensures that:
- nodes that upgraded after DIP3 has all the data processed correctly (they will crash and require reindex);
- evodb/ is removed when blocks/ is removed (otherwise sync will fail due to duplicate records).

* Implement CEvoDB::VerifyBestBlock/WriteBestBlock and call them from ConnectBlock/DisconnectBlock

* Fix walletbackup.py
2018-12-13 09:11:50 +01:00
Alexander Block
d9b28fe1ad
Introduce dummy (ping-like) contributions for the dummy DKG (#2542)
* Implement creation and propagation of dummy contributions

These act as a ping which is broadcast a few blocks before the dummy
commitments are created. They are meant to determine online/offline members.

* Use information about received dummy contributions to determine validMembers

* Fix PoSe tests

* Fix dummy DKG phase progress in PoSe tests and give tests more time

Mine one block at a time until we reach the mining phase.
2018-12-10 06:04:33 +01:00
Alexander Block
d94092b60b
Fix spork propagation while in IBD and fix spork integration tests (#2533)
* Fix spork syncing issue in sporks tests

https://github.com/dashpay/dash/pull/2522 caused an issue with sporks syncing
in tests. The introduced time check in CMasternodeSync::ProcessTick causes
masternode sync to never start when mocktime is enabled, so this commit
disables mocktime for sporks.py.

Disabling mocktime however leads to fInitialDownload never becoming false
in CMasternodeSync::UpdatedBlockTip, so mnsync is never started. To fix
this, the tests now create a block before connecting the last node.

This however doesn't work because node1 will ignore the "getheaders" request
from node2 as it has not finished mnsync yet...so we also have to force
finish mnsync for node1.

* Also respond with getdata for announced sporks while in IBD

There was never a good reason to ignore spork announcements while in IBD.
At the same time, this poses the risk of missing out on sporks while in IBD.
This also fixes an issue in sporks testing, as nodes did not request for
announced sporks.

* Use wait_to_sync instead of custom loop
2018-12-06 14:43:36 +01:00
Alexander Block
a4f5ba38b6
Implement CDummyDKG and CDummyCommitment until we have the real DKG merged (#2492)
* Add SPORK_17_QUORUM_DKG_ENABLED spork

* Implement CDummyDKG and CDummyCommitment until we have the real DKG merged

This is only used on testnet/devnet/regtest and will NEVER be used on
mainnet. It is NOT SECURE AT ALL!

See comment in quorums_dummydkg.h for more details.

* Test simple PoSe in DIP3 tests

* Generate 2 instead of 4 blocks per iteration in PoSe tests

4 was based on old chainparams where I used larger phases.

* Only sleep when necessary in PoSe tests

* Fix typo in comment

* Give PoSe tests more time and sync after fast-forward
2018-11-26 16:53:20 +01:00
Alexander Block
c248c48e4d
Try to fix a few sporadic instant send failures in DIP3 tests (#2500)
* Sleep in wait_for_instant_lock when TX is not known yet

We'll otherwise stress the CPU quite a lot, which might in turn result in
instant send timeouts.

* Wait for all nodes to have the instant send lock

Otherwise individual nodes might end up not being able to catch up,
especially when it's the last iteration and we generate 6 blocks after it.

* Use getrawtransaction in wait_for_instant_lock instead of gettransaction

gettransaction fails if the TX is not owned by the wallet

* Give instant send tests more time after DIP3 activation

Signature verification changes to BLS when DIP3 gets activated, which is
much more resource hungry. Give instant send tests more time after DIP3
activation until we do proper batched verification of instant send
signatures.
2018-11-26 16:22:54 +01:00
Alexander Block
7a709b81d8 Perform less instant send tests in DIP3 tests (#2499)
These take quite some time on Travis.
2018-11-26 16:23:46 +03:00
Alexander Block
245c3220e9
Sync blocks before creating TXs (#2496) 2018-11-26 13:40:36 +01:00