mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
b07a7b810c
* Merge #11796: [tests] Functional test naming convention5fecd84
[tests] Remove redundant import in blocktools.py test (Anthony Towns)9b20bb4
[tests] Check tests conform to naming convention (Anthony Towns)7250b4e
[tests] README.md nit fixes (Anthony Towns)82b2712
[tests] move witness util functions to blocktools.py (John Newbery)1e10854
[tests] [docs] update README for new test naming scheme (John Newbery) Pull request description: Splitting #11774 into two parts -- this part updates the README with the proposed naming convention, and adds some checks to test_runner.py that the number of tests violating the naming convention doesn't increase too much. Idea is this part of the change should not introduce merge conflicts or require much rebasing, so reviews of the complicated bits won't become invalidated too often; while the second part will just be file renames, which will require regular rebasing and will introduce merge conflicts with pending PRs, but can be merged later, and should also be much easier to review, since it will only include relatively trivial changes. Tree-SHA512: b96557d41714addbbfe2aed62fb5a48639eaeb1eb3aba30ac1b3a86bb3cb8d796c6247f9c414c4695c4bf54c0ec9968ac88e2f88fb62483bc1a2f89368f7fc80 * update violation count Signed-off-by: pasta <pasta@dashboost.org> * Merge #11774: [tests] Rename functional tests6f881cc880
[tests] Remove EXPECTED_VIOLATION_COUNT (Anthony Towns)3150b3fea7
[tests] Rename misc functional tests. (Anthony Towns)81b79f2c39
[tests] Rename rpc_* functional tests. (Anthony Towns)61b8f7f273
[tests] Rename p2p_* functional tests. (Anthony Towns)90600bc7db
[tests] Rename wallet_* functional tests. (Anthony Towns)ca6523d0c8
[tests] Rename feature_* functional tests. (Anthony Towns) Pull request description: This PR changes the functional tests to have a consistent naming scheme: tests for individual RPC methods are named rpc_... tests for interfaces (REST, ZMQ, RPC features) are named interface_... tests that explicitly test the p2p interface are named p2p_... tests for wallet features are named wallet_... tests for mining features are named mining_... tests for mempool behaviour are named mempool_... tests for full features that aren't wallet/mining/mempool are named feature_... Rationale: it's sometimes difficult for new contributors to know what's already covered by existing tests and where new tests should be added. Naming in a consistent fashion makes it easier to see what's already covered at a glance. Tree-SHA512: 4246790552d42bbd95f6d5bdf67702b81b3b2c583ce7eaf1fe6d8e254721279b47315973c6e9ae82dad6e4c747f12188160764bf2624c0f8f3b4d39330ec8b16 * rename tests and edit associated strings to align test-suite with test name standards Signed-off-by: pasta <pasta@dashboost.org> * fix grammar in test/functional/test_runner.py Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com> * ci: Fix excluded test names * rename feature_privatesend.py to rpc_privatesend.py Signed-off-by: pasta <pasta@dashboost.org> Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com> Co-authored-by: MarcoFalke <falke.marco@gmail.com> Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com> Co-authored-by: xdustinface <xdustinfacex@gmail.com>
132 lines
6.1 KiB
Python
Executable File
132 lines
6.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2018-2020 The Dash Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
import time
|
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
from test_framework.util import connect_nodes, wait_until
|
|
|
|
'''
|
|
feature_multikeysporks.py
|
|
|
|
Test logic for several signer keys usage for spork broadcast.
|
|
|
|
We set 5 possible keys for sporks signing and set minimum
|
|
required signers to 3. We check 1 and 2 signers can't set the spork
|
|
value, any 3 signers can change spork value and other 3 signers
|
|
can change it again.
|
|
'''
|
|
|
|
|
|
class MultiKeySporkTest(BitcoinTestFramework):
|
|
def set_test_params(self):
|
|
self.num_nodes = 5
|
|
self.setup_clean_chain = True
|
|
self.is_network_split = False
|
|
|
|
def setup_network(self):
|
|
# secret(base58): 931wyuRNVYvhg18Uu9bky5Qg1z4QbxaJ7fefNBzjBPiLRqcd33F
|
|
# keyid(hex): 60f0f57f71f0081f1aacdd8432340a33a526f91b
|
|
# address(base58): yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa
|
|
|
|
# secret(base58): 91vbXGMSWKGHom62986XtL1q2mQDA12ngcuUNNe5NfMSj44j7g3
|
|
# keyid(hex): 43dff2b09de2f904f688ec14ee6899087b889ad0
|
|
# address(base58): yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h
|
|
|
|
# secret(base58): 92bxUjPT5AhgXuXJwfGGXqhomY2SdQ55MYjXyx9DZNxCABCSsRH
|
|
# keyid(hex): d9aa5fa00cce99101a4044e65dc544d1579890de
|
|
# address(base58): ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7
|
|
|
|
# secret(base58): 934yPXiVGf4RCY2qTs2Bt5k3TEtAiAg12sMxCt8yVWbSU7p3fuD
|
|
# keyid(hex): 0b23935ce0bea3b997a334f6fa276c9fa17687b2
|
|
# address(base58): ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn
|
|
|
|
# secret(base58): 92Cxwia363Wg2qGF1fE5z4GKi8u7r1nrWQXdtsj2ACZqaDPSihD
|
|
# keyid(hex): 1d1098b2b1f759b678a0a7a098637a9b898adcac
|
|
# address(base58): yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui
|
|
|
|
self.add_nodes(5)
|
|
|
|
self.start_node(0, ["-sporkkey=931wyuRNVYvhg18Uu9bky5Qg1z4QbxaJ7fefNBzjBPiLRqcd33F",
|
|
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
|
|
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
|
|
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
|
|
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
|
|
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
|
|
"-minsporkkeys=3"])
|
|
self.start_node(1, ["-sporkkey=91vbXGMSWKGHom62986XtL1q2mQDA12ngcuUNNe5NfMSj44j7g3",
|
|
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
|
|
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
|
|
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
|
|
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
|
|
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
|
|
"-minsporkkeys=3"])
|
|
self.start_node(2, ["-sporkkey=92bxUjPT5AhgXuXJwfGGXqhomY2SdQ55MYjXyx9DZNxCABCSsRH",
|
|
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
|
|
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
|
|
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
|
|
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
|
|
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
|
|
"-minsporkkeys=3"])
|
|
self.start_node(3, ["-sporkkey=934yPXiVGf4RCY2qTs2Bt5k3TEtAiAg12sMxCt8yVWbSU7p3fuD",
|
|
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
|
|
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
|
|
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
|
|
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
|
|
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
|
|
"-minsporkkeys=3"])
|
|
self.start_node(4, ["-sporkkey=92Cxwia363Wg2qGF1fE5z4GKi8u7r1nrWQXdtsj2ACZqaDPSihD",
|
|
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
|
|
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
|
|
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
|
|
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
|
|
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
|
|
"-minsporkkeys=3"])
|
|
# connect nodes at start
|
|
for i in range(0, 5):
|
|
for j in range(i, 5):
|
|
connect_nodes(self.nodes[i], j)
|
|
|
|
def get_test_spork_value(self, node):
|
|
info = node.spork('show')
|
|
# use InstantSend spork for tests
|
|
return info['SPORK_2_INSTANTSEND_ENABLED']
|
|
|
|
def set_test_spork_value(self, node, value):
|
|
# use InstantSend spork for tests
|
|
node.spork('SPORK_2_INSTANTSEND_ENABLED', value)
|
|
|
|
def run_test(self):
|
|
# check test spork default state
|
|
for node in self.nodes:
|
|
assert(self.get_test_spork_value(node) == 4070908800)
|
|
|
|
self.bump_mocktime(1)
|
|
# first and second signers set spork value
|
|
self.set_test_spork_value(self.nodes[0], 1)
|
|
self.set_test_spork_value(self.nodes[1], 1)
|
|
# spork change requires at least 3 signers
|
|
time.sleep(10)
|
|
for node in self.nodes:
|
|
assert(self.get_test_spork_value(node) != 1)
|
|
|
|
# third signer set spork value
|
|
self.set_test_spork_value(self.nodes[2], 1)
|
|
# now spork state is changed
|
|
for node in self.nodes:
|
|
wait_until(lambda: self.get_test_spork_value(node) == 1, sleep=0.1, timeout=10)
|
|
|
|
self.bump_mocktime(1)
|
|
# now set the spork again with other signers to test
|
|
# old and new spork messages interaction
|
|
self.set_test_spork_value(self.nodes[2], 2)
|
|
self.set_test_spork_value(self.nodes[3], 2)
|
|
self.set_test_spork_value(self.nodes[4], 2)
|
|
for node in self.nodes:
|
|
wait_until(lambda: self.get_test_spork_value(node) == 2, sleep=0.1, timeout=10)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
MultiKeySporkTest().main()
|