Commit Graph

709 Commits

Author SHA1 Message Date
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
Alexander Block
f5beeafa14
Also restart MNs which didn't have the collateral moved, but do it later (#2483) 2018-11-23 16:45:56 +01:00
Alexander Block
22b5952c5a
Implement and enforce DIP6 commitments (#2477)
* Add LLMQ parameters to consensus params

* Add DIP6 quorum commitment special TX

* Implement CQuorumBlockProcessor which validates and handles commitments

* Add quorum commitments to new blocks

* Propagate QFCOMMITMENT messages to all nodes

* Allow special transactions in blocks which have no inputs/outputs

But only for TRANSACTION_QUORUM_COMMITMENT for now.

* Add quorum commitments to self-crafted blocks in DIP3 tests

* Add simple fork logic for current testnet

This should avoid a fork on the current testnet. It only applies to the
current chain which activated DIP3 at height 264000 and block
00000048e6e71d4bd90e7c456dcb94683ae832fcad13e1760d8283f7e89f332f.

When we revert the chain to retest the DIP3 deployment, this fork logic
can be removed again.

* Use quorumVvecHash instead of quorumHash to make null commitments unique

Implementation of https://github.com/dashpay/dips/pull/31

* Re-add quorum commitments after pruning mempool selected blocks

* Refactor CQuorumBlockProcessor::ProcessBlock to have less nested if/else statements

Also add BEGIN/END markers for temporary code.

* Add comments/documentation to LLMQParams

* Move code which determines if a commitment is required into IsCommitmentRequired

This should make the code easier to read and also removes some duplication.

The also changes the error types that are possible from 3 to 2 now. Instead
of having "bad-qc-already-mined" and "bad-qc-not-mining-phase", there is
only "bad-qc-not-allowed" now.

* Use new parameter from consensus parames for the temporary fork
2018-11-23 15:42:09 +01:00
Alexander Block
5ffc31bce4
Forbid version=0 in special TXs (#2473) 2018-11-22 06:05:32 +01:00
Alexander Block
c60687fe61 Sleep longer between attempts in sync_blocks 2018-11-15 15:25:04 +01:00
Alexander Block
91af72b18f Allow to specify how log to sleep between attempts in wait_until 2018-11-15 09:44:37 +01:00
Alexander Block
3c99d9e358 Fix test_fail_create_protx in DIP3 tests
This slipped through in a previous pull request and makes tests fail.
2018-11-15 08:06:52 +01:00
Alexander Block
4de70f0ace Test P2SH/multisig payee addresses in DIP3 tests 2018-11-15 08:06:21 +01:00
Alexander Block
f4ec3db067
Merge pull request #2442 from UdjinM6/spectx
Various fixes for special txes
2018-11-15 05:18:44 +01:00
Alexander Block
7c1f110893
Revert #2441 and retry fixing (#2444)
* Revert "Restart MNs in DIP3 tests even if collateral has not moved (#2441)"

This reverts commit 153afb9062.

* Reuse old legacy MN key when upgrading to protx
2018-11-14 18:40:31 +01:00
UdjinM6
658b7afd18 Make error messages re payload a bit more specific 2018-11-14 16:57:41 +03:00
Alexander Block
153afb9062 Restart MNs in DIP3 tests even if collateral has not moved (#2441)
These need to be restarted even in this case as keys are cycled when
upgrade_mn_protx is called. This resulted in invalid IX votes but was not
noticed because only 2 MNs were affected (still 8 of 10 votes succesful)
2018-11-13 15:24:30 +03:00
Alexander Block
c27e62935f
Allow reusing of external collaterals in DIP3 (#2427)
* Allow to reuse collaterals and addresses in ProRegTx

This also requires to move out the duplication check from CheckService to
the 2 individual ProTx check methods.

* Implement replacement logic for reused collaterals

* Add tests for new replacement logic
2018-11-10 10:54:16 +01:00
UdjinM6
bea590958b
Fix auto-IS tests (#2414)
* no `-debug` by default (it's too heavy)

* drop useless `sync_masternodes` calls and add a couple where they could be actually usefull

* change autoix-mempool.py test logic:
1. use separate nodes to send test txes
2. sync nodes while filling the mempool
2018-11-05 12:28:04 +03:00
Alexander Block
9da9d575aa Allow collaterals for non-DIP3 MNs which were created after DIP3/BIP9 activation (#2412)
* Remove reference to now removed "protocolVersion"

* Allow to use non-DIP3 collaterals after DIP3 activation

This removes a rule which only made sense when we assumed all collaterals
would remain in DIP3 ProRegTx transactions after DIP3 activation.

As we allow to refer external collaterals now, this rule should vanish as
well.

* Sleep in case block time is ahead of real time

See comment. This was not a problem before as we had enough time passed
between the last block that caused this and the start-alias call.
Now we added another start-alias call which is directly after we generated
many blocks.
2018-11-04 14:55:50 +03:00
UdjinM6
51addf9a03
Fix p2p-instantsend.py test (#2408) 2018-11-02 00:58:57 +03:00
Alexander Block
30a2b283a8 Sign ProRegTx collaterals with a string message instead of payload hash, split protx register into prepare/submit (#2395) 2018-11-02 00:57:10 +03:00
Alexander Block
28a6007a40 Prepare DIP3 for testnet and reuse DIP3 deployment for autoix deployment (#2389)
* Add BIP9 parameters for DIP3 deployment on testnet

* Remove autoix BIP9 deployment and reuse DIP3 deployment

* Add BIP9CheckMasternodesUpgraded to chain params

This controls if miners should check for upgraded masternodes first before
adding BIP9 bits to the block version. This only makes sense in network
where masternodes are up and running before BIP9 activation, which is not
necessarely the case in regtest and devnet.

Also refactor ComputeBlockVersion to use fCheckMasternodesUpgraded instead
of the inverse fAssumeMasternodeIsUpgraded. It is set to false by default
and only set to true in CreateNewBlock.

* Check for upgraded masternodes for DIP3 activation (only mainnet and testnet)

* Bump PROTOCOL_VERSION and DMN_PROTO_VERSION

We probably have nodes with 70211 already running on testnet.
2018-10-26 19:42:52 +03:00
Alexander Block
8f9b004cab Support "fast" mode when calling sync_masternodes (#2383)
This will call "mnsync next" multiple times to force finishing of mnsync.
Also reduce sleep time to 200ms.
2018-10-26 19:41:40 +03:00
UdjinM6
0692de1c58 Fix prepare_masternodes/create_masternodes in DashTestFramework (#2382)
Specify masternodeblsprivkey which is required in masternode mode now.
This should fix IS test failures which occur because of `Warning: You should specify a masternodeblsprivkey in the configuration. Please see documentation for help.` init error (there are other issues, so auto-IS test are still going to fail).
2018-10-26 07:03:48 +02:00
Alexander Block
e3df910822 Allow referencing other TX outputs for ProRegTx collateral (#2366)
* Pass CCoinsView reference to special TX handling methods

* Allow referencing other TX outputs for ProRegTx collateral

* Remove "collateralAmount" from "protx register"

* Rename "protx register" to "protx fund_register"

* Remove UpdateSpork15Value from CDeterministicMNManager

Was not used/implemented anymore

* Lock masternode collaterals after chain/DIP3 is fully initialized

Otherwise detection of collaterals does not work.

* Implement new "protx register" RPC which uses existing collaterals

* Remove "masternode info" RPC

It is not consistent with other "masternode" RPCs anymore as it requires
the ProRegTx hash while all other RPCs work with the collateral.

* Load sporks from disk cache before initializing the chain

Otherwise spork15 is not loaded when we check it for the first time.

* Implement "protx info" RPC

* Use "protx info" instead of "masternode info" in DIP3 tests

* Test external collaterals for ProTx

* Handle review comments

* Don't pass CCoinView reference when it's not used

* Revert "Pass CCoinsView reference to special TX handling methods"

This reverts commit 28688724e1.

* Use GetUTXOCoin instead of now removed coinsView

Also remove collateral height check as GetUTXOCoin only returns confirmed
coins.

* Add conflict handling for external collaterals to mempool

* Handle review comments (squashed Github suggestions)

Co-Authored-By: codablock <ablock84@gmail.com>
2018-10-25 17:29:50 +03:00
Alexander Block
eaa856eb78 Remove nProtocolVersion and add mode/type fields to DIP3 (#2358)
* Remove nProtocolVersion fields from deterministic masternode lists

This field was part of my initial implementation from DIP3. One of the last
changes of DIP3 was then to remove this field, which I did not bring back
into code yet. This commit removes it now.

We use PROTOCOL_VERSION now in cases were compatibility in the the pre-DIP3
list is needed.

* Add type and mode fields in DIP3 special TXs

These were added to DIP3 but not in-code yet.

* Add DMN_PROTO_VERSION
2018-10-23 14:15:38 +03:00