-
Notifications
You must be signed in to change notification settings - Fork 13
Add zallet migrate-zcash-conf command
#13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1e23a82 to
fa126fd
Compare
| let config_toml = | ||
| toml::Value::try_from(config).map_err(|e| ErrorKind::Generic.context(e))?; | ||
| let output = | ||
| toml::to_string_pretty(&config_toml).map_err(|e| ErrorKind::Generic.context(e))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to how serde + toml serialization works, any config option that is Option<T> is omitted when None, but any config option that is just T is not omitted when set to its default value. This is how zebrad works as well, but I'm not very happy with it, because what I really want from this command is the config file that a user would have created if they were trying to override the same defaults.
I'm half inclined to make every config option Option<T> so that it can correctly represent "user-set / not-user-set" in memory, and then have getters that map None to the intended default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that seems reasonable. In some respects though I kind of like the idea that the defaults are explicitly set in the config file, because then the user doesn't have to go hunting in various places to find out what options are available and what their defaults are; they just get to see all the options up front when looking at the config file.
I know that I value when default config files are "complete" and self-documenting, such that I don't have to go looking for separate documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with defaults set in the config file, is that you can't change them later. E.g. the default txexpirydelta changed from 20 to 40 across the Blossom NU, but if users had an explicit value set then we would not override it. I think there is value in distinguishing "user is using our defaults" from "user has specific choices they wish to use", and that it's reasonable for users to trust us to use and maintain reasonable defaults over time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what I'd prefer is to have a separate command (similar to zebrad generate) that generates a config file containing all of the defaults (unlike zebrad which doesn't fill in defaults for some of its values like Option<T>s). Then users can run it to get a readable form of whatever the current defaults are, and adapt / use them at will. (The downside of offering this command is that most users might end up configuring the defaults explicitly, preventing us from ever updating them. So maybe the command should actually generate an "empty" config file with every default commented out.)
For this command, I prefer that it only generate a file containing settings that were explicitly configured by the user in their zcash.conf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. Having the defaults commented out is a pretty standard way of approaching the problem, and in the associated comments we can also describe why those particular defaults were chosen, and what the valid ranges etc. are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good, though I think that some of the options that you've set up migrations for should not be migrated.
| let config_toml = | ||
| toml::Value::try_from(config).map_err(|e| ErrorKind::Generic.context(e))?; | ||
| let output = | ||
| toml::to_string_pretty(&config_toml).map_err(|e| ErrorKind::Generic.context(e))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that seems reasonable. In some respects though I kind of like the idea that the defaults are explicitly set in the config file, because then the user doesn't have to go hunting in various places to find out what options are available and what their defaults are; they just get to see all the options up front when looking at the config file.
I know that I value when default config files are "complete" and self-documenting, such that I don't have to go looking for separate documentation.
fa126fd to
e494b89
Compare
|
Force-pushed to address review comments and implement some TODOs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK e494b89
| // TODO: Decide whether we want to allow renaming the `WalletDb` backing file. | ||
| .chain(Action::ignore("wallet")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be a warning if it is not the default.
| // TODO: Figure out where this was used, and if we want to keep it. | ||
| .chain(Action::ignore("maxtxfee")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was used to prevent accidentally specifying an excessively large fee. Given that we will only support ZIP 317 fees, it should be ignored I think. It would be ok to warn.
| "preferredtxversion", | ||
| Action::warn(|value| { | ||
| Some(fl!( | ||
| "migrate-warn-unsupported", | ||
| option = "preferredtxversion", | ||
| value = value, | ||
| )) | ||
| }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to warn if the preferred version is 5, since that's the default for zallet (and will continue to be the default immediately after NU7 I think?)
| // The logging systems of `zcashd` and Zallet differ sufficiently that we don't | ||
| // try to map existing log targets across. | ||
| .chain(Action::ignore("debug")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a warning with a link to documentation for Zallet's logging.
| // We aren't going to migrate over the `zcashd` wallet's experimental features | ||
| // compatibly. If we add a similar framework to Zallet it will be for from-scratch | ||
| // features. | ||
| .chain(Action::ignore("experimentalfeatures")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a warning saying that all experimental feature flags are ignored.
| )) | ||
| // TODO | ||
| .chain(Action::ignore("regtest")) | ||
| // TODO: Support mapping multi-arg options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought there is support for that in this PR?
| // Unsupported in `zcashd` since 1.0.0-beta1. | ||
| .chain(Action::ignore("rpcasyncthreads")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's part of the cause of the excessive complexity in the zcashd RPC code. (It was a good decision to disable this, mind.)
| // TODO: Need to check how this interacts with `rpcport`; we may instead need a | ||
| // warning here and no migration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A migration with a warning about the change in semantics seems like the right thing here to me.
| // TODO | ||
| .chain(Action::ignore("testnet")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a warning for now I think.
| "addnode", | ||
| "alertnotify", | ||
| "alerts", | ||
| "allowdeprecated", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically I think allowdeprecated is used to allow some wallet-related RPCs, but can be ignored.
| "forcednsseed", | ||
| "fundingstream", | ||
| "fuzzmessagestest", | ||
| "gen", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is "gen" categorized differently to "genproclimit" or "mineraddress"?
| "help", | ||
| "help-debug", | ||
| "ibdskiptxverification", | ||
| "insightexplorer", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably deserves a warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post-hoc ACK with comments.
No description provided.