Merge branch 'release/v0.11.0' of github.com:nymtech/nym into release/v0.11.0
This commit is contained in:
@@ -28,4 +28,4 @@ topology = { path = "../../common/topology" }
|
||||
validator-client = { path = "../../common/client-libs/validator-client" }
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.1.0"
|
||||
tempfile = "3.1.0"
|
||||
|
||||
@@ -43,4 +43,4 @@ validator-client = { path = "../../common/client-libs/validator-client" }
|
||||
version-checker = { path = "../../common/version-checker" }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1.0" # for the "textsend" example
|
||||
serde_json = "1.0" # for the "textsend" example
|
||||
|
||||
@@ -242,6 +242,50 @@ fn patch_010_upgrade(
|
||||
config
|
||||
}
|
||||
|
||||
fn minor_011_upgrade(
|
||||
mut config: Config,
|
||||
_matches: &ArgMatches,
|
||||
config_version: &Version,
|
||||
package_version: &Version,
|
||||
) -> Config {
|
||||
let to_version = package_version;
|
||||
|
||||
print_start_upgrade(&config_version, &to_version);
|
||||
|
||||
println!(
|
||||
"Setting mixnet contract address to {}",
|
||||
DEFAULT_MIXNET_CONTRACT_ADDRESS
|
||||
);
|
||||
|
||||
config
|
||||
.get_base_mut()
|
||||
.set_mixnet_contract(DEFAULT_MIXNET_CONTRACT_ADDRESS);
|
||||
|
||||
// The default validator endpoint changed
|
||||
println!(
|
||||
"Setting validator REST endpoint to {:?}",
|
||||
default_validator_rest_endpoints()
|
||||
);
|
||||
|
||||
config
|
||||
.get_base_mut()
|
||||
.set_custom_validators(default_validator_rest_endpoints());
|
||||
|
||||
config
|
||||
.get_base_mut()
|
||||
.set_custom_version(to_version.to_string().as_ref());
|
||||
|
||||
config.save_to_file(None).unwrap_or_else(|err| {
|
||||
eprintln!("failed to overwrite config file! - {:?}", err);
|
||||
print_failed_upgrade(&config_version, &to_version);
|
||||
process::exit(1);
|
||||
});
|
||||
|
||||
print_successful_upgrade(config_version, to_version);
|
||||
|
||||
config
|
||||
}
|
||||
|
||||
fn do_upgrade(mut config: Config, matches: &ArgMatches, package_version: Version) {
|
||||
loop {
|
||||
let config_version = parse_config_version(&config);
|
||||
@@ -253,8 +297,15 @@ fn do_upgrade(mut config: Config, matches: &ArgMatches, package_version: Version
|
||||
|
||||
config = match config_version.major {
|
||||
0 => match config_version.minor {
|
||||
9 => minor_010_upgrade(config, matches, &config_version, &package_version),
|
||||
10 => patch_010_upgrade(config, matches, &config_version, &package_version),
|
||||
9 => minor_010_upgrade(config, matches, &config_version, &Version::new(0, 10, 0)),
|
||||
10 => match config_version.patch {
|
||||
0 => {
|
||||
patch_010_upgrade(config, matches, &config_version, &Version::new(0, 10, 1))
|
||||
}
|
||||
_ => {
|
||||
minor_011_upgrade(config, matches, &config_version, &Version::new(0, 11, 0))
|
||||
}
|
||||
},
|
||||
_ => unsupported_upgrade(config_version, package_version),
|
||||
},
|
||||
_ => unsupported_upgrade(config_version, package_version),
|
||||
|
||||
@@ -242,6 +242,50 @@ fn patch_010_upgrade(
|
||||
config
|
||||
}
|
||||
|
||||
fn minor_011_upgrade(
|
||||
mut config: Config,
|
||||
_matches: &ArgMatches,
|
||||
config_version: &Version,
|
||||
package_version: &Version,
|
||||
) -> Config {
|
||||
let to_version = package_version;
|
||||
|
||||
print_start_upgrade(&config_version, &to_version);
|
||||
|
||||
println!(
|
||||
"Setting mixnet contract address to {}",
|
||||
DEFAULT_MIXNET_CONTRACT_ADDRESS
|
||||
);
|
||||
|
||||
config
|
||||
.get_base_mut()
|
||||
.set_mixnet_contract(DEFAULT_MIXNET_CONTRACT_ADDRESS);
|
||||
|
||||
// The default validator endpoint changed
|
||||
println!(
|
||||
"Setting validator REST endpoint to {:?}",
|
||||
default_validator_rest_endpoints()
|
||||
);
|
||||
|
||||
config
|
||||
.get_base_mut()
|
||||
.set_custom_validators(default_validator_rest_endpoints());
|
||||
|
||||
config
|
||||
.get_base_mut()
|
||||
.set_custom_version(to_version.to_string().as_ref());
|
||||
|
||||
config.save_to_file(None).unwrap_or_else(|err| {
|
||||
eprintln!("failed to overwrite config file! - {:?}", err);
|
||||
print_failed_upgrade(&config_version, &to_version);
|
||||
process::exit(1);
|
||||
});
|
||||
|
||||
print_successful_upgrade(config_version, to_version);
|
||||
|
||||
config
|
||||
}
|
||||
|
||||
fn do_upgrade(mut config: Config, matches: &ArgMatches, package_version: Version) {
|
||||
loop {
|
||||
let config_version = parse_config_version(&config);
|
||||
@@ -253,8 +297,15 @@ fn do_upgrade(mut config: Config, matches: &ArgMatches, package_version: Version
|
||||
|
||||
config = match config_version.major {
|
||||
0 => match config_version.minor {
|
||||
9 => minor_010_upgrade(config, matches, &config_version, &package_version),
|
||||
10 => patch_010_upgrade(config, matches, &config_version, &package_version),
|
||||
9 => minor_010_upgrade(config, matches, &config_version, &Version::new(0, 10, 0)),
|
||||
10 => match config_version.patch {
|
||||
0 => {
|
||||
patch_010_upgrade(config, matches, &config_version, &Version::new(0, 10, 1))
|
||||
}
|
||||
_ => {
|
||||
minor_011_upgrade(config, matches, &config_version, &Version::new(0, 11, 0))
|
||||
}
|
||||
},
|
||||
_ => unsupported_upgrade(config_version, package_version),
|
||||
},
|
||||
_ => unsupported_upgrade(config_version, package_version),
|
||||
|
||||
@@ -238,6 +238,41 @@ fn patch_010_upgrade(
|
||||
upgraded_config
|
||||
}
|
||||
|
||||
fn minor_011_upgrade(
|
||||
config: Config,
|
||||
_matches: &ArgMatches,
|
||||
config_version: &Version,
|
||||
package_version: &Version,
|
||||
) -> Config {
|
||||
let to_version = package_version;
|
||||
|
||||
print_start_upgrade(&config_version, &to_version);
|
||||
|
||||
println!(
|
||||
"Setting validator REST endpoint to {:?}",
|
||||
default_validator_rest_endpoints()
|
||||
);
|
||||
|
||||
println!(
|
||||
"Setting mixnet contract address to {}",
|
||||
DEFAULT_MIXNET_CONTRACT_ADDRESS
|
||||
);
|
||||
|
||||
let upgraded_config = config
|
||||
.with_custom_version(to_version.to_string().as_ref())
|
||||
.with_custom_validators(default_validator_rest_endpoints())
|
||||
.with_custom_mixnet_contract(DEFAULT_MIXNET_CONTRACT_ADDRESS);
|
||||
|
||||
upgraded_config.save_to_file(None).unwrap_or_else(|err| {
|
||||
eprintln!("failed to overwrite config file! - {:?}", err);
|
||||
fail_upgrade(&config_version, &to_version)
|
||||
});
|
||||
|
||||
print_successful_upgrade(config_version, to_version);
|
||||
|
||||
upgraded_config
|
||||
}
|
||||
|
||||
// TODO: to be renamed once the release version is decided (so presumably either 0.10.2 or 0.11.0)
|
||||
fn undetermined_version_upgrade(
|
||||
config: Config,
|
||||
@@ -300,9 +335,14 @@ fn do_upgrade(mut config: Config, matches: &ArgMatches, package_version: Version
|
||||
|
||||
config = match config_version.major {
|
||||
0 => match config_version.minor {
|
||||
9 => minor_010_upgrade(config, matches, &config_version, &package_version),
|
||||
9 => minor_010_upgrade(config, matches, &config_version, &Version::new(0, 10, 0)),
|
||||
10 => match config_version.patch {
|
||||
0 => patch_010_upgrade(config, matches, &config_version, &package_version),
|
||||
0 => {
|
||||
patch_010_upgrade(config, matches, &config_version, &Version::new(0, 10, 1))
|
||||
}
|
||||
1 => {
|
||||
minor_011_upgrade(config, matches, &config_version, &Version::new(0, 11, 0))
|
||||
}
|
||||
_ => undetermined_version_upgrade(
|
||||
config,
|
||||
matches,
|
||||
|
||||
@@ -263,6 +263,43 @@ fn patch_0_10_1_upgrade(
|
||||
Ok(upgraded_config)
|
||||
}
|
||||
|
||||
fn minor_0_11_upgrade(
|
||||
config: Config,
|
||||
_matches: &ArgMatches,
|
||||
config_version: &Version,
|
||||
package_version: &Version,
|
||||
) -> Result<Config, UpgradeError> {
|
||||
let to_version = package_version;
|
||||
|
||||
print_start_upgrade(&config_version, &to_version);
|
||||
|
||||
println!(
|
||||
"Setting validator REST endpoint to {:?}",
|
||||
default_validator_rest_endpoints()
|
||||
);
|
||||
|
||||
println!(
|
||||
"Setting mixnet contract address to {}",
|
||||
DEFAULT_MIXNET_CONTRACT_ADDRESS
|
||||
);
|
||||
|
||||
let upgraded_config = config
|
||||
.with_custom_version(to_version.to_string().as_ref())
|
||||
.with_custom_validators(default_validator_rest_endpoints())
|
||||
.with_custom_mixnet_contract(DEFAULT_MIXNET_CONTRACT_ADDRESS);
|
||||
|
||||
upgraded_config.save_to_file(None).map_err(|err| {
|
||||
(
|
||||
to_version.clone(),
|
||||
format!("failed to overwrite config file! - {:?}", err),
|
||||
)
|
||||
})?;
|
||||
|
||||
print_successful_upgrade(config_version, to_version);
|
||||
|
||||
Ok(upgraded_config)
|
||||
}
|
||||
|
||||
// TODO: to be renamed once the release version is decided (so presumably either 0.10.2 or 0.11.0)
|
||||
fn undetermined_version_upgrade(
|
||||
config: Config,
|
||||
@@ -382,6 +419,12 @@ fn do_upgrade(mut config: Config, matches: &ArgMatches, package_version: Version
|
||||
&config_version,
|
||||
&Version::new(0, 10, 1),
|
||||
),
|
||||
1 => minor_0_11_upgrade(
|
||||
config,
|
||||
matches,
|
||||
&config_version,
|
||||
&Version::new(0, 11, 0),
|
||||
),
|
||||
_ => undetermined_version_upgrade(
|
||||
config,
|
||||
matches,
|
||||
|
||||
Generated
+1
-1
@@ -1627,7 +1627,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-validator-api"
|
||||
version = "0.11.0-rc1"
|
||||
version = "0.11.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
|
||||
Reference in New Issue
Block a user