Closed trevyn closed 3 years ago
Awesome work, I have a couple of questions around the changes and what they mean
Should we define a fresh install as config version 2 with 500000 as default
Functionally, it doesn't really matter. Leaving the version 1 defaults provides some implicit testing of the migration mechanism, which should probably get an explicit test if the default is changed. I see your point though, I'll think on it.
since this would allow us to remove this migration later on?
I don't think it'd be a good idea to ever remove the migration — users could have arbitrarily old configs, so the code should always be able to migrate from a day-1 config file all the way up to whatever the current version is.
If we are adding versioning to the node configuration, should we consider doing similar on the wallet side?
I took a quick look, and didn't see anything that would currently benefit from a new config version. If I missed something, happy to add that.
I'm also happy to spend the time on a more generalized approach (dreams of a generic toml_migration
crate), but I thought that might be falling into the over-engineering trap, and would make for a more difficult code review. :)
We still include the offending comment via comments.rs
when auto generating the config file -
So I guess we should also update the generated file (if we generate one) to include the latest version number.
Tested locally and looks good to me. :+1:
This adds an automatic migration of
grin-server.toml
toconfig_file_version = 2
, performed as such:config_file_version = 2
line after header commentsserver.pool_config.accept_fee_base
is 1000000, change it to 500000#a setting to 1000000 will be overridden to 500000 to respect the fixfees RFC
, since it no longer will onceconfig_file_version
>= 2grin-server.toml
file to diskThis migration is only applied when the
config_file_version
key is not present in the existinggrin-server.toml
file.For a fresh install, the migration is performed automatically when reading the initial default config.
Error handling can be improved upon request if this general approach is OK.
Closes #3540.