diff --git a/Cargo.lock b/Cargo.lock index fee5cc172..02c4e1865 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3907,12 +3907,23 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -4769,6 +4780,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + [[package]] name = "lock_api" version = "0.4.12" @@ -7363,7 +7380,7 @@ checksum = "4e69bf016dc406eff7d53a7d3f7cf1c2e72c82b9088aac1118591e36dd2cd3e9" dependencies = [ "bitcoin_hashes 0.13.0", "rand", - "rand_core 0.5.1", + "rand_core 0.6.4", "serde", "unicode-normalization", ] @@ -11789,6 +11806,16 @@ dependencies = [ "time-core", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -12261,12 +12288,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.13" @@ -12330,9 +12351,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -12346,6 +12367,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -13151,6 +13184,18 @@ version = "0.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -13323,6 +13368,27 @@ dependencies = [ "synstructure 0.13.1", ] +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", + "synstructure", +] + [[package]] name = "zeroize" version = "1.8.1" @@ -13365,6 +13431,28 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "zip" version = "2.2.0" diff --git a/Cargo.toml b/Cargo.toml index 38a3870e3..ffec8bfe2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,6 +69,7 @@ indexmap = "2.2" toml_edit = { version = "0.22", features = ["serde"] } symlink = "0.1" scale-info = { version = "2.11.3", default-features = false, features = ["derive"] } +scale-value = { version = "0.16.2", default-features = false, features = ["from-string", "parser-ss58"] } serde_json = { version = "1.0", features = ["preserve_order"] } serde = { version = "1.0", features = ["derive"] } zombienet-sdk = "0.2.18" diff --git a/crates/pop-cli/src/commands/call/chain.rs b/crates/pop-cli/src/commands/call/chain.rs index 9751b7dd9..0179f1b8f 100644 --- a/crates/pop-cli/src/commands/call/chain.rs +++ b/crates/pop-cli/src/commands/call/chain.rs @@ -100,8 +100,9 @@ impl CallChainCommand { break; } - if !prompt_to_repeat_call || - !cli.confirm("Do you want to perform another call?") + if !prompt_to_repeat_call + || !cli + .confirm("Do you want to perform another call?") .initial_value(false) .interact()? { @@ -200,8 +201,9 @@ impl CallChainCommand { // Resolve who is signing the extrinsic. let suri = match self.suri.as_ref() { Some(suri) => suri.clone(), - None => - cli.input("Signer of the extrinsic:").default_input(DEFAULT_URI).interact()?, + None => { + cli.input("Signer of the extrinsic:").default_input(DEFAULT_URI).interact()? + }, }; return Ok(Call { @@ -228,8 +230,9 @@ impl CallChainCommand { None => &cli.input("Signer of the extrinsic:").default_input(DEFAULT_URI).interact()?, }; cli.info(format!("Encoded call data: {}", call_data))?; - if !self.skip_confirm && - !cli.confirm("Do you want to submit the extrinsic?") + if !self.skip_confirm + && !cli + .confirm("Do you want to submit the extrinsic?") .initial_value(true) .interact()? { @@ -257,7 +260,7 @@ impl CallChainCommand { // execute the call via `sudo`. fn configure_sudo(&mut self, chain: &Chain, cli: &mut impl Cli) -> Result<()> { match find_dispatchable_by_name(&chain.pallets, "Sudo", "sudo") { - Ok(_) => + Ok(_) => { if !self.sudo { self.sudo = cli .confirm( @@ -265,14 +268,16 @@ impl CallChainCommand { ) .initial_value(false) .interact()?; - }, - Err(_) => + } + }, + Err(_) => { if self.sudo { cli.warning( "NOTE: sudo is not supported by the chain. Ignoring `--sudo` flag.", )?; self.sudo = false; - }, + } + }, } Ok(()) } @@ -287,11 +292,11 @@ impl CallChainCommand { // Function to check if all required fields are specified. fn requires_user_input(&self) -> bool { - self.pallet.is_none() || - self.function.is_none() || - self.args.is_empty() || - self.url.is_none() || - self.suri.is_none() + self.pallet.is_none() + || self.function.is_none() + || self.args.is_empty() + || self.url.is_none() + || self.suri.is_none() } /// Replaces file arguments with their contents, leaving other arguments unchanged. @@ -371,8 +376,9 @@ impl Call { tx: DynamicPayload, cli: &mut impl Cli, ) -> Result<()> { - if !self.skip_confirm && - !cli.confirm("Do you want to submit the extrinsic?") + if !self.skip_confirm + && !cli + .confirm("Do you want to submit the extrinsic?") .initial_value(true) .interact()? { diff --git a/crates/pop-contracts/src/call.rs b/crates/pop-contracts/src/call.rs index 546415ec5..03effcb0a 100644 --- a/crates/pop-contracts/src/call.rs +++ b/crates/pop-contracts/src/call.rs @@ -179,7 +179,7 @@ mod tests { use crate::{ contracts_node_generator, dry_run_gas_estimate_instantiate, errors::Error, instantiate_smart_contract, mock_build_process, new_environment, run_contracts_node, - set_up_deployment, testing::find_free_port, UpOpts, + set_up_deployment, UpOpts, }; use anyhow::Result; use pop_common::{find_free_port, set_executable_permission}; diff --git a/crates/pop-contracts/src/lib.rs b/crates/pop-contracts/src/lib.rs index e775d7f08..69897be33 100644 --- a/crates/pop-contracts/src/lib.rs +++ b/crates/pop-contracts/src/lib.rs @@ -20,7 +20,7 @@ pub use new::{create_smart_contract, is_valid_contract_name}; pub use node::{contracts_node_generator, is_chain_alive, run_contracts_node}; pub use templates::{Contract, ContractType}; pub use test::{test_e2e_smart_contract, test_smart_contract}; -pub use testing::{find_free_port, mock_build_process, new_environment}; +pub use testing::{mock_build_process, new_environment}; pub use up::{ dry_run_gas_estimate_instantiate, dry_run_upload, get_code_hash_from_event, get_contract_code, get_instantiate_payload, get_upload_payload, instantiate_contract_signed, diff --git a/crates/pop-contracts/src/node/mod.rs b/crates/pop-contracts/src/node/mod.rs index 7818d53d5..be5680a04 100644 --- a/crates/pop-contracts/src/node/mod.rs +++ b/crates/pop-contracts/src/node/mod.rs @@ -166,8 +166,6 @@ fn release_directory_by_target(tag: Option<&str>) -> Result<&'static str, Error> #[cfg(test)] mod tests { - use crate::testing::find_free_port; - use super::*; use anyhow::{Error, Result}; use pop_common::find_free_port; diff --git a/crates/pop-contracts/src/testing.rs b/crates/pop-contracts/src/testing.rs index c10bd4e5f..6a8abfcd9 100644 --- a/crates/pop-contracts/src/testing.rs +++ b/crates/pop-contracts/src/testing.rs @@ -4,7 +4,6 @@ use crate::{create_smart_contract, Contract}; use anyhow::Result; use std::{ fs::{copy, create_dir}, - net::TcpListener, path::Path, }; @@ -38,12 +37,3 @@ where copy(metadata_file, target_contract_dir.join("ink/testing.json"))?; Ok(()) } - -/// Finds an available port by binding to port 0 and retrieving the assigned port. -pub fn find_free_port() -> u16 { - TcpListener::bind("127.0.0.1:0") - .expect("Failed to bind to an available port") - .local_addr() - .expect("Failed to retrieve local address") - .port() -} diff --git a/crates/pop-contracts/src/up.rs b/crates/pop-contracts/src/up.rs index b731b1c31..66dd54980 100644 --- a/crates/pop-contracts/src/up.rs +++ b/crates/pop-contracts/src/up.rs @@ -381,7 +381,7 @@ mod tests { use super::*; use crate::{ contracts_node_generator, errors::Error, mock_build_process, new_environment, - run_contracts_node, testing::find_free_port, + run_contracts_node, }; use anyhow::Result; use pop_common::{find_free_port, set_executable_permission};