diff --git a/Cargo.lock b/Cargo.lock index d6d05d50b7..e6870b620e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -890,9 +890,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2209c310e29876f7f0b2721e7e26b84aff178aa3da5d091f9bfbf47669e60e3" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if 1.0.0", ] @@ -2462,7 +2462,7 @@ dependencies = [ "typed-bytes", "url", "warp", - "zip", + "zip 0.5.13", ] [[package]] @@ -2553,7 +2553,7 @@ dependencies = [ [[package]] name = "jortestkit" version = "0.1.0" -source = "git+https://github.com/input-output-hk/jortestkit.git?branch=master#51f92676429a2e8cd72ee1907195c565824b52d4" +source = "git+https://github.com/input-output-hk/jortestkit.git?branch=master#4907ed1f3f0a341158ca4e53d967c78b86cd00fa" dependencies = [ "assert_fs", "base64", @@ -2573,7 +2573,7 @@ dependencies = [ "predicates", "rand 0.8.4", "rand_chacha 0.3.1", - "rand_core 0.5.1", + "rand_core 0.6.3", "rayon", "reqwest", "semver", @@ -2589,7 +2589,7 @@ dependencies = [ "time 0.3.7", "tokio", "warp", - "zip", + "zip 0.6.0", ] [[package]] @@ -5682,6 +5682,16 @@ dependencies = [ "time 0.1.44", ] +[[package]] +name = "zip" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6fa4aa90e99fb8d701bda16fb040d8ed2f9c7176fb44de750e880a74b580315" +dependencies = [ + "byteorder", + "crc32fast", +] + [[package]] name = "zipkin" version = "0.4.2" diff --git a/testing/jormungandr-automation/src/jcli/api/certificate.rs b/testing/jormungandr-automation/src/jcli/api/certificate.rs index dc5da72967..c7d2ee0e3e 100644 --- a/testing/jormungandr-automation/src/jcli/api/certificate.rs +++ b/testing/jormungandr-automation/src/jcli/api/certificate.rs @@ -3,8 +3,7 @@ use assert_cmd::assert::OutputAssertExt; use assert_fs::{prelude::*, NamedTempFile}; use chain_impl_mockchain::vote::Choice; use jormungandr_lib::interfaces::TaxType; -use jortestkit::file; -use jortestkit::process::output_extensions::ProcessOutput; +use jortestkit::{file, process::output_extensions::ProcessOutput}; use std::path::Path; #[derive(Debug)] @@ -156,7 +155,7 @@ impl Certificate { .as_single_line() } - pub fn stake_pool_id>(self, input_file: P) -> String { + pub fn stake_pool_id>(self, input_file: P) -> Result { println!("Running get stake pool id..."); let temp_file = NamedTempFile::new("stake_pool.id").unwrap(); self.command @@ -168,7 +167,7 @@ impl Certificate { file::read_file(temp_file.path()) } - pub fn vote_plan_id>(self, cert: S) -> String { + pub fn vote_plan_id>(self, cert: S) -> Result { println!("Running get stake pool id..."); let input_file = NamedTempFile::new("cert_file").unwrap(); input_file.write_str(&cert.into()).unwrap(); diff --git a/testing/jormungandr-automation/src/jcli/api/votes/committee/communication_key.rs b/testing/jormungandr-automation/src/jcli/api/votes/committee/communication_key.rs index 8a716ff05b..3fdc483cc5 100644 --- a/testing/jormungandr-automation/src/jcli/api/votes/committee/communication_key.rs +++ b/testing/jormungandr-automation/src/jcli/api/votes/committee/communication_key.rs @@ -24,7 +24,7 @@ impl CommunicationKey { } #[allow(clippy::wrong_self_convention)] - pub fn to_public(self, input: String) -> String { + pub fn to_public(self, input: String) -> Result { let input_file = NamedTempFile::new("input.tmp").unwrap(); input_file.write_str(&input).unwrap(); let output_file = NamedTempFile::new("output.tmp").unwrap(); diff --git a/testing/jormungandr-automation/src/jcli/api/votes/committee/member_key.rs b/testing/jormungandr-automation/src/jcli/api/votes/committee/member_key.rs index e58b341c73..684efcf6fa 100644 --- a/testing/jormungandr-automation/src/jcli/api/votes/committee/member_key.rs +++ b/testing/jormungandr-automation/src/jcli/api/votes/committee/member_key.rs @@ -16,7 +16,10 @@ impl MemberKey { } #[allow(clippy::wrong_self_convention)] - pub fn to_public>(self, member_secret_key: S) -> String { + pub fn to_public>( + self, + member_secret_key: S, + ) -> Result { let input_file = NamedTempFile::new("member_key.tmp").unwrap(); input_file.write_str(&member_secret_key.into()).unwrap(); diff --git a/testing/jormungandr-automation/src/jcli/api/votes/mod.rs b/testing/jormungandr-automation/src/jcli/api/votes/mod.rs index e10af45a0e..733064bbd6 100644 --- a/testing/jormungandr-automation/src/jcli/api/votes/mod.rs +++ b/testing/jormungandr-automation/src/jcli/api/votes/mod.rs @@ -29,7 +29,10 @@ impl Votes { Crs::new(self.votes_command.crs()) } - pub fn election_public_key>(self, member_key: S) -> String { + pub fn election_public_key>( + self, + member_key: S, + ) -> Result { let output_file = NamedTempFile::new("election_public_key.tmp").unwrap(); self.votes_command .election_public_key(member_key, output_file.path()) diff --git a/testing/jormungandr-automation/src/jcli/services/certificate_builder.rs b/testing/jormungandr-automation/src/jcli/services/certificate_builder.rs index a2424c1bd1..875bfc48e1 100644 --- a/testing/jormungandr-automation/src/jcli/services/certificate_builder.rs +++ b/testing/jormungandr-automation/src/jcli/services/certificate_builder.rs @@ -24,7 +24,7 @@ impl CertificateBuilder { stake_pool_id: &str, stake_key_pub: &str, stake_key_file: &Path, - ) -> String { + ) -> Result { let temp_dir = TempDir::new().unwrap(); let stake_delegation_cert = self diff --git a/testing/jormungandr-automation/src/jormungandr/explorer/mod.rs b/testing/jormungandr-automation/src/jormungandr/explorer/mod.rs index 36559fc953..b69d644b91 100644 --- a/testing/jormungandr-automation/src/jormungandr/explorer/mod.rs +++ b/testing/jormungandr-automation/src/jormungandr/explorer/mod.rs @@ -299,8 +299,8 @@ pub fn compare_schema>(actual_schema_path: P) { PathBuf::from_str("./jormungandr-automation/resources/explorer/graphql/schema.graphql") .unwrap(); - if !file::have_the_same_content(actual_schema_path.as_ref(), &expected_schema_path) { - file::copy_file(actual_schema_path.as_ref(), &expected_schema_path, true); + if !file::have_the_same_content(actual_schema_path.as_ref(), &expected_schema_path).unwrap() { + file::copy_file(actual_schema_path.as_ref(), &expected_schema_path, true).unwrap(); println!("discrepancies detected, already replaced file with new content. Please commit to update schema"); } } diff --git a/testing/jormungandr-automation/src/jormungandr/legacy/mod.rs b/testing/jormungandr-automation/src/jormungandr/legacy/mod.rs index 6a614d5f6c..e1e4e9ef6c 100644 --- a/testing/jormungandr-automation/src/jormungandr/legacy/mod.rs +++ b/testing/jormungandr-automation/src/jormungandr/legacy/mod.rs @@ -52,5 +52,7 @@ pub fn get_jormungandr_bin(release: &Release, temp_dir: &impl PathChild) -> Path let release_dir = temp_dir.child(format!("release-{}", release.version())); release_dir.create_dir_all().unwrap(); decompress(output.path(), release_dir.path()).unwrap(); - file::find_file(release_dir.path(), "jormungandr").unwrap() + file::find_file(release_dir.path(), "jormungandr") + .unwrap() + .unwrap() } diff --git a/testing/jormungandr-automation/src/jormungandr/remote.rs b/testing/jormungandr-automation/src/jormungandr/remote.rs index 4fcdb1d32a..6709814860 100644 --- a/testing/jormungandr-automation/src/jormungandr/remote.rs +++ b/testing/jormungandr-automation/src/jormungandr/remote.rs @@ -211,7 +211,7 @@ impl RemoteJormungandrBuilder { pub fn with_node_config(mut self, node_config: PathBuf) -> Self { self.node_config = - Some(serde_yaml::from_str(&jortestkit::file::read_file(node_config)).unwrap()); + Some(serde_yaml::from_str(&jortestkit::file::read_file(node_config).unwrap()).unwrap()); self } diff --git a/testing/jormungandr-integration-tests/src/jcli/certificate/e2e.rs b/testing/jormungandr-integration-tests/src/jcli/certificate/e2e.rs index 4f22044e88..438617c6eb 100644 --- a/testing/jormungandr-integration-tests/src/jcli/certificate/e2e.rs +++ b/testing/jormungandr-integration-tests/src/jcli/certificate/e2e.rs @@ -25,7 +25,7 @@ pub fn test_create_and_sign_new_stake_delegation() { let input_file = temp_dir.child("certificate"); input_file.write_str(&certificate).unwrap(); - let stake_pool_id = jcli.certificate().stake_pool_id(input_file.path()); + let stake_pool_id = jcli.certificate().stake_pool_id(input_file.path()).unwrap(); let certificate = jcli .certificate() .new_stake_delegation(&stake_pool_id, &owner.identifier().to_bech32_str()); diff --git a/testing/jormungandr-integration-tests/src/jcli/certificate/retirement.rs b/testing/jormungandr-integration-tests/src/jcli/certificate/retirement.rs index 16b6b3627d..9715e15136 100644 --- a/testing/jormungandr-integration-tests/src/jcli/certificate/retirement.rs +++ b/testing/jormungandr-integration-tests/src/jcli/certificate/retirement.rs @@ -30,7 +30,7 @@ pub fn jcli_creates_correct_retirement_certificate() { let input_file = temp_dir.child("certificate"); input_file.write_str(&certificate).unwrap(); - let stake_pool_id = jcli.certificate().stake_pool_id(input_file.path()); + let stake_pool_id = jcli.certificate().stake_pool_id(input_file.path()).unwrap(); let expected_certificate = jcli.certificate().new_stake_pool_retirement(&stake_pool_id); let actual_certificate = assert_new_stake_pool_retirement(&stake_pool_id); @@ -38,7 +38,8 @@ pub fn jcli_creates_correct_retirement_certificate() { retirement_cert_file.write_str(&actual_certificate).unwrap(); let stake_pool_id_from_retirement = jcli .certificate() - .stake_pool_id(retirement_cert_file.path()); + .stake_pool_id(retirement_cert_file.path()) + .unwrap(); assert_eq!(expected_certificate, actual_certificate); assert_eq!(stake_pool_id, stake_pool_id_from_retirement); } diff --git a/testing/jormungandr-integration-tests/src/jormungandr/genesis/stake_pool.rs b/testing/jormungandr-integration-tests/src/jormungandr/genesis/stake_pool.rs index b966f55aca..c8e7f61641 100644 --- a/testing/jormungandr-integration-tests/src/jormungandr/genesis/stake_pool.rs +++ b/testing/jormungandr-integration-tests/src/jormungandr/genesis/stake_pool.rs @@ -118,7 +118,8 @@ pub fn create_new_stake_pool( let stake_pool_id = jcli .certificate() - .stake_pool_id(stake_pool_certificate_file.path()); + .stake_pool_id(stake_pool_certificate_file.path()) + .unwrap(); assert!( jcli.rest() diff --git a/testing/jormungandr-integration-tests/src/jormungandr/vit/private.rs b/testing/jormungandr-integration-tests/src/jormungandr/vit/private.rs index b5a621dd78..85832428ec 100644 --- a/testing/jormungandr-integration-tests/src/jormungandr/vit/private.rs +++ b/testing/jormungandr-integration-tests/src/jormungandr/vit/private.rs @@ -41,7 +41,8 @@ pub fn jcli_e2e_flow_private_vote() { .votes() .committee() .communication_key() - .to_public(communication_sk); + .to_public(communication_sk) + .unwrap(); let crs = "Committee member crs"; let member_sk = jcli.votes() @@ -52,8 +53,9 @@ pub fn jcli_e2e_flow_private_vote() { .votes() .committee() .member_key() - .to_public(member_sk.clone()); - let election_public_key = jcli.votes().election_public_key(member_pk.clone()); + .to_public(member_sk.clone()) + .unwrap(); + let election_public_key = jcli.votes().election_public_key(member_pk.clone()).unwrap(); let member_sk_file = NamedTempFile::new("member.sk").unwrap(); member_sk_file.write_str(&member_sk).unwrap(); @@ -134,7 +136,7 @@ pub fn jcli_e2e_flow_private_vote() { time::wait_for_epoch(1, jormungandr.rest()); - let vote_plan_id = jcli.certificate().vote_plan_id(&vote_plan_cert); + let vote_plan_id = jcli.certificate().vote_plan_id(&vote_plan_cert).unwrap(); let yes_vote_cast = jcli.certificate().new_private_vote_cast( vote_plan_id.clone(), 0, @@ -278,7 +280,8 @@ pub fn jcli_private_vote_invalid_proof() { .votes() .committee() .communication_key() - .to_public(communication_sk); + .to_public(communication_sk) + .unwrap(); let crs = "Committee member crs"; let invald_crs = "Invalid Committee member crs"; @@ -292,7 +295,8 @@ pub fn jcli_private_vote_invalid_proof() { .votes() .committee() .member_key() - .to_public(member_sk.clone()); + .to_public(member_sk.clone()) + .unwrap(); let member_sk_file = NamedTempFile::new("member.sk").unwrap(); member_sk_file.write_str(&member_sk).unwrap(); @@ -373,7 +377,7 @@ pub fn jcli_private_vote_invalid_proof() { jormungandr.rest(), ); - let vote_plan_id = jcli.certificate().vote_plan_id(&vote_plan_cert); + let vote_plan_id = jcli.certificate().vote_plan_id(&vote_plan_cert).unwrap(); jcli.fragment_sender(&jormungandr) .send(&tx) diff --git a/testing/jormungandr-integration-tests/src/jormungandr/vit/public.rs b/testing/jormungandr-integration-tests/src/jormungandr/vit/public.rs index d6895dc754..bf574d07ad 100644 --- a/testing/jormungandr-integration-tests/src/jormungandr/vit/public.rs +++ b/testing/jormungandr-integration-tests/src/jormungandr/vit/public.rs @@ -569,7 +569,7 @@ pub fn jcli_e2e_flow() { time::wait_for_epoch(1, jormungandr.rest()); - let vote_plan_id = jcli.certificate().vote_plan_id(&vote_plan_cert); + let vote_plan_id = jcli.certificate().vote_plan_id(&vote_plan_cert).unwrap(); let vote_cast = jcli .certificate() .new_public_vote_cast(vote_plan_id.clone(), 0, yes_choice); diff --git a/testing/mjolnir/src/mjolnir_lib/bootstrap/scenario/mod.rs b/testing/mjolnir/src/mjolnir_lib/bootstrap/scenario/mod.rs index 23b6503c14..1a529d7253 100644 --- a/testing/mjolnir/src/mjolnir_lib/bootstrap/scenario/mod.rs +++ b/testing/mjolnir/src/mjolnir_lib/bootstrap/scenario/mod.rs @@ -24,7 +24,7 @@ pub fn copy_initial_storage_if_used( fs::remove_dir_all(&client_storage).expect("cannot remove existing client storage"); } fs::create_dir(&client_storage).expect("cannot create client storage"); - file::copy_folder(storage, &client_storage, true); + file::copy_folder(storage, &client_storage, true).unwrap() } } diff --git a/testing/thor/src/fragment/export.rs b/testing/thor/src/fragment/export.rs index caad9b67b8..b95ec19742 100644 --- a/testing/thor/src/fragment/export.rs +++ b/testing/thor/src/fragment/export.rs @@ -60,7 +60,7 @@ impl FragmentExporter { .ends_with(".fragment") }) .map(|path| { - let content = jortestkit::prelude::read_file(path); + let content = jortestkit::prelude::read_file(path).unwrap(); let bytes = hex::decode(content.trim()).unwrap(); Ok(bytes) }) diff --git a/testing/thor/src/wallet/mod.rs b/testing/thor/src/wallet/mod.rs index 43af4ec691..ab792e6429 100644 --- a/testing/thor/src/wallet/mod.rs +++ b/testing/thor/src/wallet/mod.rs @@ -93,7 +93,7 @@ impl Wallet { spending_counter: Option, discrimination: Discrimination, ) -> Wallet { - let bech32_str = jortestkit::file::read_file(secret_key_file); + let bech32_str = jortestkit::file::read_file(secret_key_file).unwrap(); Wallet::Account(account::Wallet::from_existing_account( &bech32_str, spending_counter.map(Into::into),