Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/release-notes-6723.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Updated RPCs
------------

* 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`.
Comment on lines +6 to +9
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could maybe split into 2 more explicit/self-explanatory ones

Suggested change
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`.
They can be re-enabled with the runtime argument `-deprecatedrpc=protx_legacy`.
* 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=bls_generate_legacy`.

40 changes: 30 additions & 10 deletions src/rpc/evo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ static RPCHelpMan protx_register_fund_wrapper(const bool legacy)
"masternode.\n"
"A few of the limitations you see in the arguments are temporary and might be lifted after DIP3\n"
"is fully deployed.\n"
+ std::string(legacy ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : "")
+ HELP_REQUIRING_PASSPHRASE,
{
GetRpcArg("collateralAddress"),
Expand All @@ -402,6 +403,9 @@ static RPCHelpMan protx_register_fund_wrapper(const bool legacy)
},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
if (legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
}
return protx_register_common_wrapper(request, self.m_name == "protx register_fund_legacy", ProTxRegisterAction::Fund, MnType::Regular);
},
};
Expand All @@ -425,6 +429,7 @@ static RPCHelpMan protx_register_wrapper(bool legacy)
"\nSame as \"protx register_fund\", but with an externally referenced collateral.\n"
"The collateral is specified through \"collateralHash\" and \"collateralIndex\" and must be an unspent\n"
"transaction output spendable by this wallet. It must also not be used by any other masternode.\n"
+ std::string(legacy ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : "")
+ HELP_REQUIRING_PASSPHRASE,
{
GetRpcArg("collateralHash"),
Expand All @@ -449,6 +454,9 @@ static RPCHelpMan protx_register_wrapper(bool legacy)
},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
if (legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
}
return protx_register_common_wrapper(request, self.m_name == "protx register_legacy", ProTxRegisterAction::External, MnType::Regular);
},
};
Expand All @@ -473,7 +481,8 @@ static RPCHelpMan protx_register_prepare_wrapper(const bool legacy)
return RPCHelpMan{rpc_full_name,
"\nCreates an unsigned ProTx and a message that must be signed externally\n"
"with the private key that corresponds to collateralAddress to prove collateral ownership.\n"
"The prepared transaction will also contain inputs and outputs to cover fees.\n",
"The prepared transaction will also contain inputs and outputs to cover fees.\n"
+ std::string(legacy ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : ""),
{
GetRpcArg("collateralHash"),
GetRpcArg("collateralIndex"),
Expand All @@ -497,6 +506,9 @@ static RPCHelpMan protx_register_prepare_wrapper(const bool legacy)
},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
if (legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
}
return protx_register_common_wrapper(request, self.m_name == "protx register_prepare_legacy", ProTxRegisterAction::Prepare, MnType::Regular);
},
};
Expand Down Expand Up @@ -1063,6 +1075,7 @@ static RPCHelpMan protx_update_registrar_wrapper(const bool specific_legacy_bls_
"\nCreates and sends a ProUpRegTx to the network. This will update the operator key, voting key and payout\n"
"address of the masternode specified by \"proTxHash\".\n"
"The owner key of the masternode must be known to your wallet.\n"
+ std::string(specific_legacy_bls_scheme ? "\nDEPRECATED: May be removed in a future version, pass config option -deprecatedrpc=legacy_mn to use RPC\n" : "")
+ HELP_REQUIRING_PASSPHRASE,
{
GetRpcArg("proTxHash"),
Expand All @@ -1080,6 +1093,10 @@ static RPCHelpMan protx_update_registrar_wrapper(const bool specific_legacy_bls_
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
const bool use_legacy{self.m_name == "protx update_registrar_legacy"};
if (use_legacy && !IsDeprecatedRPCEnabled("legacy_mn")) {
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to enable this RPC");
}

const NodeContext& node = EnsureAnyNodeContext(request.context);
const ChainstateManager& chainman = EnsureChainman(node);

Expand Down Expand Up @@ -1662,9 +1679,9 @@ static RPCHelpMan protx_help()
" register_evo - Create and send ProTx to network for an EvoNode\n"
" register_fund_evo - Fund, create and send ProTx to network for an EvoNode\n"
" register_prepare_evo - Create an unsigned ProTx for an EvoNode\n"
" register_legacy - Create a ProTx by parsing BLS using the legacy scheme and send it to network\n"
" register_fund_legacy - Fund and create a ProTx by parsing BLS using the legacy scheme, then send it to network\n"
" register_prepare_legacy - Create an unsigned ProTx by parsing BLS using the legacy scheme\n"
" register_legacy - (DEPRECATED) Create a ProTx by parsing BLS using the legacy scheme and send it to network\n"
" register_fund_legacy - (DEPRECATED) Fund and create a ProTx by parsing BLS using the legacy scheme, then send it to network\n"
" register_prepare_legacy - (DEPRECATED) Create an unsigned ProTx by parsing BLS using the legacy scheme\n"
" register_submit - Sign and submit a ProTx\n"
#endif
" list - List ProTxs\n"
Expand All @@ -1673,7 +1690,7 @@ static RPCHelpMan protx_help()
" update_service - Create and send ProUpServTx to network\n"
" update_service_evo - Create and send ProUpServTx to network for an EvoNode\n"
" update_registrar - Create and send ProUpRegTx to network\n"
" update_registrar_legacy - Create ProUpRegTx by parsing BLS using the legacy scheme, then send it to network\n"
" update_registrar_legacy - (DEPRECATED) Create ProUpRegTx by parsing BLS using the legacy scheme, then send it to network\n"
" revoke - Create and send ProUpRevTx to network\n"
#endif
" diff - Calculate a diff and a proof between two masternode lists\n"
Expand All @@ -1696,7 +1713,7 @@ static RPCHelpMan bls_generate()
"bls generate",
"\nReturns a BLS secret/public key pair.\n",
{
{"legacy", RPCArg::Type::BOOL, RPCArg::Default{false}, "Set it true if need in legacy BLS scheme"},
{"legacy", RPCArg::Type::BOOL, RPCArg::Default{false}, "(DEPRECATED, can be set if -deprecatedrpc=legacy_mn is passed) Set true to use legacy BLS scheme"},
},
RPCResult{RPCResult::Type::OBJ,
"",
Expand All @@ -1710,6 +1727,9 @@ static RPCHelpMan bls_generate()
sk.MakeNewKey();
bool bls_legacy_scheme{false};
if (!request.params[0].isNull()) {
if (!IsDeprecatedRPCEnabled("legacy_mn")) {
throw std::runtime_error("DEPRECATED: Pass config option -deprecatedrpc=legacy_mn to set this argument");
}
bls_legacy_scheme = ParseBoolV(request.params[0], "bls_legacy_scheme");
}
UniValue ret(UniValue::VOBJ);
Expand Down Expand Up @@ -1788,19 +1808,19 @@ static const CRPCCommand commands[] =
{ "evo", &protx_info, },
{ "evo", &protx_register, },
{ "evo", &protx_register_evo, },
{ "evo", &protx_register_legacy, },
{ "evo", &protx_register_fund, },
{ "evo", &protx_register_fund_legacy, },
{ "evo", &protx_register_fund_evo, },
{ "evo", &protx_register_prepare, },
{ "evo", &protx_register_prepare_evo, },
{ "evo", &protx_register_prepare_legacy, },
{ "evo", &protx_update_service, },
{ "evo", &protx_update_service_evo, },
{ "evo", &protx_register_submit, },
{ "evo", &protx_update_registrar, },
{ "evo", &protx_update_registrar_legacy, },
{ "evo", &protx_revoke, },
{ "hidden", &protx_register_legacy, },
{ "hidden", &protx_register_fund_legacy, },
{ "hidden", &protx_register_prepare_legacy, },
{ "hidden", &protx_update_registrar_legacy, },
};
// clang-format on
return commands;
Expand Down
3 changes: 3 additions & 0 deletions src/test/rpc_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class HasJSON
class RPCTestingSetup : public TestingSetup
{
public:
RPCTestingSetup()
: TestingSetup(CBaseChainParams::MAIN, {"-deprecatedrpc=legacy_mn"}) {}

UniValue TransformParams(const UniValue& params, std::vector<std::string> arg_names);
UniValue CallRPC(std::string args);
};
Expand Down
1 change: 1 addition & 0 deletions test/functional/feature_dip3_v19.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def getmnlistdiff(self, base_block_hash, block_hash):
class DIP3V19Test(DashTestFramework):
def set_test_params(self):
self.extra_args = [[
'-deprecatedrpc=legacy_mn',
'-testactivationheight=v19@200',
]] * 6
self.set_dash_test_params(6, 5, evo_count=2, extra_args=self.extra_args)
Expand Down
Loading