From 51117ccbc0e77758118fffbd96c8975c506f6c54 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 10 Aug 2022 18:00:00 -0400 Subject: [PATCH 01/31] Add skeleton of `Verify` command --- crates/cargo-contract/src/cmd/mod.rs | 2 ++ crates/cargo-contract/src/cmd/verify.rs | 38 +++++++++++++++++++++++++ crates/cargo-contract/src/main.rs | 5 ++++ 3 files changed, 45 insertions(+) create mode 100644 crates/cargo-contract/src/cmd/verify.rs diff --git a/crates/cargo-contract/src/cmd/mod.rs b/crates/cargo-contract/src/cmd/mod.rs index 31a73208f..c1b2b7302 100644 --- a/crates/cargo-contract/src/cmd/mod.rs +++ b/crates/cargo-contract/src/cmd/mod.rs @@ -19,6 +19,7 @@ pub mod decode; pub mod metadata; pub mod new; pub mod test; +pub mod verify; pub(crate) use self::{ build::{ @@ -27,6 +28,7 @@ pub(crate) use self::{ }, decode::DecodeCommand, test::TestCommand, + verify::VerifyCommand, }; mod extrinsics; diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs new file mode 100644 index 000000000..727d3021a --- /dev/null +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -0,0 +1,38 @@ +// Copyright 2018-2022 Parity Technologies (UK) Ltd. +// This file is part of cargo-contract. +// +// cargo-contract is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// cargo-contract is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with cargo-contract. If not, see . + +use crate::workspace::ManifestPath; + +use anyhow::Result; + +use std::path::PathBuf; + +#[derive(Debug, clap::Args)] +#[clap(name = "verify")] +pub struct VerifyCommand { + /// Path to the `Cargo.toml` of the contract to verify. + #[clap(long, parse(from_os_str))] + manifest_path: Option, + /// The reference Wasm contract (`*.contract`) that the workspace will be checked against. + contract_wasm: String, +} + +impl VerifyCommand { + pub fn run(&self) -> Result<()> { + let manifest_path = ManifestPath::try_from(self.manifest_path.as_ref())?; + todo!() + } +} diff --git a/crates/cargo-contract/src/main.rs b/crates/cargo-contract/src/main.rs index afdbf2363..6d5806c1f 100644 --- a/crates/cargo-contract/src/main.rs +++ b/crates/cargo-contract/src/main.rs @@ -34,6 +34,7 @@ use self::{ InstantiateCommand, TestCommand, UploadCommand, + VerifyCommand, }, util::DEFAULT_KEY_COL_WIDTH, workspace::ManifestPath, @@ -504,6 +505,9 @@ enum Command { /// Decodes a contracts input or output data (supplied in hex-encoding) #[clap(name = "decode")] Decode(DecodeCommand), + /// Verifies that a given contract binary matches the build result of the specified workspace. + #[clap(name = "verify")] + Verify(VerifyCommand), } fn main() { @@ -570,6 +574,7 @@ fn exec(cmd: Command) -> Result<()> { .map_err(|err| map_extrinsic_err(err, call.is_json())) } Command::Decode(decode) => decode.run().map_err(format_err), + Command::Verify(verify) => verify.run(), } } From 13d29dc912861acf7d42ce472dfc9d6eb250fa95 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 10 Aug 2022 18:26:48 -0400 Subject: [PATCH 02/31] Read `BuildInfo` from contract metadata --- crates/cargo-contract/src/cmd/verify.rs | 31 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 727d3021a..7545e18a6 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -14,11 +14,19 @@ // You should have received a copy of the GNU General Public License // along with cargo-contract. If not, see . -use crate::workspace::ManifestPath; +use crate::{ + cmd::metadata::BuildInfo, + workspace::ManifestPath, +}; use anyhow::Result; +use contract_metadata::ContractMetadata; -use std::path::PathBuf; +use std::{ + fs::File, + io::prelude::Read, + path::PathBuf, +}; #[derive(Debug, clap::Args)] #[clap(name = "verify")] @@ -27,12 +35,27 @@ pub struct VerifyCommand { #[clap(long, parse(from_os_str))] manifest_path: Option, /// The reference Wasm contract (`*.contract`) that the workspace will be checked against. - contract_wasm: String, + contract: PathBuf, } impl VerifyCommand { pub fn run(&self) -> Result<()> { - let manifest_path = ManifestPath::try_from(self.manifest_path.as_ref())?; + let _manifest_path = ManifestPath::try_from(self.manifest_path.as_ref())?; + + // 1. Read the given metadata, and pull out the `BuildInfo` + let mut file = File::open(&self.contract)?; + let mut contents = String::new(); + file.read_to_string(&mut contents)?; + + let metadata: ContractMetadata = serde_json::from_str(&contents)?; + let build_info = metadata.source.build_info.as_ref().unwrap(); + let build_info: BuildInfo = + serde_json::from_value(build_info.clone().into()).unwrap(); + dbg!(&build_info); + + // 2. Call `cmd::Build` with the given `BuildInfo` + // + // 3. Read output file, compare with given contract_wasm todo!() } } From 85ccd7dd282ac01d5a075f8055fbc2bd4bb076fc Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Wed, 10 Aug 2022 18:39:10 -0400 Subject: [PATCH 03/31] Manually build contract using `BuildInfo` --- crates/cargo-contract/src/cmd/verify.rs | 27 ++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 7545e18a6..b87ac9ba0 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -15,8 +15,15 @@ // along with cargo-contract. If not, see . use crate::{ - cmd::metadata::BuildInfo, + cmd::{ + build::{ + execute, + ExecuteArgs, + }, + metadata::BuildInfo, + }, workspace::ManifestPath, + BuildArtifacts, }; use anyhow::Result; @@ -40,7 +47,7 @@ pub struct VerifyCommand { impl VerifyCommand { pub fn run(&self) -> Result<()> { - let _manifest_path = ManifestPath::try_from(self.manifest_path.as_ref())?; + let manifest_path = ManifestPath::try_from(self.manifest_path.as_ref())?; // 1. Read the given metadata, and pull out the `BuildInfo` let mut file = File::open(&self.contract)?; @@ -54,7 +61,21 @@ impl VerifyCommand { dbg!(&build_info); // 2. Call `cmd::Build` with the given `BuildInfo` - // + let args = ExecuteArgs { + manifest_path, + verbosity: Default::default(), + build_mode: build_info.build_mode, + network: Default::default(), + build_artifact: BuildArtifacts::CodeOnly, + unstable_flags: Default::default(), + optimization_passes: build_info.wasm_opt_settings.optimization_passes, + keep_debug_symbols: false, /* TODO: Will either want to add this to BuildInfo or assume release (so no) */ + skip_linting: true, + output_type: Default::default(), + }; + + let _build_result = execute(args)?; + // 3. Read output file, compare with given contract_wasm todo!() } From 7de595c5d9d79db42a5141fe82042ca1aec1470c Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 11 Aug 2022 13:17:37 -0400 Subject: [PATCH 04/31] Check built Wasm file against that in the reference metadata --- crates/cargo-contract/src/cmd/verify.rs | 39 ++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index b87ac9ba0..42a899e97 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -58,11 +58,10 @@ impl VerifyCommand { let build_info = metadata.source.build_info.as_ref().unwrap(); let build_info: BuildInfo = serde_json::from_value(build_info.clone().into()).unwrap(); - dbg!(&build_info); // 2. Call `cmd::Build` with the given `BuildInfo` let args = ExecuteArgs { - manifest_path, + manifest_path: manifest_path.clone(), verbosity: Default::default(), build_mode: build_info.build_mode, network: Default::default(), @@ -74,9 +73,41 @@ impl VerifyCommand { output_type: Default::default(), }; - let _build_result = execute(args)?; + let build_result = execute(args)?; // 3. Read output file, compare with given contract_wasm - todo!() + let reference_wasm = metadata.source.wasm.unwrap().to_string(); + + let built_wasm_path = build_result.dest_wasm.unwrap(); + let fs_wasm = std::fs::read(built_wasm_path)?; + let built_wasm = build_byte_str(&fs_wasm); + + if reference_wasm != built_wasm { + log::debug!( + "Expected Wasm Binary '{}'\n\nGot Wasm Binary `{}`", + &reference_wasm, + &built_wasm + ); + anyhow::bail!( + "Failed to verify the authenticity of `{}` contract againt the workspace found at {:?}.", + metadata.contract.name, + manifest_path.as_ref(), + ); + } + + log::info!("Succesfully verified `{}`!", &metadata.contract.name); + + Ok(()) + } +} + +fn build_byte_str(bytes: &[u8]) -> String { + use std::fmt::Write; + + let mut str = String::new(); + write!(str, "0x").expect("failed writing to string"); + for byte in bytes { + write!(str, "{:02x}", byte).expect("failed writing to string"); } + str } From e67d108a0651eab7a8ab7b1fa0f0c3d3eea1d53c Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 11 Aug 2022 13:30:11 -0400 Subject: [PATCH 05/31] Comopare `SourceWasm`'s instead of byte strings --- crates/cargo-contract/src/cmd/verify.rs | 21 +++++++-------------- crates/metadata/src/lib.rs | 2 +- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 42a899e97..b45c8855f 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -27,7 +27,10 @@ use crate::{ }; use anyhow::Result; -use contract_metadata::ContractMetadata; +use contract_metadata::{ + ContractMetadata, + SourceWasm, +}; use std::{ fs::File, @@ -76,11 +79,11 @@ impl VerifyCommand { let build_result = execute(args)?; // 3. Read output file, compare with given contract_wasm - let reference_wasm = metadata.source.wasm.unwrap().to_string(); + let reference_wasm = metadata.source.wasm.unwrap(); let built_wasm_path = build_result.dest_wasm.unwrap(); let fs_wasm = std::fs::read(built_wasm_path)?; - let built_wasm = build_byte_str(&fs_wasm); + let built_wasm = SourceWasm::new(fs_wasm); if reference_wasm != built_wasm { log::debug!( @@ -88,6 +91,7 @@ impl VerifyCommand { &reference_wasm, &built_wasm ); + anyhow::bail!( "Failed to verify the authenticity of `{}` contract againt the workspace found at {:?}.", metadata.contract.name, @@ -100,14 +104,3 @@ impl VerifyCommand { Ok(()) } } - -fn build_byte_str(bytes: &[u8]) -> String { - use std::fmt::Write; - - let mut str = String::new(); - write!(str, "0x").expect("failed writing to string"); - for byte in bytes { - write!(str, "{:02x}", byte).expect("failed writing to string"); - } - str -} diff --git a/crates/metadata/src/lib.rs b/crates/metadata/src/lib.rs index 4735dabaf..41786bbf2 100644 --- a/crates/metadata/src/lib.rs +++ b/crates/metadata/src/lib.rs @@ -166,7 +166,7 @@ impl Source { } /// The bytes of the compiled Wasm smart contract. -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub struct SourceWasm( #[serde( serialize_with = "byte_str::serialize_as_byte_str", From b90f12639a009fe87dee6cb1078d9b6f5469bedb Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Mon, 15 Aug 2022 13:46:51 -0400 Subject: [PATCH 06/31] Check that current `nightly` matches that from contract --- crates/cargo-contract/src/cmd/verify.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index b45c8855f..4e92c1d3a 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -63,6 +63,23 @@ impl VerifyCommand { serde_json::from_value(build_info.clone().into()).unwrap(); // 2. Call `cmd::Build` with the given `BuildInfo` + let expected_rustc_version = build_info.rustc_version; + let rustc_version = rustc_version::version_meta()?; + let rustc_version = format!( + "{:?}-{}", + rustc_version.channel, + rustc_version.commit_date.expect("TODO") + ) + .to_lowercase(); + + anyhow::ensure!( + rustc_version == expected_rustc_version, + "You are trying to `verify` a contract using the `{rustc_version}` toolchain.\n\ + However, the original contract was built using `{expected_rustc_version}`. Please\n\ + install the correct toolchain (`rustup install {expected_rustc_version}`) and\n\ + re-run the `verify` command.", + ); + let args = ExecuteArgs { manifest_path: manifest_path.clone(), verbosity: Default::default(), From a350f4c5d57da0d264f1252ae901928108e4f407 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 18 Aug 2022 16:20:03 -0400 Subject: [PATCH 07/31] Switch from `env_logger` to `tracing` --- crates/cargo-contract/src/cmd/verify.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 4e92c1d3a..bf8c1e979 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -103,7 +103,7 @@ impl VerifyCommand { let built_wasm = SourceWasm::new(fs_wasm); if reference_wasm != built_wasm { - log::debug!( + tracing::debug!( "Expected Wasm Binary '{}'\n\nGot Wasm Binary `{}`", &reference_wasm, &built_wasm @@ -116,7 +116,7 @@ impl VerifyCommand { ); } - log::info!("Succesfully verified `{}`!", &metadata.contract.name); + tracing::info!("Succesfully verified `{}`!", &metadata.contract.name); Ok(()) } From e87c51a8639f056c7c5db18e125adca998be91ac Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 18 Aug 2022 16:21:23 -0400 Subject: [PATCH 08/31] Use helper function to get current Rust toolchain --- crates/cargo-contract/src/cmd/verify.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index bf8c1e979..f6c5f70d5 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -64,13 +64,7 @@ impl VerifyCommand { // 2. Call `cmd::Build` with the given `BuildInfo` let expected_rustc_version = build_info.rustc_version; - let rustc_version = rustc_version::version_meta()?; - let rustc_version = format!( - "{:?}-{}", - rustc_version.channel, - rustc_version.commit_date.expect("TODO") - ) - .to_lowercase(); + let rustc_version = crate::util::rustc_toolchain()?; anyhow::ensure!( rustc_version == expected_rustc_version, From 4317f550892051b036104215286e14778dba2460 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 18 Aug 2022 16:27:54 -0400 Subject: [PATCH 09/31] Clean up docs a little --- crates/cargo-contract/src/cmd/verify.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index f6c5f70d5..c90d61a36 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -38,6 +38,7 @@ use std::{ path::PathBuf, }; +/// Checks if a contract in the given workspace matches that of a reference contract. #[derive(Debug, clap::Args)] #[clap(name = "verify")] pub struct VerifyCommand { @@ -62,7 +63,7 @@ impl VerifyCommand { let build_info: BuildInfo = serde_json::from_value(build_info.clone().into()).unwrap(); - // 2. Call `cmd::Build` with the given `BuildInfo` + // 2. Call `cargo contract build` with the `BuildInfo` from the metadata. let expected_rustc_version = build_info.rustc_version; let rustc_version = crate::util::rustc_toolchain()?; @@ -89,7 +90,7 @@ impl VerifyCommand { let build_result = execute(args)?; - // 3. Read output file, compare with given contract_wasm + // 3. Grab the built Wasm contract and compare it with the Wasm from the metadata. let reference_wasm = metadata.source.wasm.unwrap(); let built_wasm_path = build_result.dest_wasm.unwrap(); From fed9c3ffa46469312ad93499001f506b40ba112d Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Fri, 19 Aug 2022 16:43:34 -0400 Subject: [PATCH 10/31] Bail out if `wasm-opt` versions don't match This should maybe be a warning instead of an error, but I'll need to experiment with this more. --- crates/cargo-contract/src/cmd/verify.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index c90d61a36..6ae1a4f7b 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -75,6 +75,22 @@ impl VerifyCommand { re-run the `verify` command.", ); + let expected_wasm_opt_version = build_info.wasm_opt_settings.version; + // TODO: Will either want to add this to BuildInfo or assume release (so no) + let keep_debug_symbols = false; + let handler = crate::wasm_opt::WasmOptHandler::new( + build_info.wasm_opt_settings.optimization_passes, + keep_debug_symbols, + )?; + let wasm_opt_version = handler.version(); + + anyhow::ensure!( + wasm_opt_version == expected_wasm_opt_version, + "You are trying to `verify` a contract using `wasm-opt` version {wasm_opt_version}`.\n\ + However, the original contract was built using `wasm-opt` version {expected_wasm_opt_version}`.\n\ + Please install the matching version and re-run the `verify` command.", + ); + let args = ExecuteArgs { manifest_path: manifest_path.clone(), verbosity: Default::default(), @@ -83,7 +99,7 @@ impl VerifyCommand { build_artifact: BuildArtifacts::CodeOnly, unstable_flags: Default::default(), optimization_passes: build_info.wasm_opt_settings.optimization_passes, - keep_debug_symbols: false, /* TODO: Will either want to add this to BuildInfo or assume release (so no) */ + keep_debug_symbols, skip_linting: true, output_type: Default::default(), }; From b74398730df990d044f039254f3a25db470070d6 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Mon, 29 Aug 2022 15:09:08 -0400 Subject: [PATCH 11/31] Use stable `rustc` toolchain --- crates/cargo-contract/src/cmd/verify.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 6ae1a4f7b..a04418b26 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -65,7 +65,8 @@ impl VerifyCommand { // 2. Call `cargo contract build` with the `BuildInfo` from the metadata. let expected_rustc_version = build_info.rustc_version; - let rustc_version = crate::util::rustc_toolchain()?; + let rustc_version = rustc_version::version() + .expect("`rustc` always has a version associated with it."); anyhow::ensure!( rustc_version == expected_rustc_version, From f6770dedf217997d52fcc45ed0cc946bc6ecf3a9 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 29 Sep 2022 16:42:08 -0400 Subject: [PATCH 12/31] Use `keep_debug_symbols` from metadata --- crates/cargo-contract/src/cmd/verify.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index a04418b26..591a5e415 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -77,8 +77,7 @@ impl VerifyCommand { ); let expected_wasm_opt_version = build_info.wasm_opt_settings.version; - // TODO: Will either want to add this to BuildInfo or assume release (so no) - let keep_debug_symbols = false; + let keep_debug_symbols = build_info.wasm_opt_settings.keep_debug_symbols; let handler = crate::wasm_opt::WasmOptHandler::new( build_info.wasm_opt_settings.optimization_passes, keep_debug_symbols, From 2f3ca03a0d3ed6cd9b2f8e9ae1d773628962abf2 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 29 Sep 2022 16:42:19 -0400 Subject: [PATCH 13/31] Make output more colourful --- crates/cargo-contract/src/cmd/verify.rs | 27 ++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 591a5e415..ce701eb4d 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -22,11 +22,14 @@ use crate::{ }, metadata::BuildInfo, }, + maybe_println, workspace::ManifestPath, BuildArtifacts, + Verbosity, + VerbosityFlags, }; - use anyhow::Result; +use colored::Colorize; use contract_metadata::{ ContractMetadata, SourceWasm, @@ -47,11 +50,15 @@ pub struct VerifyCommand { manifest_path: Option, /// The reference Wasm contract (`*.contract`) that the workspace will be checked against. contract: PathBuf, + /// + #[clap(flatten)] + verbosity: VerbosityFlags, } impl VerifyCommand { pub fn run(&self) -> Result<()> { let manifest_path = ManifestPath::try_from(self.manifest_path.as_ref())?; + let verbosity: Verbosity = TryFrom::<&VerbosityFlags>::try_from(&self.verbosity)?; // 1. Read the given metadata, and pull out the `BuildInfo` let mut file = File::open(&self.contract)?; @@ -93,7 +100,7 @@ impl VerifyCommand { let args = ExecuteArgs { manifest_path: manifest_path.clone(), - verbosity: Default::default(), + verbosity, build_mode: build_info.build_mode, network: Default::default(), build_artifact: BuildArtifacts::CodeOnly, @@ -120,14 +127,20 @@ impl VerifyCommand { &built_wasm ); - anyhow::bail!( - "Failed to verify the authenticity of `{}` contract againt the workspace found at {:?}.", - metadata.contract.name, - manifest_path.as_ref(), + anyhow::bail!(format!( + "\nFailed to verify the authenticity of {} contract againt the workspace \n\ + found at {}.", + format!("`{}`", metadata.contract.name).bright_white(), + format!("{:?}", manifest_path.as_ref()).bright_white()).bright_red() ); } - tracing::info!("Succesfully verified `{}`!", &metadata.contract.name); + maybe_println!( + verbosity, + " \n{} {}", + "Succesfully verified contract".bright_green().bold(), + format!("`{}`!", &metadata.contract.name).bold(), + ); Ok(()) } From e2c567565bb893e01396d820cafbd0e9bd963861 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 29 Sep 2022 16:43:51 -0400 Subject: [PATCH 14/31] Add missing doc comment --- crates/cargo-contract/src/cmd/verify.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index ce701eb4d..f358945bc 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -50,7 +50,7 @@ pub struct VerifyCommand { manifest_path: Option, /// The reference Wasm contract (`*.contract`) that the workspace will be checked against. contract: PathBuf, - /// + /// Denotes if output should be printed to stdout. #[clap(flatten)] verbosity: VerbosityFlags, } From 963387cad260401b290394cdabfcb5de2b63e9ff Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 29 Sep 2022 17:23:01 -0400 Subject: [PATCH 15/31] Do a better job of error handling --- crates/cargo-contract/src/cmd/verify.rs | 64 +++++++++++++++++++------ 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index f358945bc..339804190 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -66,22 +66,36 @@ impl VerifyCommand { file.read_to_string(&mut contents)?; let metadata: ContractMetadata = serde_json::from_str(&contents)?; - let build_info = metadata.source.build_info.as_ref().unwrap(); - let build_info: BuildInfo = - serde_json::from_value(build_info.clone().into()).unwrap(); + let build_info = if let Some(info) = metadata.source.build_info { + info + } else { + anyhow::bail!( + "\nThe metadata does not contain any build information which can be used to \ + verify a contract." + .to_string() + .bright_yellow() + ) + }; + + let build_info: BuildInfo = serde_json::from_value(build_info.clone().into())?; + + tracing::debug!( + "Parsed the following build info from the metadata: {:?}", + &build_info, + ); // 2. Call `cargo contract build` with the `BuildInfo` from the metadata. let expected_rustc_version = build_info.rustc_version; let rustc_version = rustc_version::version() .expect("`rustc` always has a version associated with it."); - anyhow::ensure!( - rustc_version == expected_rustc_version, - "You are trying to `verify` a contract using the `{rustc_version}` toolchain.\n\ + let rustc_matches = rustc_version == expected_rustc_version; + let mismatched_rustc = format!( + "\nYou are trying to `verify` a contract using the `{rustc_version}` toolchain.\n\ However, the original contract was built using `{expected_rustc_version}`. Please\n\ install the correct toolchain (`rustup install {expected_rustc_version}`) and\n\ - re-run the `verify` command.", - ); + re-run the `verify` command.",); + anyhow::ensure!(rustc_matches, mismatched_rustc.bright_yellow()); let expected_wasm_opt_version = build_info.wasm_opt_settings.version; let keep_debug_symbols = build_info.wasm_opt_settings.keep_debug_symbols; @@ -91,12 +105,13 @@ impl VerifyCommand { )?; let wasm_opt_version = handler.version(); - anyhow::ensure!( - wasm_opt_version == expected_wasm_opt_version, - "You are trying to `verify` a contract using `wasm-opt` version {wasm_opt_version}`.\n\ - However, the original contract was built using `wasm-opt` version {expected_wasm_opt_version}`.\n\ + let wasm_opt_matches = wasm_opt_version == expected_wasm_opt_version; + let mismatched_wasm_opt = format!( + "\nYou are trying to `verify` a contract using `wasm-opt` version `{wasm_opt_version}`.\n\ + However, the original contract was built using `wasm-opt` version `{expected_wasm_opt_version}`.\n\ Please install the matching version and re-run the `verify` command.", ); + anyhow::ensure!(wasm_opt_matches, mismatched_wasm_opt.bright_yellow()); let args = ExecuteArgs { manifest_path: manifest_path.clone(), @@ -114,9 +129,30 @@ impl VerifyCommand { let build_result = execute(args)?; // 3. Grab the built Wasm contract and compare it with the Wasm from the metadata. - let reference_wasm = metadata.source.wasm.unwrap(); + let reference_wasm = if let Some(wasm) = metadata.source.wasm { + wasm + } else { + anyhow::bail!( + "\nThe metadata for the reference contract does not contain a Wasm binary,\n\ + therefore we are unable to verify the contract." + .to_string() + .bright_yellow() + ) + }; + + let built_wasm_path = if let Some(wasm) = build_result.dest_wasm { + wasm + } else { + // Since we're building the contract ourselves this should always be populated, + // but we'll bail out here just in case. + anyhow::bail!( + "\nThe metadata for the workspace contract does not contain a Wasm binary,\n\ + therefore we are unable to verify the contract." + .to_string() + .bright_yellow() + ) + }; - let built_wasm_path = build_result.dest_wasm.unwrap(); let fs_wasm = std::fs::read(built_wasm_path)?; let built_wasm = SourceWasm::new(fs_wasm); From e7b957783fc283375273ed8f4e735b2247795834 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 29 Sep 2022 17:36:01 -0400 Subject: [PATCH 16/31] Add more error handling improvements --- crates/cargo-contract/src/cmd/verify.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 339804190..45fc76c08 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -28,7 +28,10 @@ use crate::{ Verbosity, VerbosityFlags, }; -use anyhow::Result; +use anyhow::{ + Context, + Result, +}; use colored::Colorize; use contract_metadata::{ ContractMetadata, @@ -37,7 +40,6 @@ use contract_metadata::{ use std::{ fs::File, - io::prelude::Read, path::PathBuf, }; @@ -61,11 +63,13 @@ impl VerifyCommand { let verbosity: Verbosity = TryFrom::<&VerbosityFlags>::try_from(&self.verbosity)?; // 1. Read the given metadata, and pull out the `BuildInfo` - let mut file = File::open(&self.contract)?; - let mut contents = String::new(); - file.read_to_string(&mut contents)?; + let path = &self.contract; + let file = File::open(path) + .context(format!("Failed to open contract bundle {}", path.display()))?; - let metadata: ContractMetadata = serde_json::from_str(&contents)?; + let metadata: ContractMetadata = serde_json::from_reader(&file).context( + format!("Failed to deserialize contract bundle {}", path.display()), + )?; let build_info = if let Some(info) = metadata.source.build_info { info } else { @@ -77,7 +81,11 @@ impl VerifyCommand { ) }; - let build_info: BuildInfo = serde_json::from_value(build_info.clone().into())?; + let build_info: BuildInfo = serde_json::from_value(build_info.clone().into()) + .context(format!( + "Failed to deserialize the build info from {}", + path.display() + ))?; tracing::debug!( "Parsed the following build info from the metadata: {:?}", From a64b631d919a24d03c936e01ee0c780aa4d0b955 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 29 Sep 2022 17:44:29 -0400 Subject: [PATCH 17/31] Add `CHANGELOG` entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 126b48304..121d82466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add Rust specific build info to metadata - [#680](https://github.com/paritytech/cargo-contract/pull/680) +- Add `verify` command - [#696](https://github.com/paritytech/cargo-contract/pull/696) ### Changed - Removed requirement to install binaryen. The `wasm-opt` tool is now compiled into `cargo-contract`. From d6db73fab17ac0d8b599330ff02f0a7422ee3e00 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 29 Sep 2022 17:46:04 -0400 Subject: [PATCH 18/31] Appease Clippy --- crates/cargo-contract/src/cmd/verify.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 45fc76c08..a92e35e96 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -81,8 +81,8 @@ impl VerifyCommand { ) }; - let build_info: BuildInfo = serde_json::from_value(build_info.clone().into()) - .context(format!( + let build_info: BuildInfo = + serde_json::from_value(build_info.into()).context(format!( "Failed to deserialize the build info from {}", path.display() ))?; From 80233c43d5cfd61cd64fb4c2dee263d8e51ca805 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 20 Oct 2022 15:22:02 -0400 Subject: [PATCH 19/31] Use updated Rust toolchain build info --- crates/cargo-contract/src/cmd/verify.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index a92e35e96..773769e6b 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -93,15 +93,15 @@ impl VerifyCommand { ); // 2. Call `cargo contract build` with the `BuildInfo` from the metadata. - let expected_rustc_version = build_info.rustc_version; - let rustc_version = rustc_version::version() + let expected_rust_toolchain = build_info.rust_toolchain; + let rust_toolchain = crate::util::rust_toolchain() .expect("`rustc` always has a version associated with it."); - let rustc_matches = rustc_version == expected_rustc_version; + let rustc_matches = rust_toolchain == expected_rust_toolchain; let mismatched_rustc = format!( - "\nYou are trying to `verify` a contract using the `{rustc_version}` toolchain.\n\ - However, the original contract was built using `{expected_rustc_version}`. Please\n\ - install the correct toolchain (`rustup install {expected_rustc_version}`) and\n\ + "\nYou are trying to `verify` a contract using the `{rust_toolchain}` toolchain.\n\ + However, the original contract was built using `{expected_rust_toolchain}`. Please\n\ + install the correct toolchain (`rustup install {expected_rust_toolchain}`) and\n\ re-run the `verify` command.",); anyhow::ensure!(rustc_matches, mismatched_rustc.bright_yellow()); From 98cc7fbb057166e7743693fc96c0591369508571 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 20 Oct 2022 15:48:29 -0400 Subject: [PATCH 20/31] Apply fixes for `clap` `v4.0` --- crates/cargo-contract/src/cmd/verify.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 773769e6b..7826f9f84 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -48,7 +48,7 @@ use std::{ #[clap(name = "verify")] pub struct VerifyCommand { /// Path to the `Cargo.toml` of the contract to verify. - #[clap(long, parse(from_os_str))] + #[clap(long, value_parser)] manifest_path: Option, /// The reference Wasm contract (`*.contract`) that the workspace will be checked against. contract: PathBuf, From b2d10c26e3bed83bbbf26cd7eadbfe7d5bfa18a2 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Thu, 20 Oct 2022 15:48:51 -0400 Subject: [PATCH 21/31] Compare `cargo-contract` versions instead of `wasm-opt` versions Since releases of `cargo-contract` are now bundled with a `wasm-opt` library we can assume that equal versions of `cargo-contract` contain equal versions of `wasm-opt`. --- crates/cargo-contract/src/cmd/build/mod.rs | 2 +- crates/cargo-contract/src/cmd/verify.rs | 37 ++++++++++++---------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/crates/cargo-contract/src/cmd/build/mod.rs b/crates/cargo-contract/src/cmd/build/mod.rs index b3fd8f429..ce51b950f 100644 --- a/crates/cargo-contract/src/cmd/build/mod.rs +++ b/crates/cargo-contract/src/cmd/build/mod.rs @@ -68,7 +68,7 @@ use std::{ const MAX_MEMORY_PAGES: u32 = 16; /// Version of the currently executing `cargo-contract` binary. -const VERSION: &str = env!("CARGO_PKG_VERSION"); +pub(crate) const VERSION: &str = env!("CARGO_PKG_VERSION"); /// Arguments to use when executing `build` or `check` commands. #[derive(Default)] diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 7826f9f84..d0f262892 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -19,6 +19,7 @@ use crate::{ build::{ execute, ExecuteArgs, + VERSION, }, metadata::BuildInfo, }, @@ -92,7 +93,7 @@ impl VerifyCommand { &build_info, ); - // 2. Call `cargo contract build` with the `BuildInfo` from the metadata. + // 2. Check that the build info from the metadata matches our current setup. let expected_rust_toolchain = build_info.rust_toolchain; let rust_toolchain = crate::util::rust_toolchain() .expect("`rustc` always has a version associated with it."); @@ -105,22 +106,26 @@ impl VerifyCommand { re-run the `verify` command.",); anyhow::ensure!(rustc_matches, mismatched_rustc.bright_yellow()); - let expected_wasm_opt_version = build_info.wasm_opt_settings.version; - let keep_debug_symbols = build_info.wasm_opt_settings.keep_debug_symbols; - let handler = crate::wasm_opt::WasmOptHandler::new( - build_info.wasm_opt_settings.optimization_passes, - keep_debug_symbols, - )?; - let wasm_opt_version = handler.version(); - - let wasm_opt_matches = wasm_opt_version == expected_wasm_opt_version; - let mismatched_wasm_opt = format!( - "\nYou are trying to `verify` a contract using `wasm-opt` version `{wasm_opt_version}`.\n\ - However, the original contract was built using `wasm-opt` version `{expected_wasm_opt_version}`.\n\ + let expected_cargo_contract_version = build_info.cargo_contract_version; + let cargo_contract_version = semver::Version::parse(VERSION)?; + + // Note, assuming both versions of `cargo-contract` were installed with the same lockfile + // (e.g `--locked`) then the versions of `wasm-opt` should also match. + let cargo_contract_matches = + cargo_contract_version == expected_cargo_contract_version; + let mismatched_cargo_contract = format!( + "\nYou are trying to `verify` a contract using `cargo-contract` version \ + `{cargo_contract_version}`.\n\ + However, the original contract was built using `cargo-contract` version \ + `{expected_cargo_contract_version}`.\n\ Please install the matching version and re-run the `verify` command.", ); - anyhow::ensure!(wasm_opt_matches, mismatched_wasm_opt.bright_yellow()); + anyhow::ensure!( + cargo_contract_matches, + mismatched_cargo_contract.bright_yellow() + ); + // 3. Call `cargo contract build` with the `BuildInfo` from the metadata. let args = ExecuteArgs { manifest_path: manifest_path.clone(), verbosity, @@ -129,14 +134,14 @@ impl VerifyCommand { build_artifact: BuildArtifacts::CodeOnly, unstable_flags: Default::default(), optimization_passes: build_info.wasm_opt_settings.optimization_passes, - keep_debug_symbols, + keep_debug_symbols: build_info.wasm_opt_settings.keep_debug_symbols, skip_linting: true, output_type: Default::default(), }; let build_result = execute(args)?; - // 3. Grab the built Wasm contract and compare it with the Wasm from the metadata. + // 4. Grab the built Wasm contract and compare it with the Wasm from the metadata. let reference_wasm = if let Some(wasm) = metadata.source.wasm { wasm } else { From 2fd80f18a259bc35bf17c5f5913530678d9f9cb2 Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Tue, 29 Aug 2023 14:31:15 +0100 Subject: [PATCH 22/31] update code --- Cargo.lock | 2 + crates/build/src/util/mod.rs | 2 +- crates/cargo-contract/Cargo.toml | 2 + crates/cargo-contract/src/cmd/mod.rs | 2 + crates/cargo-contract/src/cmd/verify.rs | 50 ++++++++++++------------- crates/cargo-contract/src/main.rs | 6 +++ 6 files changed, 38 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 477eef88e..2b436d228 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -741,11 +741,13 @@ dependencies = [ "colored", "contract-build", "contract-extrinsics", + "contract-metadata", "contract-transcode", "current_platform", "hex", "predicates", "regex", + "semver", "serde_json", "substrate-build-script-utils", "subxt", diff --git a/crates/build/src/util/mod.rs b/crates/build/src/util/mod.rs index 4e6935ca1..fc3948bd4 100644 --- a/crates/build/src/util/mod.rs +++ b/crates/build/src/util/mod.rs @@ -27,7 +27,7 @@ use std::{ use term_size as _; // Returns the current Rust toolchain formatted by `-`. -pub(crate) fn rust_toolchain() -> Result { +pub fn rust_toolchain() -> Result { let meta = rustc_version::version_meta()?; let toolchain = format!("{:?}-{}", meta.channel, meta.host,).to_lowercase(); diff --git a/crates/cargo-contract/Cargo.toml b/crates/cargo-contract/Cargo.toml index 28e313c04..eb68da019 100644 --- a/crates/cargo-contract/Cargo.toml +++ b/crates/cargo-contract/Cargo.toml @@ -21,6 +21,7 @@ include = [ contract-build = { version = "4.0.0-alpha", path = "../build" } contract-extrinsics = { version = "4.0.0-alpha", path = "../extrinsics" } contract-transcode = { version = "4.0.0-alpha", path = "../transcode" } +contract-metadata = { version = "4.0.0-alpha", path = "../metadata" } anyhow = "1.0.75" clap = { version = "4.4.0", features = ["derive", "env"] } @@ -30,6 +31,7 @@ which = "4.4.0" colored = "2.0.4" serde_json = "1.0.105" url = { version = "2.4.1", features = ["serde"] } +semver = "1.0" # dependencies for extrinsics (deploying and calling a contract) diff --git a/crates/cargo-contract/src/cmd/mod.rs b/crates/cargo-contract/src/cmd/mod.rs index 11ca62dbf..367b9c93c 100644 --- a/crates/cargo-contract/src/cmd/mod.rs +++ b/crates/cargo-contract/src/cmd/mod.rs @@ -18,6 +18,7 @@ pub mod build; pub mod decode; pub mod encode; pub mod info; +pub mod verify; pub(crate) use self::{ build::{ @@ -26,6 +27,7 @@ pub(crate) use self::{ }, decode::DecodeCommand, info::InfoCommand, + verify::VerifyCommand, }; pub(crate) use contract_extrinsics::{ diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index d0f262892..5c96d9620 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -14,26 +14,21 @@ // You should have received a copy of the GNU General Public License // along with cargo-contract. If not, see . -use crate::{ - cmd::{ - build::{ - execute, - ExecuteArgs, - VERSION, - }, - metadata::BuildInfo, - }, - maybe_println, - workspace::ManifestPath, - BuildArtifacts, - Verbosity, - VerbosityFlags, -}; use anyhow::{ Context, Result, }; use colored::Colorize; +use contract_build::{ + execute, + verbose_eprintln, + BuildArtifacts, + BuildInfo, + ExecuteArgs, + ManifestPath, + Verbosity, + VerbosityFlags, +}; use contract_metadata::{ ContractMetadata, SourceWasm, @@ -44,6 +39,8 @@ use std::{ path::PathBuf, }; +const VERSION: &str = env!("CARGO_PKG_VERSION"); + /// Checks if a contract in the given workspace matches that of a reference contract. #[derive(Debug, clap::Args)] #[clap(name = "verify")] @@ -51,7 +48,8 @@ pub struct VerifyCommand { /// Path to the `Cargo.toml` of the contract to verify. #[clap(long, value_parser)] manifest_path: Option, - /// The reference Wasm contract (`*.contract`) that the workspace will be checked against. + /// The reference Wasm contract (`*.contract`) that the workspace will be checked + /// against. contract: PathBuf, /// Denotes if output should be printed to stdout. #[clap(flatten)] @@ -95,7 +93,7 @@ impl VerifyCommand { // 2. Check that the build info from the metadata matches our current setup. let expected_rust_toolchain = build_info.rust_toolchain; - let rust_toolchain = crate::util::rust_toolchain() + let rust_toolchain = contract_build::util::rust_toolchain() .expect("`rustc` always has a version associated with it."); let rustc_matches = rust_toolchain == expected_rust_toolchain; @@ -109,8 +107,9 @@ impl VerifyCommand { let expected_cargo_contract_version = build_info.cargo_contract_version; let cargo_contract_version = semver::Version::parse(VERSION)?; - // Note, assuming both versions of `cargo-contract` were installed with the same lockfile - // (e.g `--locked`) then the versions of `wasm-opt` should also match. + // Note, assuming both versions of `cargo-contract` were installed with the same + // lockfile (e.g `--locked`) then the versions of `wasm-opt` should also + // match. let cargo_contract_matches = cargo_contract_version == expected_cargo_contract_version; let mismatched_cargo_contract = format!( @@ -133,10 +132,11 @@ impl VerifyCommand { network: Default::default(), build_artifact: BuildArtifacts::CodeOnly, unstable_flags: Default::default(), - optimization_passes: build_info.wasm_opt_settings.optimization_passes, + optimization_passes: Some(build_info.wasm_opt_settings.optimization_passes), keep_debug_symbols: build_info.wasm_opt_settings.keep_debug_symbols, - skip_linting: true, + dylint: false, output_type: Default::default(), + ..Default::default() }; let build_result = execute(args)?; @@ -156,8 +156,8 @@ impl VerifyCommand { let built_wasm_path = if let Some(wasm) = build_result.dest_wasm { wasm } else { - // Since we're building the contract ourselves this should always be populated, - // but we'll bail out here just in case. + // Since we're building the contract ourselves this should always be + // populated, but we'll bail out here just in case. anyhow::bail!( "\nThe metadata for the workspace contract does not contain a Wasm binary,\n\ therefore we are unable to verify the contract." @@ -184,10 +184,10 @@ impl VerifyCommand { ); } - maybe_println!( + verbose_eprintln!( verbosity, " \n{} {}", - "Succesfully verified contract".bright_green().bold(), + "Successfully verified contract".bright_green().bold(), format!("`{}`!", &metadata.contract.name).bold(), ); diff --git a/crates/cargo-contract/src/main.rs b/crates/cargo-contract/src/main.rs index f7ffb2c7a..28a948bde 100644 --- a/crates/cargo-contract/src/main.rs +++ b/crates/cargo-contract/src/main.rs @@ -28,6 +28,7 @@ use self::cmd::{ InstantiateCommand, RemoveCommand, UploadCommand, + VerifyCommand, }; use cmd::encode::EncodeCommand; use contract_build::{ @@ -136,6 +137,10 @@ enum Command { /// Display information about a contract #[clap(name = "info")] Info(InfoCommand), + /// Verifies that a given contract binary matches the build result of the specified + /// workspace. + #[clap(name = "verify")] + Verify(VerifyCommand), } fn main() { @@ -199,6 +204,7 @@ fn exec(cmd: Command) -> Result<()> { .map_err(|err| map_extrinsic_err(err, remove.is_json())) } Command::Info(info) => info.run().map_err(format_err), + Command::Verify(verify) => verify.run(), } } From 02a9e658daef574f2d3c392503107f4b62c5f6f7 Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Tue, 29 Aug 2023 23:56:19 +0100 Subject: [PATCH 23/31] add docker support --- crates/build/src/docker.rs | 22 ++++- crates/cargo-contract/src/cmd/verify.rs | 119 +++++++++++++----------- 2 files changed, 83 insertions(+), 58 deletions(-) diff --git a/crates/build/src/docker.rs b/crates/build/src/docker.rs index ad72b6de7..d48e90cf5 100644 --- a/crates/build/src/docker.rs +++ b/crates/build/src/docker.rs @@ -110,6 +110,16 @@ pub enum ImageVariant { Custom(String), } +impl From> for ImageVariant { + fn from(value: Option) -> Self { + if let Some(image) = value { + ImageVariant::Custom(image) + } else { + ImageVariant::Default + } + } +} + /// Launches the docker container to execute verifiable build. pub fn docker_build(args: ExecuteArgs) -> Result { let ExecuteArgs { @@ -408,8 +418,12 @@ async fn run_build( match output { LogOutput::StdOut { message } => { build_result = Some( - serde_json::from_reader(BufReader::new(message.as_ref())) - .context("Error decoding BuildResult"), + serde_json::from_reader(BufReader::new(message.as_ref())).context( + format!( + "Error decoding BuildResult:\n {}", + std::str::from_utf8(&message).unwrap() + ), + ), ); } LogOutput::StdErr { message } => { @@ -436,8 +450,8 @@ async fn run_build( fn compose_build_args() -> Result> { use regex::Regex; let mut args: Vec = Vec::new(); - // match --image with arg with 1 or more white spaces surrounded - let rex = Regex::new(r#"--image[ ]*[^ ]*[ ]*"#)?; + // match `--image` or `verify` with arg with 1 or more white spaces surrounded + let rex = Regex::new(r#"(--image|verify)[ ]*[^ ]*[ ]*"#)?; // we join the args together, so we can remove `--image ` let args_string: String = std::env::args().collect::>().join(" "); let args_string = rex.replace_all(&args_string, "").to_string(); diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 5c96d9620..a5c76dd93 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -24,15 +24,14 @@ use contract_build::{ verbose_eprintln, BuildArtifacts, BuildInfo, + BuildMode, ExecuteArgs, + ImageVariant, ManifestPath, Verbosity, VerbosityFlags, }; -use contract_metadata::{ - ContractMetadata, - SourceWasm, -}; +use contract_metadata::ContractMetadata; use std::{ fs::File, @@ -54,6 +53,9 @@ pub struct VerifyCommand { /// Denotes if output should be printed to stdout. #[clap(flatten)] verbosity: VerbosityFlags, + /// Denotes if the contract should be verified inside a docker image. + #[clap(long, default_value_t = false)] + docker: bool, } impl VerifyCommand { @@ -91,70 +93,68 @@ impl VerifyCommand { &build_info, ); - // 2. Check that the build info from the metadata matches our current setup. - let expected_rust_toolchain = build_info.rust_toolchain; - let rust_toolchain = contract_build::util::rust_toolchain() - .expect("`rustc` always has a version associated with it."); + let build_mode = if metadata.image.is_some() { + BuildMode::Verifiable + } else { + build_info.build_mode + }; - let rustc_matches = rust_toolchain == expected_rust_toolchain; - let mismatched_rustc = format!( + // 2. Check that the build info from the metadata matches our current setup. + // if the build mode is `Verifiable` we skip + if build_mode != BuildMode::Verifiable { + let expected_rust_toolchain = build_info.rust_toolchain; + let rust_toolchain = contract_build::util::rust_toolchain() + .expect("`rustc` always has a version associated with it."); + + let rustc_matches = rust_toolchain == expected_rust_toolchain; + let mismatched_rustc = format!( "\nYou are trying to `verify` a contract using the `{rust_toolchain}` toolchain.\n\ However, the original contract was built using `{expected_rust_toolchain}`. Please\n\ install the correct toolchain (`rustup install {expected_rust_toolchain}`) and\n\ re-run the `verify` command.",); - anyhow::ensure!(rustc_matches, mismatched_rustc.bright_yellow()); - - let expected_cargo_contract_version = build_info.cargo_contract_version; - let cargo_contract_version = semver::Version::parse(VERSION)?; - - // Note, assuming both versions of `cargo-contract` were installed with the same - // lockfile (e.g `--locked`) then the versions of `wasm-opt` should also - // match. - let cargo_contract_matches = - cargo_contract_version == expected_cargo_contract_version; - let mismatched_cargo_contract = format!( - "\nYou are trying to `verify` a contract using `cargo-contract` version \ + anyhow::ensure!(rustc_matches, mismatched_rustc.bright_yellow()); + + let expected_cargo_contract_version = build_info.cargo_contract_version; + let cargo_contract_version = semver::Version::parse(VERSION)?; + + // Note, assuming both versions of `cargo-contract` were installed with the + // same lockfile (e.g `--locked`) then the versions of `wasm-opt` + // should also match. + let cargo_contract_matches = + cargo_contract_version == expected_cargo_contract_version; + let mismatched_cargo_contract = format!( + "\nYou are trying to `verify` a contract using `cargo-contract` version \ `{cargo_contract_version}`.\n\ However, the original contract was built using `cargo-contract` version \ `{expected_cargo_contract_version}`.\n\ Please install the matching version and re-run the `verify` command.", - ); - anyhow::ensure!( - cargo_contract_matches, - mismatched_cargo_contract.bright_yellow() - ); + ); + anyhow::ensure!( + cargo_contract_matches, + mismatched_cargo_contract.bright_yellow() + ); + } - // 3. Call `cargo contract build` with the `BuildInfo` from the metadata. + // 3a. Call `cargo contract build` with the `BuildInfo` from the metadata. let args = ExecuteArgs { manifest_path: manifest_path.clone(), verbosity, - build_mode: build_info.build_mode, - network: Default::default(), - build_artifact: BuildArtifacts::CodeOnly, - unstable_flags: Default::default(), + build_mode, + build_artifact: BuildArtifacts::All, optimization_passes: Some(build_info.wasm_opt_settings.optimization_passes), keep_debug_symbols: build_info.wasm_opt_settings.keep_debug_symbols, + image: ImageVariant::from(metadata.image), dylint: false, - output_type: Default::default(), ..Default::default() }; let build_result = execute(args)?; - // 4. Grab the built Wasm contract and compare it with the Wasm from the metadata. - let reference_wasm = if let Some(wasm) = metadata.source.wasm { - wasm - } else { - anyhow::bail!( - "\nThe metadata for the reference contract does not contain a Wasm binary,\n\ - therefore we are unable to verify the contract." - .to_string() - .bright_yellow() - ) - }; - - let built_wasm_path = if let Some(wasm) = build_result.dest_wasm { - wasm + // 4. Grab the code hash from the built contract and compare it with the reference + // one. + let reference_code_hash = metadata.source.hash; + let built_contract_path = if let Some(m) = build_result.metadata_result { + m } else { // Since we're building the contract ourselves this should always be // populated, but we'll bail out here just in case. @@ -166,18 +166,29 @@ impl VerifyCommand { ) }; - let fs_wasm = std::fs::read(built_wasm_path)?; - let built_wasm = SourceWasm::new(fs_wasm); + let target_bundle = built_contract_path.dest_bundle; + + let file = File::open(target_bundle.clone()).context(format!( + "Failed to open contract bundle {}", + target_bundle.display() + ))?; + let built_contract: ContractMetadata = + serde_json::from_reader(file).context(format!( + "Failed to deserialize contract bundle {}", + target_bundle.display() + ))?; + + let target_code_hash = built_contract.source.hash; - if reference_wasm != built_wasm { + if reference_code_hash != target_code_hash { tracing::debug!( - "Expected Wasm Binary '{}'\n\nGot Wasm Binary `{}`", - &reference_wasm, - &built_wasm + "Expected Wasm Binary '{:?}'\n\nGot Wasm Binary `{:?}`", + &reference_code_hash, + &target_code_hash ); anyhow::bail!(format!( - "\nFailed to verify the authenticity of {} contract againt the workspace \n\ + "\nFailed to verify the authenticity of {} contract against the workspace \n\ found at {}.", format!("`{}`", metadata.contract.name).bright_white(), format!("{:?}", manifest_path.as_ref()).bright_white()).bright_red() From 5759843a9899fb05251e14617081ddd7e534bcf1 Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Wed, 30 Aug 2023 00:00:06 +0100 Subject: [PATCH 24/31] remove docker flag --- crates/cargo-contract/src/cmd/verify.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index a5c76dd93..a60f2ffa5 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -53,9 +53,6 @@ pub struct VerifyCommand { /// Denotes if output should be printed to stdout. #[clap(flatten)] verbosity: VerbosityFlags, - /// Denotes if the contract should be verified inside a docker image. - #[clap(long, default_value_t = false)] - docker: bool, } impl VerifyCommand { From 3889a62a22d1a92ea4cf0eadb99c75337881c943 Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Wed, 30 Aug 2023 00:02:11 +0100 Subject: [PATCH 25/31] fix error message --- crates/cargo-contract/src/cmd/verify.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index a60f2ffa5..6b3e29bc9 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -179,7 +179,7 @@ impl VerifyCommand { if reference_code_hash != target_code_hash { tracing::debug!( - "Expected Wasm Binary '{:?}'\n\nGot Wasm Binary `{:?}`", + "Expected Code Hash: '{:?}'\n\nGot Code Hash: `{:?}`", &reference_code_hash, &target_code_hash ); From 83373d80122c181f20655517db12185f7d4575a3 Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Wed, 30 Aug 2023 00:38:46 +0100 Subject: [PATCH 26/31] display paths of the contracts --- Cargo.lock | 1 + crates/cargo-contract/Cargo.toml | 2 ++ crates/cargo-contract/src/cmd/verify.rs | 48 ++++++++++++++++++++----- crates/cargo-contract/src/main.rs | 11 +++++- 4 files changed, 53 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b436d228..ec1df07b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -748,6 +748,7 @@ dependencies = [ "predicates", "regex", "semver", + "serde", "serde_json", "substrate-build-script-utils", "subxt", diff --git a/crates/cargo-contract/Cargo.toml b/crates/cargo-contract/Cargo.toml index eb68da019..547071aa5 100644 --- a/crates/cargo-contract/Cargo.toml +++ b/crates/cargo-contract/Cargo.toml @@ -29,11 +29,13 @@ tracing = "0.1.37" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } which = "4.4.0" colored = "2.0.4" +serde = { version = "1", default-features = false, features = ["derive"] } serde_json = "1.0.105" url = { version = "2.4.1", features = ["serde"] } semver = "1.0" + # dependencies for extrinsics (deploying and calling a contract) tokio = { version = "1", features = ["macros", "rt-multi-thread"] } subxt = "0.31.0" diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 6b3e29bc9..4bf216366 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -21,7 +21,6 @@ use anyhow::{ use colored::Colorize; use contract_build::{ execute, - verbose_eprintln, BuildArtifacts, BuildInfo, BuildMode, @@ -53,10 +52,13 @@ pub struct VerifyCommand { /// Denotes if output should be printed to stdout. #[clap(flatten)] verbosity: VerbosityFlags, + /// Output the result in JSON format + #[clap(long, conflicts_with = "verbose")] + output_json: bool, } impl VerifyCommand { - pub fn run(&self) -> Result<()> { + pub fn run(&self) -> Result { let manifest_path = ManifestPath::try_from(self.manifest_path.as_ref())?; let verbosity: Verbosity = TryFrom::<&VerbosityFlags>::try_from(&self.verbosity)?; @@ -140,7 +142,7 @@ impl VerifyCommand { build_artifact: BuildArtifacts::All, optimization_passes: Some(build_info.wasm_opt_settings.optimization_passes), keep_debug_symbols: build_info.wasm_opt_settings.keep_debug_symbols, - image: ImageVariant::from(metadata.image), + image: ImageVariant::from(metadata.image.clone()), dylint: false, ..Default::default() }; @@ -192,13 +194,43 @@ impl VerifyCommand { ); } - verbose_eprintln!( + Ok(VerificationResult { + is_verified: true, + image: metadata.image, + contract: target_bundle.display().to_string(), + reference_contract: path.display().to_string(), + output_json: self.output_json, verbosity, - " \n{} {}", + }) + } +} + +/// The result of verification process +#[derive(serde::Serialize, serde::Deserialize)] +pub struct VerificationResult { + pub is_verified: bool, + pub image: Option, + pub contract: String, + pub reference_contract: String, + #[serde(skip_serializing, skip_deserializing)] + pub output_json: bool, + #[serde(skip_serializing, skip_deserializing)] + pub verbosity: Verbosity, +} + +impl VerificationResult { + /// Display the result in a fancy format + pub fn display(&self) -> String { + format!( + "\n{} {} against reference contract {}", "Successfully verified contract".bright_green().bold(), - format!("`{}`!", &metadata.contract.name).bold(), - ); + format!("`{}`", &self.contract).bold(), + format!("`{}`!", &self.reference_contract).bold() + ) + } - Ok(()) + /// Display the build results in a pretty formatted JSON string. + pub fn serialize_json(&self) -> Result { + Ok(serde_json::to_string_pretty(self)?) } } diff --git a/crates/cargo-contract/src/main.rs b/crates/cargo-contract/src/main.rs index 28a948bde..8df26a38b 100644 --- a/crates/cargo-contract/src/main.rs +++ b/crates/cargo-contract/src/main.rs @@ -204,7 +204,16 @@ fn exec(cmd: Command) -> Result<()> { .map_err(|err| map_extrinsic_err(err, remove.is_json())) } Command::Info(info) => info.run().map_err(format_err), - Command::Verify(verify) => verify.run(), + Command::Verify(verify) => { + let result = verify.run().map_err(format_err)?; + + if result.output_json { + println!("{}", result.serialize_json()?) + } else if result.verbosity.is_verbose() { + println!("{}", result.display()) + } + Ok(()) + } } } From 2154bf3d7a292a0cfbc01aab3de14c1cf874a534 Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Wed, 30 Aug 2023 00:44:45 +0100 Subject: [PATCH 27/31] fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 298401459..21fbfaa9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Adds workflow for publishing docker images for the verifiable builds - [#1267](https://github.com/paritytech/cargo-contract/pull/1267) +- Add `verify` command - [#1306](https://github.com/paritytech/cargo-contract/pull/1306) ## [4.0.0-alpha] @@ -240,7 +241,6 @@ This release supports the ink! [`v4.0.0-beta`](https://github.com/paritytech/ink ### Added - Add Rust specific build info to metadata - [#680](https://github.com/paritytech/cargo-contract/pull/680) -- Add `verify` command - [#696](https://github.com/paritytech/cargo-contract/pull/696) ### Changed - Removed requirement to install binaryen. The `wasm-opt` tool is now compiled into `cargo-contract` - [#766](https://github.com/paritytech/cargo-contract/pull/766). From c81857f73ad63134310b5e65b0a2a323af950bb3 Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Wed, 30 Aug 2023 00:46:02 +0100 Subject: [PATCH 28/31] fix file header --- crates/cargo-contract/src/cmd/verify.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 4bf216366..a13b05f15 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2022 Parity Technologies (UK) Ltd. +// Copyright (C) Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify From 56b27de09aea6fbc1fc46a8f4098b9d6d2a29aba Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Wed, 30 Aug 2023 14:04:41 +0100 Subject: [PATCH 29/31] apply review suggestions --- Cargo.lock | 1022 +++++++++++------------ crates/build/Cargo.toml | 2 +- crates/cargo-contract/src/cmd/mod.rs | 4 +- crates/cargo-contract/src/cmd/verify.rs | 6 +- 4 files changed, 499 insertions(+), 535 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 93c2f788d..938e513b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,7 +18,16 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli", + "gimli 0.27.3", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli 0.28.0", ] [[package]] @@ -33,7 +42,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -68,7 +77,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.10", "once_cell", "version_check", ] @@ -80,20 +89,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", - "getrandom 0.2.8", + "getrandom 0.2.10", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" dependencies = [ "memchr", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -128,15 +143,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] @@ -186,9 +201,9 @@ checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc" [[package]] name = "arrayref" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" @@ -207,9 +222,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "assert_cmd" @@ -234,9 +249,9 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-channel" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", "event-listener", @@ -245,9 +260,9 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" +checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb" dependencies = [ "async-lock", "async-task", @@ -271,29 +286,29 @@ dependencies = [ [[package]] name = "async-io" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ "async-lock", "autocfg", + "cfg-if", "concurrent-queue", "futures-lite", - "libc", "log", "parking", "polling", + "rustix 0.37.23", "slab", "socket2 0.4.9", "waker-fn", - "windows-sys 0.42.0", ] [[package]] name = "async-lock" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ "event-listener", ] @@ -323,26 +338,26 @@ dependencies = [ "cfg-if", "event-listener", "futures-lite", - "rustix 0.37.4", + "rustix 0.37.23", "signal-hook", "windows-sys 0.48.0", ] [[package]] name = "async-task" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" +checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.66" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84f9ebcc6c1f5b8cb160f6990096a5c127f423fcb6e1ccc46c370cbdfb75dfc" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.29", ] [[package]] @@ -353,9 +368,9 @@ checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" [[package]] name = "atomic-waker" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" +checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" [[package]] name = "autocfg" @@ -365,16 +380,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line", + "addr2line 0.21.0", "cc", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.32.0", "rustc-demangle", ] @@ -392,9 +407,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" [[package]] name = "beef" @@ -481,8 +496,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", - "arrayvec 0.7.2", - "constant_time_eq 0.2.5", + "arrayvec 0.7.4", + "constant_time_eq 0.2.6", ] [[package]] @@ -503,7 +518,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -512,7 +527,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -526,9 +541,9 @@ dependencies = [ [[package]] name = "blocking" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" +checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" dependencies = [ "async-channel", "async-lock", @@ -536,6 +551,7 @@ dependencies = [ "atomic-waker", "fastrand 1.9.0", "futures-lite", + "log", ] [[package]] @@ -544,7 +560,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af254ed2da4936ef73309e9597180558821cb16ae9bba4cb24ce6b612d8d80ed" dependencies = [ - "base64 0.21.2", + "base64 0.21.3", "bollard-stubs", "bytes", "futures-core", @@ -579,9 +595,9 @@ dependencies = [ [[package]] name = "borsh" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40f9ca3698b2e4cb7c15571db0abc5551dca417a21ae8140460b50309bb2cc62" +checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" dependencies = [ "borsh-derive", "hashbrown 0.13.2", @@ -589,9 +605,9 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598b3eacc6db9c3ee57b22707ad8f6a8d2f6d442bfe24ffeb8cbb70ca59e6a35" +checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", @@ -602,9 +618,9 @@ dependencies = [ [[package]] name = "borsh-derive-internal" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186b734fa1c9f6743e90c95d7233c9faab6360d1a96d4ffa19d9cfd1e9350f8a" +checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" dependencies = [ "proc-macro2", "quote", @@ -613,9 +629,9 @@ dependencies = [ [[package]] name = "borsh-schema-derive-internal" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b7ff1008316626f485991b960ade129253d4034014616b94f309a15366cc49" +checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" dependencies = [ "proc-macro2", "quote", @@ -640,7 +656,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "030ea61398f34f1395ccbeb046fb68c87b631d1f34567fed0f0f11fa35d18d8d" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", ] [[package]] @@ -660,21 +676,20 @@ dependencies = [ [[package]] name = "bstr" -version = "1.3.0" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1" +checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" dependencies = [ "memchr", - "once_cell", - "regex-automata 0.1.10", + "regex-automata 0.3.7", "serde", ] [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byte-slice-cast" @@ -724,9 +739,9 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "camino" -version = "1.1.4" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c530edf18f37068ac2d977409ed5cd50d53d73bc653c7647b48eb78976ac9ae2" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" dependencies = [ "serde", ] @@ -765,9 +780,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" dependencies = [ "serde", ] @@ -788,11 +803,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "jobserver", + "libc", ] [[package]] @@ -828,15 +844,15 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "f56b4c72906975ca04becb8a30e102dfecddd0c06181e3e95ddc444be28881f8" dependencies = [ + "android-tzdata", "iana-time-zone", - "num-integer", "num-traits", "serde", - "winapi", + "windows-targets 0.48.5", ] [[package]] @@ -845,7 +861,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -880,20 +896,20 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "cmake" -version = "0.1.49" +version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" dependencies = [ "cc", ] @@ -927,9 +943,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" +checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" dependencies = [ "crossbeam-utils", ] @@ -942,9 +958,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "constant_time_eq" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" +checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" [[package]] name = "contract-build" @@ -1080,9 +1096,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpp_demangle" @@ -1095,9 +1111,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -1132,9 +1148,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -1176,7 +1192,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "typenum", ] @@ -1186,7 +1202,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "subtle", ] @@ -1196,7 +1212,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "subtle", ] @@ -1243,18 +1259,31 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-rc.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d4ba9852b42210c7538b75484f9daa0655e9a3ac04f693747bb0f02cf3cfe16" +checksum = "f711ade317dd348950a9910f81c5947e3d8907ebd2b83f76203ff1807e6a2bc2" dependencies = [ "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", "fiat-crypto", - "packed_simd_2", "platforms", + "rustc_version", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + [[package]] name = "curve25519-dalek-ng" version = "4.1.1" @@ -1270,9 +1299,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.92" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a140f260e6f3f79013b8bfc65e7ce630c9ab4388c6a89c71e07226f49487b72" +checksum = "bbe98ba1789d56fb3db3bee5e032774d4f421b685de7ba703643584ba24effbe" dependencies = [ "cc", "cxxbridge-flags", @@ -1282,9 +1311,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.92" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da6383f459341ea689374bf0a42979739dc421874f112ff26f829b8040b8e613" +checksum = "c4ce20f6b8433da4841b1dadfb9468709868022d829d5ca1f2ffbda928455ea3" dependencies = [ "cc", "codespan-reporting", @@ -1292,24 +1321,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 1.0.109", + "syn 2.0.29", ] [[package]] name = "cxxbridge-flags" -version = "1.0.92" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90201c1a650e95ccff1c8c0bb5a343213bdd317c6e600a93075bca2eff54ec97" +checksum = "20888d9e1d2298e2ff473cee30efe7d5036e437857ab68bbfea84c74dba91da2" [[package]] name = "cxxbridge-macro" -version = "1.0.92" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b75aed41bb2e6367cae39e6326ef817a851db13c13e4f3263714ca3cfb8de56" +checksum = "2fa16a70dd58129e4dfffdff535fb1bce66673f7bbeec4a5a1765a504e1ccd84" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.29", ] [[package]] @@ -1357,7 +1386,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -1379,14 +1408,14 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "deranged" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" dependencies = [ "serde", ] @@ -1442,7 +1471,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", ] [[package]] @@ -1503,9 +1532,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" [[package]] name = "ed25519" @@ -1575,20 +1604,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - -[[package]] -name = "errno" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" dependencies = [ "errno-dragonfly", "libc", @@ -1691,9 +1709,9 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "15.0.0" +version = "15.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" +checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" dependencies = [ "cfg-if", "parity-scale-codec", @@ -1769,9 +1787,9 @@ checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-lite" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ "fastrand 1.9.0", "futures-core", @@ -1790,7 +1808,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -1840,9 +1858,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -1861,9 +1879,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -1882,15 +1900,21 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" dependencies = [ "fallible-iterator", "indexmap 1.9.3", "stable_deref_trait", ] +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + [[package]] name = "glob" version = "0.2.11" @@ -1899,9 +1923,9 @@ checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "h2" -version = "0.3.18" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -1966,18 +1990,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "hex" @@ -2021,7 +2036,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", - "generic-array 0.14.6", + "generic-array 0.14.7", "hmac 0.8.1", ] @@ -2055,9 +2070,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" @@ -2067,9 +2082,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.24" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -2091,18 +2106,19 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.2" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" dependencies = [ + "futures-util", "http", "hyper", "log", - "rustls 0.20.8", + "rustls", "rustls-native-certs", "tokio", - "tokio-rustls 0.23.4", - "webpki-roots", + "tokio-rustls", + "webpki-roots 0.23.1", ] [[package]] @@ -2120,26 +2136,25 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.53" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi", + "windows", ] [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] @@ -2266,7 +2281,7 @@ dependencies = [ "quote", "serde", "serde_json", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -2280,7 +2295,7 @@ dependencies = [ "ink_primitives", "parity-scale-codec", "secp256k1 0.27.0", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", ] @@ -2307,7 +2322,7 @@ dependencies = [ "scale-encode", "scale-info", "secp256k1 0.27.0", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "static_assertions", ] @@ -2323,7 +2338,7 @@ dependencies = [ "itertools 0.10.5", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -2338,8 +2353,8 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.28", - "synstructure 0.13.0", + "syn 2.0.29", + "synstructure", ] [[package]] @@ -2437,24 +2452,24 @@ checksum = "f6f38a50a899dc47a6d0ed5508e7f601a2e34c3a85303514b5d137f3c10a0c75" [[package]] name = "io-lifetimes" -version = "1.0.6" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ + "hermit-abi", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "is-terminal" -version = "0.4.4" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix 0.36.9", - "windows-sys 0.45.0", + "hermit-abi", + "rustix 0.38.10", + "windows-sys 0.48.0", ] [[package]] @@ -2477,9 +2492,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" @@ -2498,23 +2513,23 @@ checksum = "72167d68f5fce3b8655487b8038691a3c9984ee769590f93f2a631f4ad64e4f5" [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] [[package]] name = "jsonrpsee" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" +checksum = "367a292944c07385839818bb71c8d76611138e2dedb0677d035b8da21d29c78b" dependencies = [ - "jsonrpsee-client-transport 0.16.2", - "jsonrpsee-core 0.16.2", + "jsonrpsee-client-transport 0.16.3", + "jsonrpsee-core 0.16.3", "jsonrpsee-http-client", - "jsonrpsee-types 0.16.2", + "jsonrpsee-types 0.16.3", ] [[package]] @@ -2530,23 +2545,23 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" +checksum = "c8b3815d9f5d5de348e5f162b316dc9cdf4548305ebb15b4eb9328e66cf27d7a" dependencies = [ "futures-util", "http", - "jsonrpsee-core 0.16.2", - "jsonrpsee-types 0.16.2", + "jsonrpsee-core 0.16.3", + "jsonrpsee-types 0.16.3", "pin-project", "rustls-native-certs", "soketto", "thiserror", "tokio", - "tokio-rustls 0.23.4", + "tokio-rustls", "tokio-util", "tracing", - "webpki-roots", + "webpki-roots 0.25.2", ] [[package]] @@ -2563,7 +2578,7 @@ dependencies = [ "soketto", "thiserror", "tokio", - "tokio-rustls 0.24.0", + "tokio-rustls", "tokio-util", "tracing", "url", @@ -2571,9 +2586,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" +checksum = "2b5dde66c53d6dcdc8caea1874a45632ec0fcf5b437789f1e45766a1512ce803" dependencies = [ "anyhow", "async-lock", @@ -2583,7 +2598,7 @@ dependencies = [ "futures-timer", "futures-util", "hyper", - "jsonrpsee-types 0.16.2", + "jsonrpsee-types 0.16.3", "rustc-hash", "serde", "serde_json", @@ -2615,15 +2630,15 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc345b0a43c6bc49b947ebeb936e886a419ee3d894421790c969cc56040542ad" +checksum = "7e5f9fabdd5d79344728521bb65e3106b49ec405a78b66fbff073b72b389fa43" dependencies = [ "async-trait", "hyper", "hyper-rustls", - "jsonrpsee-core 0.16.2", - "jsonrpsee-types 0.16.2", + "jsonrpsee-core 0.16.3", + "jsonrpsee-types 0.16.3", "rustc-hash", "serde", "serde_json", @@ -2634,9 +2649,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" +checksum = "245ba8e5aa633dd1c1e4fae72bce06e71f42d34c14a2767c6b4d173b57bee5e5" dependencies = [ "anyhow", "beef", @@ -2675,9 +2690,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" dependencies = [ "cpufeatures", ] @@ -2696,15 +2711,9 @@ checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libm" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" - -[[package]] -name = "libm" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "libsecp256k1" @@ -2756,9 +2765,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +checksum = "9d240c6f7e1ba3a28b0249f774e6a9dd0175054b52dfbb61b16eb8505c3785c9" dependencies = [ "cc", ] @@ -2771,9 +2780,9 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "linux-raw-sys" -version = "0.3.0" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd550e73688e6d578f0ac2119e32b797a327631a42f9433e59d02e139c8df60d" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" @@ -2783,9 +2792,9 @@ checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -2832,17 +2841,17 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f478948fd84d9f8e86967bf432640e46adfb5a4bd4f14ef7e864ab38220534ae" [[package]] name = "memfd" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb" +checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix 0.36.9", + "rustix 0.37.23", ] [[package]] @@ -2895,23 +2904,23 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2973,9 +2982,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", @@ -2988,7 +2997,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "itoa", ] @@ -3016,28 +3025,28 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi", "libc", ] [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "crc32fast", "hashbrown 0.13.2", @@ -3045,11 +3054,20 @@ dependencies = [ "memchr", ] +[[package]] +name = "object" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -3085,16 +3103,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "packed_simd_2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" -dependencies = [ - "cfg-if", - "libm 0.1.4", -] - [[package]] name = "pallet-contracts-primitives" version = "24.0.0" @@ -3111,11 +3119,11 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.4" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8e946cc0cc711189c0b0249fb8b599cbeeab9784d83c415719368bb8d4ac64" +checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "bitvec", "byte-slice-cast", "bytes", @@ -3126,9 +3134,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.4" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a296c3079b5fefbc499e1de58dc26c09b1b9a5952d26694ee89f04a43ebbb3e" +checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -3144,9 +3152,9 @@ checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" [[package]] name = "parking" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" [[package]] name = "parking_lot" @@ -3160,22 +3168,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.48.5", ] [[package]] name = "paste" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pbkdf2" @@ -3227,14 +3235,14 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -3244,15 +3252,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "platforms" -version = "3.0.2" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" [[package]] name = "polling" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e1f879b2998099c2d69ab9605d145d5b661195627eccc680002c4918a7fb6fa" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", "bitflags 1.3.2", @@ -3261,7 +3269,7 @@ dependencies = [ "libc", "log", "pin-project-lite", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -3316,9 +3324,9 @@ checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" [[package]] name = "predicates-tree" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54ff541861505aabf6ea722d2131ee980b8276e10a1297b94e896dd8b621850d" +checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" dependencies = [ "predicates-core", "termtree", @@ -3430,9 +3438,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -3502,7 +3510,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.10", ] [[package]] @@ -3514,15 +3522,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -3534,22 +3533,22 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.15" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9af2cf09ef80e610097515e80095b7f76660a92743c4185aff5406cd5ce3dd5" +checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.15" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c501201393982e275433bc55de7d6ae6f00e7699cd5572c5b57581cd69c881b" +checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.29", ] [[package]] @@ -3660,7 +3659,7 @@ version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c4216490d5a413bc6d10fa4742bd7d4955941d062c0ef873141d6b0e7b30fd" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "borsh", "bytes", "num-traits", @@ -3672,9 +3671,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustc-hash" @@ -3699,12 +3698,12 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.9" +version = "0.36.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" +checksum = "c37f1bd5ef1b5422177b7646cba67430579cfe2ace80f284fee876bca52ad941" dependencies = [ "bitflags 1.3.2", - "errno 0.2.8", + "errno", "io-lifetimes", "libc", "linux-raw-sys 0.1.4", @@ -3713,26 +3712,26 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.4" +version = "0.37.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c348b5dc624ecee40108aa2922fed8bad89d7fcc2b9f8cb18f632898ac4a37f9" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" dependencies = [ "bitflags 1.3.2", - "errno 0.3.2", + "errno", "io-lifetimes", "libc", - "linux-raw-sys 0.3.0", - "windows-sys 0.45.0", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", ] [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "ed6248e1caa625eb708e266e06159f135e8c26f2bb7ceb72dc4b2766d0340964" dependencies = [ "bitflags 2.4.0", - "errno 0.3.2", + "errno", "libc", "linux-raw-sys 0.4.5", "windows-sys 0.48.0", @@ -3740,33 +3739,21 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.8" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", - "sct", - "webpki", -] - -[[package]] -name = "rustls" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07180898a28ed6a7f7ba2311594308f595e3dd2e3c3812fa0a80a47b45f17e5d" -dependencies = [ - "log", - "ring", - "rustls-webpki", + "rustls-webpki 0.101.4", "sct", ] [[package]] name = "rustls-native-certs" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -3776,11 +3763,11 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.2", + "base64 0.21.3", ] [[package]] @@ -3793,11 +3780,21 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustls-webpki" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ruzstd" @@ -3812,9 +3809,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -3928,7 +3925,7 @@ dependencies = [ "blake2", "derive_more", "either", - "frame-metadata 15.0.0", + "frame-metadata 15.1.0", "parity-scale-codec", "scale-bits", "scale-decode", @@ -3940,11 +3937,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -3983,7 +3980,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "844b7645371e6ecdf61ff246ba1958c29e802881a749ae3fb1993675d210d28d" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec 0.7.4", "curve25519-dalek-ng", "merlin 3.0.0", "rand_core 0.6.4", @@ -3995,15 +3992,15 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scratch" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" +checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" [[package]] name = "sct" @@ -4068,9 +4065,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.8.2" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -4081,9 +4078,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -4124,7 +4121,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -4146,7 +4143,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -4225,9 +4222,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", @@ -4236,9 +4233,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ "digest 0.10.7", "keccak", @@ -4307,24 +4304,24 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "siphasher" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "smol" @@ -4349,10 +4346,10 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cce5e2881b30bad7ef89f383a816ad0b22c45915911f28499026de4a76d20ee" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "async-lock", "atomic", - "base64 0.21.2", + "base64 0.21.3", "bip39", "blake2-rfc", "bs58 0.5.0", @@ -4383,7 +4380,7 @@ dependencies = [ "schnorrkel 0.10.2", "serde", "serde_json", - "sha2 0.10.6", + "sha2 0.10.7", "siphasher", "slab", "smallvec", @@ -4426,17 +4423,17 @@ dependencies = [ [[package]] name = "snow" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ccba027ba85743e09d15c03296797cad56395089b832b48b5a5217880f57733" +checksum = "0c9d1425eb528a21de2755c75af4c9b5d57f50a0d4c3b7f1828a4cd03f8ba155" dependencies = [ "aes-gcm", "blake2", "chacha20poly1305", - "curve25519-dalek 4.0.0-rc.1", + "curve25519-dalek 4.0.0", "rand_core 0.6.4", "rustc_version", - "sha2 0.10.6", + "sha2 0.10.7", "subtle", ] @@ -4633,7 +4630,7 @@ dependencies = [ "blake2b_simd", "byteorder", "digest 0.10.7", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "sp-std 8.0.0", "twox-hash", @@ -4648,7 +4645,7 @@ dependencies = [ "blake2b_simd", "byteorder", "digest 0.10.7", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "twox-hash", ] @@ -4661,7 +4658,7 @@ checksum = "c7f531814d2f16995144c74428830ccf7d94ff4a7749632b83ad8199b181140c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -4672,7 +4669,7 @@ checksum = "f12dae7cf6c1e825d13ffd4ce16bd9309db7c539929d0302b4443ed451a9f4e5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -4907,7 +4904,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -4920,7 +4917,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -5154,9 +5151,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "ss58-registry" -version = "1.39.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecf0bd63593ef78eca595a7fc25e9a443ca46fe69fd472f8f09f5245cdcd769d" +checksum = "5e6915280e2d0db8911e5032a5c275571af6bdded2916abd691a659be25d3439" dependencies = [ "Inflector", "num-format", @@ -5226,7 +5223,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -5274,7 +5271,7 @@ dependencies = [ "futures", "hex", "impl-serde", - "jsonrpsee 0.16.2", + "jsonrpsee 0.16.3", "parity-scale-codec", "primitive-types", "scale-bits", @@ -5301,13 +5298,13 @@ dependencies = [ "frame-metadata 16.0.0", "heck", "hex", - "jsonrpsee 0.16.2", + "jsonrpsee 0.16.3", "parity-scale-codec", "proc-macro2", "quote", "scale-info", "subxt-metadata", - "syn 2.0.28", + "syn 2.0.29", "thiserror", "tokio", ] @@ -5338,7 +5335,7 @@ dependencies = [ "darling 0.20.3", "proc-macro-error", "subxt-codegen", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -5369,7 +5366,7 @@ dependencies = [ "schnorrkel 0.10.2", "secp256k1 0.27.0", "secrecy", - "sha2 0.10.6", + "sha2 0.10.7", "sp-core-hashing 9.0.0", "subxt", "thiserror", @@ -5389,27 +5386,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "unicode-xid", -] - [[package]] name = "synstructure" version = "0.13.0" @@ -5418,7 +5403,7 @@ checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", "unicode-xid", ] @@ -5430,9 +5415,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.6" +version = "0.12.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" +checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" [[package]] name = "tempfile" @@ -5442,8 +5427,8 @@ checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand 2.0.0", - "redox_syscall 0.3.5", - "rustix 0.38.8", + "redox_syscall", + "rustix 0.38.10", "windows-sys 0.48.0", ] @@ -5468,9 +5453,9 @@ dependencies = [ [[package]] name = "termtree" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8" +checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" @@ -5509,7 +5494,7 @@ checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -5524,9 +5509,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" +checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" dependencies = [ "deranged", "itoa", @@ -5543,9 +5528,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" +checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" dependencies = [ "time-core", ] @@ -5562,7 +5547,7 @@ dependencies = [ "pbkdf2 0.11.0", "rand 0.8.5", "rustc-hash", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", "unicode-normalization", "wasm-bindgen", @@ -5618,27 +5603,16 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls 0.20.8", - "tokio", - "webpki", -] - -[[package]] -name = "tokio-rustls" -version = "0.24.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.0", + "rustls", "tokio", ] @@ -5655,9 +5629,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" dependencies = [ "bytes", "futures-core", @@ -5731,20 +5705,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.23" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.29", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", "valuable", @@ -5871,15 +5845,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524b68aca1d05e03fdf03fcdce2c6c94b6daf6d16861ddaa7e4f2b6638a9052c" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -5908,7 +5882,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" dependencies = [ - "generic-array 0.14.6", + "generic-array 0.14.7", "subtle", ] @@ -6014,11 +5988,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -6036,9 +6009,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -6046,24 +6019,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.29", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6071,22 +6044,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.29", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-opt" @@ -6155,7 +6128,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624e6333e861ef49095d2d678b76ebf30b06bf37effca845be7e5b87c90071b7" dependencies = [ "downcast-rs", - "libm 0.2.6", + "libm", "num-traits", "paste", ] @@ -6191,7 +6164,7 @@ dependencies = [ "indexmap 1.9.3", "libc", "log", - "object", + "object 0.30.4", "once_cell", "paste", "psm", @@ -6221,10 +6194,10 @@ checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" dependencies = [ "anyhow", "cranelift-entity", - "gimli", + "gimli 0.27.3", "indexmap 1.9.3", "log", - "object", + "object 0.30.4", "serde", "target-lexicon", "thiserror", @@ -6238,14 +6211,14 @@ version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" dependencies = [ - "addr2line", + "addr2line 0.19.0", "anyhow", "bincode", "cfg-if", "cpp_demangle", - "gimli", + "gimli 0.27.3", "log", - "object", + "object 0.30.4", "rustc-demangle", "serde", "target-lexicon", @@ -6292,7 +6265,7 @@ dependencies = [ "memoffset", "paste", "rand 0.8.5", - "rustix 0.36.9", + "rustix 0.36.15", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", @@ -6313,32 +6286,28 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] -name = "webpki" -version = "0.22.0" +name = "webpki-roots" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" dependencies = [ - "ring", - "untrusted", + "rustls-webpki 0.100.2", ] [[package]] name = "webpki-roots" -version = "0.22.6" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "which" @@ -6383,18 +6352,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows-sys" -version = "0.42.0" +name = "windows" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows_aarch64_gnullvm 0.42.1", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm 0.42.1", - "windows_x86_64_msvc 0.42.1", + "windows-targets 0.48.5", ] [[package]] @@ -6403,7 +6366,7 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets 0.42.1", + "windows-targets 0.42.2", ] [[package]] @@ -6412,128 +6375,128 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] name = "windows-targets" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm 0.42.1", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm 0.42.1", - "windows_x86_64_msvc 0.42.1", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.10" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5504cc7644f4b593cbc05c4a55bf9bd4e94b867c3c0bd440934174d50482427d" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" dependencies = [ "memchr", ] @@ -6567,23 +6530,22 @@ checksum = "ff4524214bc4629eba08d78ceb1d6507070cc0bcbbed23af74e19e6e924a24cf" [[package]] name = "zeroize" -version = "1.5.7" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.3.3" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", - "synstructure 0.12.6", + "syn 2.0.29", ] [[package]] diff --git a/crates/build/Cargo.toml b/crates/build/Cargo.toml index c0efb4cf4..feac1025f 100644 --- a/crates/build/Cargo.toml +++ b/crates/build/Cargo.toml @@ -35,7 +35,7 @@ serde_json = "1.0.105" tempfile = "3.8.0" term_size = "0.3.2" url = { version = "2.4.1", features = ["serde"] } -wasm-opt = "0.114.1" +wasm-opt = "=0.114.1" which = "4.4.0" zip = { version = "0.6.6", default-features = false } strum = { version = "0.25", features = ["derive"] } diff --git a/crates/cargo-contract/src/cmd/mod.rs b/crates/cargo-contract/src/cmd/mod.rs index 2ec77ccb5..a6e556d3f 100644 --- a/crates/cargo-contract/src/cmd/mod.rs +++ b/crates/cargo-contract/src/cmd/mod.rs @@ -19,10 +19,10 @@ pub mod call; pub mod decode; pub mod encode; pub mod info; -pub mod verify; pub mod instantiate; pub mod remove; pub mod upload; +pub mod verify; pub(crate) use self::{ build::{ @@ -32,10 +32,10 @@ pub(crate) use self::{ call::CallCommand, decode::DecodeCommand, info::InfoCommand, - verify::VerifyCommand, instantiate::InstantiateCommand, remove::RemoveCommand, upload::UploadCommand, + verify::VerifyCommand, }; use crate::{ diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 083b3118c..7c2637536 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -21,6 +21,7 @@ use anyhow::{ use colored::Colorize; use contract_build::{ execute, + verbose_eprintln, BuildArtifacts, BuildInfo, BuildMode, @@ -28,7 +29,7 @@ use contract_build::{ ImageVariant, ManifestPath, Verbosity, - VerbosityFlags, verbose_eprintln, + VerbosityFlags, }; use contract_metadata::ContractMetadata; @@ -180,7 +181,8 @@ impl VerifyCommand { let target_code_hash = built_contract.source.hash; if reference_code_hash != target_code_hash { - tracing::debug!( + verbose_eprintln!( + verbosity, "Expected Code Hash: '{:?}'\n\nGot Code Hash: `{:?}`", &reference_code_hash, &target_code_hash From 6e4fee5810e22c7d8a70ba3a9ec50ca3ccb6cbac Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Wed, 30 Aug 2023 14:20:42 +0100 Subject: [PATCH 30/31] prettify code hash output --- crates/cargo-contract/src/cmd/verify.rs | 2 +- crates/metadata/src/lib.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/cargo-contract/src/cmd/verify.rs b/crates/cargo-contract/src/cmd/verify.rs index 7c2637536..e9b9517e4 100644 --- a/crates/cargo-contract/src/cmd/verify.rs +++ b/crates/cargo-contract/src/cmd/verify.rs @@ -183,7 +183,7 @@ impl VerifyCommand { if reference_code_hash != target_code_hash { verbose_eprintln!( verbosity, - "Expected Code Hash: '{:?}'\n\nGot Code Hash: `{:?}`", + "Expected Code Hash: '{}'\n\nGot Code Hash: `{}`", &reference_code_hash, &target_code_hash ); diff --git a/crates/metadata/src/lib.rs b/crates/metadata/src/lib.rs index 5c2eda18c..5550a5919 100644 --- a/crates/metadata/src/lib.rs +++ b/crates/metadata/src/lib.rs @@ -167,6 +167,18 @@ impl From<[u8; 32]> for CodeHash { } } +impl Display for CodeHash { + fn fmt(&self, f: &mut Formatter<'_>) -> DisplayResult { + let raw_string = self + .0 + .iter() + .map(|b| format!("{:x?}", b)) + .collect::>() + .join(""); + f.write_fmt(format_args!("0x{}", raw_string)) + } +} + /// Information about the contract's Wasm code. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Source { From dee765cdc1a55afd2b0c5baa60df2e3c41094213 Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Wed, 30 Aug 2023 16:30:24 +0100 Subject: [PATCH 31/31] add integration tests --- crates/cargo-contract/tests/verify.rs | 234 ++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100644 crates/cargo-contract/tests/verify.rs diff --git a/crates/cargo-contract/tests/verify.rs b/crates/cargo-contract/tests/verify.rs new file mode 100644 index 000000000..52b096e52 --- /dev/null +++ b/crates/cargo-contract/tests/verify.rs @@ -0,0 +1,234 @@ +// Copyright 2018-2020 Parity Technologies (UK) Ltd. +// This file is part of cargo-contract. +// +// cargo-contract is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// cargo-contract is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with cargo-contract. If not, see . + +use std::path::Path; + +/// Create a `cargo contract` command +fn cargo_contract>(path: P) -> assert_cmd::Command { + let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + cmd.current_dir(path).arg("contract"); + cmd +} + +/// Compile the reference contract and return a byte array of its bundle. +fn compile_reference_contract() -> Vec { + let contract = r#" + #![cfg_attr(not(feature = "std"), no_std, no_main)] + + #[ink::contract] + mod incrementer { + #[ink(storage)] + pub struct Incrementer { + value: i32, + } + + impl Incrementer { + #[ink(constructor)] + pub fn new(init_value: i32) -> Self { + Self { value: init_value } + } + + #[ink(constructor)] + pub fn new_default() -> Self { + Self::new(Default::default()) + } + + #[ink(message)] + pub fn inc(&mut self, by: i32) { + self.value.saturating_add(by); + } + + #[ink(message, selector = 0xCACACACA)] + pub fn get(&self) -> i32 { + self.value + } + } + }"#; + let tmp_dir = tempfile::Builder::new() + .prefix("cargo-contract.cli.test.") + .tempdir() + .expect("temporary directory creation failed"); + + // cargo contract new reference contract + cargo_contract(tmp_dir.path()) + .arg("new") + .arg("incrementer") + .assert() + .success(); + + let project_dir = tmp_dir.path().to_path_buf().join("incrementer"); + + let lib = project_dir.join("lib.rs"); + std::fs::write(lib, contract).expect("Failed to write contract lib.rs"); + + tracing::debug!("Building contract in {}", project_dir.to_string_lossy()); + cargo_contract(&project_dir) + .arg("build") + .arg("--release") + .assert() + .success(); + + let bundle_path = project_dir.join("target/ink/incrementer.contract"); + + std::fs::read(bundle_path) + .expect("Failed to read the content of the contract bundle!") +} + +#[test] +fn verify_equivalent_contracts() { + // given + let contract = r#" + #![cfg_attr(not(feature = "std"), no_std, no_main)] + + #[ink::contract] + mod incrementer { + #[ink(storage)] + pub struct Incrementer { + value: i32, + } + + impl Incrementer { + #[ink(constructor)] + pub fn new(init_value: i32) -> Self { + Self { value: init_value } + } + + #[ink(constructor)] + pub fn new_default() -> Self { + Self::new(Default::default()) + } + + #[ink(message)] + pub fn inc(&mut self, by: i32) { + self.value.saturating_add(by); + } + + #[ink(message, selector = 0xCACACACA)] + pub fn get(&self) -> i32 { + self.value + } + } + }"#; + let tmp_dir = tempfile::Builder::new() + .prefix("cargo-contract.cli.test.") + .tempdir() + .expect("temporary directory creation failed"); + + // cargo contract new sample contract + cargo_contract(tmp_dir.path()) + .arg("new") + .arg("incrementer") + .assert() + .success(); + + let project_dir = tmp_dir.path().to_path_buf().join("incrementer"); + + let lib = project_dir.join("lib.rs"); + std::fs::write(lib, contract).expect("Failed to write contract lib.rs"); + + // Compile reference contract and write bundle in the directory. + let reference_contents = compile_reference_contract(); + let bundle = project_dir.join("reference.contract"); + std::fs::write(bundle, reference_contents) + .expect("Failed to write bundle contract to the current dir!"); + + // when + let output: &str = r#""is_verified": true"#; + + // then + cargo_contract(&project_dir) + .arg("verify") + .arg("reference.contract") + .arg("--output-json") + .assert() + .success() + .stdout(predicates::str::contains(output)); +} + +#[test] +fn verify_different_contracts() { + // given + let contract = r#" + #![cfg_attr(not(feature = "std"), no_std, no_main)] + + #[ink::contract] + mod incrementer { + #[ink(storage)] + pub struct Incrementer { + value: i32, + } + + impl Incrementer { + #[ink(constructor)] + pub fn new(init_value: i32) -> Self { + Self { value: init_value } + } + + #[ink(constructor)] + pub fn new_default() -> Self { + Self::new(Default::default()) + } + + #[ink(message)] + pub fn inc(&mut self, by: i32) { + self.value.saturating_add(by); + } + + #[ink(message, selector = 0xCBCBCBCB)] + pub fn get(&self) -> i32 { + self.value + } + } + }"#; + + let tmp_dir = tempfile::Builder::new() + .prefix("cargo-contract.cli.test.") + .tempdir() + .expect("temporary directory creation failed"); + + // cargo contract new sample contract. + cargo_contract(tmp_dir.path()) + .arg("new") + .arg("incrementer") + .assert() + .success(); + + let project_dir = tmp_dir.path().to_path_buf().join("incrementer"); + + let lib = project_dir.join("lib.rs"); + std::fs::write(lib, contract).expect("Failed to write contract lib.rs"); + + tracing::debug!("Building contract in {}", project_dir.to_string_lossy()); + cargo_contract(&project_dir).arg("build").assert().success(); + + // Compile reference contract and write bundle in the directory. + let reference_contents = compile_reference_contract(); + let bundle = project_dir.join("reference.contract"); + std::fs::write(bundle, reference_contents) + .expect("Failed to write bundle contract to the current dir!"); + + // when + let output: &str = r#"Failed to verify the authenticity of `incrementer`"#; + + // then + cargo_contract(&project_dir) + .arg("verify") + .arg("reference.contract") + .arg("--output-json") + .assert() + .failure() + .stderr(predicates::str::contains(output)); +}