Skip to content

Commit e8f0b62

Browse files
Merge #6723: chore: deprecate protx register{,_fund,_prepare}_legacy and protx update_registrar_legacy, specifying scheme in bls generate
bb64e2f rpc: deprecate argument for defining scheme type in `bls generate` (Kittywhiskers Van Gogh) ae262f3 rpc: deprecate legacy variants of ProTx register, update_registrar (Kittywhiskers Van Gogh) Pull request description: ## Breaking Changes * The RPCs `protx register_legacy`, `protx register_fund_legacy`, `protx register_prepare_legacy` and `protx update_registrar_legacy` have been deprecated in Dash Core v23 and may be removed in a future version They can be re-enabled with the runtime argument `-deprecatedrpc=legacy_mn`. * The argument `legacy` in `bls generate` has been deprecated in Dash Core v23 and may be ignored in a future version. It can be re-enabled with the runtime argument `deprecatedrpc=legacy_mn`. ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK bb64e2f UdjinM6: utACK bb64e2f with one nit Tree-SHA512: d892205d19058278116af029090d20866307f7de6d3f099b3f50e0bef32ce5f5b9b49daaa14d9ccdcc44afa2a0b1aa9765dd5cb785b85d90f4f595286dd379ea
2 parents 1ab7e9e + bb64e2f commit e8f0b62

File tree

4 files changed

+43
-10
lines changed

4 files changed

+43
-10
lines changed

doc/release-notes-6723.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Updated RPCs
2+
------------
3+
4+
* The RPCs `protx register_legacy`, `protx register_fund_legacy`, `protx register_prepare_legacy` and
5+
`protx update_registrar_legacy` have been deprecated in Dash Core v23 and may be removed in a future version
6+
They can be re-enabled with the runtime argument `-deprecatedrpc=legacy_mn`.
7+
8+
* The argument `legacy` in `bls generate` has been deprecated in Dash Core v23 and may be ignored in a future version.
9+
It can be re-enabled with the runtime argument `deprecatedrpc=legacy_mn`.

