Remove `-allowdeprecated=all`

We've decided to remove the option to allow all deprecated features,
because this has the effect that, if a user enables this flag, they
won't get the warning (and hence may forget to take action) at the time
that a feature is moved from the default-allowed set to the
default-denied set.

Co-authored-by: str4d <thestr4d@gmail.com>
This commit is contained in:
Kris Nuttycombe 2022-05-03 09:25:24 -06:00 committed by Kris Nuttycombe
parent 81b15f3eb7
commit 717b253a01
10 changed files with 136 additions and 83 deletions

View File

@ -3,10 +3,11 @@
[zcashd](README.md)
- [User Documentation](user.md)
- [Metrics](user/metrics.md)
- [Deprecated Features](user/deprecation.md)
- [Developer Documentation](dev.md)
- [Rust in `zcashd`](dev/rust.md)
- [Regtest tips and hints](dev/regtest.md)
- [Deprecation Policy](dev/deprecation.md)
- [Deprecation Procedure](dev/deprecation.md)
- [Design](design.md)
- [Chain state](design/chain-state.md)
- ["Coins" view](design/coins-view.md)

View File

@ -1,5 +1,5 @@
Deprecation Policy
==================
Deprecation Procedure
=====================
From time to time, features of zcashd and its associated wallet and RPC API are deprecated
to allow eventual removal of functionality that has been superseded by more recent
@ -12,17 +12,17 @@ Zcashd internally supports two sets of deprecated feature flags in `src/deprecat
- `DEFAULT_DENY_DEPRECATED` contains the set of features that are not enabled by
default, and must be explicitly enabled using `-allowdeprecated`.
Deprecation occurs as a 3-step process:
- When a feature is initially deprecated in a release, the fact of its deprecation is
announced in the release notes, any functionality that supersedes the deprecated feature
(if any) is documented in the release notes, and the string `DEPRECATED` is added to
user-facing API documentation and CLI help text. Internally, the deprecated feature
added to `DEFAULT_ALLOW_DEPRECATED`. The feature remains available to end-users
without additional action on their part.
- After 3 minor-version releases, or 1 major-version release, the deprecated feature
is removed from `DEFAULT_ALLOW_DEPRECATED` and added to `DEFAULT_DENY_DEPRECATED`.
After this point, the user must explicitly enable the feature using an
`-allowdeprecated` zcash.conf or CLI parameter in order for the feature to remain
available to them.
- After at least 2 major-version releases, the deprecated feature may be removed entirely.
Deprecation of a feature occurs as a 3-step process:
1. A deprecation flag is selected for the feature, and added to
`DEFAULT_ALLOW_DEPRECATED`. The fact of its deprecation is announced, and
any functionality that supersedes the deprecated feature (if any) is
documented, in the release notes. The string `DEPRECATED` is added to
user-facing API documentation and CLI help text.
2. The deprecation flag is removed from `DEFAULT_ALLOW_DEPRECATED` and added to
`DEFAULT_DENY_DEPRECATED`.
3. The deprecated feature is removed entirely, and its deprecation flag is
removed.
The interval between each step should be no less than a single major-version
release, or 3 minor-version releases, whichever is smaller.

View File

@ -0,0 +1,67 @@
Deprecated Features
===================
In order to support the continuous improvement of zcashd, features are
periodically deprecated and removed when they have been superseded or are no
longer useful. Deprecation follows a 3-stage process:
1. Initially, a feature will be marked as DEPRECATED in the release notes and
user-facing documentation, but no other changes are made; the feature
continues to be available and function as normal. While features at this
stage remain enabled by default, they may be explicitly disabled by
specifying `-allowdeprecated=none` on the command line when starting the
node, or by including `allowdeprecated=none` as a line in the `zcash.conf`
file.
2. In the stage of deprecation, the feature will be disabled by default.
Disabled features may be reenabled via use of the `-allowdeprecated` flag.
3. In the third stage, the feature is fully removed and is no longer available.
Features that enter Stage 1 in a particular release will be disabled by default
after no less than than a single major-version release, or 3 minor-version
releases, and features are only fully removed after two major-version releases.
For example, a feature entering Stage 1 in release 5.0.0:
- Will be disabled by default in either release 5.3.0 or release 6.0.0,
whichever comes first.
- Will be fully removed in release 7.0.0
Currently Deprecated
====================
Stage 1
-------
The following features are deprecated, but remain enabled by default. These features
will be disabled if `-allowdeprecated=none` is added to the CLI arguments when starting
the node, or if an `allowdeprecated=none` line is added to `zcash.conf`.
### Deprecated in 5.0.0
The following features are deprecated as of release 5.0.0 and will be disabled by
default as of either release 5.3.0 or release 6.0.0, whichever comes first.
- `legacy_privacy` - The default "legacy" privacy policy for z_sendmany is
deprecated. Use `-allowdeprecated=none` to require the default behavior to
conform to the `FullPrivacy` directive in all cases instead of just for
transactions involving unified addresses.
- `getnewaddress` - The `getnewaddress` RPC method is deprecated.
- `z_getnewaddress` - The `z_getnewaddress` RPC method is deprecated.
- `addrtype` - The `type` attribute is deprecated in the results of RPC
methods that return address metadata. It is recommended that applications
using this metadata be updated to use the `pool` or `address_type`
attributes, which have replaced the `type` attribute, as appropriate.
Stage 2
-------
Each feature in the lists below may be enabled by adding `-allowdeprecated=<feature>`
to the CLI arguments when starting the node, or by adding an `allowdeprecated=<feature>`
line to `zcash.conf`.
### Disabled in 5.0.0
The following features are disabled by default, and will be removed in release 6.0.0.
- `zcrawreceive` - The `zcrawreceive` RPC method is disabled.
- `zcrawjoinsplit` - The `zcrawjoinsplit` RPC method is disabled.
- `zcrawkeygen` - The `zcrawkeygen` RPC method is disabled.

View File

@ -10,43 +10,43 @@ Option handling
- The `-reindex` and `-reindex-chainstate` options now imply `-rescan`
(provided that the wallet is enabled and pruning is disabled, and unless
`-rescan=0` is specified explicitly).
- A new string-valued option, `-allowdeprecated` has been introduced to make it possible
for users to turn off deprecated methods and features in the RPC api.
Multiple instances of this argument may be provided. In the case that
this parameter is not provided, all currently deprecated RPC methods
that are not slated for removal in the next release remain available.
A user may disable all deprecated features entirely by providing the
string "none" as the argument to this parameter, or enable all
deprecated features, including those slated for removal, by providing
the string "all" as the argument to this parameter. In the case that
"all" or "none" is specified, multiple invocations of `-allowdeprecated`
are not permitted.
- A new string-valued option, `-allowdeprecated` has been introduced to allow
a user to explicitly manage the availability of deprecated zcashd features.
This flag makes it possible for users to reenable deprecated methods and
features api that are currently disabled by default, or alternately to
explicitly disable all deprecated features if they so choose. Multiple
instances of this argument may be provided. In the case that no values are
provided for this parameter, all currently deprecated RPC methods that are
not slated for removal in the next release remain enabled. A user may
disable all deprecated features entirely by providing the string "none" as
the argument to this parameter. In the case that "none" is specified,
multiple invocations of `-allowdeprecated` are not permitted.
To explicitly enable only a specific set of deprecated features, use
`-allowdeprecated=<flag1> -allowdeprecated=<flagN> ...` when starting
zcashd. The following flags are recognized:
Specific user-oriented documentation of the deprecation process may be
found in `doc/book/src/user/deprecation.md`.
- "all" - enables all deprecated features.
- "none" - disables all deprecated features.
- "legacy_privacy" - enables the use of the deprecated "legacy" privacy
policy for z_sendmany. This causes the default behavior to conform to
the `FullPrivacy` directive in all cases instead of just for
transactions involving unified addresses.
- "getnewaddress" - enables the `getnewaddress` RPC method.
- "z_getnewaddress" - enables the `z_getnewaddress` RPC method.
- "zcrawreceive" - enables the `zcrawreceive` RPC method.
- "zcrawjoinsplit" - enables the `zcrawjoinsplit` RPC method.
- "zcrawkeygen" - enables the `zcrawkeygen` RPC method.
- "addrtype" - when this option is set, the deprecated `type` attribute
is returned in addition to `pool` or `address_type` (which contain the
same information) in the results of RPC methods that return address metadata.
The following flags are recognized:
- `none` - disables all deprecated features.
- `legacy_privacy` - enables the use of the deprecated "legacy" privacy
policy for z_sendmany. This causes the default behavior to conform to the
`FullPrivacy` directive in all cases instead of just for transactions
involving unified addresses.
- `getnewaddress` - enables the `getnewaddress` RPC method.
- `z_getnewaddress` - enables the `z_getnewaddress` RPC method.
- `zcrawreceive` - enables the `zcrawreceive` RPC method.
- `zcrawjoinsplit` - enables the `zcrawjoinsplit` RPC method.
- `zcrawkeygen` - enables the `zcrawkeygen` RPC method.
- `addrtype` - when this option is set, the deprecated `type` attribute
is returned in addition to `pool` or `address_type` (which contain the same
information) in the results of RPC methods that return address metadata.
RPC Changes
-----------
- The deprecated `zcrawkeygen`, `zcrawreceive`, and `zcrawjoinsplit` RPC
methods are now disabled by default. Start with `-allowdeprecated=all`
or select individual features if you wish to continue using these APIs.
methods are now disabled by default. Use `-allowdeprecated=<feature>`
to select individual features if you wish to continue using these APIs.
Build system
------------

View File

@ -44,13 +44,8 @@ class WalletDeprecationTest(BitcoinTestFramework):
wait_bitcoinds()
self.setup_network_internal(["getnewaddress","zcrawkeygen"])
# z_getnewaddress is not specifically enabled, so it should fail
errorString = ''
try:
self.nodes[0].z_getnewaddress()
except JSONRPCException as e:
errorString = e.error['message']
assert "DEPRECATED" in errorString
# z_getnewaddress is enabled by default, so it should succeed
self.nodes[0].z_getnewaddress()
# getnewaddress and zcrawkeygen are enabled so they should succeed.
self.nodes[0].getnewaddress()
@ -75,16 +70,5 @@ class WalletDeprecationTest(BitcoinTestFramework):
errorString = e.error['message']
assert "DEPRECATED" in errorString
# restart with all deprecated methods enabled
stop_nodes(self.nodes)
wait_bitcoinds()
self.setup_network_internal(["all"])
# everything should succeed.
self.nodes[0].z_getnewaddress()
self.nodes[0].getnewaddress()
self.nodes[0].zcrawkeygen()
if __name__ == '__main__':
WalletDeprecationTest().main()

View File

@ -17,7 +17,9 @@ class JoinSplitTest(BitcoinTestFramework):
def setup_network(self):
self.nodes = []
self.is_network_split = False
self.nodes.append(start_node(0, self.options.tmpdir, ["-allowdeprecated=all"]))
self.nodes.append(start_node(0, self.options.tmpdir,
["-allowdeprecated=zcrawkeygen", "-allowdeprecated=zcrawjoinsplit", "-allowdeprecated=zcrawreceive"]
))
def run_test(self):
zckeypair = self.nodes[0].zcrawkeygen()

View File

@ -18,7 +18,7 @@ class JoinSplitTest(BitcoinTestFramework):
def setup_nodes(self):
return start_nodes(self.num_nodes, self.options.tmpdir,
extra_args = [["-allowdeprecated=all"]] * self.num_nodes)
extra_args = [["-allowdeprecated=zcrawjoinsplit", "-allowdeprecated=zcrawkeygen", "-allowdeprecated=zcrawreceive"]] * self.num_nodes)
def txid_in_mempool(self, node, txid):
exception_triggered = False

View File

@ -61,22 +61,13 @@ void EnforceNodeDeprecation(int nHeight, bool forceLogging, bool fThread) {
std::optional<std::string> SetAllowedDeprecatedFeaturesFromCLIArgs() {
auto args = GetMultiArg("-allowdeprecated");
std::set<std::string> allowdeprecated(args.begin(), args.end());
if (allowdeprecated.empty()) {
allowdeprecated = DEFAULT_ALLOW_DEPRECATED;
}
if (allowdeprecated.count("all") > 0) {
if (allowdeprecated.size() > 1)
return "When using -allowdeprecated=all no other values may be provided for -allowdeprecated.";
allowdeprecated = {};
allowdeprecated.insert(DEFAULT_ALLOW_DEPRECATED.begin(), DEFAULT_ALLOW_DEPRECATED.end());
allowdeprecated.insert(DEFAULT_DENY_DEPRECATED.begin(), DEFAULT_DENY_DEPRECATED.end());
}
if (allowdeprecated.count("none") > 0) {
if (allowdeprecated.size() > 1)
return "When using -allowdeprecated=none no other values may be provided for -allowdeprecated.";
allowdeprecated = {};
} else {
allowdeprecated.insert(DEFAULT_ALLOW_DEPRECATED.begin(), DEFAULT_ALLOW_DEPRECATED.end());
}
std::set<std::string> unrecognized;
@ -112,7 +103,7 @@ std::optional<std::string> SetAllowedDeprecatedFeaturesFromCLIArgs() {
}
std::string GetAllowableDeprecatedFeatures() {
std::string result = "\"all\", \"none\"";
std::string result = "\"none\"";
for (const auto& value : DEFAULT_ALLOW_DEPRECATED) {
result += ", \"" + value + "\"";
}

View File

@ -22,6 +22,9 @@ static const int DEPRECATION_WARN_LIMIT = 14 * 24 * EXPECTED_BLOCKS_PER_HOUR;
//! Defaults for -allowdeprecated
static const std::set<std::string> DEFAULT_ALLOW_DEPRECATED{{
// Node-level features
// Wallet-level features
#ifdef ENABLE_WALLET
"legacy_privacy",
"getnewaddress",

View File

@ -161,7 +161,8 @@ UniValue getnewaddress(const UniValue& params, bool fHelp)
throw runtime_error(
"getnewaddress is DEPRECATED and will be removed in a future release\n"
"\nUse z_getnewaccount and z_getaddressforaccount instead, or restart \n"
"with `-allowdeprecated=getnewaddress` if you require backward compatibility.");
"with `-allowdeprecated=getnewaddress` if you require backward compatibility.\n"
"See https://zcash.github.io/zcash/user/deprecation.html for more information.");
if (fHelp || params.size() > 1)
throw runtime_error(
@ -2868,7 +2869,8 @@ UniValue zc_raw_receive(const UniValue& params, bool fHelp)
if (!fEnableZCRawReceive)
throw runtime_error(
"zcrawreceive is DEPRECATED and will be removed in a future release\n"
"\nrestart with `-allowdeprecated=zcrawreceive` if you require backward compatibility.");
"\nrestart with `-allowdeprecated=zcrawreceive` if you require backward compatibility.\n"
"See https://zcash.github.io/zcash/user/deprecation.html for more information.");
if (fHelp || params.size() != 2) {
throw runtime_error(
@ -2961,7 +2963,8 @@ UniValue zc_raw_joinsplit(const UniValue& params, bool fHelp)
if (!fEnableZCRawJoinSplit)
throw runtime_error(
"zcrawjoinsplit is DEPRECATED and will be removed in a future release\n"
"\nrestart with `-allowdeprecated=zcrawjoinsplit` if you require backward compatibility.");
"\nrestart with `-allowdeprecated=zcrawjoinsplit` if you require backward compatibility.\n"
"See https://zcash.github.io/zcash/user/deprecation.html for more information.");
if (fHelp || params.size() != 5) {
throw runtime_error(
@ -3182,7 +3185,8 @@ UniValue zc_raw_keygen(const UniValue& params, bool fHelp)
if (!fEnableZCRawKeygen)
throw runtime_error(
"zcrawkeygen is DEPRECATED and will be removed in a future release\n"
"\nrestart with `-allowdeprecated=zcrawkeygen` if you require backward compatibility.");
"\nrestart with `-allowdeprecated=zcrawkeygen` if you require backward compatibility.\n"
"See https://zcash.github.io/zcash/user/deprecation.html for more information.");
if (fHelp || params.size() != 0) {
throw runtime_error(
@ -3220,7 +3224,8 @@ UniValue z_getnewaddress(const UniValue& params, bool fHelp)
throw runtime_error(
"z_getnewaddress is DEPRECATED and will be removed in a future release\n"
"\nUse z_getnewaccount and z_getaddressforaccount instead, or restart \n"
"with `-allowdeprecated=z_getnewaddress` if you require backward compatibility.");
"with `-allowdeprecated=z_getnewaddress` if you require backward compatibility.\n"
"See https://zcash.github.io/zcash/user/deprecation.html for more information.");
std::string defaultType = ADDR_TYPE_SAPLING;