diff --git a/crates/rooch-config/src/lib.rs b/crates/rooch-config/src/lib.rs index 310b6b7fa4..93ecd6bd42 100644 --- a/crates/rooch-config/src/lib.rs +++ b/crates/rooch-config/src/lib.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 pub mod rpc; +pub mod ws; use anyhow::{Context, Result}; use serde::{de::DeserializeOwned, Serialize}; diff --git a/crates/rooch-config/src/rpc/server_config.rs b/crates/rooch-config/src/rpc/server_config.rs index 78b3bcfcff..bae7b34991 100644 --- a/crates/rooch-config/src/rpc/server_config.rs +++ b/crates/rooch-config/src/rpc/server_config.rs @@ -16,7 +16,7 @@ pub struct ServerConfig { } impl ServerConfig { - pub fn url(&self, https: bool) -> String { + pub fn rpc_url(&self, https: bool) -> String { let schema = if https { "https" } else { "http" }; format!("{}://{}:{}", schema, self.host, self.port) @@ -37,7 +37,7 @@ impl Display for ServerConfig { impl Default for ServerConfig { fn default() -> Self { Self { - host: "0.0.0.0".to_string(), + host: "0.0.0.0".to_owned(), port: 50051, proposer_address: None, sequencer_address: None, diff --git a/crates/rooch-config/src/ws/mod.rs b/crates/rooch-config/src/ws/mod.rs new file mode 100644 index 0000000000..a0a1b9904a --- /dev/null +++ b/crates/rooch-config/src/ws/mod.rs @@ -0,0 +1,4 @@ +// Copyright (c) RoochNetwork +// SPDX-License-Identifier: Apache-2.0 + +pub mod relay_config; diff --git a/crates/rooch-config/src/ws/relay_config.rs b/crates/rooch-config/src/ws/relay_config.rs new file mode 100644 index 0000000000..30f6ab78ca --- /dev/null +++ b/crates/rooch-config/src/ws/relay_config.rs @@ -0,0 +1,44 @@ +// Copyright (c) RoochNetwork +// SPDX-License-Identifier: Apache-2.0 + +use serde::Deserialize; +use serde::Serialize; +use std::fmt::{Display, Formatter, Result, Write}; + +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)] +pub struct RelayConfig { + pub host: String, + pub port: u16, + pub remote_ip_header: Option, + pub ping_interval_seconds: u32, +} + +impl RelayConfig { + pub fn ws_url(&self, https: bool) -> String { + let schema = if https { "wss" } else { "ws" }; + + format!("{}://{}:{}", schema, self.host, self.port) + } +} + +impl Display for RelayConfig { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + let mut writer = String::new(); + + writeln!(writer, "host : {}", self.host)?; + writeln!(writer, "port : {}", self.port)?; + + write!(f, "{}", writer) + } +} + +impl Default for RelayConfig { + fn default() -> Self { + Self { + host: "0.0.0.0".to_owned(), + port: 8080, + remote_ip_header: None, + ping_interval_seconds: 300, + } + } +} diff --git a/crates/rooch-integration-test-runner/src/lib.rs b/crates/rooch-integration-test-runner/src/lib.rs index 03f4667b82..41f6ba05fb 100644 --- a/crates/rooch-integration-test-runner/src/lib.rs +++ b/crates/rooch-integration-test-runner/src/lib.rs @@ -362,7 +362,7 @@ pub fn run_integration_test_with_extended_check( let buffer_output = String::from_utf8_lossy(buffer.as_slice()).to_string(); let re = Regex::new("(/.*)(.move:[0-9]+:[0-9]+)").unwrap(); Some( - re.replace(buffer_output.as_str(), "/tmp/tempfile$2".to_string()) + re.replace(buffer_output.as_str(), "/tmp/tempfile$2".to_owned()) .to_string(), ) } else { diff --git a/crates/rooch-key/src/key_derive.rs b/crates/rooch-key/src/key_derive.rs index 5e5baaa373..0cc861be08 100644 --- a/crates/rooch-key/src/key_derive.rs +++ b/crates/rooch-key/src/key_derive.rs @@ -54,17 +54,17 @@ pub fn validate_path( { Ok(p) } else { - Err(RoochError::SignatureKeyGenError("Invalid path".to_string())) + Err(RoochError::SignatureKeyGenError("Invalid path".to_owned())) } } else { - Err(RoochError::SignatureKeyGenError("Invalid path".to_string())) + Err(RoochError::SignatureKeyGenError("Invalid path".to_owned())) } } None => Ok(format!( "m/{DERVIATION_PATH_PURPOSE_ED25519}'/{DERIVATION_PATH_COIN_TYPE}'/0'/0'/0'" ) .parse() - .map_err(|_| RoochError::SignatureKeyGenError("Cannot parse path".to_string()))?), + .map_err(|_| RoochError::SignatureKeyGenError("Cannot parse path".to_owned()))?), } } diff --git a/crates/rooch-open-rpc/src/lib.rs b/crates/rooch-open-rpc/src/lib.rs index 801f22ca6d..c2ebc2a4a9 100644 --- a/crates/rooch-open-rpc/src/lib.rs +++ b/crates/rooch-open-rpc/src/lib.rs @@ -39,7 +39,7 @@ impl Project { license: &str, license_url: &str, ) -> Self { - let openrpc: String = "1.2.6".to_string(); + let openrpc: String = "1.2.6".to_owned(); Self { openrpc, info: Info { @@ -230,7 +230,7 @@ impl ExamplePairing { }) .collect(), result: Example { - name: "Result".to_string(), + name: "Result".to_owned(), summary: None, description: None, value: result, @@ -309,7 +309,7 @@ impl Default for RpcModuleDocBuilder { fn default() -> Self { let schema_generator = SchemaSettings::default() .with(|s| { - s.definitions_path = "#/components/schemas/".to_string(); + s.definitions_path = "#/components/schemas/".to_owned(); }) .into_generator(); diff --git a/crates/rooch-rpc-api/src/api/eth_api.rs b/crates/rooch-rpc-api/src/api/eth_api.rs index ddb3731096..427514fc7b 100644 --- a/crates/rooch-rpc-api/src/api/eth_api.rs +++ b/crates/rooch-rpc-api/src/api/eth_api.rs @@ -82,7 +82,7 @@ pub trait EthAPI { // because it requires a signer to be available. // Please use the `eth_sendRawTransaction` method instead. //TODO find a suitable error code - Err(jsonrpsee::core::Error::Custom("eth_sendTransaction is not supported by this server. Please use eth_sendRawTransaction instead.".to_string())) + Err(jsonrpsee::core::Error::Custom("eth_sendTransaction is not supported by this server. Please use eth_sendRawTransaction instead.".to_owned())) } /// Sends signed transaction, returning its hash. diff --git a/crates/rooch-rpc-client/src/client_config.rs b/crates/rooch-rpc-client/src/client_config.rs index 5bd5ad92bb..a72cc12904 100644 --- a/crates/rooch-rpc-client/src/client_config.rs +++ b/crates/rooch-rpc-client/src/client_config.rs @@ -4,6 +4,7 @@ use crate::{Client, ClientBuilder}; use anyhow::anyhow; use rooch_config::rpc::server_config::ServerConfig; +use rooch_config::ws::relay_config::RelayConfig; use rooch_config::Config; use rooch_key::keystore::{AccountKeystore, Keystore}; use rooch_types::address::RoochAddress; @@ -91,9 +92,9 @@ impl Env { impl Default for Env { fn default() -> Self { Env { - alias: "default".to_string(), - rpc: ServerConfig::default().url(false), - ws: None, + alias: "default".to_owned(), + rpc: ServerConfig::default().rpc_url(false), + ws: Some(RelayConfig::default().ws_url(false)), } } } diff --git a/crates/rooch-rpc-client/src/wallet_context.rs b/crates/rooch-rpc-client/src/wallet_context.rs index c3ee62082f..bc750c5b2d 100644 --- a/crates/rooch-rpc-client/src/wallet_context.rs +++ b/crates/rooch-rpc-client/src/wallet_context.rs @@ -120,7 +120,7 @@ impl WalletContext { let address = match account.as_str() { "default" => AccountAddress::from(self.config.active_address.unwrap()), _ => Err(RoochError::CommandArgumentError( - "Use rooch init configuration".to_string(), + "Use rooch init configuration".to_owned(), ))?, }; diff --git a/crates/rooch-types/src/crypto.rs b/crates/rooch-types/src/crypto.rs index aa58c1fde1..4287e4c84f 100644 --- a/crates/rooch-types/src/crypto.rs +++ b/crates/rooch-types/src/crypto.rs @@ -62,7 +62,7 @@ impl BuiltinScheme { pub fn from_flag(flag: &str) -> Result { let byte_int = flag .parse::() - .map_err(|_| RoochError::KeyConversionError("Invalid key scheme".to_string()))?; + .map_err(|_| RoochError::KeyConversionError("Invalid key scheme".to_owned()))?; Self::from_flag_byte(&byte_int) } @@ -72,7 +72,7 @@ impl BuiltinScheme { 0x01 => Ok(BuiltinScheme::MultiEd25519), 0x02 => Ok(BuiltinScheme::Secp256k1), _ => Err(RoochError::KeyConversionError( - "Invalid key scheme".to_string(), + "Invalid key scheme".to_owned(), )), } } @@ -319,7 +319,7 @@ pub trait RoochSignatureInner: Sized + ToFromBytes + PartialEq + Eq + Hash { // Is this signature emitted by the expected author? let bytes = self.public_key_bytes(); let pk = Self::PubKey::from_bytes(bytes) - .map_err(|_| RoochError::KeyConversionError("Invalid public key".to_string()))?; + .map_err(|_| RoochError::KeyConversionError("Invalid public key".to_owned()))?; let received_addr = RoochAddress::from(&pk); if received_addr != author { @@ -331,7 +331,7 @@ pub trait RoochSignatureInner: Sized + ToFromBytes + PartialEq + Eq + Hash { // deserialize the signature let signature = Self::Sig::from_bytes(self.signature_bytes()).map_err(|_| { RoochError::InvalidSignature { - error: "Fail to get pubkey and sig".to_string(), + error: "Fail to get pubkey and sig".to_owned(), } })?; @@ -418,7 +418,7 @@ impl Signature { BuiltinScheme::Ed25519 => Ok(CompressedSignature::Ed25519( (&Ed25519Signature::from_bytes(bytes).map_err(|_| { RoochError::InvalidSignature { - error: "Cannot parse sig".to_string(), + error: "Cannot parse sig".to_owned(), } })?) .into(), @@ -426,13 +426,13 @@ impl Signature { BuiltinScheme::Secp256k1 => Ok(CompressedSignature::Secp256k1( (&Secp256k1Signature::from_bytes(bytes).map_err(|_| { RoochError::InvalidSignature { - error: "Cannot parse sig".to_string(), + error: "Cannot parse sig".to_owned(), } })?) .into(), )), _ => Err(RoochError::UnsupportedFeatureError { - error: "Unsupported signature scheme in MultiSig".to_string(), + error: "Unsupported signature scheme in MultiSig".to_owned(), }), } } @@ -444,16 +444,16 @@ impl Signature { match self.scheme() { BuiltinScheme::Ed25519 => Ok(PublicKey::Ed25519( (&Ed25519PublicKey::from_bytes(bytes) - .map_err(|_| RoochError::KeyConversionError("Cannot parse pk".to_string()))?) + .map_err(|_| RoochError::KeyConversionError("Cannot parse pk".to_owned()))?) .into(), )), BuiltinScheme::Secp256k1 => Ok(PublicKey::Secp256k1( (&Secp256k1PublicKey::from_bytes(bytes) - .map_err(|_| RoochError::KeyConversionError("Cannot parse pk".to_string()))?) + .map_err(|_| RoochError::KeyConversionError("Cannot parse pk".to_owned()))?) .into(), )), _ => Err(RoochError::UnsupportedFeatureError { - error: "Unsupported signature scheme in MultiSig".to_string(), + error: "Unsupported signature scheme in MultiSig".to_owned(), }), } } diff --git a/crates/rooch/src/cli_types.rs b/crates/rooch/src/cli_types.rs index a0dcb42fa8..fb0068c8de 100644 --- a/crates/rooch/src/cli_types.rs +++ b/crates/rooch/src/cli_types.rs @@ -79,7 +79,7 @@ pub fn load_account_arg(str: &str) -> RoochResult { } else { Err(RoochError::UnableToParse( "Address", - "Address should be in hex format".to_string(), + "Address should be in hex format".to_owned(), )) } } @@ -264,11 +264,11 @@ impl FromStr for FunctionArgType { if arg == FunctionArgType::Raw { return Err(RoochError::CommandArgumentError( - "vector is not supported".to_string(), + "vector is not supported".to_owned(), )); } else if matches!(arg, FunctionArgType::Vector(_)) { return Err(RoochError::CommandArgumentError( - "nested vector> is not supported".to_string(), + "nested vector> is not supported".to_owned(), )); } @@ -370,7 +370,7 @@ impl ArgWithType { } FunctionArgType::Raw | FunctionArgType::Vector(_) => { return Err(RoochError::UnexpectedError( - "Nested vectors not supported".to_string(), + "Nested vectors not supported".to_owned(), )); } }, @@ -396,7 +396,7 @@ impl FromStr for ArgWithType { let u = s.splitn(2, 'u').collect::>(); if u.len() != 2 { return Err(RoochError::CommandArgumentError( - "Arguments must be pairs of : e.g. bool:true".to_string(), + "Arguments must be pairs of : e.g. bool:true".to_owned(), )); } else { let ty_str = String::from("u") + u[1]; @@ -411,7 +411,7 @@ impl FromStr for ArgWithType { (ty, arg) } else { return Err(RoochError::CommandArgumentError( - "Arguments must be pairs of : e.g. bool:true".to_string(), + "Arguments must be pairs of : e.g. bool:true".to_owned(), )); }; let arg = ty.parse_arg(arg)?; diff --git a/crates/rooch/src/commands/account/mod.rs b/crates/rooch/src/commands/account/mod.rs index 12312e8b5d..a49bcbb924 100644 --- a/crates/rooch/src/commands/account/mod.rs +++ b/crates/rooch/src/commands/account/mod.rs @@ -27,8 +27,8 @@ impl CommandAction for Account { AccountCommand::Create(create) => create.execute().await.map(|resp| { serde_json::to_string_pretty(&resp).expect("Failed to serialize response") }), - AccountCommand::List(list) => list.execute().await.map(|_| "".to_string()), - AccountCommand::Import(import) => import.execute().await.map(|_| "".to_string()), + AccountCommand::List(list) => list.execute().await.map(|_| "".to_owned()), + AccountCommand::Import(import) => import.execute().await.map(|_| "".to_owned()), } .map_err(RoochError::from) } diff --git a/crates/rooch/src/commands/init.rs b/crates/rooch/src/commands/init.rs index 47dd80a442..a2acdab032 100644 --- a/crates/rooch/src/commands/init.rs +++ b/crates/rooch/src/commands/init.rs @@ -33,11 +33,11 @@ impl CommandAction for Init { }; // Prompt user for connect to devnet fullnode if config does not exist. if !client_config_path.exists() { - let env = match std::env::var_os("ROOCH_CONFIG_WITH_RPC_URL") { + let env = match std::env::var_os("ROOCH_CONFIG_WITH_RPC_WS_URL") { Some(v) => Some(Env { - alias: "custom".to_string(), - rpc: v.into_string().unwrap(), - ws: None, + alias: "custom".to_owned(), + rpc: v.clone().into_string().unwrap(), + ws: Some(v.clone().into_string().unwrap()), }), None => { if self.accept_defaults { @@ -63,16 +63,17 @@ impl CommandAction for Init { Env::default() } else { print!("Environment alias for [{url}] : "); + let cloned_url = url.clone(); let alias = read_line()?; let alias = if alias.trim().is_empty() { - "custom".to_string() + "custom".to_owned() } else { alias }; Env { alias, rpc: url, - ws: None, + ws: Some(cloned_url), } }) } else { diff --git a/crates/rooch/src/commands/move_cli/commands/integration_test.rs b/crates/rooch/src/commands/move_cli/commands/integration_test.rs index d964f5546d..280856de82 100644 --- a/crates/rooch/src/commands/move_cli/commands/integration_test.rs +++ b/crates/rooch/src/commands/move_cli/commands/integration_test.rs @@ -217,33 +217,33 @@ impl IntegrationTest { data, ) }, - "integration-test333".to_string(), + "integration-test333".to_owned(), tests_dir.display().to_string(), - r".*\.move".to_string(), + r".*\.move".to_owned(), named_address_string_map, ); if self.update_baseline { std::env::set_var(UPDATE_BASELINE, "true"); } let mut test_args = vec![ - "test_runner".to_string(), - "--format".to_string(), + "test_runner".to_owned(), + "--format".to_owned(), self.test_opts.format.to_string(), - "--test-threads".to_string(), + "--test-threads".to_owned(), self.test_opts.test_threads.to_string(), ]; if self.test_opts.list { - test_args.push("--list".to_string()); + test_args.push("--list".to_owned()); } if self.test_opts.quiet { - test_args.push("--quiet".to_string()); + test_args.push("--quiet".to_owned()); } if self.test_opts.filter_exact { - test_args.push("--exact".to_string()); + test_args.push("--exact".to_owned()); } if let Some(filter) = self.test_opts.filter { - test_args.push("--".to_string()); + test_args.push("--".to_owned()); test_args.push(filter); } diff --git a/crates/rooch/src/commands/move_cli/commands/run_function.rs b/crates/rooch/src/commands/move_cli/commands/run_function.rs index 3ec42cb141..33084d8e0f 100644 --- a/crates/rooch/src/commands/move_cli/commands/run_function.rs +++ b/crates/rooch/src/commands/move_cli/commands/run_function.rs @@ -63,7 +63,7 @@ impl CommandAction for RunFunction { if self.tx_options.sender_account.is_none() { return Err(RoochError::CommandArgumentError( - "--sender-account required".to_string(), + "--sender-account required".to_owned(), )); } diff --git a/crates/rooch/src/commands/move_cli/mod.rs b/crates/rooch/src/commands/move_cli/mod.rs index 38cd0abaa7..44d5b088cf 100644 --- a/crates/rooch/src/commands/move_cli/mod.rs +++ b/crates/rooch/src/commands/move_cli/mod.rs @@ -53,47 +53,47 @@ impl CommandAction for MoveCli { MoveCommand::Build(c) => c .execute(move_args.package_path, move_args.build_config) .await - .map(|_| "Success".to_string()) + .map(|_| "Success".to_owned()) .map_err(RoochError::from), MoveCommand::Coverage(c) => c .execute(move_args.package_path, move_args.build_config) - .map(|_| "Success".to_string()) + .map(|_| "Success".to_owned()) .map_err(RoochError::from), MoveCommand::Disassemble(c) => c .execute(move_args.package_path, move_args.build_config) - .map(|_| "Success".to_string()) + .map(|_| "Success".to_owned()) .map_err(RoochError::from), MoveCommand::Docgen(c) => c .execute(move_args.package_path, move_args.build_config) - .map(|_| "Success".to_string()) + .map(|_| "Success".to_owned()) .map_err(RoochError::from), MoveCommand::Errmap(c) => c .execute(move_args.package_path, move_args.build_config) - .map(|_| "Success".to_string()) + .map(|_| "Success".to_owned()) .map_err(RoochError::from), MoveCommand::Info(c) => c .execute(move_args.package_path, move_args.build_config) - .map(|_| "Success".to_string()) + .map(|_| "Success".to_owned()) .map_err(RoochError::from), MoveCommand::New(c) => c .execute(move_args.package_path) .await - .map(|_| "Success".to_string()) + .map(|_| "Success".to_owned()) .map_err(RoochError::from), MoveCommand::Prove(c) => c .execute(move_args.package_path, move_args.build_config) - .map(|_| "Success".to_string()) + .map(|_| "Success".to_owned()) .map_err(RoochError::from), MoveCommand::Test(c) => c .execute(move_args.package_path, move_args.build_config) - .map(|_| "Success".to_string()) + .map(|_| "Success".to_owned()) .map_err(RoochError::from), MoveCommand::Publish(c) => c.execute_serialized().await, MoveCommand::Run(c) => c.execute_serialized().await, MoveCommand::View(c) => c.execute_serialized().await, MoveCommand::IntegrationTest(c) => c .execute(move_args) - .map(|_| "Success".to_string()) + .map(|_| "Success".to_owned()) .map_err(RoochError::from), } } diff --git a/crates/testsuite/tests/integration.rs b/crates/testsuite/tests/integration.rs index 75cac2df0e..fe3e0962a0 100644 --- a/crates/testsuite/tests/integration.rs +++ b/crates/testsuite/tests/integration.rs @@ -55,10 +55,10 @@ async fn run_cmd(world: &mut World, args: String) { match context.config.active_address { Some(addr) => AccountAddress::from(addr).to_hex_literal(), - None => "".to_string(), + None => "".to_owned(), } } else { - "".to_string() + "".to_owned() }; let args = args.replace("{default}", &default); @@ -71,8 +71,8 @@ async fn run_cmd(world: &mut World, args: String) { let mut args = split_string_with_quotes(&args).expect("Invalid commands"); let cmd_name = args[0].clone(); - args.insert(0, "rooch".to_string()); - args.push("--config-dir".to_string()); + args.insert(0, "rooch".to_owned()); + args.push("--config-dir".to_owned()); args.push(config_dir.to_str().unwrap().to_string()); let opts: RoochCli = RoochCli::parse_from(args); let output = rooch::run_cli(opts) diff --git a/moveos/moveos-stdlib-builder/src/lib.rs b/moveos/moveos-stdlib-builder/src/lib.rs index 87d1d10bdf..00ba59f43c 100644 --- a/moveos/moveos-stdlib-builder/src/lib.rs +++ b/moveos/moveos-stdlib-builder/src/lib.rs @@ -145,7 +145,7 @@ impl Stdlib { toc_depth: Option::None, no_collapsed_sections: false, output_directory: None, - template: vec!["doc_template/README.md".to_string()], + template: vec!["doc_template/README.md".to_owned()], references_file: Option::None, include_dep_diagrams: false, include_call_diagrams: false, diff --git a/moveos/moveos-verifier/src/metadata.rs b/moveos/moveos-verifier/src/metadata.rs index d10d6c7a8c..ed446893db 100644 --- a/moveos/moveos-verifier/src/metadata.rs +++ b/moveos/moveos-verifier/src/metadata.rs @@ -503,20 +503,20 @@ pub fn is_defined_or_allowed_in_current_module( (false, struct_name) } - SignatureToken::TypeParameter(_) => (true, "TypeParameter".to_string()), + SignatureToken::TypeParameter(_) => (true, "TypeParameter".to_owned()), // Other types are not allowed. - SignatureToken::Bool => (false, "Bool".to_string()), - SignatureToken::U8 => (false, "U8".to_string()), - SignatureToken::U16 => (false, "U16".to_string()), - SignatureToken::U32 => (false, "U32".to_string()), - SignatureToken::U64 => (false, "U64".to_string()), - SignatureToken::U128 => (false, "U128".to_string()), - SignatureToken::U256 => (false, "U256".to_string()), - SignatureToken::Signer => (false, "Signer".to_string()), - SignatureToken::Address => (false, "Address".to_string()), - SignatureToken::Vector(_) => (false, "Vector".to_string()), - SignatureToken::Reference(_) => (false, "Reference".to_string()), - SignatureToken::MutableReference(_) => (false, "MutableReference".to_string()), + SignatureToken::Bool => (false, "Bool".to_owned()), + SignatureToken::U8 => (false, "U8".to_owned()), + SignatureToken::U16 => (false, "U16".to_owned()), + SignatureToken::U32 => (false, "U32".to_owned()), + SignatureToken::U64 => (false, "U64".to_owned()), + SignatureToken::U128 => (false, "U128".to_owned()), + SignatureToken::U256 => (false, "U256".to_owned()), + SignatureToken::Signer => (false, "Signer".to_owned()), + SignatureToken::Address => (false, "Address".to_owned()), + SignatureToken::Vector(_) => (false, "Vector".to_owned()), + SignatureToken::Reference(_) => (false, "Reference".to_owned()), + SignatureToken::MutableReference(_) => (false, "MutableReference".to_owned()), } } diff --git a/moveos/moveos-verifier/src/verifier.rs b/moveos/moveos-verifier/src/verifier.rs index ba2c723e31..6249710ed3 100644 --- a/moveos/moveos-verifier/src/verifier.rs +++ b/moveos/moveos-verifier/src/verifier.rs @@ -167,7 +167,7 @@ pub fn verify_entry_function_at_publish(module: &CompiledModule) -> VMResult(filename: &Path) -> Result(state_root, "key2".to_string(), None) + .verify::(state_root, "key2".to_owned(), None) .is_ok()); let mut iter = smt.iter(None).unwrap(); @@ -28,10 +28,10 @@ fn test_smt() { let item = iter.next(); assert_eq!(item.unwrap().unwrap(), (key.to_string(), value.to_string())); - let key2 = "key2".to_string(); - let value2 = "value2".to_string(); - let key3 = "key3".to_string(); - let value3 = "value3".to_string(); + let key2 = "key2".to_owned(); + let value2 = "value2".to_owned(); + let key3 = "key3".to_owned(); + let value3 = "value3".to_owned(); let state_root = smt .puts(vec![ @@ -40,7 +40,7 @@ fn test_smt() { ]) .unwrap(); - let (result, proof) = smt.get_with_proof("key2".to_string()).unwrap(); + let (result, proof) = smt.get_with_proof("key2".to_owned()).unwrap(); assert_eq!(result, Some(value2.clone())); assert!(proof .verify::(state_root, key2.clone(), Some(value2))