From 08169de15290e16cdcd2f513371e998701044107 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Sun, 12 Jun 2022 15:06:34 +0530 Subject: [PATCH 1/2] rpc: split spork manipulation logic to distinct "sporkupdate" call Co-authored-by: UdjinM6 --- src/rpc/client.cpp | 2 +- src/rpc/misc.cpp | 142 +++++++++--------- .../feature_dip4_coinbasemerkleroots.py | 12 +- test/functional/feature_llmq_chainlocks.py | 6 +- test/functional/feature_llmq_connections.py | 6 +- test/functional/feature_llmq_data_recovery.py | 4 +- test/functional/feature_llmq_dkgerrors.py | 6 +- .../feature_llmq_is_cl_conflicts.py | 6 +- test/functional/feature_llmq_is_migration.py | 4 +- .../functional/feature_llmq_is_retroactive.py | 10 +- test/functional/feature_llmq_rotation.py | 6 +- test/functional/feature_llmq_signing.py | 4 +- test/functional/feature_llmq_simplepose.py | 8 +- test/functional/feature_multikeysporks.py | 12 +- test/functional/feature_sporks.py | 2 +- test/functional/interface_zmq_dash.py | 2 +- test/functional/p2p_instantsend.py | 2 +- test/functional/p2p_quorum_data.py | 4 +- test/functional/rpc_verifychainlock.py | 2 +- test/functional/rpc_verifyislock.py | 2 +- .../test_framework/test_framework.py | 6 +- 21 files changed, 127 insertions(+), 121 deletions(-) diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 4c19f57d9d7b..3f15c40ee0b2 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -164,7 +164,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { "getmempooldescendants", 1, "verbose" }, { "logging", 0, "include" }, { "logging", 1, "exclude" }, - { "spork", 1, "value" }, + { "sporkupdate", 1, "value" }, { "voteraw", 1, "tx_index" }, { "voteraw", 5, "time" }, { "getblockhashes", 0, "high"}, diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index a39415c78185..2b7ff4c1d1b9 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -120,80 +120,85 @@ static UniValue mnsync(const JSONRPCRequest& request) */ static UniValue spork(const JSONRPCRequest& request) { - if (request.params.size() == 1) { - // basic mode, show info - std:: string strCommand = request.params[0].get_str(); - if (strCommand == "show") { - UniValue ret(UniValue::VOBJ); - for (const auto& sporkDef : sporkDefs) { - ret.pushKV(std::string(sporkDef.name), sporkManager.GetSporkValue(sporkDef.sporkId)); - } - return ret; - } else if(strCommand == "active"){ - UniValue ret(UniValue::VOBJ); - for (const auto& sporkDef : sporkDefs) { - ret.pushKV(std::string(sporkDef.name), sporkManager.IsSporkActive(sporkDef.sporkId)); - } - return ret; + // default help, for basic mode + RPCHelpMan{"spork", + "\nShows information about current state of sporks\n", + { + {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "'show' to show all current spork values, 'active' to show which sporks are active"}, + }, + { + RPCResult{"For 'show'", + RPCResult::Type::OBJ_DYN, "", "keys are the sporks, and values indicates its value", + { + {RPCResult::Type::NUM, "SPORK_NAME", "The value of the specific spork with the name SPORK_NAME"}, + }}, + RPCResult{"For 'active'", + RPCResult::Type::OBJ_DYN, "", "keys are the sporks, and values indicates its status", + { + {RPCResult::Type::BOOL, "SPORK_NAME", "'true' for time-based sporks if spork is active and 'false' otherwise"}, + }}, + }, + RPCExamples { + HelpExampleCli("spork", "show") + + HelpExampleRpc("spork", "\"show\"") } + }.Check(request); + + // basic mode, show info + std:: string strCommand = request.params[0].get_str(); + if (strCommand == "show") { + UniValue ret(UniValue::VOBJ); + for (const auto& sporkDef : sporkDefs) { + ret.pushKV(std::string(sporkDef.name), sporkManager.GetSporkValue(sporkDef.sporkId)); + } + return ret; + } else if(strCommand == "active"){ + UniValue ret(UniValue::VOBJ); + for (const auto& sporkDef : sporkDefs) { + ret.pushKV(std::string(sporkDef.name), sporkManager.IsSporkActive(sporkDef.sporkId)); + } + return ret; } - if (request.fHelp || request.params.size() != 2) { - // default help, for basic mode - RPCHelpMan{"spork", - "\nShows information about current state of sporks\n", - { - {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "'show' to show all current spork values, 'active' to show which sporks are active"}, - }, - { - RPCResult{"For 'show'", - RPCResult::Type::OBJ_DYN, "", "keys are the sporks, and values indicates its value", - { - {RPCResult::Type::NUM, "SPORK_NAME", "The value of the specific spork with the name SPORK_NAME"}, - }}, - RPCResult{"For 'active'", - RPCResult::Type::OBJ_DYN, "", "keys are the sporks, and values indicates its status", - { - {RPCResult::Type::BOOL, "SPORK_NAME", "'true' for time-based sporks if spork is active and 'false' otherwise"}, - }}, - }, - RPCExamples { - HelpExampleCli("spork", "show") - + HelpExampleRpc("spork", "\"show\"") - }}.Check(request); - } else { - // advanced mode, update spork values - SporkId nSporkID = CSporkManager::GetSporkIDByName(request.params[0].get_str()); - if(nSporkID == SPORK_INVALID) - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid spork name"); + return NullUniValue; +} - NodeContext& node = EnsureNodeContext(request.context); - if (!node.connman) - throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); +static UniValue sporkupdate(const JSONRPCRequest& request) +{ + RPCHelpMan{"sporkupdate", + "\nUpdate the value of the specific spork. Requires \"-sporkkey\" to be set to sign the message.\n", + { + {"name", RPCArg::Type::STR, RPCArg::Optional::NO, "The name of the spork to update"}, + {"value", RPCArg::Type::NUM, RPCArg::Optional::NO, "The new desired value of the spork"}, + }, + RPCResult{ + RPCResult::Type::STR, "result", "\"success\" if spork value was updated or this help otherwise" + }, + RPCExamples{ + HelpExampleCli("sporkupdate", "SPORK_2_INSTANTSEND_ENABLED 4070908800") + + HelpExampleRpc("sporkupdate", "\"SPORK_2_INSTANTSEND_ENABLED\", 4070908800") + }, + }.Check(request); - // SPORK VALUE - int64_t nValue = request.params[1].get_int64(); + // advanced mode, update spork values + SporkId nSporkID = CSporkManager::GetSporkIDByName(request.params[0].get_str()); + if (nSporkID == SPORK_INVALID) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid spork name"); + } - //broadcast new spork - if(sporkManager.UpdateSpork(nSporkID, nValue, *node.connman)){ - return "success"; - } else { - RPCHelpMan{"spork", - "\nUpdate the value of the specific spork. Requires \"-sporkkey\" to be set to sign the message.\n", - { - {"name", RPCArg::Type::STR, RPCArg::Optional::NO, "The name of the spork to update"}, - {"value", RPCArg::Type::NUM, RPCArg::Optional::NO, "The new desired value of the spork"}, - }, - RPCResult{ - RPCResult::Type::STR, "result", "\"success\" if spork value was updated or this help otherwise" - }, - RPCExamples{ - HelpExampleCli("spork", "SPORK_2_INSTANTSEND_ENABLED 4070908800") - + HelpExampleRpc("spork", "\"SPORK_2_INSTANTSEND_ENABLED\", 4070908800") - }, - }.Check(request); - } + NodeContext& node = EnsureNodeContext(request.context); + if (!node.connman) { + throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); } + + // SPORK VALUE + int64_t nValue = request.params[1].get_int64(); + + // broadcast new spork + if (sporkManager.UpdateSpork(nSporkID, nValue, *node.connman)) { + return "success"; + } + return NullUniValue; } @@ -1317,7 +1322,8 @@ static const CRPCCommand commands[] = /* Dash features */ { "dash", "mnsync", &mnsync, {} }, - { "dash", "spork", &spork, {"arg0","value"} }, + { "dash", "spork", &spork, {"command"} }, + { "dash", "sporkupdate", &sporkupdate, {"name","value"} }, /* Not shown in help */ { "hidden", "setmocktime", &setmocktime, {"timestamp"}}, diff --git a/test/functional/feature_dip4_coinbasemerkleroots.py b/test/functional/feature_dip4_coinbasemerkleroots.py index 1f797f656c28..d942be8e5970 100755 --- a/test/functional/feature_dip4_coinbasemerkleroots.py +++ b/test/functional/feature_dip4_coinbasemerkleroots.py @@ -87,7 +87,7 @@ def run_test(self): self.nodes[0].generate(1) oldhash = self.nodes[0].getbestblockhash() # Have to disable ChainLocks here because they won't let you to invalidate already locked blocks - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) + self.nodes[0].sporkupdate("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) self.wait_for_sporks_same() # Test DIP8 activation once with a pre-existing quorum and once without (we don't know in which order it will activate on mainnet) self.test_dip8_quorum_merkle_root_activation(True) @@ -97,8 +97,8 @@ def run_test(self): first_quorum = self.test_dip8_quorum_merkle_root_activation(False, True) # Re-enable ChainLocks again - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_19_CHAINLOCKS_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() # Verify that the first quorum appears in MNLISTDIFF @@ -243,13 +243,13 @@ def test_getmnlistdiff_base(self, baseBlockHash, blockHash): def test_dip8_quorum_merkle_root_activation(self, with_initial_quorum, slow_mode=False): if with_initial_quorum: - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() # Mine one quorum before dip8 is activated self.mine_quorum() - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 4070908800) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 4070908800) self.wait_for_sporks_same() cbtx = self.nodes[0].getblock(self.nodes[0].getbestblockhash(), 2)["tx"][0] @@ -269,7 +269,7 @@ def test_dip8_quorum_merkle_root_activation(self, with_initial_quorum, slow_mode assert_equal(merkleRootQuorums, 0) self.bump_mocktime(1) - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() # Mine quorum and verify that merkleRootQuorums has changed diff --git a/test/functional/feature_llmq_chainlocks.py b/test/functional/feature_llmq_chainlocks.py index 67103310090a..4102393dd8b3 100755 --- a/test/functional/feature_llmq_chainlocks.py +++ b/test/functional/feature_llmq_chainlocks.py @@ -31,7 +31,7 @@ def run_test(self): self.activate_dip8() - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() self.log.info("Mining 4 quorums") @@ -144,10 +144,10 @@ def run_test(self): assert not node0_tip_block["chainlock"] assert node0_tip_block["previousblockhash"] == good_tip self.log.info("Disable LLMQ based InstantSend for a very short time (this never gets propagated to other nodes)") - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 4070908800) + self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 4070908800) self.log.info("Now the TXs should be included") self.nodes[0].generate(1) - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 0) self.log.info("Assert that TXs got included now") for txid in txs: tx = self.nodes[0].getrawtransaction(txid, 1) diff --git a/test/functional/feature_llmq_connections.py b/test/functional/feature_llmq_connections.py index cfc101965b7a..8ce9a61fe09d 100755 --- a/test/functional/feature_llmq_connections.py +++ b/test/functional/feature_llmq_connections.py @@ -22,7 +22,7 @@ def set_test_params(self): self.set_dash_llmq_test_params(5, 3) def run_test(self): - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() q = self.mine_quorum() @@ -38,7 +38,7 @@ def run_test(self): self.check_reconnects(2) self.log.info("Activating SPORK_23_QUORUM_POSE") - self.nodes[0].spork("SPORK_23_QUORUM_POSE", 0) + self.nodes[0].sporkupdate("SPORK_23_QUORUM_POSE", 0) self.wait_for_sporks_same() self.log.info("mining one block and waiting for all members to connect to each other") @@ -64,7 +64,7 @@ def run_test(self): wait_until(lambda: self.get_mn_probe_count(mn.node, q, True) == 4) self.log.info("Activating SPORK_21_QUORUM_ALL_CONNECTED") - self.nodes[0].spork("SPORK_21_QUORUM_ALL_CONNECTED", 0) + self.nodes[0].sporkupdate("SPORK_21_QUORUM_ALL_CONNECTED", 0) self.wait_for_sporks_same() self.check_reconnects(4) diff --git a/test/functional/feature_llmq_data_recovery.py b/test/functional/feature_llmq_data_recovery.py index e721ac083a8f..9dd9396549e3 100755 --- a/test/functional/feature_llmq_data_recovery.py +++ b/test/functional/feature_llmq_data_recovery.py @@ -121,8 +121,8 @@ def test_llmq_qvvec_sync(self, llmq_sync_entries): def run_test(self): node = self.nodes[0] - node.spork("SPORK_17_QUORUM_DKG_ENABLED", 0) - node.spork("SPORK_21_QUORUM_ALL_CONNECTED", 0) + node.sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) + node.sporkupdate("SPORK_21_QUORUM_ALL_CONNECTED", 0) self.wait_for_sporks_same() self.activate_dip8() diff --git a/test/functional/feature_llmq_dkgerrors.py b/test/functional/feature_llmq_dkgerrors.py index 61e7b837c666..74ae53ea73cf 100755 --- a/test/functional/feature_llmq_dkgerrors.py +++ b/test/functional/feature_llmq_dkgerrors.py @@ -19,7 +19,7 @@ def set_test_params(self): def run_test(self): self.activate_dip8() - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() self.log.info("Mine one quorum without simulating any errors") @@ -83,13 +83,13 @@ def assert_member_valid(self, quorumHash, proTxHash, expectedValid): def heal_masternodes(self, blockCount): # We're not testing PoSe here, so lets heal the MNs :) - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 4070908800) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 4070908800) self.wait_for_sporks_same() for i in range(blockCount): self.bump_mocktime(1) self.nodes[0].generate(1) self.sync_all() - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() diff --git a/test/functional/feature_llmq_is_cl_conflicts.py b/test/functional/feature_llmq_is_cl_conflicts.py index 52d3951953fc..51461a3991b1 100755 --- a/test/functional/feature_llmq_is_cl_conflicts.py +++ b/test/functional/feature_llmq_is_cl_conflicts.py @@ -60,7 +60,7 @@ def run_test(self): self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn()) - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() self.mine_quorum() @@ -216,7 +216,7 @@ def test_chainlock_overrides_islock_overrides_nonchainlock(self, deterministic): # Ensure spork uniqueness in multiple function runs self.bump_mocktime(1) # Disable ChainLocks to avoid accidental locking - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) + self.nodes[0].sporkupdate("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) self.wait_for_sporks_same() # Send tx1, which will later conflict with the ISLOCK @@ -268,7 +268,7 @@ def test_chainlock_overrides_islock_overrides_nonchainlock(self, deterministic): assert_equal(node.getbestblockhash(), islock_tip) # Check that the CL-ed block overrides the one with islocks - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) # Re-enable ChainLocks to accept clsig + self.nodes[0].sporkupdate("SPORK_19_CHAINLOCKS_ENABLED", 0) # Re-enable ChainLocks to accept clsig self.test_node.send_clsig(cl) # relay clsig ASAP to prevent nodes from locking islock-ed tip self.wait_for_sporks_same() for node in self.nodes: diff --git a/test/functional/feature_llmq_is_migration.py b/test/functional/feature_llmq_is_migration.py index 87485696bd5b..0b8dbbc6cd38 100755 --- a/test/functional/feature_llmq_is_migration.py +++ b/test/functional/feature_llmq_is_migration.py @@ -38,8 +38,8 @@ def run_test(self): self.activate_dip8() node = self.nodes[0] - node.spork("SPORK_17_QUORUM_DKG_ENABLED", 0) - node.spork("SPORK_2_INSTANTSEND_ENABLED", 0) + node.sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) + node.sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 0) self.wait_for_sporks_same() self.mine_quorum() diff --git a/test/functional/feature_llmq_is_retroactive.py b/test/functional/feature_llmq_is_retroactive.py index ad8daa9c5b8e..89c3ee2d885b 100755 --- a/test/functional/feature_llmq_is_retroactive.py +++ b/test/functional/feature_llmq_is_retroactive.py @@ -28,9 +28,9 @@ def set_test_params(self): def run_test(self): self.activate_dip8() - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) # Turn mempool IS signing off - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 1) + self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 1) self.wait_for_sporks_same() self.mine_quorum() @@ -45,18 +45,18 @@ def run_test(self): # are the only "neighbours" in intra-quorum connections for one of them. self.wait_for_instantlock(txid, self.nodes[0], False, 5) # Have to disable ChainLocks to avoid signing a block with a "safe" tx too early - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 4000000000) + self.nodes[0].sporkupdate("SPORK_19_CHAINLOCKS_ENABLED", 4000000000) self.wait_for_sporks_same() # We have to wait in order to include tx in block self.bump_mocktime(10 * 60 + 1) block = self.nodes[0].generate(1)[0] self.wait_for_instantlock(txid, self.nodes[0]) - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_19_CHAINLOCKS_ENABLED", 0) self.wait_for_sporks_same() self.wait_for_chainlocked_block_all_nodes(block) self.log.info("Enable mempool IS signing") - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 0) self.wait_for_sporks_same() self.log.info("trying normal IS lock") diff --git a/test/functional/feature_llmq_rotation.py b/test/functional/feature_llmq_rotation.py index acb285ce6980..6c11cedf76fb 100755 --- a/test/functional/feature_llmq_rotation.py +++ b/test/functional/feature_llmq_rotation.py @@ -72,7 +72,7 @@ def run_test(self): self.activate_dip8() - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() self.activate_dip0024(expected_activation_height=900) @@ -170,7 +170,7 @@ def run_test(self): self.log.info("Invalidate the quorum") self.bump_mocktime(5) - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) + self.nodes[0].sporkupdate("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) self.wait_for_sporks_same() self.nodes[0].invalidateblock(fallback_blockhash) assert_equal(self.nodes[0].getbestblockhash(), quorum_blockhash) @@ -178,7 +178,7 @@ def run_test(self): self.log.info("Reconsider the quorum") self.bump_mocktime(5) - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_19_CHAINLOCKS_ENABLED", 0) self.wait_for_sporks_same() self.nodes[0].reconsiderblock(fallback_blockhash) wait_until(lambda: self.nodes[0].getbestblockhash() == new_quorum_blockhash, sleep=1) diff --git a/test/functional/feature_llmq_signing.py b/test/functional/feature_llmq_signing.py index fbfa4565708c..e1e37c54c764 100755 --- a/test/functional/feature_llmq_signing.py +++ b/test/functional/feature_llmq_signing.py @@ -27,9 +27,9 @@ def add_options(self, parser): def run_test(self): - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) if self.options.spork21: - self.nodes[0].spork("SPORK_21_QUORUM_ALL_CONNECTED", 0) + self.nodes[0].sporkupdate("SPORK_21_QUORUM_ALL_CONNECTED", 0) self.wait_for_sporks_same() self.mine_quorum() diff --git a/test/functional/feature_llmq_simplepose.py b/test/functional/feature_llmq_simplepose.py index 56c0d67f6f44..c9d7406e06a6 100755 --- a/test/functional/feature_llmq_simplepose.py +++ b/test/functional/feature_llmq_simplepose.py @@ -23,7 +23,7 @@ def set_test_params(self): def run_test(self): - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() # check if mining quorums with all nodes being online succeeds without punishment/banning @@ -34,8 +34,8 @@ def run_test(self): self.repair_masternodes(False) - self.nodes[0].spork("SPORK_21_QUORUM_ALL_CONNECTED", 0) - self.nodes[0].spork("SPORK_23_QUORUM_POSE", 0) + self.nodes[0].sporkupdate("SPORK_21_QUORUM_ALL_CONNECTED", 0) + self.nodes[0].sporkupdate("SPORK_23_QUORUM_POSE", 0) self.wait_for_sporks_same() self.reset_probe_timeouts() @@ -52,7 +52,7 @@ def run_test(self): self.test_banning(self.force_old_mn_proto, 3) # With PoSe off there should be no punishing for non-reachable and outdated nodes - self.nodes[0].spork("SPORK_23_QUORUM_POSE", 4070908800) + self.nodes[0].sporkupdate("SPORK_23_QUORUM_POSE", 4070908800) self.wait_for_sporks_same() self.repair_masternodes(True) diff --git a/test/functional/feature_multikeysporks.py b/test/functional/feature_multikeysporks.py index fe889a9966ae..593d64ef93ed 100755 --- a/test/functional/feature_multikeysporks.py +++ b/test/functional/feature_multikeysporks.py @@ -81,8 +81,8 @@ def test_spork(self, spork_name, final_value): self.bump_mocktime(1) # first and second signers set spork value - self.nodes[0].spork(spork_name, 1) - self.nodes[1].spork(spork_name, 1) + self.nodes[0].sporkupdate(spork_name, 1) + self.nodes[1].sporkupdate(spork_name, 1) # spork change requires at least 3 signers time.sleep(10) for node in self.nodes: @@ -98,7 +98,7 @@ def test_spork(self, spork_name, final_value): connect_nodes(self.nodes[0], i) # third signer set spork value - self.nodes[2].spork(spork_name, 1) + self.nodes[2].sporkupdate(spork_name, 1) # now spork state is changed for node in self.nodes: wait_until(lambda: self.get_test_spork_value(node, spork_name) == 1, sleep=0.1, timeout=10) @@ -117,9 +117,9 @@ def test_spork(self, spork_name, final_value): self.bump_mocktime(1) # now set the spork again with other signers to test # old and new spork messages interaction - self.nodes[2].spork(spork_name, final_value) - self.nodes[3].spork(spork_name, final_value) - self.nodes[4].spork(spork_name, final_value) + self.nodes[2].sporkupdate(spork_name, final_value) + self.nodes[3].sporkupdate(spork_name, final_value) + self.nodes[4].sporkupdate(spork_name, final_value) for node in self.nodes: wait_until(lambda: self.get_test_spork_value(node, spork_name) == final_value, sleep=0.1, timeout=10) diff --git a/test/functional/feature_sporks.py b/test/functional/feature_sporks.py index 0f1d2d1da7b7..9966b71b0389 100755 --- a/test/functional/feature_sporks.py +++ b/test/functional/feature_sporks.py @@ -32,7 +32,7 @@ def set_test_spork_state(self, node, state): else: value = 4070908800 # use InstantSend spork for tests - node.spork('SPORK_2_INSTANTSEND_ENABLED', value) + node.sporkupdate("SPORK_2_INSTANTSEND_ENABLED", value) def run_test(self): spork_default_state = self.get_test_spork_state(self.nodes[0]) diff --git a/test/functional/interface_zmq_dash.py b/test/functional/interface_zmq_dash.py index 9af7cc69ad6e..6cba4018e788 100755 --- a/test/functional/interface_zmq_dash.py +++ b/test/functional/interface_zmq_dash.py @@ -127,7 +127,7 @@ def run_test(self): self.zmq_context = zmq.Context() # Initialize the network self.activate_dip8() - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() # Create an LLMQ for testing self.quorum_type = 100 # llmq_test diff --git a/test/functional/p2p_instantsend.py b/test/functional/p2p_instantsend.py index e154e77af99c..50dfa6fe9046 100755 --- a/test/functional/p2p_instantsend.py +++ b/test/functional/p2p_instantsend.py @@ -21,7 +21,7 @@ def set_test_params(self): self.sender_idx = 3 def run_test(self): - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() self.mine_quorum() diff --git a/test/functional/p2p_quorum_data.py b/test/functional/p2p_quorum_data.py index 3fbe54a1fc08..421e31c44a9c 100755 --- a/test/functional/p2p_quorum_data.py +++ b/test/functional/p2p_quorum_data.py @@ -395,8 +395,8 @@ def test_rpc_quorum_getdata_protx_hash(): "0000000000000000000000000000000000000000000000000000000000000000") # Enable DKG and disable ChainLocks - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) self.wait_for_sporks_same() quorum_hash = self.mine_quorum() diff --git a/test/functional/rpc_verifychainlock.py b/test/functional/rpc_verifychainlock.py index e7d8bb3c700a..85779a641ac7 100755 --- a/test/functional/rpc_verifychainlock.py +++ b/test/functional/rpc_verifychainlock.py @@ -24,7 +24,7 @@ def run_test(self): node0 = self.nodes[0] node1 = self.nodes[1] self.activate_dip8() - self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() self.mine_quorum() self.wait_for_chainlocked_block(node0, node0.generate(1)[0]) diff --git a/test/functional/rpc_verifyislock.py b/test/functional/rpc_verifyislock.py index e374063ad4d8..a21f90e20eb4 100755 --- a/test/functional/rpc_verifyislock.py +++ b/test/functional/rpc_verifyislock.py @@ -31,7 +31,7 @@ def get_request_id(self, tx_hex): def run_test(self): node = self.nodes[0] - node.spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + node.sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() self.mine_quorum() diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 0f3bd07c0346..236c923e2f6b 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -958,9 +958,9 @@ def setup_network(self): force_finish_mnsync(self.nodes[i + 1]) # Enable InstantSend (including block filtering) and ChainLocks by default - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) - self.nodes[0].spork("SPORK_3_INSTANTSEND_BLOCK_FILTERING", 0) - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 0) + self.nodes[0].sporkupdate("SPORK_3_INSTANTSEND_BLOCK_FILTERING", 0) + self.nodes[0].sporkupdate("SPORK_19_CHAINLOCKS_ENABLED", 0) self.wait_for_sporks_same() self.bump_mocktime(1) From ffd369fdce8c79bcbbaf04d1e138fe5a685fafb4 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Tue, 14 Jun 2022 23:38:07 +0530 Subject: [PATCH 2/2] docs: add release notes for dash#4885 --- doc/release-notes-4885.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/release-notes-4885.md diff --git a/doc/release-notes-4885.md b/doc/release-notes-4885.md new file mode 100644 index 000000000000..9b5ad6b51d5d --- /dev/null +++ b/doc/release-notes-4885.md @@ -0,0 +1,4 @@ +Updated RPCs +------------ + +* The `spork` RPC call will no longer offer both get (labelled as "basic mode") and set (labelled as "advanced mode") functionality. `spork` will now only offer "basic" functionality. "Advanced" functionality is now exposed through the `sporkupdate` RPC call.