From 191b3c09e2cfde799c8b36de31db2007ab3a3ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C5=9Fu?= Date: Wed, 21 Jul 2021 16:10:27 +0300 Subject: [PATCH] V0.11.0 release (#696) * Update the version to 0.11.0 for non-upgradable crates * Fix target version for the current upgrade functions * Upgrade native client * Upgrade socks5 client * Upgrade mixnode * Upgrade gateway --- Cargo.lock | 14 ++--- clients/client-core/Cargo.toml | 4 +- clients/native/Cargo.toml | 4 +- clients/native/src/commands/upgrade.rs | 55 ++++++++++++++++++- clients/socks5/Cargo.toml | 2 +- clients/socks5/src/commands/upgrade.rs | 55 ++++++++++++++++++- clients/webassembly/Cargo.toml | 2 +- gateway/Cargo.toml | 2 +- gateway/src/commands/upgrade.rs | 44 ++++++++++++++- mixnode/Cargo.toml | 2 +- mixnode/src/commands/upgrade.rs | 43 +++++++++++++++ .../network-requester/Cargo.toml | 2 +- validator-api/Cargo.lock | 2 +- validator-api/Cargo.toml | 2 +- 14 files changed, 209 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8716cf63c9..30b973c71d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -349,7 +349,7 @@ dependencies = [ [[package]] name = "client-core" -version = "0.11.0-rc1" +version = "0.11.0" dependencies = [ "config", "crypto", @@ -1673,7 +1673,7 @@ dependencies = [ [[package]] name = "nym-client" -version = "0.11.0-rc1" +version = "0.11.0" dependencies = [ "clap", "client-core", @@ -1703,7 +1703,7 @@ dependencies = [ [[package]] name = "nym-client-wasm" -version = "0.11.0-rc1" +version = "0.11.0" dependencies = [ "console_error_panic_hook", "crypto", @@ -1724,7 +1724,7 @@ dependencies = [ [[package]] name = "nym-gateway" -version = "0.11.0-rc1" +version = "0.11.0" dependencies = [ "clap", "config", @@ -1754,7 +1754,7 @@ dependencies = [ [[package]] name = "nym-mixnode" -version = "0.11.0-rc1" +version = "0.11.0" dependencies = [ "bs58 0.4.0", "clap", @@ -1786,7 +1786,7 @@ dependencies = [ [[package]] name = "nym-network-requester" -version = "0.11.0-rc1" +version = "0.11.0" dependencies = [ "clap", "dirs", @@ -1807,7 +1807,7 @@ dependencies = [ [[package]] name = "nym-socks5-client" -version = "0.11.0-rc1" +version = "0.11.0" dependencies = [ "clap", "client-core", diff --git a/clients/client-core/Cargo.toml b/clients/client-core/Cargo.toml index 2efc844575..aadf4318fe 100644 --- a/clients/client-core/Cargo.toml +++ b/clients/client-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "client-core" -version = "0.11.0-rc1" +version = "0.11.0" authors = ["Dave Hrycyszyn "] edition = "2018" @@ -28,4 +28,4 @@ topology = { path = "../../common/topology" } validator-client = { path = "../../common/client-libs/validator-client" } [dev-dependencies] -tempfile = "3.1.0" \ No newline at end of file +tempfile = "3.1.0" diff --git a/clients/native/Cargo.toml b/clients/native/Cargo.toml index 73e0ce6001..8540ae7bcb 100644 --- a/clients/native/Cargo.toml +++ b/clients/native/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nym-client" -version = "0.11.0-rc1" +version = "0.11.0" authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] edition = "2018" @@ -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 \ No newline at end of file +serde_json = "1.0" # for the "textsend" example diff --git a/clients/native/src/commands/upgrade.rs b/clients/native/src/commands/upgrade.rs index 4cbcf46a7e..99966838fa 100644 --- a/clients/native/src/commands/upgrade.rs +++ b/clients/native/src/commands/upgrade.rs @@ -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), diff --git a/clients/socks5/Cargo.toml b/clients/socks5/Cargo.toml index 9eb32f50aa..df6f26f71b 100644 --- a/clients/socks5/Cargo.toml +++ b/clients/socks5/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nym-socks5-client" -version = "0.11.0-rc1" +version = "0.11.0" authors = ["Dave Hrycyszyn "] edition = "2018" diff --git a/clients/socks5/src/commands/upgrade.rs b/clients/socks5/src/commands/upgrade.rs index c5924953ce..83fd82b521 100644 --- a/clients/socks5/src/commands/upgrade.rs +++ b/clients/socks5/src/commands/upgrade.rs @@ -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), diff --git a/clients/webassembly/Cargo.toml b/clients/webassembly/Cargo.toml index 91def83246..b46c39fb63 100644 --- a/clients/webassembly/Cargo.toml +++ b/clients/webassembly/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nym-client-wasm" authors = ["Dave Hrycyszyn ", "Jedrzej Stuczynski "] -version = "0.11.0-rc1" +version = "0.11.0" edition = "2018" keywords = ["nym", "sphinx", "wasm", "webassembly", "privacy", "client"] license = "Apache-2.0" diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index a143dee420..621372c085 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "nym-gateway" -version = "0.11.0-rc1" +version = "0.11.0" authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] edition = "2018" diff --git a/gateway/src/commands/upgrade.rs b/gateway/src/commands/upgrade.rs index 4968272e1b..259b498dc7 100644 --- a/gateway/src/commands/upgrade.rs +++ b/gateway/src/commands/upgrade.rs @@ -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, diff --git a/mixnode/Cargo.toml b/mixnode/Cargo.toml index 1539ce6b93..3f12e93ce1 100644 --- a/mixnode/Cargo.toml +++ b/mixnode/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "nym-mixnode" -version = "0.11.0-rc1" +version = "0.11.0" authors = [ "Dave Hrycyszyn ", "Jędrzej Stuczyński ", diff --git a/mixnode/src/commands/upgrade.rs b/mixnode/src/commands/upgrade.rs index 895648b05f..17dfe68f23 100644 --- a/mixnode/src/commands/upgrade.rs +++ b/mixnode/src/commands/upgrade.rs @@ -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 { + 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, diff --git a/service-providers/network-requester/Cargo.toml b/service-providers/network-requester/Cargo.toml index 0342173e4a..b2199a8565 100644 --- a/service-providers/network-requester/Cargo.toml +++ b/service-providers/network-requester/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "nym-network-requester" -version = "0.11.0-rc1" +version = "0.11.0" authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] edition = "2018" diff --git a/validator-api/Cargo.lock b/validator-api/Cargo.lock index ccf826a987..b4947cc83c 100644 --- a/validator-api/Cargo.lock +++ b/validator-api/Cargo.lock @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "nym-validator-api" -version = "0.11.0-rc1" +version = "0.11.0" dependencies = [ "anyhow", "clap", diff --git a/validator-api/Cargo.toml b/validator-api/Cargo.toml index 235e8d3ae1..c58f12fe73 100644 --- a/validator-api/Cargo.toml +++ b/validator-api/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "nym-validator-api" -version = "0.11.0-rc1" +version = "0.11.0" authors = [ "Dave Hrycyszyn ", "Jędrzej Stuczyński ",