src/rpc/evo.cpp

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ static RPCHelpMan protx_register_fund_wrapper(const bool legacy)
379379
"masternode.\n"
380380
"A few of the limitations you see in the arguments are temporary and might be lifted after DIP3\n"
381381
"is fully deployed.\n"
382+
+ std::string(legacy ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : "")
382383
+ HELP_REQUIRING_PASSPHRASE,
383384
{
384385
GetRpcArg("collateralAddress"),
@@ -402,6 +403,9 @@ static RPCHelpMan protx_register_fund_wrapper(const bool legacy)
402403
},
403404
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
404405
{
406+
if (legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
407+
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
408+
}
405409
return protx_register_common_wrapper(request, self.m_name == "protx register_fund_legacy", ProTxRegisterAction::Fund, MnType::Regular);
406410
},
407411
};
@@ -425,6 +429,7 @@ static RPCHelpMan protx_register_wrapper(bool legacy)
425429
"\nSame as \"protx register_fund\", but with an externally referenced collateral.\n"
426430
"The collateral is specified through \"collateralHash\" and \"collateralIndex\" and must be an unspent\n"
427431
"transaction output spendable by this wallet. It must also not be used by any other masternode.\n"
432+
+ std::string(legacy ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : "")
428433
+ HELP_REQUIRING_PASSPHRASE,
429434
{
430435
GetRpcArg("collateralHash"),
@@ -449,6 +454,9 @@ static RPCHelpMan protx_register_wrapper(bool legacy)
449454
},
450455
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
451456
{
457+
if (legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
458+
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
459+
}
452460
return protx_register_common_wrapper(request, self.m_name == "protx register_legacy", ProTxRegisterAction::External, MnType::Regular);
453461
},
454462
};
@@ -473,7 +481,8 @@ static RPCHelpMan protx_register_prepare_wrapper(const bool legacy)
473481
return RPCHelpMan{rpc_full_name,
474482
"\nCreates an unsigned ProTx and a message that must be signed externally\n"
475483
"with the private key that corresponds to collateralAddress to prove collateral ownership.\n"
476-
"The prepared transaction will also contain inputs and outputs to cover fees.\n",
484+
"The prepared transaction will also contain inputs and outputs to cover fees.\n"
485+
+ std::string(legacy ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : ""),
477486
{
478487
GetRpcArg("collateralHash"),
479488
GetRpcArg("collateralIndex"),
@@ -497,6 +506,9 @@ static RPCHelpMan protx_register_prepare_wrapper(const bool legacy)
497506
},
498507
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
499508
{
509+
if (legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
510+
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
511+
}
500512
return protx_register_common_wrapper(request, self.m_name == "protx register_prepare_legacy", ProTxRegisterAction::Prepare, MnType::Regular);
501513
},
502514
};
@@ -1063,6 +1075,7 @@ static RPCHelpMan protx_update_registrar_wrapper(const bool specific_legacy_bls_
10631075
"\nCreates and sends a ProUpRegTx to the network. This will update the operator key, voting key and payout\n"
10641076
"address of the masternode specified by \"proTxHash\".\n"
10651077
"The owner key of the masternode must be known to your wallet.\n"
1078+
+ std::string(specific_legacy_bls_scheme ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : "")
10661079
+ HELP_REQUIRING_PASSPHRASE,
10671080
{
10681081
GetRpcArg("proTxHash"),
@@ -1080,6 +1093,10 @@ static RPCHelpMan protx_update_registrar_wrapper(const bool specific_legacy_bls_
10801093
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
10811094
{
10821095
const bool use_legacy{self.m_name == "protx update_registrar_legacy"};
1096+
if (use_legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
1097+
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
1098+
}
1099+
10831100
const NodeContext& node = EnsureAnyNodeContext(request.context);
10841101
const ChainstateManager& chainman = EnsureChainman(node);
10851102

@@ -1662,9 +1679,9 @@ static RPCHelpMan protx_help()
16621679
" register_evo - Create and send ProTx to network for an EvoNode\n"
16631680
" register_fund_evo - Fund, create and send ProTx to network for an EvoNode\n"
16641681
" register_prepare_evo - Create an unsigned ProTx for an EvoNode\n"
1665-
" register_legacy - Create a ProTx by parsing BLS using the legacy scheme and send it to network\n"
1666-
" register_fund_legacy - Fund and create a ProTx by parsing BLS using the legacy scheme, then send it to network\n"
1667-
" register_prepare_legacy - Create an unsigned ProTx by parsing BLS using the legacy scheme\n"
1682+
" register_legacy - (DEPRECATED) Create a ProTx by parsing BLS using the legacy scheme and send it to network\n"
1683+
" register_fund_legacy - (DEPRECATED) Fund and create a ProTx by parsing BLS using the legacy scheme, then send it to network\n"
1684+
" register_prepare_legacy - (DEPRECATED) Create an unsigned ProTx by parsing BLS using the legacy scheme\n"
16681685
" register_submit - Sign and submit a ProTx\n"
16691686
#endif
16701687
" list - List ProTxs\n"
@@ -1673,7 +1690,7 @@ static RPCHelpMan protx_help()
16731690
" update_service - Create and send ProUpServTx to network\n"
16741691
" update_service_evo - Create and send ProUpServTx to network for an EvoNode\n"
16751692
" update_registrar - Create and send ProUpRegTx to network\n"
1676-
" update_registrar_legacy - Create ProUpRegTx by parsing BLS using the legacy scheme, then send it to network\n"
1693+
" update_registrar_legacy - (DEPRECATED) Create ProUpRegTx by parsing BLS using the legacy scheme, then send it to network\n"
16771694
" revoke - Create and send ProUpRevTx to network\n"
16781695
#endif
16791696
" diff - Calculate a diff and a proof between two masternode lists\n"
@@ -1696,7 +1713,7 @@ static RPCHelpMan bls_generate()
16961713
"bls generate",
16971714
"\nReturns a BLS secret/public key pair.\n",
16981715
{
1699-
{"legacy", RPCArg::Type::BOOL, RPCArg::Default{false}, "Set it true if need in legacy BLS scheme"},
1716+
{"legacy", RPCArg::Type::BOOL, RPCArg::Default{false}, "(DEPRECATED, can be set if -deprecatedrpc=legacy_mn is passed) Set true to use legacy BLS scheme"},
17001717
},
17011718
RPCResult{RPCResult::Type::OBJ,
17021719
"",
@@ -1710,6 +1727,9 @@ static RPCHelpMan bls_generate()
17101727
sk.MakeNewKey();
17111728
bool bls_legacy_scheme{false};
17121729
if (!request.params[0].isNull()) {
1730+
if (!IsDeprecatedRPCEnabled("legacy_mn")) {
1731+
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to set this argument");
1732+
}
17131733
bls_legacy_scheme = ParseBoolV(request.params[0], "bls_legacy_scheme");
17141734
}
17151735
UniValue ret(UniValue::VOBJ);
@@ -1788,19 +1808,19 @@ static const CRPCCommand commands[] =
17881808
{ "evo", &protx_info, },
17891809
{ "evo", &protx_register, },
17901810
{ "evo", &protx_register_evo, },
1791-
{ "evo", &protx_register_legacy, },
17921811
{ "evo", &protx_register_fund, },
1793-
{ "evo", &protx_register_fund_legacy, },
17941812
{ "evo", &protx_register_fund_evo, },
17951813
{ "evo", &protx_register_prepare, },
17961814
{ "evo", &protx_register_prepare_evo, },
1797-
{ "evo", &protx_register_prepare_legacy, },
17981815
{ "evo", &protx_update_service, },
17991816
{ "evo", &protx_update_service_evo, },
18001817
{ "evo", &protx_register_submit, },
18011818
{ "evo", &protx_update_registrar, },
1802-
{ "evo", &protx_update_registrar_legacy, },
18031819
{ "evo", &protx_revoke, },
1820+
{ "hidden", &protx_register_legacy, },
1821+
{ "hidden", &protx_register_fund_legacy, },
1822+
{ "hidden", &protx_register_prepare_legacy, },
1823+
{ "hidden", &protx_update_registrar_legacy, },
18041824
};
18051825
// clang-format on
18061826
return commands;

src/test/rpc_tests.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ class HasJSON
4141
class RPCTestingSetup : public TestingSetup
4242
{
4343
public:
44+
RPCTestingSetup()
45+
: TestingSetup(CBaseChainParams::MAIN, {"-deprecatedrpc=legacy_mn"}) {}
46+
4447
UniValue TransformParams(const UniValue& params, std::vector<std::string> arg_names);
4548
UniValue CallRPC(std::string args);
4649
};

test/functional/feature_dip3_v19.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def getmnlistdiff(self, base_block_hash, block_hash):
4747
class DIP3V19Test(DashTestFramework):
4848
def set_test_params(self):
4949
self.extra_args = [[
50+
'-deprecatedrpc=legacy_mn',
5051
'-testactivationheight=v19@200',
5152
]] * 6
5253
self.set_dash_test_params(6, 5, evo_count=2, extra_args=self.extra_args)

0 commit comments

Comments
 (0)