Skip to content

Commit 2bafadf

Browse files
committed
feat: put DIP0024 activation to block 1 on RegTest
1 parent 632c4c4 commit 2bafadf

File tree

7 files changed

+41
-40
lines changed

7 files changed

+41
-40
lines changed

src/chainparams.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ class CRegTestParams : public CChainParams {
794794
consensus.DIP0008Height = 1; // Always active unless overridden
795795
consensus.BRRHeight = 1; // Always active unless overridden
796796
consensus.DIP0020Height = 1; // Always active unless overridden
797-
consensus.DIP0024QuorumsHeight = 900;
797+
consensus.DIP0024QuorumsHeight = 1; // Always have dip0024 quorums unless overridden
798798
consensus.V19Height = 900;
799799
consensus.V20Height = 900;
800800
consensus.MN_RRHeight = 900;
@@ -1025,6 +1025,8 @@ static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& conse
10251025
consensus.DIP0001Height = int{height};
10261026
} else if (name == "dip0008") {
10271027
consensus.DIP0008Height = int{height};
1028+
} else if (name == "dip0024") {
1029+
consensus.DIP0024QuorumsHeight = int{height};
10281030
} else if (name == "v20") {
10291031
consensus.V20Height = int{height};
10301032
} else if (name == "mn_rr") {

src/chainparamsbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
2020
argsman.AddArg("-budgetparams=<masternode>:<budget>:<superblock>", "Override masternode, budget and superblock start heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
2121
argsman.AddArg("-devnet=<name>", "Use devnet chain with provided name", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2222
argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
23-
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, brr, dip0001, dip0008, v20, mn_rr). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
23+
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, brr, dip0001, dip0008, dip0024, v20, mn_rr). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
2424
argsman.AddArg("-highsubsidyblocks=<n>", "The number of blocks with a higher than normal subsidy to mine at the start of a chain. Block after that height will have fixed subsidy base. (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2525
argsman.AddArg("-highsubsidyfactor=<n>", "The factor to multiply the normal block subsidy by while in the highsubsidyblocks window of a chain (default: 1, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
2626
argsman.AddArg("-llmqchainlocks=<quorum name>", "Override the default LLMQ type used for ChainLocks. Allows using ChainLocks with smaller LLMQs. (default: llmq_devnet, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);

src/test/util/setup_common.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,9 @@ TestChainSetup::TestChainSetup(int num_blocks, const std::vector<const char*>& e
354354
/* TestChainDIP3BeforeActivationSetup */
355355
{ 430, uint256S("0x0bcefaa33fec56cd84d05d0e76cd6a78badcc20f627d91903646de6a07930a14") },
356356
/* TestChainBRRBeforeActivationSetup */
357-
{ 497, uint256S("0x23c31820ec5160b7181bfdf328e2b76cd12c9fa4544d892b7f01e74dd6220849") },
357+
{ 497, uint256S("0x3c71d807d28b9b813434eb0679ec3d5bcf424c20088cf578f3757521c3e3eded") },
358358
/* TestChainV19BeforeActivationSetup */
359-
{ 894, uint256S("0x2885cf0fe8fdf29803b6c65002ba2570ff011531d8ea92be312a85d655e00c51") },
359+
{ 894, uint256S("0x3f031e5cceade15bdfa559ddecb2ccb2b8d17083bdfd871a9d23b17d04b15292") },
360360
}
361361
};
362362

test/functional/feature_dip4_coinbasemerkleroots.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from test_framework.util import assert_equal
1919

2020
DIP0008_HEIGHT = 432
21+
DIP0024_HEIGHT = 900
2122

2223
# TODO: this helper used in many tests, find a new home for it
2324
class TestP2PConn(P2PInterface):
@@ -43,7 +44,7 @@ def getmnlistdiff(self, baseBlockHash, blockHash):
4344

4445
class LLMQCoinbaseCommitmentsTest(DashTestFramework):
4546
def set_test_params(self):
46-
self.extra_args = [[ f'-testactivationheight=dip0008@{DIP0008_HEIGHT}', "-vbparams=testdummy:999999999999:999999999999" ]] * 4
47+
self.extra_args = [[ f'-testactivationheight=dip0008@{DIP0008_HEIGHT}', f'-testactivationheight=dip0024@{DIP0024_HEIGHT}', "-vbparams=testdummy:999999999999:999999999999" ]] * 4
4748
self.set_dash_test_params(4, 3, extra_args = self.extra_args)
4849

4950
def remove_masternode(self, idx):

test/functional/feature_llmq_rotation.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,9 @@ def run_test(self):
8181
h_0 = self.mine_quorum()
8282
h_100_0 = QuorumId(100, int(h_0, 16))
8383
h_106_0 = QuorumId(106, int(h_0, 16))
84-
h_104_0 = QuorumId(104, int(h_0, 16))
8584
h_1 = self.mine_quorum()
8685
h_100_1 = QuorumId(100, int(h_1, 16))
8786
h_106_1 = QuorumId(106, int(h_1, 16))
88-
h_104_1 = QuorumId(104, int(h_1, 16))
8987

9088
self.log.info("Mine single block, wait for chainlock")
9189
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
@@ -103,10 +101,10 @@ def run_test(self):
103101
assert_equal(dkg_info['active_dkgs'], 0)
104102
nonzero_dkgs += dkg_info['active_dkgs']
105103
assert_equal(dkg_info['next_dkg'], next_dkg)
106-
assert_equal(nonzero_dkgs, 11) # 2 quorums 4 nodes each and 1 quorum of 3 nodes
104+
assert_equal(nonzero_dkgs, 7) # 1 quorums 4 nodes and 1 quorum of 3 nodes
107105

108106
expectedDeleted = []
109-
expectedNew = [h_100_0, h_106_0, h_104_0, h_100_1, h_106_1, h_104_1]
107+
expectedNew = [h_100_0, h_106_0, h_100_1, h_106_1]
110108
quorumList = self.test_getmnlistdiff_quorums(b_h_0, b_h_1, {}, expectedDeleted, expectedNew, testQuorumsCLSigs=False)
111109

112110
projected_activation_height = 900
@@ -363,7 +361,6 @@ def get_llmq_size(self, llmq_type):
363361
100: 4, # In this test size for llmqType 100 is overwritten to 4
364362
102: 3,
365363
103: 4,
366-
104: 4, # In this test size for llmqType 104 is overwritten to 4
367364
106: 3
368365
}.get(llmq_type, -1)
369366

test/functional/feature_llmq_signing.py

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from test_framework.util import assert_equal, assert_raises_rpc_error, force_finish_mnsync
1717

1818

19+
q_type=100
1920
class LLMQSigningTest(DashTestFramework):
2021
def set_test_params(self):
2122
self.set_dash_test_params(6, 5)
@@ -43,11 +44,11 @@ def run_test(self):
4344

4445
def check_sigs(hasrecsigs, isconflicting1, isconflicting2):
4546
for mn in self.mninfo:
46-
if mn.node.quorum("hasrecsig", 104, id, msgHash) != hasrecsigs:
47+
if mn.node.quorum("hasrecsig", q_type, id, msgHash) != hasrecsigs:
4748
return False
48-
if mn.node.quorum("isconflicting", 104, id, msgHash) != isconflicting1:
49+
if mn.node.quorum("isconflicting", q_type, id, msgHash) != isconflicting1:
4950
return False
50-
if mn.node.quorum("isconflicting", 104, id, msgHashConflict) != isconflicting2:
51+
if mn.node.quorum("isconflicting", q_type, id, msgHashConflict) != isconflicting2:
5152
return False
5253
return True
5354

@@ -61,24 +62,24 @@ def assert_sigs_nochange(hasrecsigs, isconflicting1, isconflicting2, timeout):
6162
wait_for_sigs(False, False, False, 1)
6263

6364
# Sign first share without any optional parameter, should not result in recovered sig
64-
self.mninfo[0].node.quorum("sign", 104, id, msgHash)
65+
self.mninfo[0].node.quorum("sign", q_type, id, msgHash)
6566
assert_sigs_nochange(False, False, False, 3)
6667
# Sign second share and test optional quorumHash parameter, should not result in recovered sig
6768
# 1. Providing an invalid quorum hash should fail and cause no changes for sigs
68-
assert not self.mninfo[1].node.quorum("sign", 104, id, msgHash, msgHash)
69+
assert not self.mninfo[1].node.quorum("sign", q_type, id, msgHash, msgHash)
6970
assert_sigs_nochange(False, False, False, 3)
7071
# 2. Providing a valid quorum hash should succeed and cause no changes for sigss
71-
quorumHash = self.mninfo[1].node.quorum("selectquorum", 104, id)["quorumHash"]
72-
assert self.mninfo[1].node.quorum("sign", 104, id, msgHash, quorumHash)
72+
quorumHash = self.mninfo[1].node.quorum("selectquorum", q_type, id)["quorumHash"]
73+
assert self.mninfo[1].node.quorum("sign", q_type, id, msgHash, quorumHash)
7374
assert_sigs_nochange(False, False, False, 3)
7475
# Sign third share and test optional submit parameter if spork21 is enabled, should result in recovered sig
7576
# and conflict for msgHashConflict
7677
if self.options.spork21:
7778
# 1. Providing an invalid quorum hash and set submit=false, should throw an error
78-
assert_raises_rpc_error(-8, 'quorum not found', self.mninfo[2].node.quorum, "sign", 104, id, msgHash, id, False)
79+
assert_raises_rpc_error(-8, 'quorum not found', self.mninfo[2].node.quorum, "sign", q_type, id, msgHash, id, False)
7980
# 2. Providing a valid quorum hash and set submit=false, should return a valid sigShare object
80-
sig_share_rpc_1 = self.mninfo[2].node.quorum("sign", 104, id, msgHash, quorumHash, False)
81-
sig_share_rpc_2 = self.mninfo[2].node.quorum("sign", 104, id, msgHash, "", False)
81+
sig_share_rpc_1 = self.mninfo[2].node.quorum("sign", q_type, id, msgHash, quorumHash, False)
82+
sig_share_rpc_2 = self.mninfo[2].node.quorum("sign", q_type, id, msgHash, "", False)
8283
assert_equal(sig_share_rpc_1, sig_share_rpc_2)
8384
assert_sigs_nochange(False, False, False, 3)
8485
# 3. Sending the sig share received from RPC to the recovery member through P2P interface, should result
@@ -93,15 +94,15 @@ def assert_sigs_nochange(hasrecsigs, isconflicting1, isconflicting2, timeout):
9394
for mn in self.mninfo:
9495
assert mn.node.getconnectioncount() == self.llmq_size
9596
# Get the current recovery member of the quorum
96-
q = self.nodes[0].quorum('selectquorum', 104, id)
97+
q = self.nodes[0].quorum('selectquorum', q_type, id)
9798
mn = self.get_mninfo(q['recoveryMembers'][0])
9899
# Open a P2P connection to it
99100
p2p_interface = mn.node.add_p2p_connection(P2PInterface())
100101
# Send the last required QSIGSHARE message to the recovery member
101102
p2p_interface.send_message(msg_qsigshare([sig_share]))
102103
else:
103104
# If spork21 is not enabled just sign regularly
104-
self.mninfo[2].node.quorum("sign", 104, id, msgHash)
105+
self.mninfo[2].node.quorum("sign", q_type, id, msgHash)
105106

106107
wait_for_sigs(True, False, True, 15)
107108

@@ -110,19 +111,19 @@ def assert_sigs_nochange(hasrecsigs, isconflicting1, isconflicting2, timeout):
110111

111112
# Test `quorum verify` rpc
112113
node = self.mninfo[0].node
113-
recsig = node.quorum("getrecsig", 104, id, msgHash)
114+
recsig = node.quorum("getrecsig", q_type, id, msgHash)
114115
# Find quorum automatically
115116
height = node.getblockcount()
116117
height_bad = node.getblockheader(recsig["quorumHash"])["height"]
117118
hash_bad = node.getblockhash(0)
118-
assert node.quorum("verify", 104, id, msgHash, recsig["sig"])
119-
assert node.quorum("verify", 104, id, msgHash, recsig["sig"], "", height)
120-
assert not node.quorum("verify", 104, id, msgHashConflict, recsig["sig"])
121-
assert not node.quorum("verify", 104, id, msgHash, recsig["sig"], "", height_bad)
119+
assert node.quorum("verify", q_type, id, msgHash, recsig["sig"])
120+
assert node.quorum("verify", q_type, id, msgHash, recsig["sig"], "", height)
121+
assert not node.quorum("verify", q_type, id, msgHashConflict, recsig["sig"])
122+
assert not node.quorum("verify", q_type, id, msgHash, recsig["sig"], "", height_bad)
122123
# Use specific quorum
123-
assert node.quorum("verify", 104, id, msgHash, recsig["sig"], recsig["quorumHash"])
124-
assert not node.quorum("verify", 104, id, msgHashConflict, recsig["sig"], recsig["quorumHash"])
125-
assert_raises_rpc_error(-8, "quorum not found", node.quorum, "verify", 104, id, msgHash, recsig["sig"], hash_bad)
124+
assert node.quorum("verify", q_type, id, msgHash, recsig["sig"], recsig["quorumHash"])
125+
assert not node.quorum("verify", q_type, id, msgHashConflict, recsig["sig"], recsig["quorumHash"])
126+
assert_raises_rpc_error(-8, "quorum not found", node.quorum, "verify", q_type, id, msgHash, recsig["sig"], hash_bad)
126127

127128
# Mine one more quorum, so that we have 2 active ones, nothing should change
128129
self.mine_quorum()
@@ -131,23 +132,23 @@ def assert_sigs_nochange(hasrecsigs, isconflicting1, isconflicting2, timeout):
131132
# Create a recovered sig for the oldest quorum i.e. the active quorum which will be moved
132133
# out of the active set when a new quorum appears
133134
request_id = 2
134-
oldest_quorum_hash = node.quorum("list")["llmq_test_instantsend"][-1]
135+
oldest_quorum_hash = node.quorum("list")["llmq_test"][-1]
135136
# Search for a request id which selects the last active quorum
136137
while True:
137-
selected_hash = node.quorum('selectquorum', 104, uint256_to_string(request_id))["quorumHash"]
138+
selected_hash = node.quorum('selectquorum', q_type, uint256_to_string(request_id))["quorumHash"]
138139
if selected_hash == oldest_quorum_hash:
139140
break
140141
else:
141142
request_id += 1
142143
# Produce the recovered signature
143144
id = uint256_to_string(request_id)
144145
for mn in self.mninfo:
145-
mn.node.quorum("sign", 104, id, msgHash)
146+
mn.node.quorum("sign", q_type, id, msgHash)
146147
# And mine a quorum to move the quorum which signed out of the active set
147148
self.mine_quorum()
148149
# Verify the recovered sig. This triggers the "signHeight + dkgInterval" verification
149-
recsig = node.quorum("getrecsig", 104, id, msgHash)
150-
assert node.quorum("verify", 104, id, msgHash, recsig["sig"], "", node.getblockcount())
150+
recsig = node.quorum("getrecsig", q_type, id, msgHash)
151+
assert node.quorum("verify", q_type, id, msgHash, recsig["sig"], "", node.getblockcount())
151152

152153
recsig_time = self.mocktime
153154

@@ -166,21 +167,21 @@ def assert_sigs_nochange(hasrecsigs, isconflicting1, isconflicting2, timeout):
166167
wait_for_sigs(False, False, False, 15)
167168

168169
for i in range(2):
169-
self.mninfo[i].node.quorum("sign", 104, id, msgHashConflict)
170+
self.mninfo[i].node.quorum("sign", q_type, id, msgHashConflict)
170171
for i in range(2, 5):
171-
self.mninfo[i].node.quorum("sign", 104, id, msgHash)
172+
self.mninfo[i].node.quorum("sign", q_type, id, msgHash)
172173
wait_for_sigs(True, False, True, 15)
173174

174175
if self.options.spork21:
175176
id = uint256_to_string(request_id + 1)
176177

177178
# Isolate the node that is responsible for the recovery of a signature and assert that recovery fails
178-
q = self.nodes[0].quorum('selectquorum', 104, id)
179+
q = self.nodes[0].quorum('selectquorum', q_type, id)
179180
mn = self.get_mninfo(q['recoveryMembers'][0])
180181
mn.node.setnetworkactive(False)
181182
self.wait_until(lambda: mn.node.getconnectioncount() == 0)
182183
for i in range(4):
183-
self.mninfo[i].node.quorum("sign", 104, id, msgHash)
184+
self.mninfo[i].node.quorum("sign", q_type, id, msgHash)
184185
assert_sigs_nochange(False, False, False, 3)
185186
# Need to re-connect so that it later gets the recovered sig
186187
mn.node.setnetworkactive(True)

test/functional/rpc_blockchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _test_getblockchaininfo(self):
168168
'dip0003': { 'type': 'buried', 'active': False, 'height': 432},
169169
'dip0008': { 'type': 'buried', 'active': True, 'height': 1},
170170
'dip0020': { 'type': 'buried', 'active': True, 'height': 1},
171-
'dip0024': { 'type': 'buried', 'active': False, 'height': 900},
171+
'dip0024': { 'type': 'buried', 'active': True, 'height': 1},
172172
'realloc': { 'type': 'buried', 'active': True, 'height': 1},
173173
'v19': { 'type': 'buried', 'active': False, 'height': 900},
174174
'v20': { 'type': 'buried', 'active': False, 'height': 900},

0 commit comments

Comments
 (0)