Skip to content

Conversation

@str4d
Copy link
Collaborator

@str4d str4d commented Jan 27, 2025

No description provided.

@str4d str4d force-pushed the cmd-migrate-zcash-conf branch from 1e23a82 to fa126fd Compare January 27, 2025 10:15
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))?;
Copy link
Collaborator Author

@str4d str4d Jan 27, 2025

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.

Copy link
Contributor

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

@str4d str4d Jan 28, 2025

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.

Copy link
Contributor

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.

Copy link
Contributor

@nuttycom nuttycom left a 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))?;
Copy link
Contributor

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.

@str4d str4d force-pushed the cmd-migrate-zcash-conf branch from fa126fd to e494b89 Compare January 28, 2025 02:27
@str4d
Copy link
Collaborator Author

str4d commented Jan 28, 2025

Force-pushed to address review comments and implement some TODOs.

Copy link
Contributor

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

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

utACK e494b89

@str4d str4d marked this pull request as ready for review January 29, 2025 03:01
@nuttycom nuttycom merged commit a60e0a1 into main Jan 29, 2025
@nuttycom nuttycom deleted the cmd-migrate-zcash-conf branch January 29, 2025 03:09
Comment on lines +348 to +349
// TODO: Decide whether we want to allow renaming the `WalletDb` backing file.
.chain(Action::ignore("wallet"))
Copy link
Contributor

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.

Comment on lines +416 to +417
// TODO: Figure out where this was used, and if we want to keep it.
.chain(Action::ignore("maxtxfee"))
Copy link
Contributor

@daira daira Jan 29, 2025

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.

Comment on lines +424 to +431
"preferredtxversion",
Action::warn(|value| {
Some(fl!(
"migrate-warn-unsupported",
option = "preferredtxversion",
value = value,
))
}),
Copy link
Contributor

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?)

Comment on lines +447 to +449
// The logging systems of `zcashd` and Zallet differ sufficiently that we don't
// try to map existing log targets across.
.chain(Action::ignore("debug"))
Copy link
Contributor

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.

Comment on lines +450 to +453
// 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"))
Copy link
Contributor

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.
Copy link
Contributor

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?

Comment on lines +463 to +464
// Unsupported in `zcashd` since 1.0.0-beta1.
.chain(Action::ignore("rpcasyncthreads"))
Copy link
Contributor

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.)

Comment on lines +468 to +469
// TODO: Need to check how this interacts with `rpcport`; we may instead need a
// warning here and no migration.
Copy link
Contributor

@daira daira Jan 29, 2025

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.

Comment on lines +500 to +501
// TODO
.chain(Action::ignore("testnet"));
Copy link
Contributor

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",
Copy link
Contributor

@daira daira Jan 29, 2025

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",
Copy link
Contributor

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",
Copy link
Contributor

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.

Copy link
Contributor

@daira daira left a 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.

@str4d str4d added the A-config Area: Configuration label Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-config Area: Configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants