From 2cda649b73078b1fffc55828fd6ba45d0c71e8ec Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 5 Feb 2020 22:36:57 +0000 Subject: [PATCH 01/98] WIP: building wasm with xargo --- Cargo.lock | 25 +------------------ Cargo.toml | 2 +- src/cmd/build.rs | 58 +++++++++++++++++++++++++++++++++++---------- src/cmd/cargo.rs | 54 +++++++++++++++++++++++++++++++++++++++++ src/cmd/metadata.rs | 7 ++++++ src/cmd/mod.rs | 35 ++------------------------- 6 files changed, 110 insertions(+), 71 deletions(-) create mode 100644 src/cmd/cargo.rs diff --git a/Cargo.lock b/Cargo.lock index 33d3108d..e9f48ed2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,7 +281,7 @@ dependencies = [ "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", "structopt 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-subxt 0.4.0 (git+https://github.com/paritytech/substrate-subxt/?rev=399ac68cb1547ba4879e389c28d72aa7a2bae139)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1855,14 +1855,6 @@ name = "regex-syntax" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "remove_dir_all" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ring" version = "0.16.9" @@ -2508,19 +2500,6 @@ dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tempfile" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "termcolor" version = "1.1.0" @@ -3258,7 +3237,6 @@ dependencies = [ "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8" "checksum regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06" -"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" "checksum ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6747f8da1f2b1fabbee1aaa4eb8a11abf9adef0bf58a41cee45db5d59cecdfac" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" "checksum rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" @@ -3320,7 +3298,6 @@ dependencies = [ "checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" "checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" "checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" -"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thiserror 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "205684fd018ca14432b12cce6ea3d46763311a571c3d294e71ba3f01adcf1aad" diff --git a/Cargo.toml b/Cargo.toml index 4756d527..0a765934 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ cargo_metadata = "0.9.1" codec = { package = "parity-scale-codec", version = "1.1" } which = "3.1.0" colored = "1.9" +toml = "0.5.4" # dependencies for optional extrinsics feature async-std = { version = "1.5.0", optional = true } @@ -43,7 +44,6 @@ walkdir = "2.3.1" [dev-dependencies] assert_matches = "1.3.0" -tempfile = "3.1.0" wabt = "0.9.2" [features] diff --git a/src/cmd/build.rs b/src/cmd/build.rs index c054f591..7aa0c63d 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -15,7 +15,7 @@ // along with ink!. If not, see . use std::{ - fs::metadata, + fs::{self, metadata}, io::{self, Write}, path::PathBuf, process::Command, @@ -25,6 +25,7 @@ use anyhow::{Context, Result}; use cargo_metadata::MetadataCommand; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; +use crate::cmd::tests::with_tmp_dir; /// This is the maximum number of pages available for a contract to allocate. const MAX_MEMORY_PAGES: u32 = 16; @@ -79,20 +80,51 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result) -> Result<()> { - super::exec_cargo( - "build", - &[ - "--no-default-features", - "--release", - "--target=wasm32-unknown-unknown", - "--verbose", - ], - working_dir, - ) + let args = [ + "--no-default-features", + "--release", + "--target=wasm32-unknown-unknown", + "--verbose", + ]; + if which::which("xargo").is_err() { + super::exec_cargo( + "build", + &args, + working_dir, + )?; + println!("TODO: tell the user nicely to install xargo"); + return Ok(()) + } + let working_dir = working_dir.unwrap_or(&PathBuf::from(".")); + let manifest_path = working_dir.join("Cargo.toml"); + let xargo_config_path = working_dir.join("Xargo.toml"); + + let xargo_config = r#" +[target.wasm32-unknown-unknown.dependencies] +core = {default-features=false, features=["panic_immediate_abort"]} +std = {default-features=false, features=["panic_immediate_abort"]} +alloc = {} +"#; + + // todo: [AJ] what to do if Xargo.toml already exists? + fs::write(xargo_config_path, xargo_config)?; + + // todo: [AJ] check rlib not enabled and warn if it is +// let toml = fs::read_to_string(&manifest_path)?; +// let toml = toml::from_str(&toml)?; +// toml + + // todo: [AJ] check if nightly enabled, if not then `rustup run nightly xargo`, or even just run that anyway... + // need to figure out what cargo does + + Ok(()) } /// Ensures the wasm memory import of a given module has the maximum number of pages. diff --git a/src/cmd/cargo.rs b/src/cmd/cargo.rs new file mode 100644 index 00000000..56302ab0 --- /dev/null +++ b/src/cmd/cargo.rs @@ -0,0 +1,54 @@ +// Copyright 2018-2019 Parity Technologies (UK) Ltd. +// This file is part of ink!. +// +// ink! 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. +// +// ink! 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 ink!. If not, see . + +use anyhow::Result; +use std::{ + io::{self, Write}, + path::PathBuf, + process::Command, +}; + +pub(crate) fn exec_cargo(command: &str, args: &[&'static str], working_dir: Option<&PathBuf>) -> Result<()> { + let mut cmd = Command::new("cargo"); + if let Some(dir) = working_dir { + cmd.current_dir(dir); + } + + if !is_nightly(working_dir) { + cmd.arg("+nightly"); + } + + let output = cmd.arg(command).args(args).output()?; + + if !output.status.success() { + // Dump the output streams produced by cargo into the stdout/stderr. + io::stdout().write_all(&output.stdout)?; + io::stderr().write_all(&output.stderr)?; + anyhow::bail!("Build failed"); + } + + Ok(()) +} + +pub(crate) fn is_nightly(working_dir: Option<&PathBuf>) -> Result { + let mut cmd = Command::new("cargo"); + if let Some(dir) = working_dir { + cmd.current_dir(dir); + } + let output = cmd.arg("--version").output()?; + let decoded = String::from_utf8(o.stdout).unwrap_or_default(); + Ok(decoded.contains("-nightly")) +} diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 733a65c1..f1c6e97f 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -25,6 +25,13 @@ use cargo_metadata::MetadataCommand; pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result { println!(" Generating metadata"); + // check for existing .Cargo.toml.bk? + // todo: [AJ] check for rlib enabled, add if not + // - copy Cargo.toml to .Cargo.toml.bk or whatever (and ignore in gitignore) + // - add rlib crate type + // - exec build + // - rename backup to original + super::exec_cargo( "run", &[ diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index a7f99882..d052e637 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -22,6 +22,7 @@ use std::{ }; mod build; +mod cargo; #[cfg(feature = "extrinsics")] mod deploy; #[cfg(feature = "extrinsics")] @@ -32,45 +33,13 @@ mod metadata; mod new; pub(crate) use self::{ - build::execute_build, metadata::execute_generate_metadata, new::execute_new, + build::execute_build, cargo::exec_cargo, cargo::is_nightly, metadata::execute_generate_metadata, new::execute_new, }; #[cfg(feature = "extrinsics")] pub(crate) use self::{ deploy::execute_deploy, extrinsics::submit_extrinsic, instantiate::execute_instantiate, }; -fn exec_cargo(command: &str, args: &[&'static str], working_dir: Option<&PathBuf>) -> Result<()> { - let mut cmd = Command::new("cargo"); - let mut is_nightly_cmd = Command::new("cargo"); - if let Some(dir) = working_dir { - cmd.current_dir(dir); - is_nightly_cmd.current_dir(dir); - } - - let is_nightly_default = is_nightly_cmd - .arg("--version") - .output() - .map_err(|_| ()) - .and_then(|o| String::from_utf8(o.stdout).map_err(|_| ())) - .unwrap_or_default() - .contains("-nightly"); - - if !is_nightly_default { - cmd.arg("+nightly"); - } - - let output = cmd.arg(command).args(args).output()?; - - if !output.status.success() { - // Dump the output streams produced by cargo into the stdout/stderr. - io::stdout().write_all(&output.stdout)?; - io::stderr().write_all(&output.stderr)?; - anyhow::bail!("Build failed"); - } - - Ok(()) -} - #[cfg(test)] mod tests { use std::path::PathBuf; -- GitLab From efa20d32b934b63c83d6800da3a119bae4687147 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 6 Feb 2020 09:36:32 +0000 Subject: [PATCH 02/98] Fix compilation errors --- src/cmd/build.rs | 5 +++-- src/cmd/cargo.rs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 7aa0c63d..cd7ac922 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -25,7 +25,6 @@ use anyhow::{Context, Result}; use cargo_metadata::MetadataCommand; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; -use crate::cmd::tests::with_tmp_dir; /// This is the maximum number of pages available for a contract to allocate. const MAX_MEMORY_PAGES: u32 = 16; @@ -102,7 +101,9 @@ fn build_cargo_project(working_dir: Option<&PathBuf>) -> Result<()> { println!("TODO: tell the user nicely to install xargo"); return Ok(()) } - let working_dir = working_dir.unwrap_or(&PathBuf::from(".")); + + let current_dir = PathBuf::from("."); + let working_dir = working_dir.unwrap_or(¤t_dir); let manifest_path = working_dir.join("Cargo.toml"); let xargo_config_path = working_dir.join("Xargo.toml"); diff --git a/src/cmd/cargo.rs b/src/cmd/cargo.rs index 56302ab0..8e8a8ddf 100644 --- a/src/cmd/cargo.rs +++ b/src/cmd/cargo.rs @@ -27,7 +27,7 @@ pub(crate) fn exec_cargo(command: &str, args: &[&'static str], working_dir: Opti cmd.current_dir(dir); } - if !is_nightly(working_dir) { + if !is_nightly(working_dir)? { cmd.arg("+nightly"); } @@ -49,6 +49,6 @@ pub(crate) fn is_nightly(working_dir: Option<&PathBuf>) -> Result { cmd.current_dir(dir); } let output = cmd.arg("--version").output()?; - let decoded = String::from_utf8(o.stdout).unwrap_or_default(); + let decoded = String::from_utf8(output.stdout).unwrap_or_default(); Ok(decoded.contains("-nightly")) } -- GitLab From 16d34e082737d6fa6c93b589e2956c83d053f952 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 6 Feb 2020 09:38:04 +0000 Subject: [PATCH 03/98] Fmt --- src/cmd/build.rs | 14 +++++------- src/cmd/cargo.rs | 56 ++++++++++++++++++++++++++---------------------- src/cmd/mod.rs | 3 ++- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index cd7ac922..a57fd466 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -93,13 +93,9 @@ fn build_cargo_project(working_dir: Option<&PathBuf>) -> Result<()> { "--verbose", ]; if which::which("xargo").is_err() { - super::exec_cargo( - "build", - &args, - working_dir, - )?; + super::exec_cargo("build", &args, working_dir)?; println!("TODO: tell the user nicely to install xargo"); - return Ok(()) + return Ok(()); } let current_dir = PathBuf::from("."); @@ -118,9 +114,9 @@ alloc = {} fs::write(xargo_config_path, xargo_config)?; // todo: [AJ] check rlib not enabled and warn if it is -// let toml = fs::read_to_string(&manifest_path)?; -// let toml = toml::from_str(&toml)?; -// toml + // let toml = fs::read_to_string(&manifest_path)?; + // let toml = toml::from_str(&toml)?; + // toml // todo: [AJ] check if nightly enabled, if not then `rustup run nightly xargo`, or even just run that anyway... // need to figure out what cargo does diff --git a/src/cmd/cargo.rs b/src/cmd/cargo.rs index 8e8a8ddf..d018be29 100644 --- a/src/cmd/cargo.rs +++ b/src/cmd/cargo.rs @@ -16,39 +16,43 @@ use anyhow::Result; use std::{ - io::{self, Write}, - path::PathBuf, - process::Command, + io::{self, Write}, + path::PathBuf, + process::Command, }; -pub(crate) fn exec_cargo(command: &str, args: &[&'static str], working_dir: Option<&PathBuf>) -> Result<()> { - let mut cmd = Command::new("cargo"); - if let Some(dir) = working_dir { - cmd.current_dir(dir); - } +pub(crate) fn exec_cargo( + command: &str, + args: &[&'static str], + working_dir: Option<&PathBuf>, +) -> Result<()> { + let mut cmd = Command::new("cargo"); + if let Some(dir) = working_dir { + cmd.current_dir(dir); + } - if !is_nightly(working_dir)? { - cmd.arg("+nightly"); - } + if !is_nightly(working_dir)? { + cmd.arg("+nightly"); + } - let output = cmd.arg(command).args(args).output()?; + let output = cmd.arg(command).args(args).output()?; - if !output.status.success() { - // Dump the output streams produced by cargo into the stdout/stderr. - io::stdout().write_all(&output.stdout)?; - io::stderr().write_all(&output.stderr)?; - anyhow::bail!("Build failed"); - } + if !output.status.success() { + // Dump the output streams produced by cargo into the stdout/stderr. + io::stdout().write_all(&output.stdout)?; + io::stderr().write_all(&output.stderr)?; + anyhow::bail!("Build failed"); + } - Ok(()) + Ok(()) } pub(crate) fn is_nightly(working_dir: Option<&PathBuf>) -> Result { - let mut cmd = Command::new("cargo"); - if let Some(dir) = working_dir { - cmd.current_dir(dir); - } - let output = cmd.arg("--version").output()?; - let decoded = String::from_utf8(output.stdout).unwrap_or_default(); - Ok(decoded.contains("-nightly")) + let mut cmd = Command::new("cargo"); + if let Some(dir) = working_dir { + cmd.current_dir(dir); + } + let output = cmd.arg("--version").output()?; + let decoded = String::from_utf8(output.stdout).unwrap_or_default(); + Ok(decoded.contains("-nightly")) } diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index d052e637..8f2f629c 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -33,7 +33,8 @@ mod metadata; mod new; pub(crate) use self::{ - build::execute_build, cargo::exec_cargo, cargo::is_nightly, metadata::execute_generate_metadata, new::execute_new, + build::execute_build, cargo::exec_cargo, cargo::is_nightly, + metadata::execute_generate_metadata, new::execute_new, }; #[cfg(feature = "extrinsics")] pub(crate) use self::{ -- GitLab From 9502f625a1f4860e92da0a69ab825fdf82d8f93d Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 6 Feb 2020 10:24:13 +0000 Subject: [PATCH 04/98] Run commands with `rustup run nightly` --- src/cmd/build.rs | 12 ++++++---- src/cmd/cargo.rs | 58 --------------------------------------------- src/cmd/metadata.rs | 3 ++- src/cmd/mod.rs | 44 +++++++++++++++++++++++++++++++--- 4 files changed, 50 insertions(+), 67 deletions(-) delete mode 100644 src/cmd/cargo.rs diff --git a/src/cmd/build.rs b/src/cmd/build.rs index a57fd466..691112b7 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -86,22 +86,22 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result) -> Result<()> { - let args = [ + let build_args = [ "--no-default-features", "--release", "--target=wasm32-unknown-unknown", "--verbose", ]; if which::which("xargo").is_err() { - super::exec_cargo("build", &args, working_dir)?; + super::rustup_run("cargo", "build", &build_args, working_dir)?; println!("TODO: tell the user nicely to install xargo"); return Ok(()); } let current_dir = PathBuf::from("."); - let working_dir = working_dir.unwrap_or(¤t_dir); - let manifest_path = working_dir.join("Cargo.toml"); - let xargo_config_path = working_dir.join("Xargo.toml"); + let dir = working_dir.unwrap_or(¤t_dir); + let manifest_path = dir.join("Cargo.toml"); + let xargo_config_path = dir.join("Xargo.toml"); let xargo_config = r#" [target.wasm32-unknown-unknown.dependencies] @@ -121,6 +121,8 @@ alloc = {} // todo: [AJ] check if nightly enabled, if not then `rustup run nightly xargo`, or even just run that anyway... // need to figure out what cargo does + super::rustup_run("xargo", "build", &build_args, working_dir)?; + Ok(()) } diff --git a/src/cmd/cargo.rs b/src/cmd/cargo.rs deleted file mode 100644 index d018be29..00000000 --- a/src/cmd/cargo.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2018-2019 Parity Technologies (UK) Ltd. -// This file is part of ink!. -// -// ink! 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. -// -// ink! 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 ink!. If not, see . - -use anyhow::Result; -use std::{ - io::{self, Write}, - path::PathBuf, - process::Command, -}; - -pub(crate) fn exec_cargo( - command: &str, - args: &[&'static str], - working_dir: Option<&PathBuf>, -) -> Result<()> { - let mut cmd = Command::new("cargo"); - if let Some(dir) = working_dir { - cmd.current_dir(dir); - } - - if !is_nightly(working_dir)? { - cmd.arg("+nightly"); - } - - let output = cmd.arg(command).args(args).output()?; - - if !output.status.success() { - // Dump the output streams produced by cargo into the stdout/stderr. - io::stdout().write_all(&output.stdout)?; - io::stderr().write_all(&output.stderr)?; - anyhow::bail!("Build failed"); - } - - Ok(()) -} - -pub(crate) fn is_nightly(working_dir: Option<&PathBuf>) -> Result { - let mut cmd = Command::new("cargo"); - if let Some(dir) = working_dir { - cmd.current_dir(dir); - } - let output = cmd.arg("--version").output()?; - let decoded = String::from_utf8(output.stdout).unwrap_or_default(); - Ok(decoded.contains("-nightly")) -} diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index f1c6e97f..96acf6a1 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -32,7 +32,8 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result // - exec build // - rename backup to original - super::exec_cargo( + super::rustup_run( + "cargo", "run", &[ "--package", diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index 8f2f629c..45800745 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -22,7 +22,6 @@ use std::{ }; mod build; -mod cargo; #[cfg(feature = "extrinsics")] mod deploy; #[cfg(feature = "extrinsics")] @@ -33,14 +32,53 @@ mod metadata; mod new; pub(crate) use self::{ - build::execute_build, cargo::exec_cargo, cargo::is_nightly, - metadata::execute_generate_metadata, new::execute_new, + build::execute_build, metadata::execute_generate_metadata, new::execute_new, }; #[cfg(feature = "extrinsics")] pub(crate) use self::{ deploy::execute_deploy, extrinsics::submit_extrinsic, instantiate::execute_instantiate, }; +/// Run the given command in the rustup nightly environment +pub(crate) fn rustup_run( + command: &str, + subcommand: &str, + args: &[&'static str], + working_dir: Option<&PathBuf>, +) -> Result<()> { + if which::which("rustup").is_err() { + anyhow::bail!( + "The 'rustup' tool not was not found. \ + See: https://github.com/rust-lang/rustup#installation" + ) + } + + // todo: [AJ] check nightly toolchain installed + + let mut cmd = Command::new("rustup"); + + if let Some(dir) = working_dir { + cmd.current_dir(dir); + } + + let output = cmd + .arg("run") + .arg("nightly") + .arg(command) + .arg(subcommand) + .args(args) + .output()?; + + if !output.status.success() { + // Dump the output streams produced by cargo into the stdout/stderr. + io::stdout().write_all(&output.stdout)?; + io::stderr().write_all(&output.stderr)?; + anyhow::bail!("{} {} failed", command, subcommand); + } + + Ok(()) +} + #[cfg(test)] mod tests { use std::path::PathBuf; -- GitLab From e61035bb52192424d1ce09a9ec312104d69842a3 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 6 Feb 2020 11:33:01 +0000 Subject: [PATCH 05/98] Pass separate link-args in rustflags for xargo compat --- template/.cargo/config | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/template/.cargo/config b/template/.cargo/config index 9ed784e6..cba15a9a 100644 --- a/template/.cargo/config +++ b/template/.cargo/config @@ -1,4 +1,6 @@ [target.wasm32-unknown-unknown] rustflags = [ - "-C", "link-args=-z stack-size=65536 --import-memory" -] \ No newline at end of file + "-C", "link-arg=-z", + "-C", "link-arg=stack-size=65536", + "-C", "link-arg=--import-memory", +] -- GitLab From 7ecfc4693e4ea50f23ef5c456c0711f6ee1170c5 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 6 Feb 2020 14:24:39 +0000 Subject: [PATCH 06/98] Warn user if 'rlib' crate type --- src/cmd/build.rs | 52 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 691112b7..bc4072a6 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -25,17 +25,29 @@ use anyhow::{Context, Result}; use cargo_metadata::MetadataCommand; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; +use toml::value; /// This is the maximum number of pages available for a contract to allocate. const MAX_MEMORY_PAGES: u32 = 16; /// Relevant metadata obtained from Cargo.toml. pub struct CrateMetadata { + working_dir: PathBuf, package_name: String, + crate_types: Vec, original_wasm: PathBuf, pub dest_wasm: PathBuf, } +impl CrateMetadata { +// fn manifest_path(&self) -> PathBuf { +// self.working_dir.join("Cargo.toml") +// } + fn has_rlib_crate_type(&self) -> bool { + self.crate_types.contains(&"rlib".to_string()) + } +} + /// Parses the contract manifest and returns relevant metadata. pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result { let mut cmd = MetadataCommand::new(); @@ -72,8 +84,23 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result().ok()) + .and_then(|mut t| t.remove("crate-type")) + .and_then(|v| v.try_into::().ok()) + .map(|vs| vs.iter().filter_map(|v| v.as_str()).map(|s| s.to_owned()).collect()) + .unwrap_or_else(Vec::new); + Ok(CrateMetadata { + working_dir: working_dir.clone(), package_name, + crate_types, original_wasm, dest_wasm, }) @@ -85,7 +112,7 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result) -> Result<()> { +fn build_cargo_project(crate_metadata: &CrateMetadata, working_dir: Option<&PathBuf>) -> Result<()> { let build_args = [ "--no-default-features", "--release", @@ -98,10 +125,7 @@ fn build_cargo_project(working_dir: Option<&PathBuf>) -> Result<()> { return Ok(()); } - let current_dir = PathBuf::from("."); - let dir = working_dir.unwrap_or(¤t_dir); - let manifest_path = dir.join("Cargo.toml"); - let xargo_config_path = dir.join("Xargo.toml"); + let xargo_config_path = crate_metadata.working_dir.join("Xargo.toml"); let xargo_config = r#" [target.wasm32-unknown-unknown.dependencies] @@ -113,13 +137,15 @@ alloc = {} // todo: [AJ] what to do if Xargo.toml already exists? fs::write(xargo_config_path, xargo_config)?; - // todo: [AJ] check rlib not enabled and warn if it is - // let toml = fs::read_to_string(&manifest_path)?; - // let toml = toml::from_str(&toml)?; - // toml - - // todo: [AJ] check if nightly enabled, if not then `rustup run nightly xargo`, or even just run that anyway... - // need to figure out what cargo does + if crate_metadata.has_rlib_crate_type() { + println!( + "{} {}", + "WARNING:".bright_yellow().bold(), + "Remove 'rlib' from the '[lib] crate-types' section in your contract's Cargo.toml. \ + This is not required to build the Wasm binary, and significantly increases the size." + .bright_yellow() + ) + } super::rustup_run("xargo", "build", &build_args, working_dir)?; @@ -256,7 +282,7 @@ pub(crate) fn execute_build(working_dir: Option<&PathBuf>) -> Result { "[2/4]".bold(), "Building cargo project".bright_green().bold() ); - build_cargo_project(working_dir)?; + build_cargo_project(&crate_metadata, working_dir)?; println!( " {} {}", "[3/4]".bold(), -- GitLab From fcc7157c6820130c0e0fc6d94aafe7abcb966ac7 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 6 Feb 2020 16:10:15 +0000 Subject: [PATCH 07/98] Colourise printed error --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 361847de..a82ed017 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,7 @@ use sp_core::{crypto::Pair, sr25519, H256}; use std::path::PathBuf; use anyhow::Result; +use colored::Colorize; use structopt::{clap, StructOpt}; #[derive(Debug, StructOpt)] @@ -148,7 +149,7 @@ fn main() { let Opts::Contract(args) = Opts::from_args(); match exec(args.cmd) { Ok(msg) => println!("\t{}", msg), - Err(err) => eprintln!("error: {}", err), + Err(err) => eprintln!("{} {}", "ERROR:".red().bold(), format!("{}", err).red()) } } -- GitLab From cd1658bf83cc8799ecf26789b7af73b3612e8cf4 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 6 Feb 2020 16:11:03 +0000 Subject: [PATCH 08/98] Ignore Xargo.toml in template --- template/.gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/template/.gitignore b/template/.gitignore index bf910de1..7c2de94a 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -6,4 +6,8 @@ # Remove Cargo.lock when creating an executable, leave it for libraries # More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock -Cargo.lock \ No newline at end of file +Cargo.lock + +# This file is generated when compiling the contract wasm with `xargo` for optimal size +# It should not be changed by the user and is always overwritten by the build tool +Xargo.toml -- GitLab From e85fe453e8192f57c2131d49f1ba143540b35e97 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 6 Feb 2020 16:11:38 +0000 Subject: [PATCH 09/98] Refactor Xargo file generation, only remove if generated. --- src/cmd/build.rs | 70 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 15 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index bc4072a6..1db1fb4a 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -106,6 +106,58 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()>>(crate_metadata: &CrateMetadata, f: F) -> Result<()> { + let xargo_config_path = crate_metadata.working_dir.join("Xargo.toml"); + + let xargo_config = r#" +[target.wasm32-unknown-unknown.dependencies] +core = {default-features=false, features=["panic_immediate_abort"]} +std = {default-features=false, features=["panic_immediate_abort"]} +alloc = {} +"#; + + // If there is an existing Xargo.toml which is different to the config above, instead of + // overwriting it fail the build instead. + let open_result = fs::OpenOptions::new() + .write(true) + .create_new(true) + .open(xargo_config_path.clone()); + + match open_result { + Ok(mut outfile) => { + // No existing Xargo.toml + outfile.write_all(xargo_config.as_bytes())?; + let res = f(); + // clean up the auto generated Xargo.config: the user should not be editing this file + let _ = fs::remove_file(xargo_config_path); + res + } + Err(e) => { + if e.kind() == std::io::ErrorKind::AlreadyExists { + let existing = fs::read_to_string(xargo_config_path) + .expect("File exists"); + if existing != xargo_config { + anyhow::bail!( + "A Xargo.config already exists which is different to the recommended \ + configuration. Please remove/rename it and run again", + ) + } + // Xargo.config file already exists with correct content so just use it + Ok(()) + } else { + anyhow::bail!(e) + } + } + } +} + /// Builds the project in the specified directory, defaults to the current directory. /// /// Attempts to build using [`xargo`](https://github.com/japaric/xargo) for maximum optimization of @@ -125,18 +177,6 @@ fn build_cargo_project(crate_metadata: &CrateMetadata, working_dir: Option<&Path return Ok(()); } - let xargo_config_path = crate_metadata.working_dir.join("Xargo.toml"); - - let xargo_config = r#" -[target.wasm32-unknown-unknown.dependencies] -core = {default-features=false, features=["panic_immediate_abort"]} -std = {default-features=false, features=["panic_immediate_abort"]} -alloc = {} -"#; - - // todo: [AJ] what to do if Xargo.toml already exists? - fs::write(xargo_config_path, xargo_config)?; - if crate_metadata.has_rlib_crate_type() { println!( "{} {}", @@ -147,9 +187,9 @@ alloc = {} ) } - super::rustup_run("xargo", "build", &build_args, working_dir)?; - - Ok(()) + with_xargo_config(crate_metadata, || { + super::rustup_run("xargo", "build", &build_args, working_dir) + }) } /// Ensures the wasm memory import of a given module has the maximum number of pages. -- GitLab From 416f2108ca1c519a3c75ed0607163101ecacb2fc Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 6 Feb 2020 17:33:32 +0000 Subject: [PATCH 10/98] WIP: Add rlib crate-type when generating metadata --- src/cmd/build.rs | 10 +----- src/cmd/metadata.rs | 77 ++++++++++++++++++++++++++++++++++----------- src/cmd/mod.rs | 12 ++++++- template/.gitignore | 3 ++ 4 files changed, 73 insertions(+), 29 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 1db1fb4a..c82b37f7 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -22,7 +22,6 @@ use std::{ }; use anyhow::{Context, Result}; -use cargo_metadata::MetadataCommand; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; use toml::value; @@ -40,9 +39,6 @@ pub struct CrateMetadata { } impl CrateMetadata { -// fn manifest_path(&self) -> PathBuf { -// self.working_dir.join("Cargo.toml") -// } fn has_rlib_crate_type(&self) -> bool { self.crate_types.contains(&"rlib".to_string()) } @@ -50,11 +46,7 @@ impl CrateMetadata { /// Parses the contract manifest and returns relevant metadata. pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result { - let mut cmd = MetadataCommand::new(); - if let Some(dir) = working_dir { - cmd.current_dir(dir); - } - let metadata = cmd.exec()?; + let metadata = super::get_cargo_metadata(working_dir)?; let root_package_id = metadata .resolve diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 96acf6a1..0f38a365 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use std::path::PathBuf; - +use std::{ + fs, + path::PathBuf, +}; use anyhow::{Context, Result}; -use cargo_metadata::MetadataCommand; +use toml::value; /// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. /// @@ -32,22 +34,23 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result // - exec build // - rename backup to original - super::rustup_run( - "cargo", - "run", - &[ - "--package", - "abi-gen", - "--release", - // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! - "--verbose", - ], - dir, - )?; - - let cargo_metadata = MetadataCommand::new() - .exec() - .context("Error invoking `cargo metadata`")?; + let cargo_metadata = super::get_cargo_metadata(dir)?; + + with_contract_rust_lib(&cargo_metadata, || { + super::rustup_run( + "cargo", + "run", + &[ + "--package", + "abi-gen", + "--release", + // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! + "--verbose", + ], + dir, + ) + }); + let mut out_path = cargo_metadata.target_directory; out_path.push("metadata.json"); @@ -57,6 +60,42 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result )) } +/// Adds the 'rlib' crate_type to the Cargo.toml if not present. +/// Makes a backup of the existing Cargo.toml which is restored once complete. +fn with_contract_rust_lib Result<()>>(cargo_meta: &cargo_metadata::Metadata, f: F) -> Result<()> { + let cargo_toml = cargo_meta.workspace_root.join("Cargo.toml"); + let backup = cargo_meta.workspace_root.join(".Cargo.toml.bk"); + + // todo: acquire workspace lock here before doing all this + + let toml = fs::read_to_string(&cargo_toml)?; + let mut toml: value::Table = toml::from_str(&toml)?; + let mut crate_types = toml.get_mut("lib") + .and_then(|v| v.try_into::().ok()) + .and_then(|mut t| t.get_mut("crate-type")) + .and_then(|v| v.try_into::().ok()) + .ok_or(anyhow::anyhow!("No [lib] crate-type section found"))?; + + if crate_types.iter().any(|v| v.as_str().map_or(false, |s| s == "rlib")) { + log::debug!("rlib crate-type already specified in Cargo.toml"); + return f() + } + + fs::copy(&cargo_toml, &backup).context("Creating a backup for Cargo.toml")?; + + // add rlib to crate-types and write updated Cargo.toml + crate_types.push(value::Value::String("rlib".into())); + + let updated_toml = toml::to_string(&toml)?; + fs::write(&cargo_toml, updated_toml).context("Writing updated Cargo.toml")?; + + // Now run the function with a modified Cargo.toml in place + let result = f(); + + fs::rename(&backup, &cargo_toml).context("Restoring the backup of Cargo.toml")?; + result +} + #[cfg(feature = "test-ci-only")] #[cfg(test)] mod tests { diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index 45800745..10d15b95 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use anyhow::Result; +use anyhow::{Context, Result}; +use cargo_metadata::{MetadataCommand, Metadata as CargoMetadata}; use std::{ io::{self, Write}, path::PathBuf, @@ -39,6 +40,15 @@ pub(crate) use self::{ deploy::execute_deploy, extrinsics::submit_extrinsic, instantiate::execute_instantiate, }; +/// Get the result of `cargo metadata` +pub(crate) fn get_cargo_metadata(working_dir: Option<&PathBuf>) -> Result { + let mut cmd = MetadataCommand::new(); + if let Some(dir) = working_dir { + cmd.current_dir(dir); + } + cmd.exec().context("Error invoking `cargo metadata`") +} + /// Run the given command in the rustup nightly environment pub(crate) fn rustup_run( command: &str, diff --git a/template/.gitignore b/template/.gitignore index 7c2de94a..8440c8eb 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -11,3 +11,6 @@ Cargo.lock # This file is generated when compiling the contract wasm with `xargo` for optimal size # It should not be changed by the user and is always overwritten by the build tool Xargo.toml + +# The backup file created by `cargo contract` when modiying the Cargo.toml for the build +.Cargo.toml.bk -- GitLab From dbb93fe14a35f4c73d074599358075f2ac44c8b9 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 7 Feb 2020 15:22:55 +0000 Subject: [PATCH 11/98] Add rlib when building metadata, remove when building wasm --- src/cmd/build.rs | 72 ++++++++-------------- src/cmd/metadata.rs | 60 +++--------------- src/main.rs | 1 + src/manifest.rs | 146 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 181 insertions(+), 98 deletions(-) create mode 100644 src/manifest.rs diff --git a/src/cmd/build.rs b/src/cmd/build.rs index c82b37f7..f7f5dfe4 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -24,26 +24,20 @@ use std::{ use anyhow::{Context, Result}; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; -use toml::value; +use crate::manifest::CargoToml; /// This is the maximum number of pages available for a contract to allocate. const MAX_MEMORY_PAGES: u32 = 16; /// Relevant metadata obtained from Cargo.toml. pub struct CrateMetadata { - working_dir: PathBuf, + workspace_root: PathBuf, + manifest_path: PathBuf, package_name: String, - crate_types: Vec, original_wasm: PathBuf, pub dest_wasm: PathBuf, } -impl CrateMetadata { - fn has_rlib_crate_type(&self) -> bool { - self.crate_types.contains(&"rlib".to_string()) - } -} - /// Parses the contract manifest and returns relevant metadata. pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result { let metadata = super::get_cargo_metadata(working_dir)?; @@ -76,23 +70,10 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result().ok()) - .and_then(|mut t| t.remove("crate-type")) - .and_then(|v| v.try_into::().ok()) - .map(|vs| vs.iter().filter_map(|v| v.as_str()).map(|s| s.to_owned()).collect()) - .unwrap_or_else(Vec::new); - Ok(CrateMetadata { - working_dir: working_dir.clone(), + workspace_root: metadata.workspace_root.clone(), + manifest_path: metadata.workspace_root.join("Cargo.toml"), package_name, - crate_types, original_wasm, dest_wasm, }) @@ -105,8 +86,11 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()>>(crate_metadata: &CrateMetadata, f: F) -> Result<()> { - let xargo_config_path = crate_metadata.working_dir.join("Xargo.toml"); +fn with_xargo_config(crate_metadata: &CrateMetadata, f: F) -> Result<()> +where + F: FnOnce() -> Result<()> +{ + let xargo_config_path = crate_metadata.workspace_root.join("Xargo.toml"); let xargo_config = r#" [target.wasm32-unknown-unknown.dependencies] @@ -156,31 +140,27 @@ alloc = {} /// the resulting Wasm binary. /// /// If `xargo` is not installed then the user will be warned and it will fall back to `cargo`. -fn build_cargo_project(crate_metadata: &CrateMetadata, working_dir: Option<&PathBuf>) -> Result<()> { +fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { let build_args = [ "--no-default-features", "--release", "--target=wasm32-unknown-unknown", "--verbose", ]; - if which::which("xargo").is_err() { - super::rustup_run("cargo", "build", &build_args, working_dir)?; - println!("TODO: tell the user nicely to install xargo"); - return Ok(()); - } - - if crate_metadata.has_rlib_crate_type() { - println!( - "{} {}", - "WARNING:".bright_yellow().bold(), - "Remove 'rlib' from the '[lib] crate-types' section in your contract's Cargo.toml. \ - This is not required to build the Wasm binary, and significantly increases the size." - .bright_yellow() - ) - } - - with_xargo_config(crate_metadata, || { - super::rustup_run("xargo", "build", &build_args, working_dir) + let manifest = CargoToml::load(&crate_metadata.manifest_path)?; + let working_dir = Some(&crate_metadata.workspace_root); + + // temporarily remove the 'rlib' crate-type to build wasm blob for optimal size + manifest.with_removed_crate_type("rlib", || { + // prefer building with xargo for optimal size, but fall back to cargo + if which::which("xargo").is_err() { + println!("TODO: tell the user nicely to install xargo"); + super::rustup_run("cargo", "build", &build_args, working_dir) + } else { + with_xargo_config(crate_metadata, || { + super::rustup_run("xargo", "build", &build_args, working_dir) + }) + } }) } @@ -314,7 +294,7 @@ pub(crate) fn execute_build(working_dir: Option<&PathBuf>) -> Result { "[2/4]".bold(), "Building cargo project".bright_green().bold() ); - build_cargo_project(&crate_metadata, working_dir)?; + build_cargo_project(&crate_metadata)?; println!( " {} {}", "[3/4]".bold(), diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 0f38a365..d6a62849 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -14,12 +14,9 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use std::{ - fs, - path::PathBuf, -}; -use anyhow::{Context, Result}; -use toml::value; +use std::path::PathBuf; +use anyhow::Result; +use crate::manifest::CargoToml; /// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. /// @@ -27,16 +24,11 @@ use toml::value; pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result { println!(" Generating metadata"); - // check for existing .Cargo.toml.bk? - // todo: [AJ] check for rlib enabled, add if not - // - copy Cargo.toml to .Cargo.toml.bk or whatever (and ignore in gitignore) - // - add rlib crate type - // - exec build - // - rename backup to original - let cargo_metadata = super::get_cargo_metadata(dir)?; + let manifest_path = cargo_metadata.workspace_root.join("Cargo.toml"); + let manifest = CargoToml::load(&manifest_path)?; - with_contract_rust_lib(&cargo_metadata, || { + manifest.with_added_crate_type("rlib", || { super::rustup_run( "cargo", "run", @@ -47,9 +39,9 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! "--verbose", ], - dir, + Some(&cargo_metadata.workspace_root), ) - }); + })?; let mut out_path = cargo_metadata.target_directory; out_path.push("metadata.json"); @@ -60,42 +52,6 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result )) } -/// Adds the 'rlib' crate_type to the Cargo.toml if not present. -/// Makes a backup of the existing Cargo.toml which is restored once complete. -fn with_contract_rust_lib Result<()>>(cargo_meta: &cargo_metadata::Metadata, f: F) -> Result<()> { - let cargo_toml = cargo_meta.workspace_root.join("Cargo.toml"); - let backup = cargo_meta.workspace_root.join(".Cargo.toml.bk"); - - // todo: acquire workspace lock here before doing all this - - let toml = fs::read_to_string(&cargo_toml)?; - let mut toml: value::Table = toml::from_str(&toml)?; - let mut crate_types = toml.get_mut("lib") - .and_then(|v| v.try_into::().ok()) - .and_then(|mut t| t.get_mut("crate-type")) - .and_then(|v| v.try_into::().ok()) - .ok_or(anyhow::anyhow!("No [lib] crate-type section found"))?; - - if crate_types.iter().any(|v| v.as_str().map_or(false, |s| s == "rlib")) { - log::debug!("rlib crate-type already specified in Cargo.toml"); - return f() - } - - fs::copy(&cargo_toml, &backup).context("Creating a backup for Cargo.toml")?; - - // add rlib to crate-types and write updated Cargo.toml - crate_types.push(value::Value::String("rlib".into())); - - let updated_toml = toml::to_string(&toml)?; - fs::write(&cargo_toml, updated_toml).context("Writing updated Cargo.toml")?; - - // Now run the function with a modified Cargo.toml in place - let result = f(); - - fs::rename(&backup, &cargo_toml).context("Restoring the backup of Cargo.toml")?; - result -} - #[cfg(feature = "test-ci-only")] #[cfg(test)] mod tests { diff --git a/src/main.rs b/src/main.rs index a82ed017..ab4d468f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ // along with ink!. If not, see . mod cmd; +mod manifest; #[cfg(feature = "extrinsics")] use sp_core::{crypto::Pair, sr25519, H256}; diff --git a/src/manifest.rs b/src/manifest.rs new file mode 100644 index 00000000..1f5617ca --- /dev/null +++ b/src/manifest.rs @@ -0,0 +1,146 @@ +// Copyright 2018-2019 Parity Technologies (UK) Ltd. +// This file is part of ink!. +// +// ink! 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. +// +// ink! 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 ink!. If not, see . + +use std::{ + fs, + path::PathBuf, +}; +use anyhow::{Context, Result}; +use toml::value; + +// todo [AJ] add docs +pub struct CargoToml { + path: PathBuf, + table: value::Table, +} + +impl CargoToml { + pub fn load(path: &PathBuf) -> Result + { + if let Some(file_name) = path.file_name() { + if file_name != "Cargo.toml" { + anyhow::bail!("Manifest file must be a Cargo.toml") + } + } + + let toml = fs::read_to_string(&path)?; + let table: value::Table = toml::from_str(&toml)?; + + Ok(CargoToml { + path: path.clone(), + table, + }) + } + + /// Amend the Cargo.toml and run the supplied function. + /// Makes a backup of the existing Cargo.toml which is restored once complete. + /// + /// # Note + /// + /// If the program terminates while in progress then the amended `Cargo.toml` will remain in + /// place. The user will be given the option to restore from the backup on the next run. + /// + /// # Arguments + /// + /// - `amend`: Accepts the mutable toml Table to modify, saving the result to the temporary + /// `Cargo.toml`. If the manifest does not need to modified, should return false. + /// - `f`: Function to be executed while the temporary amended `Cargo.toml` is in place. e.g. + /// running a `cargo` command which will pick up the manifest. + pub fn with_amended_manifest(mut self, amend: A, f: F) -> Result<()> + where + A: FnOnce(&mut value::Table) -> Result, + F: FnOnce() -> Result<()>, + { + let mut backup_path = self.path.clone(); + backup_path.set_file_name(".Cargo.toml.bk"); + + // todo: [AJ] check for existing backup and ask user if they want to restore it + // todo: [AJ] acquire workspace lock here before doing all this + + // run supplied amend function + let should_amend = amend(&mut self.table)?; + + if !should_amend { + log::debug!("amend function returned false, so update not required"); + return Ok(()) + } + + fs::copy(&self.path, &backup_path).context("Creating a backup for Cargo.toml")?; + + let updated_toml = toml::to_string(&self.table)?; + fs::write(&self.path, updated_toml).context("Writing updated Cargo.toml")?; + + // Now run the function with a modified Cargo.toml in place + let result = f(); + + fs::rename(&backup_path, &self.path).context("Restoring the backup of Cargo.toml")?; + result + } + + fn with_amended_crate_types(self, amend: A, f: F) -> Result<()> + where + A: FnOnce(&mut value::Array) -> bool, + F: FnOnce() -> Result<()>, + { + self.with_amended_manifest(|toml| { + let lib = toml.get_mut("lib") + .ok_or(anyhow::anyhow!("lib section not found"))?; + let crate_types = lib.get_mut("crate-type") + .ok_or(anyhow::anyhow!("crate-type section not found"))?; + let crate_types = crate_types.as_array_mut() + .ok_or(anyhow::anyhow!("crate-types should be an Array"))?; + + let should_amend = amend(crate_types); + Ok(should_amend) + }, f) + } + + pub fn with_added_crate_type(self, crate_type: &str, f: F) -> Result<()> + where + F: FnOnce() -> Result<()> + { + self.with_amended_crate_types(|crate_types| { + if crate_type_exists(crate_type, crate_types) { + false + } else { + crate_types.push(crate_type.into()); + true + } + }, f) + } + + pub fn with_removed_crate_type(self, crate_type: &str, f: F) -> Result<()> + where + F: FnOnce() -> Result<()> + { + self.with_amended_crate_types(|crate_types| { + if crate_type_exists(crate_type, crate_types) { + crate_types.retain(|v| v.as_str().map_or(true, |s| s != crate_type)); + true + } else { + false + } + }, f) + } +} + +fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { + crate_types + .iter() + .any(|v| v.as_str().map_or(false, |s| s == crate_type )) +} + + -- GitLab From d8bbc912f48a47789bc67af85a659823f0f2dc1c Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 7 Feb 2020 15:24:56 +0000 Subject: [PATCH 12/98] Fmt --- src/cmd/build.rs | 7 +- src/cmd/metadata.rs | 4 +- src/cmd/mod.rs | 2 +- src/main.rs | 2 +- src/manifest.rs | 242 +++++++++++++++++++++++--------------------- 5 files changed, 131 insertions(+), 126 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index f7f5dfe4..38cf52e2 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -21,10 +21,10 @@ use std::{ process::Command, }; +use crate::manifest::CargoToml; use anyhow::{Context, Result}; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; -use crate::manifest::CargoToml; /// This is the maximum number of pages available for a contract to allocate. const MAX_MEMORY_PAGES: u32 = 16; @@ -88,7 +88,7 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result(crate_metadata: &CrateMetadata, f: F) -> Result<()> where - F: FnOnce() -> Result<()> + F: FnOnce() -> Result<()>, { let xargo_config_path = crate_metadata.workspace_root.join("Xargo.toml"); @@ -117,8 +117,7 @@ alloc = {} } Err(e) => { if e.kind() == std::io::ErrorKind::AlreadyExists { - let existing = fs::read_to_string(xargo_config_path) - .expect("File exists"); + let existing = fs::read_to_string(xargo_config_path).expect("File exists"); if existing != xargo_config { anyhow::bail!( "A Xargo.config already exists which is different to the recommended \ diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index d6a62849..c41c105e 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -14,9 +14,9 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use std::path::PathBuf; -use anyhow::Result; use crate::manifest::CargoToml; +use anyhow::Result; +use std::path::PathBuf; /// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. /// diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index 10d15b95..0e1ed8db 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -15,7 +15,7 @@ // along with ink!. If not, see . use anyhow::{Context, Result}; -use cargo_metadata::{MetadataCommand, Metadata as CargoMetadata}; +use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand}; use std::{ io::{self, Write}, path::PathBuf, diff --git a/src/main.rs b/src/main.rs index ab4d468f..1f8685fc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -150,7 +150,7 @@ fn main() { let Opts::Contract(args) = Opts::from_args(); match exec(args.cmd) { Ok(msg) => println!("\t{}", msg), - Err(err) => eprintln!("{} {}", "ERROR:".red().bold(), format!("{}", err).red()) + Err(err) => eprintln!("{} {}", "ERROR:".red().bold(), format!("{}", err).red()), } } diff --git a/src/manifest.rs b/src/manifest.rs index 1f5617ca..6f58dec7 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -14,133 +14,139 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use std::{ - fs, - path::PathBuf, -}; use anyhow::{Context, Result}; +use std::{fs, path::PathBuf}; use toml::value; // todo [AJ] add docs pub struct CargoToml { - path: PathBuf, - table: value::Table, + path: PathBuf, + table: value::Table, } impl CargoToml { - pub fn load(path: &PathBuf) -> Result - { - if let Some(file_name) = path.file_name() { - if file_name != "Cargo.toml" { - anyhow::bail!("Manifest file must be a Cargo.toml") - } - } - - let toml = fs::read_to_string(&path)?; - let table: value::Table = toml::from_str(&toml)?; - - Ok(CargoToml { - path: path.clone(), - table, - }) - } - - /// Amend the Cargo.toml and run the supplied function. - /// Makes a backup of the existing Cargo.toml which is restored once complete. - /// - /// # Note - /// - /// If the program terminates while in progress then the amended `Cargo.toml` will remain in - /// place. The user will be given the option to restore from the backup on the next run. - /// - /// # Arguments - /// - /// - `amend`: Accepts the mutable toml Table to modify, saving the result to the temporary - /// `Cargo.toml`. If the manifest does not need to modified, should return false. - /// - `f`: Function to be executed while the temporary amended `Cargo.toml` is in place. e.g. - /// running a `cargo` command which will pick up the manifest. - pub fn with_amended_manifest(mut self, amend: A, f: F) -> Result<()> - where - A: FnOnce(&mut value::Table) -> Result, - F: FnOnce() -> Result<()>, - { - let mut backup_path = self.path.clone(); - backup_path.set_file_name(".Cargo.toml.bk"); - - // todo: [AJ] check for existing backup and ask user if they want to restore it - // todo: [AJ] acquire workspace lock here before doing all this - - // run supplied amend function - let should_amend = amend(&mut self.table)?; - - if !should_amend { - log::debug!("amend function returned false, so update not required"); - return Ok(()) - } - - fs::copy(&self.path, &backup_path).context("Creating a backup for Cargo.toml")?; - - let updated_toml = toml::to_string(&self.table)?; - fs::write(&self.path, updated_toml).context("Writing updated Cargo.toml")?; - - // Now run the function with a modified Cargo.toml in place - let result = f(); - - fs::rename(&backup_path, &self.path).context("Restoring the backup of Cargo.toml")?; - result - } - - fn with_amended_crate_types(self, amend: A, f: F) -> Result<()> - where - A: FnOnce(&mut value::Array) -> bool, - F: FnOnce() -> Result<()>, - { - self.with_amended_manifest(|toml| { - let lib = toml.get_mut("lib") - .ok_or(anyhow::anyhow!("lib section not found"))?; - let crate_types = lib.get_mut("crate-type") - .ok_or(anyhow::anyhow!("crate-type section not found"))?; - let crate_types = crate_types.as_array_mut() - .ok_or(anyhow::anyhow!("crate-types should be an Array"))?; - - let should_amend = amend(crate_types); - Ok(should_amend) - }, f) - } - - pub fn with_added_crate_type(self, crate_type: &str, f: F) -> Result<()> - where - F: FnOnce() -> Result<()> - { - self.with_amended_crate_types(|crate_types| { - if crate_type_exists(crate_type, crate_types) { - false - } else { - crate_types.push(crate_type.into()); - true - } - }, f) - } - - pub fn with_removed_crate_type(self, crate_type: &str, f: F) -> Result<()> - where - F: FnOnce() -> Result<()> - { - self.with_amended_crate_types(|crate_types| { - if crate_type_exists(crate_type, crate_types) { - crate_types.retain(|v| v.as_str().map_or(true, |s| s != crate_type)); - true - } else { - false - } - }, f) - } + pub fn load(path: &PathBuf) -> Result { + if let Some(file_name) = path.file_name() { + if file_name != "Cargo.toml" { + anyhow::bail!("Manifest file must be a Cargo.toml") + } + } + + let toml = fs::read_to_string(&path)?; + let table: value::Table = toml::from_str(&toml)?; + + Ok(CargoToml { + path: path.clone(), + table, + }) + } + + /// Amend the Cargo.toml and run the supplied function. + /// Makes a backup of the existing Cargo.toml which is restored once complete. + /// + /// # Note + /// + /// If the program terminates while in progress then the amended `Cargo.toml` will remain in + /// place. The user will be given the option to restore from the backup on the next run. + /// + /// # Arguments + /// + /// - `amend`: Accepts the mutable toml Table to modify, saving the result to the temporary + /// `Cargo.toml`. If the manifest does not need to modified, should return false. + /// - `f`: Function to be executed while the temporary amended `Cargo.toml` is in place. e.g. + /// running a `cargo` command which will pick up the manifest. + pub fn with_amended_manifest(mut self, amend: A, f: F) -> Result<()> + where + A: FnOnce(&mut value::Table) -> Result, + F: FnOnce() -> Result<()>, + { + let mut backup_path = self.path.clone(); + backup_path.set_file_name(".Cargo.toml.bk"); + + // todo: [AJ] check for existing backup and ask user if they want to restore it + // todo: [AJ] acquire workspace lock here before doing all this + + // run supplied amend function + let should_amend = amend(&mut self.table)?; + + if !should_amend { + log::debug!("amend function returned false, so update not required"); + return Ok(()); + } + + fs::copy(&self.path, &backup_path).context("Creating a backup for Cargo.toml")?; + + let updated_toml = toml::to_string(&self.table)?; + fs::write(&self.path, updated_toml).context("Writing updated Cargo.toml")?; + + // Now run the function with a modified Cargo.toml in place + let result = f(); + + fs::rename(&backup_path, &self.path).context("Restoring the backup of Cargo.toml")?; + result + } + + fn with_amended_crate_types(self, amend: A, f: F) -> Result<()> + where + A: FnOnce(&mut value::Array) -> bool, + F: FnOnce() -> Result<()>, + { + self.with_amended_manifest( + |toml| { + let lib = toml + .get_mut("lib") + .ok_or(anyhow::anyhow!("lib section not found"))?; + let crate_types = lib + .get_mut("crate-type") + .ok_or(anyhow::anyhow!("crate-type section not found"))?; + let crate_types = crate_types + .as_array_mut() + .ok_or(anyhow::anyhow!("crate-types should be an Array"))?; + + let should_amend = amend(crate_types); + Ok(should_amend) + }, + f, + ) + } + + pub fn with_added_crate_type(self, crate_type: &str, f: F) -> Result<()> + where + F: FnOnce() -> Result<()>, + { + self.with_amended_crate_types( + |crate_types| { + if crate_type_exists(crate_type, crate_types) { + false + } else { + crate_types.push(crate_type.into()); + true + } + }, + f, + ) + } + + pub fn with_removed_crate_type(self, crate_type: &str, f: F) -> Result<()> + where + F: FnOnce() -> Result<()>, + { + self.with_amended_crate_types( + |crate_types| { + if crate_type_exists(crate_type, crate_types) { + crate_types.retain(|v| v.as_str().map_or(true, |s| s != crate_type)); + true + } else { + false + } + }, + f, + ) + } } fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { - crate_types - .iter() - .any(|v| v.as_str().map_or(false, |s| s == crate_type )) + crate_types + .iter() + .any(|v| v.as_str().map_or(false, |s| s == crate_type)) } - - -- GitLab From 9998a1f6c66e33ecb1b35ecc5077719c9b2b5dc1 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 7 Feb 2020 15:27:17 +0000 Subject: [PATCH 13/98] Make error bright red --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 1f8685fc..3dd470ce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -150,7 +150,7 @@ fn main() { let Opts::Contract(args) = Opts::from_args(); match exec(args.cmd) { Ok(msg) => println!("\t{}", msg), - Err(err) => eprintln!("{} {}", "ERROR:".red().bold(), format!("{}", err).red()), + Err(err) => eprintln!("{} {}", "ERROR:".bright_red().bold(), format!("{}", err).bright_red()), } } -- GitLab From 9a0b0dc6f2e0ef6ff94745f184e0efed4287c993 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 7 Feb 2020 16:03:33 +0000 Subject: [PATCH 14/98] Fix generating without modified Cargo.toml --- src/manifest.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/manifest.rs b/src/manifest.rs index 6f58dec7..1163cf42 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -71,7 +71,8 @@ impl CargoToml { if !should_amend { log::debug!("amend function returned false, so update not required"); - return Ok(()); + // Now run the function without a modified Cargo.toml + return f() } fs::copy(&self.path, &backup_path).context("Creating a backup for Cargo.toml")?; -- GitLab From 8ddb26dcef00f1589604068a77923b27aadcd4bb Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 7 Feb 2020 16:10:04 +0000 Subject: [PATCH 15/98] Don't need to check nightly installed, the command will fail --- src/cmd/mod.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index 0e1ed8db..b4c8d0a3 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -63,8 +63,6 @@ pub(crate) fn rustup_run( ) } - // todo: [AJ] check nightly toolchain installed - let mut cmd = Command::new("rustup"); if let Some(dir) = working_dir { -- GitLab From 3c349945890e86af7d66f09e400b18502ab6cb23 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 7 Feb 2020 16:30:24 +0000 Subject: [PATCH 16/98] Only load toml when ready to modify: allow for multi usage --- src/cmd/build.rs | 2 +- src/cmd/metadata.rs | 2 +- src/manifest.rs | 35 +++++++++++++++++++++-------------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 38cf52e2..a32c751c 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -146,7 +146,7 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { "--target=wasm32-unknown-unknown", "--verbose", ]; - let manifest = CargoToml::load(&crate_metadata.manifest_path)?; + let manifest = CargoToml::new(&crate_metadata.manifest_path)?; let working_dir = Some(&crate_metadata.workspace_root); // temporarily remove the 'rlib' crate-type to build wasm blob for optimal size diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index c41c105e..0172ee45 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -26,7 +26,7 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result let cargo_metadata = super::get_cargo_metadata(dir)?; let manifest_path = cargo_metadata.workspace_root.join("Cargo.toml"); - let manifest = CargoToml::load(&manifest_path)?; + let manifest = CargoToml::new(&manifest_path)?; manifest.with_added_crate_type("rlib", || { super::rustup_run( diff --git a/src/manifest.rs b/src/manifest.rs index 1163cf42..d3ede9d3 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -18,26 +18,24 @@ use anyhow::{Context, Result}; use std::{fs, path::PathBuf}; use toml::value; -// todo [AJ] add docs +/// Load and temporarily modify the manifest file (Cargo.toml). pub struct CargoToml { path: PathBuf, - table: value::Table, } impl CargoToml { - pub fn load(path: &PathBuf) -> Result { + /// Create new CargoToml for the given manifest path. + /// + /// The path *must* be to a `Cargo.toml`. + pub fn new(path: &PathBuf) -> Result { if let Some(file_name) = path.file_name() { if file_name != "Cargo.toml" { anyhow::bail!("Manifest file must be a Cargo.toml") } } - let toml = fs::read_to_string(&path)?; - let table: value::Table = toml::from_str(&toml)?; - Ok(CargoToml { path: path.clone(), - table, }) } @@ -55,7 +53,7 @@ impl CargoToml { /// `Cargo.toml`. If the manifest does not need to modified, should return false. /// - `f`: Function to be executed while the temporary amended `Cargo.toml` is in place. e.g. /// running a `cargo` command which will pick up the manifest. - pub fn with_amended_manifest(mut self, amend: A, f: F) -> Result<()> + pub fn with_amended_manifest(&self, amend: A, f: F) -> Result<()> where A: FnOnce(&mut value::Table) -> Result, F: FnOnce() -> Result<()>, @@ -64,10 +62,12 @@ impl CargoToml { backup_path.set_file_name(".Cargo.toml.bk"); // todo: [AJ] check for existing backup and ask user if they want to restore it - // todo: [AJ] acquire workspace lock here before doing all this + + let toml = fs::read_to_string(&self.path)?; + let mut table: value::Table = toml::from_str(&toml)?; // run supplied amend function - let should_amend = amend(&mut self.table)?; + let should_amend = amend(&mut table)?; if !should_amend { log::debug!("amend function returned false, so update not required"); @@ -77,7 +77,7 @@ impl CargoToml { fs::copy(&self.path, &backup_path).context("Creating a backup for Cargo.toml")?; - let updated_toml = toml::to_string(&self.table)?; + let updated_toml = toml::to_string(&table)?; fs::write(&self.path, updated_toml).context("Writing updated Cargo.toml")?; // Now run the function with a modified Cargo.toml in place @@ -87,7 +87,8 @@ impl CargoToml { result } - fn with_amended_crate_types(self, amend: A, f: F) -> Result<()> + /// Amend the `[lib] crate-types = []` section + fn with_amended_crate_types(&self, amend: A, f: F) -> Result<()> where A: FnOnce(&mut value::Array) -> bool, F: FnOnce() -> Result<()>, @@ -111,7 +112,10 @@ impl CargoToml { ) } - pub fn with_added_crate_type(self, crate_type: &str, f: F) -> Result<()> + /// Add an value to the `[lib] crate-types = []` section + /// + /// If the value already exists, does nothing. + pub fn with_added_crate_type(&self, crate_type: &str, f: F) -> Result<()> where F: FnOnce() -> Result<()>, { @@ -128,7 +132,10 @@ impl CargoToml { ) } - pub fn with_removed_crate_type(self, crate_type: &str, f: F) -> Result<()> + /// Remove a value from the `[lib] crate-types = []` section + /// + /// If the value does not exist, does nothing. + pub fn with_removed_crate_type(&self, crate_type: &str, f: F) -> Result<()> where F: FnOnce() -> Result<()>, { -- GitLab From 82c64b38a854188c8c30ccc3261292458aa422e0 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 7 Feb 2020 17:42:54 +0000 Subject: [PATCH 17/98] Fmt --- src/main.rs | 6 +++++- src/manifest.rs | 47 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3dd470ce..04171c8e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -150,7 +150,11 @@ fn main() { let Opts::Contract(args) = Opts::from_args(); match exec(args.cmd) { Ok(msg) => println!("\t{}", msg), - Err(err) => eprintln!("{} {}", "ERROR:".bright_red().bold(), format!("{}", err).bright_red()), + Err(err) => eprintln!( + "{} {}", + "ERROR:".bright_red().bold(), + format!("{}", err).bright_red() + ), } } diff --git a/src/manifest.rs b/src/manifest.rs index d3ede9d3..254053f4 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -15,7 +15,12 @@ // along with ink!. If not, see . use anyhow::{Context, Result}; -use std::{fs, path::PathBuf}; +use colored::Colorize; +use std::{ + fs, + io::{self, Write}, + path::PathBuf, +}; use toml::value; /// Load and temporarily modify the manifest file (Cargo.toml). @@ -34,9 +39,7 @@ impl CargoToml { } } - Ok(CargoToml { - path: path.clone(), - }) + Ok(CargoToml { path: path.clone() }) } /// Amend the Cargo.toml and run the supplied function. @@ -61,7 +64,7 @@ impl CargoToml { let mut backup_path = self.path.clone(); backup_path.set_file_name(".Cargo.toml.bk"); - // todo: [AJ] check for existing backup and ask user if they want to restore it + cleanup_existing_backup(&backup_path, &self.path)?; let toml = fs::read_to_string(&self.path)?; let mut table: value::Table = toml::from_str(&toml)?; @@ -72,7 +75,7 @@ impl CargoToml { if !should_amend { log::debug!("amend function returned false, so update not required"); // Now run the function without a modified Cargo.toml - return f() + return f(); } fs::copy(&self.path, &backup_path).context("Creating a backup for Cargo.toml")?; @@ -153,6 +156,38 @@ impl CargoToml { } } +/// Handle the case where a previous build was terminated leaving the modified Cargo.toml +/// and its backup in place. +/// +/// Asks the user whether to restore the backup. +fn cleanup_existing_backup(backup_path: &PathBuf, manifest_path: &PathBuf) -> Result<()> { + if backup_path.exists() { + print!( + "A backup of the original 'Cargo.toml' exists from a previous build which may have \ + terminated prematurely. The current 'Cargo.toml' is likely to be a temporary \ + modified copy created by this build process. Would you like to restore from the \ + backup and overwrite the current 'Cargo.toml'? {}", + "[Y/n]".bold() + ); + io::stdout().flush()?; + + let mut input = String::new(); + io::stdin().read_line(&mut input)?; + let input = input.trim(); + + match input.chars().nth(0) { + Some('n') | Some('N') => Ok(()), + _ => { + fs::rename(&backup_path, &manifest_path) + .context("Creating a backup for Cargo.toml")?; + Ok(()) + } + } + } else { + Ok(()) + } +} + fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { crate_types .iter() -- GitLab From 3568343fa69bbe6d15f2334c8779e6197717c258 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 10 Feb 2020 11:18:48 +0000 Subject: [PATCH 18/98] Show error context --- src/cmd/build.rs | 6 +++++- src/main.rs | 2 +- src/manifest.rs | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index a32c751c..ce860700 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -213,7 +213,11 @@ fn strip_custom_sections(module: &mut Module) { /// Performs required post-processing steps on the wasm artifact. fn post_process_wasm(crate_metadata: &CrateMetadata) -> Result<()> { // Deserialize wasm module from a file. - let mut module = parity_wasm::deserialize_file(&crate_metadata.original_wasm)?; + let mut module = + parity_wasm::deserialize_file(&crate_metadata.original_wasm).context(format!( + "Loading original wasm file '{}'", + crate_metadata.original_wasm.display() + ))?; // Perform optimization. // diff --git a/src/main.rs b/src/main.rs index 04171c8e..0dd885e3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -153,7 +153,7 @@ fn main() { Err(err) => eprintln!( "{} {}", "ERROR:".bright_red().bold(), - format!("{}", err).bright_red() + format!("{:?}", err).bright_red() ), } } diff --git a/src/manifest.rs b/src/manifest.rs index 254053f4..6d77b8a2 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -66,7 +66,7 @@ impl CargoToml { cleanup_existing_backup(&backup_path, &self.path)?; - let toml = fs::read_to_string(&self.path)?; + let toml = fs::read_to_string(&self.path).context("Loading Cargo.toml")?; let mut table: value::Table = toml::from_str(&toml)?; // run supplied amend function -- GitLab From 2c70524a58ac8a86e3aba251440ebf431a12f87c Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 10 Feb 2020 11:39:51 +0000 Subject: [PATCH 19/98] Debug crate metadata --- src/cmd/build.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index ce860700..448de40f 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -30,6 +30,7 @@ use parity_wasm::elements::{External, MemoryType, Module, Section}; const MAX_MEMORY_PAGES: u32 = 16; /// Relevant metadata obtained from Cargo.toml. +#[derive(Debug)] pub struct CrateMetadata { workspace_root: PathBuf, manifest_path: PathBuf, @@ -70,13 +71,15 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Date: Mon, 10 Feb 2020 12:38:20 +0000 Subject: [PATCH 20/98] Disable rlib by default for template --- template/Cargo.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/template/Cargo.toml b/template/Cargo.toml index 8bb06c94..de9fd343 100644 --- a/template/Cargo.toml +++ b/template/Cargo.toml @@ -19,8 +19,10 @@ path = "lib.rs" crate-type = [ # Used for normal contract Wasm blobs. "cdylib", - # Used for ABI generation. - "rlib", + # Required for ABI generation. + # If using `cargo contract generate-metadata`, will automatically be enabled. + # If using plain `cargo run`, must be enabled manually. +# "rlib", ] [features] -- GitLab From 0067ce7273578c8f823c35163d98c329ad7a0673 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 10 Feb 2020 12:38:50 +0000 Subject: [PATCH 21/98] Use correct working dir, not workspace root --- src/cmd/build.rs | 11 ++++++----- src/cmd/metadata.rs | 5 ++--- src/manifest.rs | 12 +++++++++++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 448de40f..2f14e762 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -32,8 +32,8 @@ const MAX_MEMORY_PAGES: u32 = 16; /// Relevant metadata obtained from Cargo.toml. #[derive(Debug)] pub struct CrateMetadata { + working_dir: Option, workspace_root: PathBuf, - manifest_path: PathBuf, package_name: String, original_wasm: PathBuf, pub dest_wasm: PathBuf, @@ -72,8 +72,8 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result(crate_metadata: &CrateMetadata, f: F) -> Result<()> where F: FnOnce() -> Result<()>, { - let xargo_config_path = crate_metadata.workspace_root.join("Xargo.toml"); + let xargo_config_path = crate_metadata.working_dir.as_ref() + .map_or("Xargo.toml".into(), |dir| dir.join("Xargo.toml")); let xargo_config = r#" [target.wasm32-unknown-unknown.dependencies] @@ -149,8 +150,8 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { "--target=wasm32-unknown-unknown", "--verbose", ]; - let manifest = CargoToml::new(&crate_metadata.manifest_path)?; - let working_dir = Some(&crate_metadata.workspace_root); + let manifest = CargoToml::from_working_dir(crate_metadata.working_dir.as_ref())?; + let working_dir = crate_metadata.working_dir.as_ref(); // temporarily remove the 'rlib' crate-type to build wasm blob for optimal size manifest.with_removed_crate_type("rlib", || { diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 0172ee45..226bda28 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -25,8 +25,7 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result println!(" Generating metadata"); let cargo_metadata = super::get_cargo_metadata(dir)?; - let manifest_path = cargo_metadata.workspace_root.join("Cargo.toml"); - let manifest = CargoToml::new(&manifest_path)?; + let manifest = CargoToml::from_working_dir(dir)?; manifest.with_added_crate_type("rlib", || { super::rustup_run( @@ -39,7 +38,7 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! "--verbose", ], - Some(&cargo_metadata.workspace_root), + dir, ) })?; diff --git a/src/manifest.rs b/src/manifest.rs index 6d77b8a2..da6a86d0 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -23,6 +23,8 @@ use std::{ }; use toml::value; +const MANIFEST_FILE: &str = "Cargo.toml"; + /// Load and temporarily modify the manifest file (Cargo.toml). pub struct CargoToml { path: PathBuf, @@ -34,7 +36,7 @@ impl CargoToml { /// The path *must* be to a `Cargo.toml`. pub fn new(path: &PathBuf) -> Result { if let Some(file_name) = path.file_name() { - if file_name != "Cargo.toml" { + if file_name != MANIFEST_FILE { anyhow::bail!("Manifest file must be a Cargo.toml") } } @@ -42,6 +44,14 @@ impl CargoToml { Ok(CargoToml { path: path.clone() }) } + /// Create a new CargoToml from the given directory path. + /// + /// Passing `None` will assume the current directory so just `Cargo.toml` + pub fn from_working_dir(path: Option<&PathBuf>) -> Result { + let file_path = path.map_or(MANIFEST_FILE.into(), |d| d.join(MANIFEST_FILE)); + Self::new(&file_path) + } + /// Amend the Cargo.toml and run the supplied function. /// Makes a backup of the existing Cargo.toml which is restored once complete. /// -- GitLab From 00e7fa687d01a7706f88a288e46a78b45bbbcf49 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 12 Feb 2020 16:51:43 +0000 Subject: [PATCH 22/98] Use `cargo-xbuild` as lib --- Cargo.lock | 119 +++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 2 + src/cmd/build.rs | 80 +++++-------------------------- src/manifest.rs | 7 ++- 4 files changed, 139 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e9f48ed2..efd75a54 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -268,6 +268,7 @@ dependencies = [ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "async-std 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo-xbuild 0.5.23 (git+https://github.com/ascjones/cargo-xbuild?branch=pub-build-fn)", "cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "colored 1.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -289,6 +290,24 @@ dependencies = [ "zip 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cargo-xbuild" +version = "0.5.23" +source = "git+https://github.com/ascjones/cargo-xbuild?branch=pub-build-fn#3c09942179fc70b67c4493ef1879d56cf66dc64c" +dependencies = [ + "cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cargo_metadata" version = "0.9.1" @@ -537,6 +556,11 @@ dependencies = [ "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "error-chain" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "failure" version = "0.1.6" @@ -663,6 +687,15 @@ dependencies = [ "sp-version 2.0.0 (git+https://github.com/paritytech/substrate/)", ] +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fuchsia-cprng" version = "0.1.1" @@ -1693,6 +1726,18 @@ dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.6.5" @@ -1855,6 +1900,14 @@ name = "regex-syntax" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "remove_dir_all" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ring" version = "0.16.9" @@ -1879,6 +1932,19 @@ name = "rustc-hex" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc-serialize" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc_version" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1914,6 +1980,15 @@ name = "ryu" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "same-file" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "same-file" version = "1.0.6" @@ -1957,6 +2032,11 @@ dependencies = [ "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "semver" version = "0.9.0" @@ -2500,6 +2580,15 @@ dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tempdir" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "termcolor" version = "1.1.0" @@ -2602,6 +2691,14 @@ dependencies = [ "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "toml" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "toml" version = "0.5.6" @@ -2797,6 +2894,16 @@ dependencies = [ "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "walkdir" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "walkdir" version = "2.3.1" @@ -3067,6 +3174,7 @@ dependencies = [ "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" "checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" +"checksum cargo-xbuild 0.5.23 (git+https://github.com/ascjones/cargo-xbuild?branch=pub-build-fn)" = "" "checksum cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "46e3374c604fb39d1a2f35ed5e4a4e30e60d01fab49446e08f1b3e9a90aef202" "checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" @@ -3094,6 +3202,7 @@ dependencies = [ "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" "checksum environmental 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "516aa8d7a71cb00a1c4146f0798549b93d083d4f189b3ced8f3de6b8f11ee6c4" "checksum err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b41487fadaa500d02a819eefcde5f713599a01dd51626ef25d2d72d87115667b" +"checksum error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "318cb3c71ee4cdea69fdc9e15c173b245ed6063e1709029e8fd32525a881120f" "checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9" "checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" @@ -3105,6 +3214,7 @@ dependencies = [ "checksum frame-support-procedural-tools 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" "checksum frame-support-procedural-tools-derive 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" "checksum frame-system 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" +"checksum fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" @@ -3219,6 +3329,7 @@ dependencies = [ "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" +"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" @@ -3237,18 +3348,23 @@ dependencies = [ "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8" "checksum regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06" +"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" "checksum ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6747f8da1f2b1fabbee1aaa4eb8a11abf9adef0bf58a41cee45db5d59cecdfac" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" "checksum rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rustls 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" "checksum rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6" "checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" +"checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7" "checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" "checksum schnorrkel 0.8.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eacd8381b3c37840c9c9f40472af529e49975bdcbc24f83c31059fd6539023d3" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" @@ -3298,6 +3414,7 @@ dependencies = [ "checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" "checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" "checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" +"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thiserror 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "205684fd018ca14432b12cce6ea3d46763311a571c3d294e71ba3f01adcf1aad" @@ -3308,6 +3425,7 @@ dependencies = [ "checksum tiny-keccak 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2953ca5148619bc99695c1274cb54c5275bbb913c6adad87e72eaf8db9787f69" "checksum tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8fdd17989496f49cdc57978c96f0c9fe5e4a58a8bddc6813c449a4624f6a030b" "checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" +"checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" "checksum tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" "checksum tracing 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e213bd24252abeb86a0b7060e02df677d367ce6cb772cef17e9214b8390a8d3" @@ -3334,6 +3452,7 @@ dependencies = [ "checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" "checksum wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3c5c5c1286c6e578416982609f47594265f9d489f9b836157d403ad605a46693" "checksum wabt-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "af5d153dc96aad7dc13ab90835b892c69867948112d95299e522d370c4e13a08" +"checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff" "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" "checksum want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" diff --git a/Cargo.toml b/Cargo.toml index 0a765934..8749768c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,8 @@ codec = { package = "parity-scale-codec", version = "1.1" } which = "3.1.0" colored = "1.9" toml = "0.5.4" +cargo-xbuild = { git = "https://github.com/ascjones/cargo-xbuild", branch = "pub-build-fn" } +#cargo-xbuild = "0.5.23" # dependencies for optional extrinsics feature async-std = { version = "1.5.0", optional = true } diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 2f14e762..3dcd1ee9 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -15,7 +15,7 @@ // along with ink!. If not, see . use std::{ - fs::{self, metadata}, + fs::metadata, io::{self, Write}, path::PathBuf, process::Command, @@ -82,61 +82,6 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result(crate_metadata: &CrateMetadata, f: F) -> Result<()> -where - F: FnOnce() -> Result<()>, -{ - let xargo_config_path = crate_metadata.working_dir.as_ref() - .map_or("Xargo.toml".into(), |dir| dir.join("Xargo.toml")); - - let xargo_config = r#" -[target.wasm32-unknown-unknown.dependencies] -core = {default-features=false, features=["panic_immediate_abort"]} -std = {default-features=false, features=["panic_immediate_abort"]} -alloc = {} -"#; - - // If there is an existing Xargo.toml which is different to the config above, instead of - // overwriting it fail the build instead. - let open_result = fs::OpenOptions::new() - .write(true) - .create_new(true) - .open(xargo_config_path.clone()); - - match open_result { - Ok(mut outfile) => { - // No existing Xargo.toml - outfile.write_all(xargo_config.as_bytes())?; - let res = f(); - // clean up the auto generated Xargo.config: the user should not be editing this file - let _ = fs::remove_file(xargo_config_path); - res - } - Err(e) => { - if e.kind() == std::io::ErrorKind::AlreadyExists { - let existing = fs::read_to_string(xargo_config_path).expect("File exists"); - if existing != xargo_config { - anyhow::bail!( - "A Xargo.config already exists which is different to the recommended \ - configuration. Please remove/rename it and run again", - ) - } - // Xargo.config file already exists with correct content so just use it - Ok(()) - } else { - anyhow::bail!(e) - } - } - } -} - /// Builds the project in the specified directory, defaults to the current directory. /// /// Attempts to build using [`xargo`](https://github.com/japaric/xargo) for maximum optimization of @@ -144,26 +89,25 @@ alloc = {} /// /// If `xargo` is not installed then the user will be warned and it will fall back to `cargo`. fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { + let target = "wasm32-unknown-unknown"; let build_args = [ "--no-default-features", "--release", - "--target=wasm32-unknown-unknown", - "--verbose", + &format!("--target={}", target), +// "--verbose", ]; let manifest = CargoToml::from_working_dir(crate_metadata.working_dir.as_ref())?; - let working_dir = crate_metadata.working_dir.as_ref(); + + // todo: check for xbuild config section `root_package.metadata.get("cargo-xbuild");` // temporarily remove the 'rlib' crate-type to build wasm blob for optimal size manifest.with_removed_crate_type("rlib", || { - // prefer building with xargo for optimal size, but fall back to cargo - if which::which("xargo").is_err() { - println!("TODO: tell the user nicely to install xargo"); - super::rustup_run("cargo", "build", &build_args, working_dir) - } else { - with_xargo_config(crate_metadata, || { - super::rustup_run("xargo", "build", &build_args, working_dir) - }) - } + let manifest_path = Some(manifest.manifest_path()); + let exit_status = xargo_lib::build(xargo_lib::Args::new(&build_args, Some(target), manifest_path), "build") + .map_err(|e| anyhow::anyhow!("{}", e)) + .context("Building with xbuild")?; + log::debug!("xargo exit status: {:?}", exit_status); + Ok(()) }) } diff --git a/src/manifest.rs b/src/manifest.rs index da6a86d0..08fb8ea5 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -19,7 +19,7 @@ use colored::Colorize; use std::{ fs, io::{self, Write}, - path::PathBuf, + path::{Path, PathBuf}, }; use toml::value; @@ -52,6 +52,11 @@ impl CargoToml { Self::new(&file_path) } + /// The path to the Cargo.toml + pub fn manifest_path(&self) -> &Path { + self.path.as_path() + } + /// Amend the Cargo.toml and run the supplied function. /// Makes a backup of the existing Cargo.toml which is restored once complete. /// -- GitLab From 3230d8921bee550d6f60ea6deb2d177061dab34c Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 12 Feb 2020 17:41:22 +0000 Subject: [PATCH 23/98] Check for nightly channel --- Cargo.lock | 1 + Cargo.toml | 1 + src/cmd/build.rs | 6 ++++-- src/cmd/metadata.rs | 5 +++-- src/cmd/mod.rs | 12 +----------- src/main.rs | 1 + src/util.rs | 44 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 src/util.rs diff --git a/Cargo.lock b/Cargo.lock index efd75a54..a63fc402 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,6 +279,7 @@ dependencies = [ "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", "structopt 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-subxt 0.4.0 (git+https://github.com/paritytech/substrate-subxt/?rev=399ac68cb1547ba4879e389c28d72aa7a2bae139)", diff --git a/Cargo.toml b/Cargo.toml index 8749768c..dfb643bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ which = "3.1.0" colored = "1.9" toml = "0.5.4" cargo-xbuild = { git = "https://github.com/ascjones/cargo-xbuild", branch = "pub-build-fn" } +rustc_version = "0.2.3" #cargo-xbuild = "0.5.23" # dependencies for optional extrinsics feature diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 3dcd1ee9..0e41868f 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -21,7 +21,7 @@ use std::{ process::Command, }; -use crate::manifest::CargoToml; +use crate::{manifest::CargoToml, util}; use anyhow::{Context, Result}; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; @@ -41,7 +41,7 @@ pub struct CrateMetadata { /// Parses the contract manifest and returns relevant metadata. pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result { - let metadata = super::get_cargo_metadata(working_dir)?; + let metadata = crate::util::get_cargo_metadata(working_dir)?; let root_package_id = metadata .resolve @@ -89,6 +89,8 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()> { + util::assert_channel()?; + let target = "wasm32-unknown-unknown"; let build_args = [ "--no-default-features", diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 226bda28..130b91a6 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use crate::manifest::CargoToml; +use crate::{manifest::CargoToml, util}; use anyhow::Result; use std::path::PathBuf; @@ -22,9 +22,10 @@ use std::path::PathBuf; /// /// It does so by invoking build by cargo and then post processing the final binary. pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result { + util::assert_channel()?; println!(" Generating metadata"); - let cargo_metadata = super::get_cargo_metadata(dir)?; + let cargo_metadata = crate::util::get_cargo_metadata(dir)?; let manifest = CargoToml::from_working_dir(dir)?; manifest.with_added_crate_type("rlib", || { diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index b4c8d0a3..b46f2a81 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -14,8 +14,7 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use anyhow::{Context, Result}; -use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand}; +use anyhow::Result; use std::{ io::{self, Write}, path::PathBuf, @@ -40,15 +39,6 @@ pub(crate) use self::{ deploy::execute_deploy, extrinsics::submit_extrinsic, instantiate::execute_instantiate, }; -/// Get the result of `cargo metadata` -pub(crate) fn get_cargo_metadata(working_dir: Option<&PathBuf>) -> Result { - let mut cmd = MetadataCommand::new(); - if let Some(dir) = working_dir { - cmd.current_dir(dir); - } - cmd.exec().context("Error invoking `cargo metadata`") -} - /// Run the given command in the rustup nightly environment pub(crate) fn rustup_run( command: &str, diff --git a/src/main.rs b/src/main.rs index 0dd885e3..62e26994 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ // along with ink!. If not, see . mod cmd; +mod util; mod manifest; #[cfg(feature = "extrinsics")] diff --git a/src/util.rs b/src/util.rs new file mode 100644 index 00000000..443763a6 --- /dev/null +++ b/src/util.rs @@ -0,0 +1,44 @@ +// Copyright 2018-2019 Parity Technologies (UK) Ltd. +// This file is part of ink!. +// +// ink! 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. +// +// ink! 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 ink!. If not, see . + +use anyhow::{Context, Result}; +use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand}; +use rustc_version::Channel; +use std::path::PathBuf; + +/// Get the result of `cargo metadata` +pub fn get_cargo_metadata(working_dir: Option<&PathBuf>) -> Result { + let mut cmd = MetadataCommand::new(); + if let Some(dir) = working_dir { + cmd.current_dir(dir); + } + cmd.exec().context("Error invoking `cargo metadata`") +} + +/// Check whether the current rust channel is valid: `nightly` is recommended. +pub fn assert_channel() -> Result<()> { + let meta = rustc_version::version_meta()?; + match meta.channel { + Channel::Dev | Channel::Nightly => Ok(()), + Channel::Stable | Channel::Beta => { + anyhow::bail!( + "cargo-contract cannot build using the {:?} channel. \ + Switch to nightly.", + meta.channel + ); + } + } +} -- GitLab From 17e06800c29f8d95083090acb9098d4d798f68a6 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 10:41:22 +0000 Subject: [PATCH 24/98] Check for correct xbuild configuration --- src/cmd/build.rs | 28 ++++++++++++++++++++++++++-- src/util.rs | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 0e41868f..97c66788 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -23,6 +23,7 @@ use std::{ use crate::{manifest::CargoToml, util}; use anyhow::{Context, Result}; +use cargo_metadata::Package; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; @@ -35,6 +36,7 @@ pub struct CrateMetadata { working_dir: Option, workspace_root: PathBuf, package_name: String, + root_package: Package, original_wasm: PathBuf, pub dest_wasm: PathBuf, } @@ -74,6 +76,7 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()> { "--no-default-features", "--release", &format!("--target={}", target), -// "--verbose", ]; let manifest = CargoToml::from_working_dir(crate_metadata.working_dir.as_ref())?; - // todo: check for xbuild config section `root_package.metadata.get("cargo-xbuild");` + // check `cargo-xbuild` config section exists and has `panic_immediate_abort` enabled + let xbuild_metadata = crate_metadata.root_package.metadata.get("cargo-xbuild"); + if let Some(xbuild_metadata) = xbuild_metadata { + let panic_immediate_abort_enabled = xbuild_metadata.get("panic_immediate_abort") + .map_or(false, |v| v == "true"); + if !panic_immediate_abort_enabled { + println!( + "{}: {}", + "WARNING".bold().bright_yellow(), + "For optimal binary size please set `panic_immediate_abort = true` in the \ + `[package.metadata.cargo-xbuild]` section of `Cargo.toml`. \ + See https://github.com/rust-osdev/cargo-xbuild#configuration".bold(), + ) + } + } else { + println!( + "{}: {}", + "WARNING".bold().bright_yellow(), + "For optimal binary size please add a `[package.metadata.cargo-xbuild]` section to \ + `Cargo.toml` with `panic_immediate_abort = true` \ + See https://github.com/rust-osdev/cargo-xbuild#configuration".bold(), + ) + } // temporarily remove the 'rlib' crate-type to build wasm blob for optimal size manifest.with_removed_crate_type("rlib", || { diff --git a/src/util.rs b/src/util.rs index 443763a6..f924e1d9 100644 --- a/src/util.rs +++ b/src/util.rs @@ -37,7 +37,7 @@ pub fn assert_channel() -> Result<()> { anyhow::bail!( "cargo-contract cannot build using the {:?} channel. \ Switch to nightly.", - meta.channel + format!("{:?}", meta.channel).to_lowercase(), ); } } -- GitLab From 1f48c0711a35a7670cd634fb63bef75f361a2ab0 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 10:47:57 +0000 Subject: [PATCH 25/98] Add xbuild config to template --- template/Cargo.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/template/Cargo.toml b/template/Cargo.toml index de9fd343..f54a8d46 100644 --- a/template/Cargo.toml +++ b/template/Cargo.toml @@ -4,6 +4,12 @@ version = "0.1.0" authors = ["[your_name] <[your_email]>"] edition = "2018" +# Configuration for `cargo-xbuild`, used by [`cargo-contract`](https://github.com/paritytech/cargo-contract) +[package.metadata.cargo-xbuild] +# Prevents panic strings and formatting code from `core` being included in final binary +# See https://github.com/johnthagen/min-sized-rust#remove-panic-string-formatting-with-panic_immediate_abort +panic_immediate_abort = true + [dependencies] ink_abi = { git = "https://github.com/paritytech/ink", package = "ink_abi", default-features = false, features = ["derive"], optional = true } ink_primitives = { git = "https://github.com/paritytech/ink", package = "ink_primitives", default-features = false } -- GitLab From 9c3c4e149743a55db8c98ba808e4352be057b09f Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 11:17:43 +0000 Subject: [PATCH 26/98] Fix xbuild config check and use latest xbuild version --- Cargo.lock | 9 +++++---- Cargo.toml | 4 ++-- src/cmd/build.rs | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a63fc402..d1244d6c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -268,7 +268,7 @@ dependencies = [ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "async-std 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo-xbuild 0.5.23 (git+https://github.com/ascjones/cargo-xbuild?branch=pub-build-fn)", + "cargo-xbuild 0.5.24 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "colored 1.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -280,6 +280,7 @@ dependencies = [ "parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", "structopt 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-subxt 0.4.0 (git+https://github.com/paritytech/substrate-subxt/?rev=399ac68cb1547ba4879e389c28d72aa7a2bae139)", @@ -293,8 +294,8 @@ dependencies = [ [[package]] name = "cargo-xbuild" -version = "0.5.23" -source = "git+https://github.com/ascjones/cargo-xbuild?branch=pub-build-fn#3c09942179fc70b67c4493ef1879d56cf66dc64c" +version = "0.5.24" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3175,7 +3176,7 @@ dependencies = [ "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" "checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" -"checksum cargo-xbuild 0.5.23 (git+https://github.com/ascjones/cargo-xbuild?branch=pub-build-fn)" = "" +"checksum cargo-xbuild 0.5.24 (registry+https://github.com/rust-lang/crates.io-index)" = "67914307b10adada78b82bc9978315221806e0f23c66e014560a2e7299c0ecc2" "checksum cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "46e3374c604fb39d1a2f35ed5e4a4e30e60d01fab49446e08f1b3e9a90aef202" "checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" diff --git a/Cargo.toml b/Cargo.toml index dfb643bd..2dba98cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,9 +28,9 @@ codec = { package = "parity-scale-codec", version = "1.1" } which = "3.1.0" colored = "1.9" toml = "0.5.4" -cargo-xbuild = { git = "https://github.com/ascjones/cargo-xbuild", branch = "pub-build-fn" } +cargo-xbuild = "0.5.24" rustc_version = "0.2.3" -#cargo-xbuild = "0.5.23" +serde_json = "1.0" # dependencies for optional extrinsics feature async-std = { version = "1.5.0", optional = true } diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 97c66788..a193f9ab 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -26,6 +26,7 @@ use anyhow::{Context, Result}; use cargo_metadata::Package; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; +use serde_json::Value; /// This is the maximum number of pages available for a contract to allocate. const MAX_MEMORY_PAGES: u32 = 16; @@ -106,7 +107,7 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { let xbuild_metadata = crate_metadata.root_package.metadata.get("cargo-xbuild"); if let Some(xbuild_metadata) = xbuild_metadata { let panic_immediate_abort_enabled = xbuild_metadata.get("panic_immediate_abort") - .map_or(false, |v| v == "true"); + .map_or(false, |v| *v == Value::Bool(true)); if !panic_immediate_abort_enabled { println!( "{}: {}", -- GitLab From 4ff297166550b5d1aa4ad7296471f15af6eb8a3a Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 11:18:18 +0000 Subject: [PATCH 27/98] Fmt --- src/cmd/build.rs | 18 ++++++++++++------ src/main.rs | 2 +- src/util.rs | 30 +++++++++++++++--------------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index a193f9ab..69fbb7eb 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -106,7 +106,8 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { // check `cargo-xbuild` config section exists and has `panic_immediate_abort` enabled let xbuild_metadata = crate_metadata.root_package.metadata.get("cargo-xbuild"); if let Some(xbuild_metadata) = xbuild_metadata { - let panic_immediate_abort_enabled = xbuild_metadata.get("panic_immediate_abort") + let panic_immediate_abort_enabled = xbuild_metadata + .get("panic_immediate_abort") .map_or(false, |v| *v == Value::Bool(true)); if !panic_immediate_abort_enabled { println!( @@ -114,7 +115,8 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { "WARNING".bold().bright_yellow(), "For optimal binary size please set `panic_immediate_abort = true` in the \ `[package.metadata.cargo-xbuild]` section of `Cargo.toml`. \ - See https://github.com/rust-osdev/cargo-xbuild#configuration".bold(), + See https://github.com/rust-osdev/cargo-xbuild#configuration" + .bold(), ) } } else { @@ -123,16 +125,20 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { "WARNING".bold().bright_yellow(), "For optimal binary size please add a `[package.metadata.cargo-xbuild]` section to \ `Cargo.toml` with `panic_immediate_abort = true` \ - See https://github.com/rust-osdev/cargo-xbuild#configuration".bold(), + See https://github.com/rust-osdev/cargo-xbuild#configuration" + .bold(), ) } // temporarily remove the 'rlib' crate-type to build wasm blob for optimal size manifest.with_removed_crate_type("rlib", || { let manifest_path = Some(manifest.manifest_path()); - let exit_status = xargo_lib::build(xargo_lib::Args::new(&build_args, Some(target), manifest_path), "build") - .map_err(|e| anyhow::anyhow!("{}", e)) - .context("Building with xbuild")?; + let exit_status = xargo_lib::build( + xargo_lib::Args::new(&build_args, Some(target), manifest_path), + "build", + ) + .map_err(|e| anyhow::anyhow!("{}", e)) + .context("Building with xbuild")?; log::debug!("xargo exit status: {:?}", exit_status); Ok(()) }) diff --git a/src/main.rs b/src/main.rs index 62e26994..ec2486a8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,8 +15,8 @@ // along with ink!. If not, see . mod cmd; -mod util; mod manifest; +mod util; #[cfg(feature = "extrinsics")] use sp_core::{crypto::Pair, sr25519, H256}; diff --git a/src/util.rs b/src/util.rs index f924e1d9..311ddd1c 100644 --- a/src/util.rs +++ b/src/util.rs @@ -21,24 +21,24 @@ use std::path::PathBuf; /// Get the result of `cargo metadata` pub fn get_cargo_metadata(working_dir: Option<&PathBuf>) -> Result { - let mut cmd = MetadataCommand::new(); - if let Some(dir) = working_dir { - cmd.current_dir(dir); - } - cmd.exec().context("Error invoking `cargo metadata`") + let mut cmd = MetadataCommand::new(); + if let Some(dir) = working_dir { + cmd.current_dir(dir); + } + cmd.exec().context("Error invoking `cargo metadata`") } /// Check whether the current rust channel is valid: `nightly` is recommended. pub fn assert_channel() -> Result<()> { - let meta = rustc_version::version_meta()?; - match meta.channel { - Channel::Dev | Channel::Nightly => Ok(()), - Channel::Stable | Channel::Beta => { - anyhow::bail!( - "cargo-contract cannot build using the {:?} channel. \ + let meta = rustc_version::version_meta()?; + match meta.channel { + Channel::Dev | Channel::Nightly => Ok(()), + Channel::Stable | Channel::Beta => { + anyhow::bail!( + "cargo-contract cannot build using the {:?} channel. \ Switch to nightly.", - format!("{:?}", meta.channel).to_lowercase(), - ); - } - } + format!("{:?}", meta.channel).to_lowercase(), + ); + } + } } -- GitLab From 436077dbd5397eb0f5734fde0a21ad15638705ba Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 11:41:37 +0000 Subject: [PATCH 28/98] Restore tempfile dev dependency --- Cargo.lock | 15 +++++++++++++++ Cargo.toml | 1 + 2 files changed, 16 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index d1244d6c..5b0f4041 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -284,6 +284,7 @@ dependencies = [ "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", "structopt 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-subxt 0.4.0 (git+https://github.com/paritytech/substrate-subxt/?rev=399ac68cb1547ba4879e389c28d72aa7a2bae139)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2591,6 +2592,19 @@ dependencies = [ "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tempfile" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "termcolor" version = "1.1.0" @@ -3417,6 +3431,7 @@ dependencies = [ "checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" "checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thiserror 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "205684fd018ca14432b12cce6ea3d46763311a571c3d294e71ba3f01adcf1aad" diff --git a/Cargo.toml b/Cargo.toml index 2dba98cd..8f20fde8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,6 +47,7 @@ walkdir = "2.3.1" [dev-dependencies] assert_matches = "1.3.0" +tempfile = "3.1.0" wabt = "0.9.2" [features] -- GitLab From fe27fee7bb02db59c064ac1d3ec72535dd8708fd Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 14:38:10 +0000 Subject: [PATCH 29/98] Move xbuild config to the end of the file --- template/Cargo.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/template/Cargo.toml b/template/Cargo.toml index f54a8d46..d5aa8997 100644 --- a/template/Cargo.toml +++ b/template/Cargo.toml @@ -4,12 +4,6 @@ version = "0.1.0" authors = ["[your_name] <[your_email]>"] edition = "2018" -# Configuration for `cargo-xbuild`, used by [`cargo-contract`](https://github.com/paritytech/cargo-contract) -[package.metadata.cargo-xbuild] -# Prevents panic strings and formatting code from `core` being included in final binary -# See https://github.com/johnthagen/min-sized-rust#remove-panic-string-formatting-with-panic_immediate_abort -panic_immediate_abort = true - [dependencies] ink_abi = { git = "https://github.com/paritytech/ink", package = "ink_abi", default-features = false, features = ["derive"], optional = true } ink_primitives = { git = "https://github.com/paritytech/ink", package = "ink_primitives", default-features = false } @@ -66,3 +60,9 @@ members = [ exclude = [ ".ink" ] + +# Configuration for `cargo-xbuild`, used by [`cargo-contract`](https://github.com/paritytech/cargo-contract) +[package.metadata.cargo-xbuild] +# Prevents panic strings and formatting code from `core` being included in final binary +# See https://github.com/johnthagen/min-sized-rust#remove-panic-string-formatting-with-panic_immediate_abort +panic_immediate_abort = true -- GitLab From 4ace9b3bfa10dc91cedfb1511ac5758f56734a6b Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 14:40:26 +0000 Subject: [PATCH 30/98] Enable rlib by default in template --- template/Cargo.toml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/template/Cargo.toml b/template/Cargo.toml index d5aa8997..807a5d01 100644 --- a/template/Cargo.toml +++ b/template/Cargo.toml @@ -19,10 +19,9 @@ path = "lib.rs" crate-type = [ # Used for normal contract Wasm blobs. "cdylib", - # Required for ABI generation. - # If using `cargo contract generate-metadata`, will automatically be enabled. - # If using plain `cargo run`, must be enabled manually. -# "rlib", + # Required for ABI generation, and using this contract as a dependency. + # If using `cargo contract build`, it will be automatically disabled to produce a smaller Wasm binary + "rlib", ] [features] -- GitLab From 9b49dbea954bfdec514ba5f0e1a54087f468ad32 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 14:51:11 +0000 Subject: [PATCH 31/98] Don't need nightly for generating the metadata --- src/cmd/metadata.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 130b91a6..c3b6eff6 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -22,7 +22,6 @@ use std::path::PathBuf; /// /// It does so by invoking build by cargo and then post processing the final binary. pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result { - util::assert_channel()?; println!(" Generating metadata"); let cargo_metadata = crate::util::get_cargo_metadata(dir)?; -- GitLab From b4ab11ec4130013a86abeccb4eef44f080ce2fb4 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 15:18:42 +0000 Subject: [PATCH 32/98] Actually do need nightly, and just run plain cargo --- src/cmd/metadata.rs | 4 ++-- src/cmd/mod.rs | 57 --------------------------------------------- src/util.rs | 45 ++++++++++++++++++++++++++++++++++- 3 files changed, 46 insertions(+), 60 deletions(-) diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index c3b6eff6..9dbcad5c 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -22,14 +22,14 @@ use std::path::PathBuf; /// /// It does so by invoking build by cargo and then post processing the final binary. pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result { + util::assert_channel()?; println!(" Generating metadata"); let cargo_metadata = crate::util::get_cargo_metadata(dir)?; let manifest = CargoToml::from_working_dir(dir)?; manifest.with_added_crate_type("rlib", || { - super::rustup_run( - "cargo", + util::invoke_cargo( "run", &[ "--package", diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index b46f2a81..5b8c1b1e 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -14,13 +14,6 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use anyhow::Result; -use std::{ - io::{self, Write}, - path::PathBuf, - process::Command, -}; - mod build; #[cfg(feature = "extrinsics")] mod deploy; @@ -38,53 +31,3 @@ pub(crate) use self::{ pub(crate) use self::{ deploy::execute_deploy, extrinsics::submit_extrinsic, instantiate::execute_instantiate, }; - -/// Run the given command in the rustup nightly environment -pub(crate) fn rustup_run( - command: &str, - subcommand: &str, - args: &[&'static str], - working_dir: Option<&PathBuf>, -) -> Result<()> { - if which::which("rustup").is_err() { - anyhow::bail!( - "The 'rustup' tool not was not found. \ - See: https://github.com/rust-lang/rustup#installation" - ) - } - - let mut cmd = Command::new("rustup"); - - if let Some(dir) = working_dir { - cmd.current_dir(dir); - } - - let output = cmd - .arg("run") - .arg("nightly") - .arg(command) - .arg(subcommand) - .args(args) - .output()?; - - if !output.status.success() { - // Dump the output streams produced by cargo into the stdout/stderr. - io::stdout().write_all(&output.stdout)?; - io::stderr().write_all(&output.stderr)?; - anyhow::bail!("{} {} failed", command, subcommand); - } - - Ok(()) -} - -#[cfg(test)] -mod tests { - use std::path::PathBuf; - use tempfile::TempDir; - - pub fn with_tmp_dir(f: F) { - let tmp_dir = TempDir::new().expect("temporary directory creation failed"); - - f(&tmp_dir.into_path()); - } -} diff --git a/src/util.rs b/src/util.rs index 311ddd1c..271fcddf 100644 --- a/src/util.rs +++ b/src/util.rs @@ -17,7 +17,11 @@ use anyhow::{Context, Result}; use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand}; use rustc_version::Channel; -use std::path::PathBuf; +use std::{ + ffi::OsStr, + path::PathBuf, + process::Command, +}; /// Get the result of `cargo metadata` pub fn get_cargo_metadata(working_dir: Option<&PathBuf>) -> Result { @@ -42,3 +46,42 @@ pub fn assert_channel() -> Result<()> { } } } + +/// Run cargo with the supplied args +pub(crate) fn invoke_cargo( + command: &str, + args: I, + working_dir: Option<&PathBuf>, +) -> Result<()> +where + I: IntoIterator, + S: AsRef, +{ + let cargo = std::env::var("CARGO").unwrap_or("cargo".to_string()); + let mut cmd = Command::new(cargo); + if let Some(working_dir) = working_dir { + cmd.current_dir(working_dir); + } + cmd.arg(command); + cmd.args(args); + + let status = cmd.status()?; //.context("Error executing `cargo {}` with args `{}`", command, args)?; + + if status.success() { + Ok(()) + } else { + anyhow::bail!("`{:?}` failed with exit code: {:?}", cmd, status.code()); + } +} + +#[cfg(test)] +mod tests { + use std::path::PathBuf; + use tempfile::TempDir; + + pub fn with_tmp_dir(f: F) { + let tmp_dir = TempDir::new().expect("temporary directory creation failed"); + + f(&tmp_dir.into_path()); + } +} -- GitLab From f38c6e35903ed8ef7797e27b6abbc8e0cc62fb89 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 15:19:13 +0000 Subject: [PATCH 33/98] Not verbose: need to pass that flag through properly --- src/cmd/metadata.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 9dbcad5c..5cab73b9 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -36,7 +36,6 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result "abi-gen", "--release", // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! - "--verbose", ], dir, ) -- GitLab From 8c00f0d2498e69908844d51b6f6f2d1c58f7293a Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 15:20:08 +0000 Subject: [PATCH 34/98] Fmt --- src/util.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/util.rs b/src/util.rs index 271fcddf..c909e0c0 100644 --- a/src/util.rs +++ b/src/util.rs @@ -17,11 +17,7 @@ use anyhow::{Context, Result}; use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand}; use rustc_version::Channel; -use std::{ - ffi::OsStr, - path::PathBuf, - process::Command, -}; +use std::{ffi::OsStr, path::PathBuf, process::Command}; /// Get the result of `cargo metadata` pub fn get_cargo_metadata(working_dir: Option<&PathBuf>) -> Result { -- GitLab From 3aa17bf651fa35d101445effe1cb198ea3897a21 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 15:21:27 +0000 Subject: [PATCH 35/98] Fix tests --- src/cmd/build.rs | 2 +- src/cmd/deploy.rs | 2 +- src/cmd/instantiate.rs | 2 +- src/cmd/metadata.rs | 2 +- src/cmd/new.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 69fbb7eb..5dd6d714 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -301,7 +301,7 @@ pub(crate) fn execute_build(working_dir: Option<&PathBuf>) -> Result { #[cfg(feature = "test-ci-only")] #[cfg(test)] mod tests { - use crate::cmd::{execute_new, tests::with_tmp_dir}; + use crate::cmd::{execute_new, util::tests::with_tmp_dir}; #[test] fn build_template() { diff --git a/src/cmd/deploy.rs b/src/cmd/deploy.rs index 4b798233..691e2c75 100644 --- a/src/cmd/deploy.rs +++ b/src/cmd/deploy.rs @@ -62,7 +62,7 @@ mod tests { use std::{fs, io::Write}; use crate::{ - cmd::{deploy::execute_deploy, tests::with_tmp_dir}, + cmd::{deploy::execute_deploy, util::tests::with_tmp_dir}, ExtrinsicOpts, }; use assert_matches::assert_matches; diff --git a/src/cmd/instantiate.rs b/src/cmd/instantiate.rs index bb473b6c..dbf613b4 100644 --- a/src/cmd/instantiate.rs +++ b/src/cmd/instantiate.rs @@ -41,7 +41,7 @@ mod tests { use std::{fs, io::Write}; use crate::{ - cmd::{deploy::execute_deploy, tests::with_tmp_dir}, + cmd::{deploy::execute_deploy, util::tests::with_tmp_dir}, ExtrinsicOpts, HexData, }; use assert_matches::assert_matches; diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 5cab73b9..d2a8ce49 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -53,7 +53,7 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result #[cfg(feature = "test-ci-only")] #[cfg(test)] mod tests { - use crate::cmd::{execute_generate_metadata, execute_new, tests::with_tmp_dir}; + use crate::cmd::{execute_generate_metadata, execute_new, util::tests::with_tmp_dir}; #[test] fn generate_metadata() { diff --git a/src/cmd/new.rs b/src/cmd/new.rs index eee64c46..749b0f9b 100644 --- a/src/cmd/new.rs +++ b/src/cmd/new.rs @@ -97,7 +97,7 @@ pub(crate) fn execute_new(name: &str, dir: Option<&PathBuf>) -> Result { #[cfg(test)] mod tests { use super::*; - use crate::cmd::{execute_new, tests::with_tmp_dir}; + use crate::cmd::{execute_new, util::tests::with_tmp_dir}; #[test] fn rejects_hyphenated_name() { -- GitLab From 2c53aeb997db7399b0c2a3aa6b32a28df5822456 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 15:58:45 +0000 Subject: [PATCH 36/98] Error when xbuild config not present, and update README --- README.md | 13 +++++++++++++ src/cmd/build.rs | 10 ++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dda99ea5..03b62d2e 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,19 @@ SUBCOMMANDS: help Prints this message or the help of the given subcommand(s) ``` +## Contract build config + +Building the contract uses `cargo-xbuild` under the hood for optimum Wasm binary size. This requires the following +configuration section to be added to your contract's `Cargo.toml`: + +``` +[package.metadata.cargo-xbuild] +panic_immediate_abort = true +``` + +This will perform a custom build of Rust's `libcore` without panic strings and formatting code, which significantly +reduces the final binary size. + ## Features The `deploy` and `instantiate` subcommands are **disabled by default**, since they are not fully stable yet and increase the build time. diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 5dd6d714..0533d4d9 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -110,23 +110,17 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { .get("panic_immediate_abort") .map_or(false, |v| *v == Value::Bool(true)); if !panic_immediate_abort_enabled { - println!( - "{}: {}", - "WARNING".bold().bright_yellow(), + anyhow::bail!( "For optimal binary size please set `panic_immediate_abort = true` in the \ `[package.metadata.cargo-xbuild]` section of `Cargo.toml`. \ See https://github.com/rust-osdev/cargo-xbuild#configuration" - .bold(), ) } } else { - println!( - "{}: {}", - "WARNING".bold().bright_yellow(), + anyhow::bail!( "For optimal binary size please add a `[package.metadata.cargo-xbuild]` section to \ `Cargo.toml` with `panic_immediate_abort = true` \ See https://github.com/rust-osdev/cargo-xbuild#configuration" - .bold(), ) } -- GitLab From 9d056ac7bc07fd32475149c295a0fab34eb2208e Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 16:01:23 +0000 Subject: [PATCH 37/98] Fix tests --- src/cmd/metadata.rs | 5 ++++- src/cmd/new.rs | 5 ++++- src/util.rs | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index d2a8ce49..ef81b44e 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -53,7 +53,10 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result #[cfg(feature = "test-ci-only")] #[cfg(test)] mod tests { - use crate::cmd::{execute_generate_metadata, execute_new, util::tests::with_tmp_dir}; + use crate::{ + cmd::{execute_generate_metadata, execute_new}, + util::tests::with_tmp_dir, + }; #[test] fn generate_metadata() { diff --git a/src/cmd/new.rs b/src/cmd/new.rs index 749b0f9b..1a62b542 100644 --- a/src/cmd/new.rs +++ b/src/cmd/new.rs @@ -97,7 +97,10 @@ pub(crate) fn execute_new(name: &str, dir: Option<&PathBuf>) -> Result { #[cfg(test)] mod tests { use super::*; - use crate::cmd::{execute_new, util::tests::with_tmp_dir}; + use crate::{ + cmd::execute_new, + util::tests::with_tmp_dir, + }; #[test] fn rejects_hyphenated_name() { diff --git a/src/util.rs b/src/util.rs index c909e0c0..8683c8db 100644 --- a/src/util.rs +++ b/src/util.rs @@ -71,7 +71,7 @@ where } #[cfg(test)] -mod tests { +pub mod tests { use std::path::PathBuf; use tempfile::TempDir; -- GitLab From 90f1485ff883cf38e2d9d443cbf0142e8e3a70e8 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 16:07:37 +0000 Subject: [PATCH 38/98] Remove references to xargo and update readmes --- README.md | 2 +- src/cmd/build.rs | 8 +++----- template/.gitignore | 4 ---- template/Cargo.toml | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 03b62d2e..267a3fb4 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ configuration section to be added to your contract's `Cargo.toml`: panic_immediate_abort = true ``` -This will perform a custom build of Rust's `libcore` without panic strings and formatting code, which significantly +This will perform a custom build of Rust's `libcore` [without panic strings and formatting code](https://github.com/johnthagen/min-sized-rust#remove-panic-string-formatting-with-panic_immediate_abort), which significantly reduces the final binary size. ## Features diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 0533d4d9..6cef40ff 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -88,10 +88,8 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()> { util::assert_channel()?; @@ -113,14 +111,14 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { anyhow::bail!( "For optimal binary size please set `panic_immediate_abort = true` in the \ `[package.metadata.cargo-xbuild]` section of `Cargo.toml`. \ - See https://github.com/rust-osdev/cargo-xbuild#configuration" + See https://github.com/paritytech/cargo-contract#contract-build-config" ) } } else { anyhow::bail!( "For optimal binary size please add a `[package.metadata.cargo-xbuild]` section to \ `Cargo.toml` with `panic_immediate_abort = true` \ - See https://github.com/rust-osdev/cargo-xbuild#configuration" + See https://github.com/paritytech/cargo-contract#contract-build-config" ) } diff --git a/template/.gitignore b/template/.gitignore index 8440c8eb..5b286f57 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -8,9 +8,5 @@ # More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock Cargo.lock -# This file is generated when compiling the contract wasm with `xargo` for optimal size -# It should not be changed by the user and is always overwritten by the build tool -Xargo.toml - # The backup file created by `cargo contract` when modiying the Cargo.toml for the build .Cargo.toml.bk diff --git a/template/Cargo.toml b/template/Cargo.toml index 807a5d01..0b156c4a 100644 --- a/template/Cargo.toml +++ b/template/Cargo.toml @@ -63,5 +63,5 @@ exclude = [ # Configuration for `cargo-xbuild`, used by [`cargo-contract`](https://github.com/paritytech/cargo-contract) [package.metadata.cargo-xbuild] # Prevents panic strings and formatting code from `core` being included in final binary -# See https://github.com/johnthagen/min-sized-rust#remove-panic-string-formatting-with-panic_immediate_abort +# See https://github.com/paritytech/cargo-contract#contract-build-config panic_immediate_abort = true -- GitLab From be57190d234fd0cba103ca8d7acec184d70a0381 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 16:07:54 +0000 Subject: [PATCH 39/98] Fmt --- src/cmd/new.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/cmd/new.rs b/src/cmd/new.rs index 1a62b542..734b486e 100644 --- a/src/cmd/new.rs +++ b/src/cmd/new.rs @@ -97,10 +97,7 @@ pub(crate) fn execute_new(name: &str, dir: Option<&PathBuf>) -> Result { #[cfg(test)] mod tests { use super::*; - use crate::{ - cmd::execute_new, - util::tests::with_tmp_dir, - }; + use crate::{cmd::execute_new, util::tests::with_tmp_dir}; #[test] fn rejects_hyphenated_name() { -- GitLab From 4e421464c1eba5a4c960757bdebbce3e3de80f0c Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 16:14:04 +0000 Subject: [PATCH 40/98] Add error context to cargo invocation --- src/util.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util.rs b/src/util.rs index 8683c8db..8219ca88 100644 --- a/src/util.rs +++ b/src/util.rs @@ -50,7 +50,7 @@ pub(crate) fn invoke_cargo( working_dir: Option<&PathBuf>, ) -> Result<()> where - I: IntoIterator, + I: IntoIterator + std::fmt::Debug, S: AsRef, { let cargo = std::env::var("CARGO").unwrap_or("cargo".to_string()); @@ -61,7 +61,9 @@ where cmd.arg(command); cmd.args(args); - let status = cmd.status()?; //.context("Error executing `cargo {}` with args `{}`", command, args)?; + let status = cmd + .status() + .context(format!("Error executing `{:?}`", cmd))?; if status.success() { Ok(()) -- GitLab From 3d44090ebc52dce4f2f9ce2e5791b16c998b663d Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 16:31:51 +0000 Subject: [PATCH 41/98] Fix tests compilation --- src/cmd/build.rs | 5 ++++- src/cmd/deploy.rs | 3 ++- src/cmd/instantiate.rs | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 6cef40ff..5a2983d2 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -293,7 +293,10 @@ pub(crate) fn execute_build(working_dir: Option<&PathBuf>) -> Result { #[cfg(feature = "test-ci-only")] #[cfg(test)] mod tests { - use crate::cmd::{execute_new, util::tests::with_tmp_dir}; + use crate::{ + cmd::execute_new, + util::tests::with_tmp_dir, + }; #[test] fn build_template() { diff --git a/src/cmd/deploy.rs b/src/cmd/deploy.rs index 691e2c75..a65a4b6d 100644 --- a/src/cmd/deploy.rs +++ b/src/cmd/deploy.rs @@ -62,7 +62,8 @@ mod tests { use std::{fs, io::Write}; use crate::{ - cmd::{deploy::execute_deploy, util::tests::with_tmp_dir}, + cmd::{deploy::execute_deploy}, + util::tests::with_tmp_dir, ExtrinsicOpts, }; use assert_matches::assert_matches; diff --git a/src/cmd/instantiate.rs b/src/cmd/instantiate.rs index dbf613b4..7d43cee3 100644 --- a/src/cmd/instantiate.rs +++ b/src/cmd/instantiate.rs @@ -41,7 +41,8 @@ mod tests { use std::{fs, io::Write}; use crate::{ - cmd::{deploy::execute_deploy, util::tests::with_tmp_dir}, + cmd::deploy::execute_deploy, + util::tests::with_tmp_dir, ExtrinsicOpts, HexData, }; use assert_matches::assert_matches; -- GitLab From 7f5f3562f982d2627d4b7798dd00707400cd6062 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 13 Feb 2020 16:45:39 +0000 Subject: [PATCH 42/98] Fmt --- src/cmd/build.rs | 5 +---- src/cmd/deploy.rs | 6 +----- src/cmd/instantiate.rs | 6 +----- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 5a2983d2..482a6fdc 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -293,10 +293,7 @@ pub(crate) fn execute_build(working_dir: Option<&PathBuf>) -> Result { #[cfg(feature = "test-ci-only")] #[cfg(test)] mod tests { - use crate::{ - cmd::execute_new, - util::tests::with_tmp_dir, - }; + use crate::{cmd::execute_new, util::tests::with_tmp_dir}; #[test] fn build_template() { diff --git a/src/cmd/deploy.rs b/src/cmd/deploy.rs index a65a4b6d..64ba155f 100644 --- a/src/cmd/deploy.rs +++ b/src/cmd/deploy.rs @@ -61,11 +61,7 @@ pub(crate) fn execute_deploy( mod tests { use std::{fs, io::Write}; - use crate::{ - cmd::{deploy::execute_deploy}, - util::tests::with_tmp_dir, - ExtrinsicOpts, - }; + use crate::{cmd::deploy::execute_deploy, util::tests::with_tmp_dir, ExtrinsicOpts}; use assert_matches::assert_matches; const CONTRACT: &str = r#" diff --git a/src/cmd/instantiate.rs b/src/cmd/instantiate.rs index 7d43cee3..29a6d1c4 100644 --- a/src/cmd/instantiate.rs +++ b/src/cmd/instantiate.rs @@ -40,11 +40,7 @@ pub(crate) fn execute_instantiate( mod tests { use std::{fs, io::Write}; - use crate::{ - cmd::deploy::execute_deploy, - util::tests::with_tmp_dir, - ExtrinsicOpts, HexData, - }; + use crate::{cmd::deploy::execute_deploy, util::tests::with_tmp_dir, ExtrinsicOpts, HexData}; use assert_matches::assert_matches; const CONTRACT: &str = r#" -- GitLab From 98d2101d692ae7fa719587fb16eb414d2fe022f9 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 14 Feb 2020 09:37:29 +0000 Subject: [PATCH 43/98] Nightly toolchain for CI --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0884d535..d0990c3d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,7 @@ variables: CARGO_TARGET_DIR: "/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}" CI_SERVER_NAME: "GitLab CI" REGISTRY: registry.parity.io/parity/infrastructure/scripts + RUSTUP_TOOLCHAIN: nightly .collect-artifacts: &collect-artifacts artifacts: -- GitLab From 1919afaf9affaa69597c9889ad969a907fbcd39e Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 14 Feb 2020 09:49:59 +0000 Subject: [PATCH 44/98] Add docs for nightly toolchain requirement --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 267a3fb4..17d37217 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,13 @@ SUBCOMMANDS: help Prints this message or the help of the given subcommand(s) ``` +## `build` Requires the `nightly` toolchain + +`cargo contract build` must be run using the `nightly` toolchain. If you have +[`rustup`](https://github.com/rust-lang/rustup) installed, the simplest way to do so is `cargo +nightly contract build`. +To avoid having to add `+nightly` you can also create a `rust-toolchain` file in your local directory containing +`nightly`. + ## Contract build config Building the contract uses `cargo-xbuild` under the hood for optimum Wasm binary size. This requires the following -- GitLab From dab7d851473f8fb95f395fbd7674c8b2c9ae665f Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 14 Feb 2020 09:52:38 +0000 Subject: [PATCH 45/98] Link to nightly docs --- README.md | 4 ++-- src/util.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 17d37217..906afc98 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,12 @@ SUBCOMMANDS: help Prints this message or the help of the given subcommand(s) ``` -## `build` Requires the `nightly` toolchain +## `build` requires the `nightly` toolchain `cargo contract build` must be run using the `nightly` toolchain. If you have [`rustup`](https://github.com/rust-lang/rustup) installed, the simplest way to do so is `cargo +nightly contract build`. To avoid having to add `+nightly` you can also create a `rust-toolchain` file in your local directory containing -`nightly`. +`nightly`. Read more about how to [specify the rustup toolchain](https://github.com/rust-lang/rustup#override-precedence). ## Contract build config diff --git a/src/util.rs b/src/util.rs index 8219ca88..df05bb58 100644 --- a/src/util.rs +++ b/src/util.rs @@ -36,7 +36,8 @@ pub fn assert_channel() -> Result<()> { Channel::Stable | Channel::Beta => { anyhow::bail!( "cargo-contract cannot build using the {:?} channel. \ - Switch to nightly.", + Switch to nightly. \ + See https://github.com/paritytech/cargo-contract/tree/aj-xargo#build-requires-the-nightly-toolchain", format!("{:?}", meta.channel).to_lowercase(), ); } -- GitLab From 897313872f1f32b0c61bdcc7dd70b1b0e277b62b Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 14 Feb 2020 10:04:40 +0000 Subject: [PATCH 46/98] Disable backtrace on CI --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d0990c3d..f1fdf8e8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,6 +18,7 @@ variables: CI_SERVER_NAME: "GitLab CI" REGISTRY: registry.parity.io/parity/infrastructure/scripts RUSTUP_TOOLCHAIN: nightly + RUST_LIB_BACKTRACE: 0 .collect-artifacts: &collect-artifacts artifacts: -- GitLab From 3a6738884d75412bdf72c7210d7756d3a89c26c1 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 14 Feb 2020 10:36:29 +0000 Subject: [PATCH 47/98] Make tests pass --- .gitlab-ci.yml | 1 - src/cmd/new.rs | 16 ++++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f1fdf8e8..d0990c3d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,6 @@ variables: CI_SERVER_NAME: "GitLab CI" REGISTRY: registry.parity.io/parity/infrastructure/scripts RUSTUP_TOOLCHAIN: nightly - RUST_LIB_BACKTRACE: 0 .collect-artifacts: &collect-artifacts artifacts: diff --git a/src/cmd/new.rs b/src/cmd/new.rs index 734b486e..4291ed50 100644 --- a/src/cmd/new.rs +++ b/src/cmd/new.rs @@ -116,10 +116,12 @@ mod tests { let name = "test_contract_cargo_project_already_exists"; let _ = execute_new(name, Some(path)); let result = execute_new(name, Some(path)); + + assert!(result.is_err(), "Should fail"); assert_eq!( - format!("{:?}", result), - r#"Err(A Cargo package already exists in test_contract_cargo_project_already_exists)"# - ) + result.err().unwrap().to_string(), + "A Cargo package already exists in test_contract_cargo_project_already_exists" + ); }); } @@ -131,10 +133,12 @@ mod tests { fs::create_dir_all(&dir).unwrap(); fs::File::create(dir.join(".gitignore")).unwrap(); let result = execute_new(name, Some(path)); + + assert!(result.is_err(), "Should fail"); assert_eq!( - format!("{:?}", result), - r#"Err(New contract file .gitignore already exists)"# - ) + result.err().unwrap().to_string(), + "New contract file .gitignore already exists" + ); }); } } -- GitLab From 4b689ff8d940c38c8987c2d87f973bef663992be Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 14 Feb 2020 10:37:26 +0000 Subject: [PATCH 48/98] Install rust-src --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d0990c3d..c7b3bb70 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,6 +39,7 @@ variables: # global RUSTFLAGS overrides the linker args so this way is better to pass the flags - printf '[build]\nrustflags = ["-C", "link-dead-code"]\n' | tee ${CARGO_HOME}/config - sccache -s + - rustup component add rust-src only: - master - /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 -- GitLab From 631ca91f138f822efb1a8a1fd5d323f7da6edcd1 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 14 Feb 2020 10:48:49 +0000 Subject: [PATCH 49/98] Disable backtrace to make tests pass --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c7b3bb70..119a5531 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,6 +18,7 @@ variables: CI_SERVER_NAME: "GitLab CI" REGISTRY: registry.parity.io/parity/infrastructure/scripts RUSTUP_TOOLCHAIN: nightly + RUST_LIB_BACKTRACE: 0 .collect-artifacts: &collect-artifacts artifacts: -- GitLab From c36bb60a282618c5a37c145881b4d76ef2ff6ded Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 14 Feb 2020 15:55:02 +0000 Subject: [PATCH 50/98] Move args closer to invocation --- src/cmd/build.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 482a6fdc..bf118cd3 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -93,12 +93,6 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()> { util::assert_channel()?; - let target = "wasm32-unknown-unknown"; - let build_args = [ - "--no-default-features", - "--release", - &format!("--target={}", target), - ]; let manifest = CargoToml::from_working_dir(crate_metadata.working_dir.as_ref())?; // check `cargo-xbuild` config section exists and has `panic_immediate_abort` enabled @@ -124,13 +118,18 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { // temporarily remove the 'rlib' crate-type to build wasm blob for optimal size manifest.with_removed_crate_type("rlib", || { + let target = "wasm32-unknown-unknown"; + let build_args = [ + "--no-default-features", + "--release", + &format!("--target={}", target), + "--verbose", + ]; let manifest_path = Some(manifest.manifest_path()); - let exit_status = xargo_lib::build( - xargo_lib::Args::new(&build_args, Some(target), manifest_path), - "build", - ) - .map_err(|e| anyhow::anyhow!("{}", e)) - .context("Building with xbuild")?; + let args = xargo_lib::Args::new(&build_args, Some(target), manifest_path); + let exit_status = xargo_lib::build(args, "build") + .map_err(|e| anyhow::anyhow!("{}", e)) + .context("Building with xbuild")?; log::debug!("xargo exit status: {:?}", exit_status); Ok(()) }) -- GitLab From d2e069370acc65f72fc12bc81a8676e8ffe24b24 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 17 Feb 2020 14:06:46 +0000 Subject: [PATCH 51/98] Create temporary Cargo.toml --- Cargo.toml | 2 +- src/cmd/build.rs | 57 ++++++------ src/cmd/metadata.rs | 29 +++--- src/main.rs | 2 +- src/manifest.rs | 210 -------------------------------------------- src/tmp_manifest.rs | 197 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 246 insertions(+), 251 deletions(-) delete mode 100644 src/manifest.rs create mode 100644 src/tmp_manifest.rs diff --git a/Cargo.toml b/Cargo.toml index 8f20fde8..25a3414e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ toml = "0.5.4" cargo-xbuild = "0.5.24" rustc_version = "0.2.3" serde_json = "1.0" +tempfile = "3.1.0" # dependencies for optional extrinsics feature async-std = { version = "1.5.0", optional = true } @@ -47,7 +48,6 @@ walkdir = "2.3.1" [dev-dependencies] assert_matches = "1.3.0" -tempfile = "3.1.0" wabt = "0.9.2" [features] diff --git a/src/cmd/build.rs b/src/cmd/build.rs index bf118cd3..984d3639 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -21,7 +21,7 @@ use std::{ process::Command, }; -use crate::{manifest::CargoToml, util}; +use crate::{tmp_manifest::TmpManifest, util}; use anyhow::{Context, Result}; use cargo_metadata::Package; use colored::Colorize; @@ -35,7 +35,7 @@ const MAX_MEMORY_PAGES: u32 = 16; #[derive(Debug)] pub struct CrateMetadata { working_dir: Option, - workspace_root: PathBuf, + cargo_meta: cargo_metadata::Metadata, package_name: String, root_package: Package, original_wasm: PathBuf, @@ -48,7 +48,8 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result) -> Result) -> Result) -> Result Result<()> { util::assert_channel()?; - let manifest = CargoToml::from_working_dir(crate_metadata.working_dir.as_ref())?; - // check `cargo-xbuild` config section exists and has `panic_immediate_abort` enabled let xbuild_metadata = crate_metadata.root_package.metadata.get("cargo-xbuild"); if let Some(xbuild_metadata) = xbuild_metadata { @@ -116,23 +116,30 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { ) } - // temporarily remove the 'rlib' crate-type to build wasm blob for optimal size - manifest.with_removed_crate_type("rlib", || { - let target = "wasm32-unknown-unknown"; - let build_args = [ - "--no-default-features", - "--release", - &format!("--target={}", target), - "--verbose", - ]; - let manifest_path = Some(manifest.manifest_path()); - let args = xargo_lib::Args::new(&build_args, Some(target), manifest_path); - let exit_status = xargo_lib::build(args, "build") - .map_err(|e| anyhow::anyhow!("{}", e)) - .context("Building with xbuild")?; - log::debug!("xargo exit status: {:?}", exit_status); - Ok(()) - }) + // remove the 'rlib' crate type in our temp manifest + let tmp_manifest = TmpManifest::from_working_dir(crate_metadata.working_dir.as_ref())? + .with_removed_crate_type("rlib")? + .write()?; + + // build xbuild args + let abs_target_dir = crate_metadata.cargo_meta.target_directory.canonicalize()?; + let target = "wasm32-unknown-unknown"; + let build_args = [ + "--no-default-features", + "--release", + &format!("--target={}", target), + &format!("--target-dir={}", abs_target_dir.to_string_lossy()), + "--verbose", + ]; + // point to our temporary manifest + let manifest_path = Some(tmp_manifest.path()); + let args = xargo_lib::Args::new(&build_args, Some(target), manifest_path); + + let exit_status = xargo_lib::build(args, "build") + .map_err(|e| anyhow::anyhow!("{}", e)) + .context("Building with xbuild")?; + log::debug!("xargo exit status: {:?}", exit_status); + Ok(()) } /// Ensures the wasm memory import of a given module has the maximum number of pages. diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index ef81b44e..f69ac8b7 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use crate::{manifest::CargoToml, util}; +use crate::{tmp_manifest::TmpManifest, util}; use anyhow::Result; use std::path::PathBuf; @@ -26,20 +26,21 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result println!(" Generating metadata"); let cargo_metadata = crate::util::get_cargo_metadata(dir)?; - let manifest = CargoToml::from_working_dir(dir)?; + // todo: use tmp manifest in invocation + let _tmp_manifest = TmpManifest::from_working_dir(dir)? + .with_added_crate_type("rlib")? + .write()?; - manifest.with_added_crate_type("rlib", || { - util::invoke_cargo( - "run", - &[ - "--package", - "abi-gen", - "--release", - // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! - ], - dir, - ) - })?; + util::invoke_cargo( + "run", + &[ + "--package", + "abi-gen", + "--release", + // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! + ], + dir, + )?; let mut out_path = cargo_metadata.target_directory; out_path.push("metadata.json"); diff --git a/src/main.rs b/src/main.rs index ec2486a8..a28b1843 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,7 +15,7 @@ // along with ink!. If not, see . mod cmd; -mod manifest; +mod tmp_manifest; mod util; #[cfg(feature = "extrinsics")] diff --git a/src/manifest.rs b/src/manifest.rs deleted file mode 100644 index 08fb8ea5..00000000 --- a/src/manifest.rs +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright 2018-2019 Parity Technologies (UK) Ltd. -// This file is part of ink!. -// -// ink! 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. -// -// ink! 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 ink!. If not, see . - -use anyhow::{Context, Result}; -use colored::Colorize; -use std::{ - fs, - io::{self, Write}, - path::{Path, PathBuf}, -}; -use toml::value; - -const MANIFEST_FILE: &str = "Cargo.toml"; - -/// Load and temporarily modify the manifest file (Cargo.toml). -pub struct CargoToml { - path: PathBuf, -} - -impl CargoToml { - /// Create new CargoToml for the given manifest path. - /// - /// The path *must* be to a `Cargo.toml`. - pub fn new(path: &PathBuf) -> Result { - if let Some(file_name) = path.file_name() { - if file_name != MANIFEST_FILE { - anyhow::bail!("Manifest file must be a Cargo.toml") - } - } - - Ok(CargoToml { path: path.clone() }) - } - - /// Create a new CargoToml from the given directory path. - /// - /// Passing `None` will assume the current directory so just `Cargo.toml` - pub fn from_working_dir(path: Option<&PathBuf>) -> Result { - let file_path = path.map_or(MANIFEST_FILE.into(), |d| d.join(MANIFEST_FILE)); - Self::new(&file_path) - } - - /// The path to the Cargo.toml - pub fn manifest_path(&self) -> &Path { - self.path.as_path() - } - - /// Amend the Cargo.toml and run the supplied function. - /// Makes a backup of the existing Cargo.toml which is restored once complete. - /// - /// # Note - /// - /// If the program terminates while in progress then the amended `Cargo.toml` will remain in - /// place. The user will be given the option to restore from the backup on the next run. - /// - /// # Arguments - /// - /// - `amend`: Accepts the mutable toml Table to modify, saving the result to the temporary - /// `Cargo.toml`. If the manifest does not need to modified, should return false. - /// - `f`: Function to be executed while the temporary amended `Cargo.toml` is in place. e.g. - /// running a `cargo` command which will pick up the manifest. - pub fn with_amended_manifest(&self, amend: A, f: F) -> Result<()> - where - A: FnOnce(&mut value::Table) -> Result, - F: FnOnce() -> Result<()>, - { - let mut backup_path = self.path.clone(); - backup_path.set_file_name(".Cargo.toml.bk"); - - cleanup_existing_backup(&backup_path, &self.path)?; - - let toml = fs::read_to_string(&self.path).context("Loading Cargo.toml")?; - let mut table: value::Table = toml::from_str(&toml)?; - - // run supplied amend function - let should_amend = amend(&mut table)?; - - if !should_amend { - log::debug!("amend function returned false, so update not required"); - // Now run the function without a modified Cargo.toml - return f(); - } - - fs::copy(&self.path, &backup_path).context("Creating a backup for Cargo.toml")?; - - let updated_toml = toml::to_string(&table)?; - fs::write(&self.path, updated_toml).context("Writing updated Cargo.toml")?; - - // Now run the function with a modified Cargo.toml in place - let result = f(); - - fs::rename(&backup_path, &self.path).context("Restoring the backup of Cargo.toml")?; - result - } - - /// Amend the `[lib] crate-types = []` section - fn with_amended_crate_types(&self, amend: A, f: F) -> Result<()> - where - A: FnOnce(&mut value::Array) -> bool, - F: FnOnce() -> Result<()>, - { - self.with_amended_manifest( - |toml| { - let lib = toml - .get_mut("lib") - .ok_or(anyhow::anyhow!("lib section not found"))?; - let crate_types = lib - .get_mut("crate-type") - .ok_or(anyhow::anyhow!("crate-type section not found"))?; - let crate_types = crate_types - .as_array_mut() - .ok_or(anyhow::anyhow!("crate-types should be an Array"))?; - - let should_amend = amend(crate_types); - Ok(should_amend) - }, - f, - ) - } - - /// Add an value to the `[lib] crate-types = []` section - /// - /// If the value already exists, does nothing. - pub fn with_added_crate_type(&self, crate_type: &str, f: F) -> Result<()> - where - F: FnOnce() -> Result<()>, - { - self.with_amended_crate_types( - |crate_types| { - if crate_type_exists(crate_type, crate_types) { - false - } else { - crate_types.push(crate_type.into()); - true - } - }, - f, - ) - } - - /// Remove a value from the `[lib] crate-types = []` section - /// - /// If the value does not exist, does nothing. - pub fn with_removed_crate_type(&self, crate_type: &str, f: F) -> Result<()> - where - F: FnOnce() -> Result<()>, - { - self.with_amended_crate_types( - |crate_types| { - if crate_type_exists(crate_type, crate_types) { - crate_types.retain(|v| v.as_str().map_or(true, |s| s != crate_type)); - true - } else { - false - } - }, - f, - ) - } -} - -/// Handle the case where a previous build was terminated leaving the modified Cargo.toml -/// and its backup in place. -/// -/// Asks the user whether to restore the backup. -fn cleanup_existing_backup(backup_path: &PathBuf, manifest_path: &PathBuf) -> Result<()> { - if backup_path.exists() { - print!( - "A backup of the original 'Cargo.toml' exists from a previous build which may have \ - terminated prematurely. The current 'Cargo.toml' is likely to be a temporary \ - modified copy created by this build process. Would you like to restore from the \ - backup and overwrite the current 'Cargo.toml'? {}", - "[Y/n]".bold() - ); - io::stdout().flush()?; - - let mut input = String::new(); - io::stdin().read_line(&mut input)?; - let input = input.trim(); - - match input.chars().nth(0) { - Some('n') | Some('N') => Ok(()), - _ => { - fs::rename(&backup_path, &manifest_path) - .context("Creating a backup for Cargo.toml")?; - Ok(()) - } - } - } else { - Ok(()) - } -} - -fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { - crate_types - .iter() - .any(|v| v.as_str().map_or(false, |s| s == crate_type)) -} diff --git a/src/tmp_manifest.rs b/src/tmp_manifest.rs new file mode 100644 index 00000000..4cc65871 --- /dev/null +++ b/src/tmp_manifest.rs @@ -0,0 +1,197 @@ +// Copyright 2018-2019 Parity Technologies (UK) Ltd. +// This file is part of ink!. +// +// ink! 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. +// +// ink! 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 ink!. If not, see . + +use anyhow::{Context, Result}; +use std::{ + fs, + marker::PhantomData, + path::{Path, PathBuf}, +}; +use toml::value; +use tempfile::TempDir; + +const MANIFEST_FILE: &str = "Cargo.toml"; + +/// Create an amended copy of `Cargo.toml` in a temporary directory. +/// +/// Relative paths are rewritten to absolute paths. +pub struct TmpManifest { + path: PathBuf, + toml: value::Table, + tmp_path: PathBuf, + marker: PhantomData S>, +} + +/// The temp manifest has not been written and can be amended +pub enum Preparing {} +/// The temp manifest has already been written and can no longer be amended +pub enum Committed {} + +impl TmpManifest { + /// Create new CargoToml for the given manifest path. + /// + /// The path *must* be to a `Cargo.toml`. + pub fn new(path: &PathBuf) -> Result { + if let Some(file_name) = path.file_name() { + if file_name != MANIFEST_FILE { + anyhow::bail!("Manifest file must be a Cargo.toml") + } + } + + let toml = fs::read_to_string(&path).context("Loading Cargo.toml")?; + let toml: value::Table = toml::from_str(&toml)?; + + let tmp_dir = TempDir::new()?; + let tmp_path = tmp_dir.path().join(MANIFEST_FILE); + + Ok(TmpManifest { path: path.clone(), toml, tmp_path, marker: Default::default() }) + } + + /// Create a new CargoToml from the given directory path. + /// + /// Passing `None` will assume the current directory so just `Cargo.toml` + pub fn from_working_dir(path: Option<&PathBuf>) -> Result { + let file_path = path.map_or(MANIFEST_FILE.into(), |d| d.join(MANIFEST_FILE)); + Self::new(&file_path) + } +} + +impl TmpManifest { + /// Get mutable reference to `[lib] crate-types = []` section + fn get_crate_types_mut(&mut self) -> Result<&mut value::Array> { + let lib = self.toml + .get_mut("lib") + .ok_or(anyhow::anyhow!("lib section not found"))?; + let crate_types = lib + .get_mut("crate-type") + .ok_or(anyhow::anyhow!("crate-type section not found"))?; + + crate_types + .as_array_mut() + .ok_or(anyhow::anyhow!("crate-types should be an Array")) + } + + /// Add a value to the `[lib] crate-types = []` section. + /// + /// If the value already exists, does nothing. + pub fn with_added_crate_type(&mut self, crate_type: &str) -> Result<&mut Self> { + let crate_types = self.get_crate_types_mut()?; + if !crate_type_exists(crate_type, crate_types) { + crate_types.push(crate_type.into()); + } + Ok(self) + } + + /// Remove a value from the `[lib] crate-types = []` section + /// + /// If the value does not exist, does nothing. + pub fn with_removed_crate_type(&mut self, crate_type: &str) -> Result<&mut Self> { + let crate_types = self.get_crate_types_mut()?; + if crate_type_exists(crate_type, crate_types) { + crate_types.retain(|v| v.as_str().map_or(true, |s| s != crate_type)); + } + Ok(self) + } + + fn rewrite_relative_paths(&mut self) -> Result<()> { + let abs_path = self.path.canonicalize()?; + let abs_dir = abs_path.parent() + .expect("The manifest path is a file path so has a parent; qed"); + + // Rewrite `[lib] path =` value to an absolute path. + // Defaults to src/lib.rs if not specified + let lib = self.toml + .get_mut("lib") + .ok_or(anyhow::anyhow!("lib section not found"))?; + + match lib.get_mut("path") { + Some(existing_path) => { + let path_str = existing_path.as_str() + .ok_or(anyhow::anyhow!("[lib]/path should be a string"))?; + let path = PathBuf::from(path_str); + if path.is_relative() { + let lib_abs = abs_dir.join(path); + log::debug!("Rewriting lib/path to '{}'", lib_abs.display()); + *existing_path = value::Value::String(lib_abs.to_string_lossy().into()) + } + } + None => { + let lib_table = lib + .as_table_mut() + .ok_or(anyhow::anyhow!("lib section should be a table"))?; + let inferred_lib_path = abs_dir.join("src").join("lib.rs"); + if !inferred_lib_path.exists() { + anyhow::bail!( + "No `[lib] path =` specified, and the default `src/lib.rs` was not found" + ) + } + let path = inferred_lib_path.to_string_lossy(); + log::debug!("Adding inferred path '{}'", path); + lib_table.insert("path".into(), value::Value::String(path.into())); + } + } + + // Rewrite any dependency relative paths + if let Some(dependencies) = lib.get_mut("dependencies") { + let table = dependencies.as_table_mut() + .ok_or(anyhow::anyhow!("dependencies should be a table"))?; + for (name, value) in table { + if let Some(dependency) = value.as_table_mut() { + if let Some(dep_path) = dependency.get_mut("path") { + let path_str = dep_path.as_str() + .ok_or(anyhow::anyhow!("dependency path should be a string"))?; + let path = PathBuf::from(path_str); + if path.is_relative() { + let dep_abs = abs_dir.join(path); + log::debug!("Rewriting dependency {} to '{}'", name, dep_abs.display()); + *dep_path = value::Value::String(dep_abs.to_string_lossy().into()) + } + } + } + } + } + + Ok(()) + } + + /// Writes the amended manifest to the temporary directory. + /// + /// Before saving relative paths are rewritten to absolute paths. + pub fn write(&mut self) -> Result> { + self.rewrite_relative_paths()?; + + let updated_toml = toml::to_string(&self.toml)?; + fs::write(&self.tmp_path, updated_toml) + .context(format!("Writing updated Cargo.toml to {}", self.tmp_path.display()))?; + Ok(TmpManifest { + path: self.path.clone(), + toml: self.toml.clone(), + tmp_path: self.tmp_path.clone(), + marker: Default::default() + }) + } +} + +impl TmpManifest { + /// The path to the temporary Cargo.toml + pub fn path(&self) -> &Path { self.tmp_path.as_path() } +} + +fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { + crate_types + .iter() + .any(|v| v.as_str().map_or(false, |s| s == crate_type)) +} -- GitLab From 67ee4c7f7d4e9cd1260ec95270ac91fa6ed3f6e0 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 17 Feb 2020 17:14:26 +0000 Subject: [PATCH 52/98] Rework temp manifest api --- src/cmd/build.rs | 52 +++++++++++---------- src/cmd/metadata.rs | 32 +++++++------ src/main.rs | 2 +- src/{tmp_manifest.rs => manifest.rs} | 68 ++++++++++++---------------- 4 files changed, 76 insertions(+), 78 deletions(-) rename src/{tmp_manifest.rs => manifest.rs} (80%) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 984d3639..56e3a565 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -21,7 +21,7 @@ use std::{ process::Command, }; -use crate::{tmp_manifest::TmpManifest, util}; +use crate::{manifest::Manifest, util}; use anyhow::{Context, Result}; use cargo_metadata::Package; use colored::Colorize; @@ -116,29 +116,35 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { ) } - // remove the 'rlib' crate type in our temp manifest - let tmp_manifest = TmpManifest::from_working_dir(crate_metadata.working_dir.as_ref())? + let mut manifest = Manifest::from_working_dir(crate_metadata.working_dir.as_ref())?; + + // remove the 'rlib' crate type in a temp manifest + manifest .with_removed_crate_type("rlib")? - .write()?; - - // build xbuild args - let abs_target_dir = crate_metadata.cargo_meta.target_directory.canonicalize()?; - let target = "wasm32-unknown-unknown"; - let build_args = [ - "--no-default-features", - "--release", - &format!("--target={}", target), - &format!("--target-dir={}", abs_target_dir.to_string_lossy()), - "--verbose", - ]; - // point to our temporary manifest - let manifest_path = Some(tmp_manifest.path()); - let args = xargo_lib::Args::new(&build_args, Some(target), manifest_path); - - let exit_status = xargo_lib::build(args, "build") - .map_err(|e| anyhow::anyhow!("{}", e)) - .context("Building with xbuild")?; - log::debug!("xargo exit status: {:?}", exit_status); + .rewrite_relative_paths()?; + + manifest.using_temp(|tmp_manifest_path| { + // build xbuild args + let abs_target_dir = crate_metadata.cargo_meta.target_directory.canonicalize()?; + let target = "wasm32-unknown-unknown"; + let build_args = [ + "--no-default-features", + "--release", + &format!("--target={}", target), + &format!("--target-dir={}", abs_target_dir.to_string_lossy()), + "--verbose", + ]; + // point to our temporary manifest + let manifest_path = Some(tmp_manifest_path); + let args = xargo_lib::Args::new(&build_args, Some(target), manifest_path); + + let exit_status = xargo_lib::build(args, "build") + .map_err(|e| anyhow::anyhow!("{}", e)) + .context("Building with xbuild")?; + log::debug!("xargo exit status: {:?}", exit_status); + Ok(()) + })?; + Ok(()) } diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index f69ac8b7..ebbe76b9 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use crate::{tmp_manifest::TmpManifest, util}; +use crate::{manifest::Manifest, util}; use anyhow::Result; use std::path::PathBuf; @@ -26,21 +26,23 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result println!(" Generating metadata"); let cargo_metadata = crate::util::get_cargo_metadata(dir)?; - // todo: use tmp manifest in invocation - let _tmp_manifest = TmpManifest::from_working_dir(dir)? - .with_added_crate_type("rlib")? - .write()?; - util::invoke_cargo( - "run", - &[ - "--package", - "abi-gen", - "--release", - // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! - ], - dir, - )?; + Manifest::from_working_dir(dir)? + .with_added_crate_type("rlib")? + .rewrite_relative_paths()? + .using_temp(|tmp_manifest_path| { + // todo: use tmp manifest in invocation + util::invoke_cargo( + "run", + &[ + "--package", + "abi-gen", + "--release", + // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! + ], + dir, + ) + })?; let mut out_path = cargo_metadata.target_directory; out_path.push("metadata.json"); diff --git a/src/main.rs b/src/main.rs index a28b1843..ec2486a8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,7 +15,7 @@ // along with ink!. If not, see . mod cmd; -mod tmp_manifest; +mod manifest; mod util; #[cfg(feature = "extrinsics")] diff --git a/src/tmp_manifest.rs b/src/manifest.rs similarity index 80% rename from src/tmp_manifest.rs rename to src/manifest.rs index 4cc65871..2c0ee299 100644 --- a/src/tmp_manifest.rs +++ b/src/manifest.rs @@ -17,7 +17,6 @@ use anyhow::{Context, Result}; use std::{ fs, - marker::PhantomData, path::{Path, PathBuf}, }; use toml::value; @@ -25,26 +24,19 @@ use tempfile::TempDir; const MANIFEST_FILE: &str = "Cargo.toml"; -/// Create an amended copy of `Cargo.toml` in a temporary directory. +/// Create an amended copy of `Cargo.toml`. /// /// Relative paths are rewritten to absolute paths. -pub struct TmpManifest { +pub struct Manifest { path: PathBuf, toml: value::Table, - tmp_path: PathBuf, - marker: PhantomData S>, } -/// The temp manifest has not been written and can be amended -pub enum Preparing {} -/// The temp manifest has already been written and can no longer be amended -pub enum Committed {} - -impl TmpManifest { +impl Manifest { /// Create new CargoToml for the given manifest path. /// /// The path *must* be to a `Cargo.toml`. - pub fn new(path: &PathBuf) -> Result { + pub fn new(path: &PathBuf) -> Result { if let Some(file_name) = path.file_name() { if file_name != MANIFEST_FILE { anyhow::bail!("Manifest file must be a Cargo.toml") @@ -54,22 +46,17 @@ impl TmpManifest { let toml = fs::read_to_string(&path).context("Loading Cargo.toml")?; let toml: value::Table = toml::from_str(&toml)?; - let tmp_dir = TempDir::new()?; - let tmp_path = tmp_dir.path().join(MANIFEST_FILE); - - Ok(TmpManifest { path: path.clone(), toml, tmp_path, marker: Default::default() }) + Ok(Manifest { path: path.clone(), toml }) } /// Create a new CargoToml from the given directory path. /// /// Passing `None` will assume the current directory so just `Cargo.toml` - pub fn from_working_dir(path: Option<&PathBuf>) -> Result { - let file_path = path.map_or(MANIFEST_FILE.into(), |d| d.join(MANIFEST_FILE)); + pub fn from_working_dir>(path: Option

) -> Result { + let file_path = path.map_or(MANIFEST_FILE.into(), |d| d.as_ref().join(MANIFEST_FILE)); Self::new(&file_path) } -} -impl TmpManifest { /// Get mutable reference to `[lib] crate-types = []` section fn get_crate_types_mut(&mut self) -> Result<&mut value::Array> { let lib = self.toml @@ -106,7 +93,7 @@ impl TmpManifest { Ok(self) } - fn rewrite_relative_paths(&mut self) -> Result<()> { + pub fn rewrite_relative_paths(&mut self) -> Result<&mut Self> { let abs_path = self.path.canonicalize()?; let abs_dir = abs_path.parent() .expect("The manifest path is a file path so has a parent; qed"); @@ -164,30 +151,33 @@ impl TmpManifest { } } - Ok(()) + Ok(self) } - /// Writes the amended manifest to the temporary directory. - /// - /// Before saving relative paths are rewritten to absolute paths. - pub fn write(&mut self) -> Result> { - self.rewrite_relative_paths()?; + /// Writes the amended manifest to the given directory. + pub fn write>(&self, path: P) -> Result { + let dir = path.as_ref(); + if !dir.is_dir() { + anyhow::bail!("{} should be a directory", dir.display()) + } + let manifest_path = dir.join(MANIFEST_FILE); let updated_toml = toml::to_string(&self.toml)?; - fs::write(&self.tmp_path, updated_toml) - .context(format!("Writing updated Cargo.toml to {}", self.tmp_path.display()))?; - Ok(TmpManifest { - path: self.path.clone(), - toml: self.toml.clone(), - tmp_path: self.tmp_path.clone(), - marker: Default::default() - }) + fs::write(&manifest_path, updated_toml) + .context(format!("Writing updated Cargo.toml to {}", manifest_path.display()))?; + Ok(manifest_path) } -} -impl TmpManifest { - /// The path to the temporary Cargo.toml - pub fn path(&self) -> &Path { self.tmp_path.as_path() } + /// Create the amended manifest in a temporary directory, executing the supplied function + /// before the temporary file is cleaned up. + pub fn using_temp(&self, f: F) -> Result<()> + where + F: FnOnce(&Path) -> Result<()>, + { + let tmp_dir = TempDir::new()?; + let path = self.write(&tmp_dir)?; + f(path.as_path()) + } } fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { -- GitLab From fb7520763e0d73ef75936e4bf909fb31137f474b Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 17 Feb 2020 17:28:57 +0000 Subject: [PATCH 53/98] Target dir is already absolute --- src/cmd/build.rs | 12 ++++++++---- src/manifest.rs | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 56e3a565..716eff6d 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -17,7 +17,7 @@ use std::{ fs::metadata, io::{self, Write}, - path::PathBuf, + path::{PathBuf, Path}, process::Command, }; @@ -42,6 +42,12 @@ pub struct CrateMetadata { pub dest_wasm: PathBuf, } +impl CrateMetadata { + pub fn target_dir(&self) -> &Path { + self.cargo_meta.target_directory.as_path() + } +} + /// Parses the contract manifest and returns relevant metadata. pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result { let metadata = crate::util::get_cargo_metadata(working_dir)?; @@ -84,7 +90,6 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()> { manifest.using_temp(|tmp_manifest_path| { // build xbuild args - let abs_target_dir = crate_metadata.cargo_meta.target_directory.canonicalize()?; let target = "wasm32-unknown-unknown"; let build_args = [ "--no-default-features", "--release", &format!("--target={}", target), - &format!("--target-dir={}", abs_target_dir.to_string_lossy()), + &format!("--target-dir={}", crate_metadata.target_dir().to_string_lossy()), "--verbose", ]; // point to our temporary manifest diff --git a/src/manifest.rs b/src/manifest.rs index 2c0ee299..c9617175 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -176,6 +176,7 @@ impl Manifest { { let tmp_dir = TempDir::new()?; let path = self.write(&tmp_dir)?; + log::debug!("Using temp manifest '{}'", path.display()); f(path.as_path()) } } -- GitLab From 2acc79d4a8b5bfdb01f62976a3d7d4369bc344d2 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 18 Feb 2020 10:54:50 +0000 Subject: [PATCH 54/98] temp dir prefix --- src/manifest.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/manifest.rs b/src/manifest.rs index c9617175..67a4bb29 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -20,7 +20,6 @@ use std::{ path::{Path, PathBuf}, }; use toml::value; -use tempfile::TempDir; const MANIFEST_FILE: &str = "Cargo.toml"; @@ -174,7 +173,7 @@ impl Manifest { where F: FnOnce(&Path) -> Result<()>, { - let tmp_dir = TempDir::new()?; + let tmp_dir = tempfile::Builder::new().prefix(".cargo-contract_").tempdir()?; let path = self.write(&tmp_dir)?; log::debug!("Using temp manifest '{}'", path.display()); f(path.as_path()) -- GitLab From afe99ab22fbeb76b4dfa8478c825f86151354d9b Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 18 Feb 2020 14:59:22 +0000 Subject: [PATCH 55/98] xbuild config with sysroot path and explicit args --- src/cmd/build.rs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 716eff6d..a0ec4757 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -129,20 +129,27 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { .rewrite_relative_paths()?; manifest.using_temp(|tmp_manifest_path| { - // build xbuild args - let target = "wasm32-unknown-unknown"; - let build_args = [ + // point to our temporary manifest + let manifest_path = Some(tmp_manifest_path); + let target = Some("wasm32-unknown-unknown"); + let verbosity = Some(xargo_lib::Verbosity::Verbose); + let target_dir = crate_metadata.target_dir(); + let other_args = [ "--no-default-features", "--release", - &format!("--target={}", target), - &format!("--target-dir={}", crate_metadata.target_dir().to_string_lossy()), - "--verbose", + &format!("--target-dir={}", target_dir.to_string_lossy()), ]; - // point to our temporary manifest - let manifest_path = Some(tmp_manifest_path); - let args = xargo_lib::Args::new(&build_args, Some(target), manifest_path); + let args = xargo_lib::Args::new(target, manifest_path, verbosity, &other_args) + .map_err(|e| anyhow::anyhow!("{}", e)) + .context("Creating xargo args")?; + + let config = xargo_lib::Config { + sysroot_path: target_dir.join("sysroot"), + memcpy: false, + panic_immediate_abort: true, + }; - let exit_status = xargo_lib::build(args, "build") + let exit_status = xargo_lib::build(args, "build", Some(config)) .map_err(|e| anyhow::anyhow!("{}", e)) .context("Building with xbuild")?; log::debug!("xargo exit status: {:?}", exit_status); -- GitLab From 4bc56fc970008ea502f4673c713e357396fe6689 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 18 Feb 2020 15:32:28 +0000 Subject: [PATCH 56/98] Use custom xbuild branch --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b0f4041..e7a48ff3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -268,7 +268,7 @@ dependencies = [ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "async-std 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo-xbuild 0.5.24 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo-xbuild 0.5.25 (git+https://github.com/ascjones/cargo-xbuild?branch=build-args)", "cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "colored 1.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -295,8 +295,8 @@ dependencies = [ [[package]] name = "cargo-xbuild" -version = "0.5.24" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.5.25" +source = "git+https://github.com/ascjones/cargo-xbuild?branch=build-args#5371a8edbaeab04d581b30f54ba24c52bb4ad006" dependencies = [ "cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3190,7 +3190,7 @@ dependencies = [ "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" "checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" -"checksum cargo-xbuild 0.5.24 (registry+https://github.com/rust-lang/crates.io-index)" = "67914307b10adada78b82bc9978315221806e0f23c66e014560a2e7299c0ecc2" +"checksum cargo-xbuild 0.5.25 (git+https://github.com/ascjones/cargo-xbuild?branch=build-args)" = "" "checksum cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "46e3374c604fb39d1a2f35ed5e4a4e30e60d01fab49446e08f1b3e9a90aef202" "checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" diff --git a/Cargo.toml b/Cargo.toml index 25a3414e..4295fdf2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ codec = { package = "parity-scale-codec", version = "1.1" } which = "3.1.0" colored = "1.9" toml = "0.5.4" -cargo-xbuild = "0.5.24" +cargo-xbuild = { git = "https://github.com/ascjones/cargo-xbuild", branch = "build-args" } rustc_version = "0.2.3" serde_json = "1.0" tempfile = "3.1.0" -- GitLab From 407a548a3fe3187811dadcf51c127bec6b537598 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 18 Feb 2020 15:35:05 +0000 Subject: [PATCH 57/98] Remove check for xbuild config --- README.md | 13 ------------- src/cmd/build.rs | 21 --------------------- template/Cargo.toml | 6 ------ 3 files changed, 40 deletions(-) diff --git a/README.md b/README.md index 906afc98..68934523 100644 --- a/README.md +++ b/README.md @@ -42,19 +42,6 @@ SUBCOMMANDS: To avoid having to add `+nightly` you can also create a `rust-toolchain` file in your local directory containing `nightly`. Read more about how to [specify the rustup toolchain](https://github.com/rust-lang/rustup#override-precedence). -## Contract build config - -Building the contract uses `cargo-xbuild` under the hood for optimum Wasm binary size. This requires the following -configuration section to be added to your contract's `Cargo.toml`: - -``` -[package.metadata.cargo-xbuild] -panic_immediate_abort = true -``` - -This will perform a custom build of Rust's `libcore` [without panic strings and formatting code](https://github.com/johnthagen/min-sized-rust#remove-panic-string-formatting-with-panic_immediate_abort), which significantly -reduces the final binary size. - ## Features The `deploy` and `instantiate` subcommands are **disabled by default**, since they are not fully stable yet and increase the build time. diff --git a/src/cmd/build.rs b/src/cmd/build.rs index a0ec4757..50209301 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -100,27 +100,6 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()> { util::assert_channel()?; - // check `cargo-xbuild` config section exists and has `panic_immediate_abort` enabled - let xbuild_metadata = crate_metadata.root_package.metadata.get("cargo-xbuild"); - if let Some(xbuild_metadata) = xbuild_metadata { - let panic_immediate_abort_enabled = xbuild_metadata - .get("panic_immediate_abort") - .map_or(false, |v| *v == Value::Bool(true)); - if !panic_immediate_abort_enabled { - anyhow::bail!( - "For optimal binary size please set `panic_immediate_abort = true` in the \ - `[package.metadata.cargo-xbuild]` section of `Cargo.toml`. \ - See https://github.com/paritytech/cargo-contract#contract-build-config" - ) - } - } else { - anyhow::bail!( - "For optimal binary size please add a `[package.metadata.cargo-xbuild]` section to \ - `Cargo.toml` with `panic_immediate_abort = true` \ - See https://github.com/paritytech/cargo-contract#contract-build-config" - ) - } - let mut manifest = Manifest::from_working_dir(crate_metadata.working_dir.as_ref())?; // remove the 'rlib' crate type in a temp manifest diff --git a/template/Cargo.toml b/template/Cargo.toml index 0b156c4a..8fe3cd7a 100644 --- a/template/Cargo.toml +++ b/template/Cargo.toml @@ -59,9 +59,3 @@ members = [ exclude = [ ".ink" ] - -# Configuration for `cargo-xbuild`, used by [`cargo-contract`](https://github.com/paritytech/cargo-contract) -[package.metadata.cargo-xbuild] -# Prevents panic strings and formatting code from `core` being included in final binary -# See https://github.com/paritytech/cargo-contract#contract-build-config -panic_immediate_abort = true -- GitLab From dc0351f9a934513adf6f26adf1f08146f6b32dd3 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 18 Feb 2020 16:50:21 +0000 Subject: [PATCH 58/98] Rewrite relatives paths when using temp file --- src/cmd/build.rs | 17 +++++++--------- src/cmd/metadata.rs | 1 - src/manifest.rs | 49 +++++++++++++++++++++++++++------------------ 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 50209301..ba56bee0 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -26,7 +26,6 @@ use anyhow::{Context, Result}; use cargo_metadata::Package; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; -use serde_json::Value; /// This is the maximum number of pages available for a contract to allocate. const MAX_MEMORY_PAGES: u32 = 16; @@ -100,14 +99,7 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()> { util::assert_channel()?; - let mut manifest = Manifest::from_working_dir(crate_metadata.working_dir.as_ref())?; - - // remove the 'rlib' crate type in a temp manifest - manifest - .with_removed_crate_type("rlib")? - .rewrite_relative_paths()?; - - manifest.using_temp(|tmp_manifest_path| { + let xbuild = |tmp_manifest_path: &Path| { // point to our temporary manifest let manifest_path = Some(tmp_manifest_path); let target = Some("wasm32-unknown-unknown"); @@ -133,7 +125,12 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { .context("Building with xbuild")?; log::debug!("xargo exit status: {:?}", exit_status); Ok(()) - })?; + }; + + // remove the 'rlib' crate type in a temp manifest + Manifest::from_working_dir(crate_metadata.working_dir.as_ref())? + .with_removed_crate_type("rlib")? + .using_temp(xbuild)?; Ok(()) } diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index ebbe76b9..f60d203f 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -29,7 +29,6 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result Manifest::from_working_dir(dir)? .with_added_crate_type("rlib")? - .rewrite_relative_paths()? .using_temp(|tmp_manifest_path| { // todo: use tmp manifest in invocation util::invoke_cargo( diff --git a/src/manifest.rs b/src/manifest.rs index 67a4bb29..c4983e1a 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -92,7 +92,17 @@ impl Manifest { Ok(self) } - pub fn rewrite_relative_paths(&mut self) -> Result<&mut Self> { + /// Replace relative paths with absolute paths with the working directory. + /// + /// Enables the use of a temporary amended copy of the manifest. + /// + /// # Rewrites + /// + /// - `[lib]/path` + /// - `[lib]/dependencies` + /// - `[workspace]/members` + /// - `[workspace]/exclude` + fn rewrite_relative_paths(&mut self) -> Result<&mut Self> { let abs_path = self.path.canonicalize()?; let abs_dir = abs_path.parent() .expect("The manifest path is a file path so has a parent; qed"); @@ -103,17 +113,20 @@ impl Manifest { .get_mut("lib") .ok_or(anyhow::anyhow!("lib section not found"))?; - match lib.get_mut("path") { - Some(existing_path) => { - let path_str = existing_path.as_str() - .ok_or(anyhow::anyhow!("[lib]/path should be a string"))?; - let path = PathBuf::from(path_str); - if path.is_relative() { - let lib_abs = abs_dir.join(path); - log::debug!("Rewriting lib/path to '{}'", lib_abs.display()); - *existing_path = value::Value::String(lib_abs.to_string_lossy().into()) - } + let to_absolute = |value_id: String, existing_path: &mut value::Value| -> Result<()> { + let path_str = existing_path.as_str() + .ok_or(anyhow::anyhow!("{} should be a string", value_id))?; + let path = PathBuf::from(path_str); + if path.is_relative() { + let lib_abs = abs_dir.join(path); + log::debug!("Rewriting {} to '{}'", value_id, lib_abs.display()); + *existing_path = value::Value::String(lib_abs.to_string_lossy().into()) } + Ok(()) + }; + + match lib.get_mut("path") { + Some(existing_path) => to_absolute("lib/path".into(), existing_path)?, None => { let lib_table = lib .as_table_mut() @@ -137,14 +150,7 @@ impl Manifest { for (name, value) in table { if let Some(dependency) = value.as_table_mut() { if let Some(dep_path) = dependency.get_mut("path") { - let path_str = dep_path.as_str() - .ok_or(anyhow::anyhow!("dependency path should be a string"))?; - let path = PathBuf::from(path_str); - if path.is_relative() { - let dep_abs = abs_dir.join(path); - log::debug!("Rewriting dependency {} to '{}'", name, dep_abs.display()); - *dep_path = value::Value::String(dep_abs.to_string_lossy().into()) - } + to_absolute(format!("dependency {}", name), dep_path)?; } } } @@ -169,13 +175,16 @@ impl Manifest { /// Create the amended manifest in a temporary directory, executing the supplied function /// before the temporary file is cleaned up. - pub fn using_temp(&self, f: F) -> Result<()> + pub fn using_temp(&mut self, f: F) -> Result<()> where F: FnOnce(&Path) -> Result<()>, { + self.rewrite_relative_paths()?; + let tmp_dir = tempfile::Builder::new().prefix(".cargo-contract_").tempdir()?; let path = self.write(&tmp_dir)?; log::debug!("Using temp manifest '{}'", path.display()); + f(path.as_path()) } } -- GitLab From 2fd59a6c5ebb85695105056c8c9a24cdc4acdd35 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 18 Feb 2020 17:02:41 +0000 Subject: [PATCH 59/98] Fix dependency path rewrite --- src/manifest.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/manifest.rs b/src/manifest.rs index c4983e1a..e2cd388a 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -99,9 +99,7 @@ impl Manifest { /// # Rewrites /// /// - `[lib]/path` - /// - `[lib]/dependencies` - /// - `[workspace]/members` - /// - `[workspace]/exclude` + /// - `[dependencies]` fn rewrite_relative_paths(&mut self) -> Result<&mut Self> { let abs_path = self.path.canonicalize()?; let abs_dir = abs_path.parent() @@ -144,7 +142,7 @@ impl Manifest { } // Rewrite any dependency relative paths - if let Some(dependencies) = lib.get_mut("dependencies") { + if let Some(dependencies) = self.toml.get_mut("dependencies") { let table = dependencies.as_table_mut() .ok_or(anyhow::anyhow!("dependencies should be a table"))?; for (name, value) in table { -- GitLab From afa76ab7548274e28881573d2b2231166f410af1 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 19 Feb 2020 10:47:35 +0000 Subject: [PATCH 60/98] Update cargo-xbuild --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e7a48ff3..b8327f1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -268,7 +268,7 @@ dependencies = [ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "async-std 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo-xbuild 0.5.25 (git+https://github.com/ascjones/cargo-xbuild?branch=build-args)", + "cargo-xbuild 0.5.26 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "colored 1.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -295,8 +295,8 @@ dependencies = [ [[package]] name = "cargo-xbuild" -version = "0.5.25" -source = "git+https://github.com/ascjones/cargo-xbuild?branch=build-args#5371a8edbaeab04d581b30f54ba24c52bb4ad006" +version = "0.5.26" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3190,7 +3190,7 @@ dependencies = [ "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" "checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" -"checksum cargo-xbuild 0.5.25 (git+https://github.com/ascjones/cargo-xbuild?branch=build-args)" = "" +"checksum cargo-xbuild 0.5.26 (registry+https://github.com/rust-lang/crates.io-index)" = "cbc751c3ab120b385e0e0e6ea8d75709d4ef867c47481960ea5e01eafe93a718" "checksum cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "46e3374c604fb39d1a2f35ed5e4a4e30e60d01fab49446e08f1b3e9a90aef202" "checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" diff --git a/Cargo.toml b/Cargo.toml index 4295fdf2..babbf155 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ codec = { package = "parity-scale-codec", version = "1.1" } which = "3.1.0" colored = "1.9" toml = "0.5.4" -cargo-xbuild = { git = "https://github.com/ascjones/cargo-xbuild", branch = "build-args" } +cargo-xbuild = "0.5.26" rustc_version = "0.2.3" serde_json = "1.0" tempfile = "3.1.0" -- GitLab From 90e75645b2a4fbf8ed895cbaa6b8dee5e8322bf1 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 19 Feb 2020 13:13:08 +0000 Subject: [PATCH 61/98] workspaces: parse workspace member manifests --- Cargo.toml | 4 ++-- src/cmd/build.rs | 2 +- src/cmd/metadata.rs | 2 +- src/manifest.rs | 55 +++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 55 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index babbf155..9fcd70a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,13 +32,13 @@ cargo-xbuild = "0.5.26" rustc_version = "0.2.3" serde_json = "1.0" tempfile = "3.1.0" +url = "2.1.1" # dependencies for optional extrinsics feature async-std = { version = "1.5.0", optional = true } sp-core = { git = "https://github.com/paritytech/substrate/", package = "sp-core", optional = true } subxt = { git = "https://github.com/paritytech/substrate-subxt/", rev = "399ac68cb1547ba4879e389c28d72aa7a2bae139", package = "substrate-subxt", optional = true } futures = { version = "0.3.2", optional = true } -url = { version = "2.1.1", optional = true } hex = { version = "0.4.0", optional = true } [build-dependencies] @@ -52,5 +52,5 @@ wabt = "0.9.2" [features] default = [] -extrinsics = ["sp-core", "subxt", "async-std", "futures", "url", "hex"] +extrinsics = ["sp-core", "subxt", "async-std", "futures", "hex"] test-ci-only = [] diff --git a/src/cmd/build.rs b/src/cmd/build.rs index ba56bee0..1aeb8b0b 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -128,7 +128,7 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { }; // remove the 'rlib' crate type in a temp manifest - Manifest::from_working_dir(crate_metadata.working_dir.as_ref())? + Manifest::from_dir(crate_metadata.working_dir.as_ref())? .with_removed_crate_type("rlib")? .using_temp(xbuild)?; diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index f60d203f..275e80d4 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -27,7 +27,7 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result let cargo_metadata = crate::util::get_cargo_metadata(dir)?; - Manifest::from_working_dir(dir)? + Manifest::from_dir(dir)? .with_added_crate_type("rlib")? .using_temp(|tmp_manifest_path| { // todo: use tmp manifest in invocation diff --git a/src/manifest.rs b/src/manifest.rs index e2cd388a..192206bf 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -15,7 +15,12 @@ // along with ink!. If not, see . use anyhow::{Context, Result}; +use cargo_metadata::{ + Metadata as CargoMetadata, + PackageId, +}; use std::{ + collections::HashMap, fs, path::{Path, PathBuf}, }; @@ -48,12 +53,19 @@ impl Manifest { Ok(Manifest { path: path.clone(), toml }) } - /// Create a new CargoToml from the given directory path. + /// Create a new Manifest from the given directory path. /// /// Passing `None` will assume the current directory so just `Cargo.toml` - pub fn from_working_dir>(path: Option

) -> Result { - let file_path = path.map_or(MANIFEST_FILE.into(), |d| d.as_ref().join(MANIFEST_FILE)); - Self::new(&file_path) + pub fn from_dir>(path: Option

) -> Result { + if let Some(path) = path { + let path = path.as_ref(); + if !path.is_dir() { + anyhow::bail!("{} is not a directory", path.display()) + } + Self::new(&path.join(MANIFEST_FILE)) + } else { + Self::new(&PathBuf::from(MANIFEST_FILE)) + } } /// Get mutable reference to `[lib] crate-types = []` section @@ -192,3 +204,38 @@ fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { .iter() .any(|v| v.as_str().map_or(false, |s| s == crate_type)) } + +struct Workspace { + root: Manifest, + members: HashMap, +} + +impl Workspace { + pub fn new(metadata: CargoMetadata) -> Result { + let member_manifest = |package_id: &PackageId| -> Result<(PathBuf, Manifest)> { + // package id e.g. "abi-gen 0.1.0 (path+file:///home/code/test/.ink/abi_gen)" + let open_bracket = package_id.repr.find('(') + .ok_or(anyhow::anyhow!("Package id should contain opening bracket for url"))?; + let close_bracket = package_id.repr.find(')') + .ok_or(anyhow::anyhow!("Package id should contain closing bracket for url"))?; + let raw_url = &package_id.repr[open_bracket..close_bracket]; + let url = url::Url::parse(raw_url)?; + if url.scheme() != "path+file" { + anyhow::bail!("Workspace member package should be a file path") + } + let path = PathBuf::from(url.path()); + let manifest = Manifest::from_dir(Some(&path))?; + Ok((path, manifest)) + }; + + let root = Manifest::from_dir(Some(metadata.workspace_root))?; + let members = metadata.workspace_members + .iter() + .map(member_manifest) + .collect::>>()?; + + Ok(Workspace { root, members }) + } + +// pub fn cop +} -- GitLab From bc4060e445ca6a4c6f3436e75ab5ad074cd2b7b3 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 20 Feb 2020 17:05:34 +0000 Subject: [PATCH 62/98] WIP workspaces --- src/cmd/build.rs | 26 ++++---- src/cmd/metadata.rs | 38 ++++++------ src/manifest.rs | 140 +++++++++++++++++++++++++++++++++++--------- src/util.rs | 15 +++-- 4 files changed, 152 insertions(+), 67 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 1aeb8b0b..b43edb7f 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -21,7 +21,7 @@ use std::{ process::Command, }; -use crate::{manifest::Manifest, util}; +use crate::{manifest::Workspace, util}; use anyhow::{Context, Result}; use cargo_metadata::Package; use colored::Colorize; @@ -49,20 +49,14 @@ impl CrateMetadata { /// Parses the contract manifest and returns relevant metadata. pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result { - let metadata = crate::util::get_cargo_metadata(working_dir)?; - - let root_package_id = metadata - .resolve - .as_ref() - .and_then(|resolve| resolve.root.as_ref()) - .context("Cannot infer the root project id")?; + let (metadata,root_package_id) = crate::util::get_cargo_metadata(working_dir)?; // Find the root package by id in the list of packages. It is logical error if the root // package is not found in the list. let root_package = metadata .packages .iter() - .find(|package| package.id == *root_package_id) + .find(|package| package.id == root_package_id) .expect("The package is not found in the `cargo metadata` output") .clone(); @@ -99,9 +93,8 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()> { util::assert_channel()?; - let xbuild = |tmp_manifest_path: &Path| { - // point to our temporary manifest - let manifest_path = Some(tmp_manifest_path); + let xbuild = |manifest_path: &Path| { + let manifest_path = Some(manifest_path); let target = Some("wasm32-unknown-unknown"); let verbosity = Some(xargo_lib::Verbosity::Verbose); let target_dir = crate_metadata.target_dir(); @@ -127,10 +120,11 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { Ok(()) }; - // remove the 'rlib' crate type in a temp manifest - Manifest::from_dir(crate_metadata.working_dir.as_ref())? - .with_removed_crate_type("rlib")? - .using_temp(xbuild)?; + let mut workspace = Workspace::new(&crate_metadata.cargo_meta, &crate_metadata.root_package.id)?; + workspace + .root_package_manifest_mut() + .with_removed_crate_type("rlib")?; + workspace.using_temp(xbuild)?; Ok(()) } diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 275e80d4..b6a39fc6 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use crate::{manifest::Manifest, util}; +use crate::{manifest::Workspace, util}; use anyhow::Result; use std::path::PathBuf; @@ -25,25 +25,27 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result util::assert_channel()?; println!(" Generating metadata"); - let cargo_metadata = crate::util::get_cargo_metadata(dir)?; + let (metadata,root_package_id) = crate::util::get_cargo_metadata(dir)?; - Manifest::from_dir(dir)? - .with_added_crate_type("rlib")? - .using_temp(|tmp_manifest_path| { - // todo: use tmp manifest in invocation - util::invoke_cargo( - "run", - &[ - "--package", - "abi-gen", - "--release", - // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! - ], - dir, - ) - })?; + let mut workspace = Workspace::new(&metadata, &root_package_id)?; + workspace + .root_package_manifest_mut() + .with_added_crate_type("rlib")?; + workspace.using_temp(|root_manifest_path| { + // todo: use tmp manifest in invocation + util::invoke_cargo( + "run", + &[ + "--package", + "abi-gen", + "--release", + // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! + ], + dir, + ) + })?; - let mut out_path = cargo_metadata.target_directory; + let mut out_path = metadata.target_directory; out_path.push("metadata.json"); Ok(format!( diff --git a/src/manifest.rs b/src/manifest.rs index 192206bf..9ed3dd9b 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -20,7 +20,10 @@ use cargo_metadata::{ PackageId, }; use std::{ - collections::HashMap, + collections::{ + HashMap, + HashSet, + }, fs, path::{Path, PathBuf}, }; @@ -112,7 +115,13 @@ impl Manifest { /// /// - `[lib]/path` /// - `[dependencies]` - fn rewrite_relative_paths(&mut self) -> Result<&mut Self> { + /// + /// Dependencies with package names specified in `exclude_deps` will not be rewritten. + fn rewrite_relative_paths(&mut self, exclude_deps: I) -> Result<&mut Self> + where + I: IntoIterator, + S: AsRef, + { let abs_path = self.path.canonicalize()?; let abs_dir = abs_path.parent() .expect("The manifest path is a file path so has a parent; qed"); @@ -155,12 +164,18 @@ impl Manifest { // Rewrite any dependency relative paths if let Some(dependencies) = self.toml.get_mut("dependencies") { + let exclude = exclude_deps + .into_iter() + .map(|s| s.as_ref().to_string()) + .collect::>(); let table = dependencies.as_table_mut() .ok_or(anyhow::anyhow!("dependencies should be a table"))?; for (name, value) in table { - if let Some(dependency) = value.as_table_mut() { - if let Some(dep_path) = dependency.get_mut("path") { - to_absolute(format!("dependency {}", name), dep_path)?; + if !exclude.contains(name) { + if let Some(dependency) = value.as_table_mut() { + if let Some(dep_path) = dependency.get_mut("path") { + to_absolute(format!("dependency {}", name), dep_path)?; + } } } } @@ -182,21 +197,6 @@ impl Manifest { .context(format!("Writing updated Cargo.toml to {}", manifest_path.display()))?; Ok(manifest_path) } - - /// Create the amended manifest in a temporary directory, executing the supplied function - /// before the temporary file is cleaned up. - pub fn using_temp(&mut self, f: F) -> Result<()> - where - F: FnOnce(&Path) -> Result<()>, - { - self.rewrite_relative_paths()?; - - let tmp_dir = tempfile::Builder::new().prefix(".cargo-contract_").tempdir()?; - let path = self.write(&tmp_dir)?; - log::debug!("Using temp manifest '{}'", path.display()); - - f(path.as_path()) - } } fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { @@ -205,15 +205,22 @@ fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { .any(|v| v.as_str().map_or(false, |s| s == crate_type)) } -struct Workspace { - root: Manifest, - members: HashMap, +pub struct Workspace { + workspace_root: PathBuf, + root_package: PackageId, + members: HashMap, +} + +pub struct Member { + package_id: PackageId, + package_name } impl Workspace { - pub fn new(metadata: CargoMetadata) -> Result { - let member_manifest = |package_id: &PackageId| -> Result<(PathBuf, Manifest)> { - // package id e.g. "abi-gen 0.1.0 (path+file:///home/code/test/.ink/abi_gen)" + /// Create a new Workspace from the supplied cargo metadata. + pub fn new(metadata: &CargoMetadata, root_package: &PackageId) -> Result { + let member_manifest = |package_id: &PackageId| -> Result<(PackageId, (PathBuf, Manifest))> { + // package id e.g. "foo 0.1.0 (path+file:///path/to/foo)" let open_bracket = package_id.repr.find('(') .ok_or(anyhow::anyhow!("Package id should contain opening bracket for url"))?; let close_bracket = package_id.repr.find(')') @@ -225,17 +232,92 @@ impl Workspace { } let path = PathBuf::from(url.path()); let manifest = Manifest::from_dir(Some(&path))?; - Ok((path, manifest)) + Ok((package_id.clone(), (path, manifest))) }; - let root = Manifest::from_dir(Some(metadata.workspace_root))?; let members = metadata.workspace_members .iter() .map(member_manifest) .collect::>>()?; - Ok(Workspace { root, members }) + if !members.contains_key(root_package) { + anyhow::bail!("The root package should be a workspace member") + } + + Ok(Workspace { + workspace_root: metadata.workspace_root.clone(), + root_package: root_package.clone(), + members + }) + } + + /// Get a mutable reference to the root package's manifest. + /// + /// # Note + /// + /// The root package is the current workspace package being built, not to be confused with + /// the workspace root (where the top level workspace Cargo.toml is defined). + pub fn root_package_manifest_mut(&mut self) -> &mut Manifest { + self.members + .get_mut(&self.root_package) + .map(|(_,m)| m) + .expect("The root package should be a workspace member") } + pub fn root_package_manifest(&self) -> &Manifest { + self.members + .get(&self.root_package) + .map(|(_,m)| m) + .expect("The root package should be a workspace member") + } + + /// Get a mutable reference to the manifest at the given path + // pub fn get_manifest_mut(&self, package_id: &PackageId) -> Option<&mut Manifest> { + // // self.members. + // None + // } + + /// Writes the amended manifests to the `target` directory, retaining the workspace directory + /// structure, but only with the `Cargo.toml` files. + /// + /// Relative paths will be rewritten to absolute paths from the original workspace root, except + /// intra-workspace relative dependency paths which will be preserved. + /// + /// Returns the paths of the new manifests. + pub fn write>(&self, target: P) -> Result> { + let mut new_manifest_paths = Vec::new(); + for (package_id, (path, mut manifest)) in self.members { + let new_path = path.strip_prefix(&self.workspace_root)?; + manifest.rewrite_relative_paths()?; + manifest.write(&new_path)?; + new_manifest_paths.push((package_id, new_path.into())); + } + Ok(new_manifest_paths) + } + + // in the end we want to replace the workspace root with our temp dir + // so strip out workspace root and replace it with specified root // pub fn cop + + /// Copy the workspace with amended manifest files to a temporary directory, executing the + /// supplied function with the root manifest path before the directory is cleaned up. + pub fn using_temp(&mut self, f: F) -> Result<()> + where + F: FnOnce(&Path) -> Result<()>, + { + let tmp_dir = tempfile::Builder::new().prefix(".cargo-contract_").tempdir()?; + log::debug!("Using temp workspace at '{}'", tmp_dir.path().display()); + let new_paths = self.write(&tmp_dir)?; + let root_manifest_path = new_paths + .iter() + .find_map(|(pid,path)| { + if *pid == self.root_package { + Some(path) + } else { + None + } + }) + .expect("root package should be a member of the temp workspace"); + f(root_manifest_path) + } } diff --git a/src/util.rs b/src/util.rs index df05bb58..c04dbc1b 100644 --- a/src/util.rs +++ b/src/util.rs @@ -15,17 +15,24 @@ // along with ink!. If not, see . use anyhow::{Context, Result}; -use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand}; +use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand, PackageId}; use rustc_version::Channel; use std::{ffi::OsStr, path::PathBuf, process::Command}; -/// Get the result of `cargo metadata` -pub fn get_cargo_metadata(working_dir: Option<&PathBuf>) -> Result { +/// Get the result of `cargo metadata`, together with the root package id. +pub fn get_cargo_metadata(working_dir: Option<&PathBuf>) -> Result<(CargoMetadata, PackageId)> { let mut cmd = MetadataCommand::new(); if let Some(dir) = working_dir { cmd.current_dir(dir); } - cmd.exec().context("Error invoking `cargo metadata`") + let metadata = cmd.exec().context("Error invoking `cargo metadata`")?; + let root_package_id = metadata + .resolve + .as_ref() + .and_then(|resolve| resolve.root.as_ref()) + .context("Cannot infer the root project id")? + .clone(); + Ok((metadata, root_package_id)) } /// Check whether the current rust channel is valid: `nightly` is recommended. -- GitLab From cd1b69c5ffafeeb978d7a6779bb7f67f932ece2a Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 20 Feb 2020 17:30:23 +0000 Subject: [PATCH 63/98] Implement temp workspace copy --- src/manifest.rs | 83 +++++++++++++------------------------------------ 1 file changed, 22 insertions(+), 61 deletions(-) diff --git a/src/manifest.rs b/src/manifest.rs index 9ed3dd9b..19e086b4 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -15,10 +15,7 @@ // along with ink!. If not, see . use anyhow::{Context, Result}; -use cargo_metadata::{ - Metadata as CargoMetadata, - PackageId, -}; +use cargo_metadata::{Metadata as CargoMetadata, PackageId, Package}; use std::{ collections::{ HashMap, @@ -56,21 +53,6 @@ impl Manifest { Ok(Manifest { path: path.clone(), toml }) } - /// Create a new Manifest from the given directory path. - /// - /// Passing `None` will assume the current directory so just `Cargo.toml` - pub fn from_dir>(path: Option

) -> Result { - if let Some(path) = path { - let path = path.as_ref(); - if !path.is_dir() { - anyhow::bail!("{} is not a directory", path.display()) - } - Self::new(&path.join(MANIFEST_FILE)) - } else { - Self::new(&PathBuf::from(MANIFEST_FILE)) - } - } - /// Get mutable reference to `[lib] crate-types = []` section fn get_crate_types_mut(&mut self) -> Result<&mut value::Array> { let lib = self.toml @@ -208,31 +190,19 @@ fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { pub struct Workspace { workspace_root: PathBuf, root_package: PackageId, - members: HashMap, -} - -pub struct Member { - package_id: PackageId, - package_name + members: HashMap, } impl Workspace { /// Create a new Workspace from the supplied cargo metadata. pub fn new(metadata: &CargoMetadata, root_package: &PackageId) -> Result { - let member_manifest = |package_id: &PackageId| -> Result<(PackageId, (PathBuf, Manifest))> { - // package id e.g. "foo 0.1.0 (path+file:///path/to/foo)" - let open_bracket = package_id.repr.find('(') - .ok_or(anyhow::anyhow!("Package id should contain opening bracket for url"))?; - let close_bracket = package_id.repr.find(')') - .ok_or(anyhow::anyhow!("Package id should contain closing bracket for url"))?; - let raw_url = &package_id.repr[open_bracket..close_bracket]; - let url = url::Url::parse(raw_url)?; - if url.scheme() != "path+file" { - anyhow::bail!("Workspace member package should be a file path") - } - let path = PathBuf::from(url.path()); - let manifest = Manifest::from_dir(Some(&path))?; - Ok((package_id.clone(), (path, manifest))) + let member_manifest = |package_id: &PackageId| -> Result<(PackageId, (Package, Manifest))> { + let package = metadata.packages + .iter() + .find(|p| p.id == *package_id) + .expect(&format!("Package '{}' is a member and should be in the packages list", package_id)); + let manifest = Manifest::new(&package.manifest_path)?; + Ok((package_id.clone(), (package.clone(), manifest))) }; let members = metadata.workspace_members @@ -264,19 +234,6 @@ impl Workspace { .expect("The root package should be a workspace member") } - pub fn root_package_manifest(&self) -> &Manifest { - self.members - .get(&self.root_package) - .map(|(_,m)| m) - .expect("The root package should be a workspace member") - } - - /// Get a mutable reference to the manifest at the given path - // pub fn get_manifest_mut(&self, package_id: &PackageId) -> Option<&mut Manifest> { - // // self.members. - // None - // } - /// Writes the amended manifests to the `target` directory, retaining the workspace directory /// structure, but only with the `Cargo.toml` files. /// @@ -284,21 +241,25 @@ impl Workspace { /// intra-workspace relative dependency paths which will be preserved. /// /// Returns the paths of the new manifests. - pub fn write>(&self, target: P) -> Result> { + pub fn write>(&mut self, target: P) -> Result> { + let exclude_member_package_names = self.members + .iter() + .map(|(_, (p,_))| p.name.clone()) + .collect::>(); let mut new_manifest_paths = Vec::new(); - for (package_id, (path, mut manifest)) in self.members { - let new_path = path.strip_prefix(&self.workspace_root)?; - manifest.rewrite_relative_paths()?; + for (package_id, (package, manifest)) in self.members.iter_mut() { + // replace the original workspace root with the temporary directory + let mut new_path: PathBuf = target.as_ref().into(); + new_path.push(package.manifest_path.strip_prefix(&self.workspace_root)?); + + manifest.rewrite_relative_paths(&exclude_member_package_names)?; manifest.write(&new_path)?; - new_manifest_paths.push((package_id, new_path.into())); + + new_manifest_paths.push((package_id.clone(), new_path.into())); } Ok(new_manifest_paths) } - // in the end we want to replace the workspace root with our temp dir - // so strip out workspace root and replace it with specified root -// pub fn cop - /// Copy the workspace with amended manifest files to a temporary directory, executing the /// supplied function with the root manifest path before the directory is cleaned up. pub fn using_temp(&mut self, f: F) -> Result<()> -- GitLab From 9df469116cb90ce624bb15ebce68e9d922a27f15 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 20 Feb 2020 17:30:59 +0000 Subject: [PATCH 64/98] Fmt --- src/cmd/build.rs | 7 ++--- src/cmd/metadata.rs | 2 +- src/manifest.rs | 65 ++++++++++++++++++++++++++++----------------- 3 files changed, 45 insertions(+), 29 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index b43edb7f..0069f33f 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -17,7 +17,7 @@ use std::{ fs::metadata, io::{self, Write}, - path::{PathBuf, Path}, + path::{Path, PathBuf}, process::Command, }; @@ -49,7 +49,7 @@ impl CrateMetadata { /// Parses the contract manifest and returns relevant metadata. pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result { - let (metadata,root_package_id) = crate::util::get_cargo_metadata(working_dir)?; + let (metadata, root_package_id) = crate::util::get_cargo_metadata(working_dir)?; // Find the root package by id in the list of packages. It is logical error if the root // package is not found in the list. @@ -120,7 +120,8 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { Ok(()) }; - let mut workspace = Workspace::new(&crate_metadata.cargo_meta, &crate_metadata.root_package.id)?; + let mut workspace = + Workspace::new(&crate_metadata.cargo_meta, &crate_metadata.root_package.id)?; workspace .root_package_manifest_mut() .with_removed_crate_type("rlib")?; diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index b6a39fc6..9748c5dc 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -25,7 +25,7 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result util::assert_channel()?; println!(" Generating metadata"); - let (metadata,root_package_id) = crate::util::get_cargo_metadata(dir)?; + let (metadata, root_package_id) = crate::util::get_cargo_metadata(dir)?; let mut workspace = Workspace::new(&metadata, &root_package_id)?; workspace diff --git a/src/manifest.rs b/src/manifest.rs index 19e086b4..ed0360bd 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -15,12 +15,9 @@ // along with ink!. If not, see . use anyhow::{Context, Result}; -use cargo_metadata::{Metadata as CargoMetadata, PackageId, Package}; +use cargo_metadata::{Metadata as CargoMetadata, Package, PackageId}; use std::{ - collections::{ - HashMap, - HashSet, - }, + collections::{HashMap, HashSet}, fs, path::{Path, PathBuf}, }; @@ -50,12 +47,16 @@ impl Manifest { let toml = fs::read_to_string(&path).context("Loading Cargo.toml")?; let toml: value::Table = toml::from_str(&toml)?; - Ok(Manifest { path: path.clone(), toml }) + Ok(Manifest { + path: path.clone(), + toml, + }) } /// Get mutable reference to `[lib] crate-types = []` section fn get_crate_types_mut(&mut self) -> Result<&mut value::Array> { - let lib = self.toml + let lib = self + .toml .get_mut("lib") .ok_or(anyhow::anyhow!("lib section not found"))?; let crate_types = lib @@ -105,17 +106,20 @@ impl Manifest { S: AsRef, { let abs_path = self.path.canonicalize()?; - let abs_dir = abs_path.parent() + let abs_dir = abs_path + .parent() .expect("The manifest path is a file path so has a parent; qed"); // Rewrite `[lib] path =` value to an absolute path. // Defaults to src/lib.rs if not specified - let lib = self.toml + let lib = self + .toml .get_mut("lib") .ok_or(anyhow::anyhow!("lib section not found"))?; let to_absolute = |value_id: String, existing_path: &mut value::Value| -> Result<()> { - let path_str = existing_path.as_str() + let path_str = existing_path + .as_str() .ok_or(anyhow::anyhow!("{} should be a string", value_id))?; let path = PathBuf::from(path_str); if path.is_relative() { @@ -150,7 +154,8 @@ impl Manifest { .into_iter() .map(|s| s.as_ref().to_string()) .collect::>(); - let table = dependencies.as_table_mut() + let table = dependencies + .as_table_mut() .ok_or(anyhow::anyhow!("dependencies should be a table"))?; for (name, value) in table { if !exclude.contains(name) { @@ -175,8 +180,10 @@ impl Manifest { let manifest_path = dir.join(MANIFEST_FILE); let updated_toml = toml::to_string(&self.toml)?; - fs::write(&manifest_path, updated_toml) - .context(format!("Writing updated Cargo.toml to {}", manifest_path.display()))?; + fs::write(&manifest_path, updated_toml).context(format!( + "Writing updated Cargo.toml to {}", + manifest_path.display() + ))?; Ok(manifest_path) } } @@ -197,18 +204,23 @@ impl Workspace { /// Create a new Workspace from the supplied cargo metadata. pub fn new(metadata: &CargoMetadata, root_package: &PackageId) -> Result { let member_manifest = |package_id: &PackageId| -> Result<(PackageId, (Package, Manifest))> { - let package = metadata.packages + let package = metadata + .packages .iter() .find(|p| p.id == *package_id) - .expect(&format!("Package '{}' is a member and should be in the packages list", package_id)); + .expect(&format!( + "Package '{}' is a member and should be in the packages list", + package_id + )); let manifest = Manifest::new(&package.manifest_path)?; Ok((package_id.clone(), (package.clone(), manifest))) }; - let members = metadata.workspace_members + let members = metadata + .workspace_members .iter() .map(member_manifest) - .collect::>>()?; + .collect::>>()?; if !members.contains_key(root_package) { anyhow::bail!("The root package should be a workspace member") @@ -217,7 +229,7 @@ impl Workspace { Ok(Workspace { workspace_root: metadata.workspace_root.clone(), root_package: root_package.clone(), - members + members, }) } @@ -230,7 +242,7 @@ impl Workspace { pub fn root_package_manifest_mut(&mut self) -> &mut Manifest { self.members .get_mut(&self.root_package) - .map(|(_,m)| m) + .map(|(_, m)| m) .expect("The root package should be a workspace member") } @@ -242,9 +254,10 @@ impl Workspace { /// /// Returns the paths of the new manifests. pub fn write>(&mut self, target: P) -> Result> { - let exclude_member_package_names = self.members + let exclude_member_package_names = self + .members .iter() - .map(|(_, (p,_))| p.name.clone()) + .map(|(_, (p, _))| p.name.clone()) .collect::>(); let mut new_manifest_paths = Vec::new(); for (package_id, (package, manifest)) in self.members.iter_mut() { @@ -263,15 +276,17 @@ impl Workspace { /// Copy the workspace with amended manifest files to a temporary directory, executing the /// supplied function with the root manifest path before the directory is cleaned up. pub fn using_temp(&mut self, f: F) -> Result<()> - where - F: FnOnce(&Path) -> Result<()>, + where + F: FnOnce(&Path) -> Result<()>, { - let tmp_dir = tempfile::Builder::new().prefix(".cargo-contract_").tempdir()?; + let tmp_dir = tempfile::Builder::new() + .prefix(".cargo-contract_") + .tempdir()?; log::debug!("Using temp workspace at '{}'", tmp_dir.path().display()); let new_paths = self.write(&tmp_dir)?; let root_manifest_path = new_paths .iter() - .find_map(|(pid,path)| { + .find_map(|(pid, path)| { if *pid == self.root_package { Some(path) } else { -- GitLab From 2da47dcfce40c880e84104282d7ac0277baaf513 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 21 Feb 2020 15:21:06 +0000 Subject: [PATCH 65/98] Rewrite bin relative path --- src/manifest.rs | 82 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 28 deletions(-) diff --git a/src/manifest.rs b/src/manifest.rs index ed0360bd..59f8229b 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -18,6 +18,7 @@ use anyhow::{Context, Result}; use cargo_metadata::{Metadata as CargoMetadata, Package, PackageId}; use std::{ collections::{HashMap, HashSet}, + ffi::OsStr, fs, path::{Path, PathBuf}, }; @@ -110,13 +111,6 @@ impl Manifest { .parent() .expect("The manifest path is a file path so has a parent; qed"); - // Rewrite `[lib] path =` value to an absolute path. - // Defaults to src/lib.rs if not specified - let lib = self - .toml - .get_mut("lib") - .ok_or(anyhow::anyhow!("lib section not found"))?; - let to_absolute = |value_id: String, existing_path: &mut value::Value| -> Result<()> { let path_str = existing_path .as_str() @@ -130,21 +124,43 @@ impl Manifest { Ok(()) }; - match lib.get_mut("path") { - Some(existing_path) => to_absolute("lib/path".into(), existing_path)?, - None => { - let lib_table = lib - .as_table_mut() - .ok_or(anyhow::anyhow!("lib section should be a table"))?; - let inferred_lib_path = abs_dir.join("src").join("lib.rs"); - if !inferred_lib_path.exists() { - anyhow::bail!( - "No `[lib] path =` specified, and the default `src/lib.rs` was not found" - ) + let rewrite_path = |table_value: &mut value::Value, table_section: &str, default: &str| { + let table = table_value + .as_table_mut() + .ok_or(anyhow::anyhow!("'[{}]' section should be a table", table_section))?; + + match table.get_mut("path") { + Some(existing_path) => to_absolute(format!("[{}]/path", table_section), existing_path), + None => { + let default_path = PathBuf::from(default); + if !default_path.exists() { + anyhow::bail!( + "No path specified, and the default `{}` was not found", + default + ) + } + let path = default_path.to_string_lossy(); + log::debug!("Adding default path '{}'", path); + table.insert("path".into(), value::Value::String(path.into())); + Ok(()) } - let path = inferred_lib_path.to_string_lossy(); - log::debug!("Adding inferred path '{}'", path); - lib_table.insert("path".into(), value::Value::String(path.into())); + } + }; + + // Rewrite `[lib] path = /path/to/lib.rs` + if let Some(lib) = self.toml.get_mut("lib") { + rewrite_path(lib, "lib", "src/lib.rs")?; + } + + // Rewrite `[[bin]] path = /path/to/main.rs` + if let Some(bin) = self.toml.get_mut("bin") { + let bins = bin + .as_array_mut() + .ok_or(anyhow::anyhow!("'[[bin]]' section should be a table array"))?; + + // Rewrite `[[bin]] path =` value to an absolute path. + for bin in bins { + rewrite_path(bin, "[bin]", "src/main.rs")?; } } @@ -171,20 +187,30 @@ impl Manifest { Ok(self) } - /// Writes the amended manifest to the given directory. + /// Writes the amended manifest to the given path. + /// + /// # Errors + /// + /// If the path is not for a `Cargo.toml` file pub fn write>(&self, path: P) -> Result { - let dir = path.as_ref(); - if !dir.is_dir() { - anyhow::bail!("{} should be a directory", dir.display()) + let manifest_path = path.as_ref(); + if manifest_path.file_name() != Some(OsStr::new(MANIFEST_FILE)) { + anyhow::bail!("{} should be a Cargo.toml file path", manifest_path.display()) + } + + if let Some(dir) = manifest_path.parent() { + fs::create_dir_all(&dir).context(format!( + "Creating directory '{}'", + dir.display() + ))?; } - let manifest_path = dir.join(MANIFEST_FILE); let updated_toml = toml::to_string(&self.toml)?; fs::write(&manifest_path, updated_toml).context(format!( - "Writing updated Cargo.toml to {}", + "Writing updated manifest to '{}'", manifest_path.display() ))?; - Ok(manifest_path) + Ok(manifest_path.into()) } } -- GitLab From 52b82cb4ba2d4f810464d707f8efb1f3ab7423ea Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 21 Feb 2020 16:02:17 +0000 Subject: [PATCH 66/98] Handle package rename for contracts --- src/manifest.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/manifest.rs b/src/manifest.rs index 59f8229b..7c227be4 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -174,10 +174,18 @@ impl Manifest { .as_table_mut() .ok_or(anyhow::anyhow!("dependencies should be a table"))?; for (name, value) in table { - if !exclude.contains(name) { + let package_name = { + let package = value.get("package"); + let package_name = package + .and_then(|p| p.as_str()) + .unwrap_or(name); + package_name.to_string() + }; + + if !exclude.contains(&package_name) { if let Some(dependency) = value.as_table_mut() { if let Some(dep_path) = dependency.get_mut("path") { - to_absolute(format!("dependency {}", name), dep_path)?; + to_absolute(format!("dependency {}", package_name), dep_path)?; } } } -- GitLab From 9aff20d2460966395fcc74339ad61be8a246231b Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 21 Feb 2020 16:34:57 +0000 Subject: [PATCH 67/98] Fmt --- src/manifest.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/manifest.rs b/src/manifest.rs index 7c227be4..450e0cd1 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -125,12 +125,15 @@ impl Manifest { }; let rewrite_path = |table_value: &mut value::Value, table_section: &str, default: &str| { - let table = table_value - .as_table_mut() - .ok_or(anyhow::anyhow!("'[{}]' section should be a table", table_section))?; + let table = table_value.as_table_mut().ok_or(anyhow::anyhow!( + "'[{}]' section should be a table", + table_section + ))?; match table.get_mut("path") { - Some(existing_path) => to_absolute(format!("[{}]/path", table_section), existing_path), + Some(existing_path) => { + to_absolute(format!("[{}]/path", table_section), existing_path) + } None => { let default_path = PathBuf::from(default); if !default_path.exists() { @@ -176,9 +179,7 @@ impl Manifest { for (name, value) in table { let package_name = { let package = value.get("package"); - let package_name = package - .and_then(|p| p.as_str()) - .unwrap_or(name); + let package_name = package.and_then(|p| p.as_str()).unwrap_or(name); package_name.to_string() }; @@ -203,14 +204,14 @@ impl Manifest { pub fn write>(&self, path: P) -> Result { let manifest_path = path.as_ref(); if manifest_path.file_name() != Some(OsStr::new(MANIFEST_FILE)) { - anyhow::bail!("{} should be a Cargo.toml file path", manifest_path.display()) + anyhow::bail!( + "{} should be a Cargo.toml file path", + manifest_path.display() + ) } if let Some(dir) = manifest_path.parent() { - fs::create_dir_all(&dir).context(format!( - "Creating directory '{}'", - dir.display() - ))?; + fs::create_dir_all(&dir).context(format!("Creating directory '{}'", dir.display()))?; } let updated_toml = toml::to_string(&self.toml)?; -- GitLab From 34800572b54f30df13033ee9fd1621e3a7e4c1a5 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 21 Feb 2020 17:08:22 +0000 Subject: [PATCH 68/98] Pass rustflags by setting env var --- src/cmd/build.rs | 6 ++++++ template/.cargo/config | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 template/.cargo/config diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 0069f33f..3da0f26c 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -93,6 +93,12 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()> { util::assert_channel()?; + // set RUSTFLAGS, read from environment var by cargo-xbuild + std::env::set_var( + "RUSTFLAGS", + "-C link-arg=-z -C link-arg=stack-size=65536 -C link-arg=--import-memory" + ); + let xbuild = |manifest_path: &Path| { let manifest_path = Some(manifest_path); let target = Some("wasm32-unknown-unknown"); diff --git a/template/.cargo/config b/template/.cargo/config deleted file mode 100644 index cba15a9a..00000000 --- a/template/.cargo/config +++ /dev/null @@ -1,6 +0,0 @@ -[target.wasm32-unknown-unknown] -rustflags = [ - "-C", "link-arg=-z", - "-C", "link-arg=stack-size=65536", - "-C", "link-arg=--import-memory", -] -- GitLab From 963cd34804c9f1724806bb164ec158d0392e39c0 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 21 Feb 2020 17:08:49 +0000 Subject: [PATCH 69/98] Fmt --- src/cmd/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 3da0f26c..b8000c24 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -96,7 +96,7 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { // set RUSTFLAGS, read from environment var by cargo-xbuild std::env::set_var( "RUSTFLAGS", - "-C link-arg=-z -C link-arg=stack-size=65536 -C link-arg=--import-memory" + "-C link-arg=-z -C link-arg=stack-size=65536 -C link-arg=--import-memory", ); let xbuild = |manifest_path: &Path| { -- GitLab From 6f5f75961ffc2ac2fe81817f2289c7649ea8d3b9 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 21 Feb 2020 17:20:23 +0000 Subject: [PATCH 70/98] Use abs path for lib default --- src/manifest.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/manifest.rs b/src/manifest.rs index 450e0cd1..dcede83d 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -142,9 +142,12 @@ impl Manifest { default ) } - let path = default_path.to_string_lossy(); - log::debug!("Adding default path '{}'", path); - table.insert("path".into(), value::Value::String(path.into())); + let path = abs_dir.join(default_path); + log::debug!("Adding default path '{}'", path.display()); + table.insert( + "path".into(), + value::Value::String(path.to_string_lossy().into()), + ); Ok(()) } } -- GitLab From 67e30a05c635e61857e61bf98faf21fde05800c8 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 10:06:24 +0000 Subject: [PATCH 71/98] Add 1 decimal place to file size --- src/cmd/build.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index b8000c24..58d2795a 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -243,10 +243,10 @@ fn optimize_wasm(crate_metadata: &CrateMetadata) -> Result<()> { anyhow::bail!("wasm-opt optimization failed"); } - let original_size = metadata(&crate_metadata.dest_wasm)?.len() / 1000; - let optimized_size = metadata(&optimized)?.len() / 1000; + let original_size = metadata(&crate_metadata.dest_wasm)?.len() as f64 / 1000.0; + let optimized_size = metadata(&optimized)?.len() as f64 / 1000.0; println!( - " Original wasm size: {}K, Optimized: {}K", + " Original wasm size: {:.1}K, Optimized: {:.1}K", original_size, optimized_size ); -- GitLab From b85ad22dea7f9b3bd79349ae6a42502fd82cf2d8 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 11:36:52 +0000 Subject: [PATCH 72/98] Make generate-metadata work, introduces ManifestPath --- src/cmd/build.rs | 15 ++++---- src/cmd/metadata.rs | 16 ++++---- src/main.rs | 4 +- src/manifest.rs | 89 +++++++++++++++++++++++++++++++-------------- src/util.rs | 16 +++----- 5 files changed, 86 insertions(+), 54 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 58d2795a..f1985734 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -26,6 +26,7 @@ use anyhow::{Context, Result}; use cargo_metadata::Package; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; +use crate::manifest::ManifestPath; /// This is the maximum number of pages available for a contract to allocate. const MAX_MEMORY_PAGES: u32 = 16; @@ -33,7 +34,7 @@ const MAX_MEMORY_PAGES: u32 = 16; /// Relevant metadata obtained from Cargo.toml. #[derive(Debug)] pub struct CrateMetadata { - working_dir: Option, + manifest_path: ManifestPath, cargo_meta: cargo_metadata::Metadata, package_name: String, root_package: Package, @@ -48,8 +49,8 @@ impl CrateMetadata { } /// Parses the contract manifest and returns relevant metadata. -pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result { - let (metadata, root_package_id) = crate::util::get_cargo_metadata(working_dir)?; +pub fn collect_crate_metadata(manifest_path: &ManifestPath) -> Result { + let (metadata, root_package_id) = crate::util::get_cargo_metadata(manifest_path)?; // Find the root package by id in the list of packages. It is logical error if the root // package is not found in the list. @@ -76,7 +77,7 @@ pub fn collect_crate_metadata(working_dir: Option<&PathBuf>) -> Result Result<()> { "-C link-arg=-z -C link-arg=stack-size=65536 -C link-arg=--import-memory", ); - let xbuild = |manifest_path: &Path| { + let xbuild = |manifest_path: &ManifestPath| { let manifest_path = Some(manifest_path); let target = Some("wasm32-unknown-unknown"); let verbosity = Some(xargo_lib::Verbosity::Verbose); @@ -258,13 +259,13 @@ fn optimize_wasm(crate_metadata: &CrateMetadata) -> Result<()> { /// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. /// /// It does so by invoking build by cargo and then post processing the final binary. -pub(crate) fn execute_build(working_dir: Option<&PathBuf>) -> Result { +pub(crate) fn execute_build(manifest_path: ManifestPath) -> Result { println!( " {} {}", "[1/4]".bold(), "Collecting crate metadata".bright_green().bold() ); - let crate_metadata = collect_crate_metadata(working_dir)?; + let crate_metadata = collect_crate_metadata(&manifest_path)?; println!( " {} {}", "[2/4]".bold(), diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 9748c5dc..5a3a75e5 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -14,34 +14,34 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use crate::{manifest::Workspace, util}; +use crate::{manifest::{ManifestPath, Workspace}, util}; use anyhow::Result; -use std::path::PathBuf; /// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. /// /// It does so by invoking build by cargo and then post processing the final binary. -pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result { +pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath) -> Result { util::assert_channel()?; println!(" Generating metadata"); - let (metadata, root_package_id) = crate::util::get_cargo_metadata(dir)?; + let (metadata, root_package_id) = crate::util::get_cargo_metadata(&manifest_path)?; let mut workspace = Workspace::new(&metadata, &root_package_id)?; workspace .root_package_manifest_mut() .with_added_crate_type("rlib")?; workspace.using_temp(|root_manifest_path| { - // todo: use tmp manifest in invocation + let target_dir = format!("--target-dir={}", metadata.target_directory.to_string_lossy()); util::invoke_cargo( "run", &[ "--package", "abi-gen", + &root_manifest_path.cargo_arg(), + &target_dir, "--release", // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! ], - dir, ) })?; @@ -59,6 +59,7 @@ pub(crate) fn execute_generate_metadata(dir: Option<&PathBuf>) -> Result mod tests { use crate::{ cmd::{execute_generate_metadata, execute_new}, + manifest::ManifestPath, util::tests::with_tmp_dir, }; @@ -67,7 +68,8 @@ mod tests { with_tmp_dir(|path| { execute_new("new_project", Some(path)).expect("new project creation failed"); let working_dir = path.join("new_project"); - execute_generate_metadata(Some(&working_dir)).expect("generate metadata failed"); + let manifest_path = ManifestPath::new(working_dir.join("Cargo.toml")).unwrap(); + execute_generate_metadata(manifest_path).expect("generate metadata failed"); let mut abi_file = working_dir; abi_file.push("target"); diff --git a/src/main.rs b/src/main.rs index ec2486a8..43e91998 100644 --- a/src/main.rs +++ b/src/main.rs @@ -162,8 +162,8 @@ fn main() { fn exec(cmd: Command) -> Result { match &cmd { Command::New { name, target_dir } => cmd::execute_new(name, target_dir.as_ref()), - Command::Build {} => cmd::execute_build(None), - Command::GenerateMetadata {} => cmd::execute_generate_metadata(None), + Command::Build {} => cmd::execute_build(Default::default()), + Command::GenerateMetadata {} => cmd::execute_generate_metadata(Default::default()), Command::Test {} => Err(anyhow::anyhow!("Command unimplemented")), #[cfg(feature = "extrinsics")] Command::Deploy { diff --git a/src/manifest.rs b/src/manifest.rs index dcede83d..4140ca94 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -18,19 +18,63 @@ use anyhow::{Context, Result}; use cargo_metadata::{Metadata as CargoMetadata, Package, PackageId}; use std::{ collections::{HashMap, HashSet}, - ffi::OsStr, fs, path::{Path, PathBuf}, }; use toml::value; +use std::convert::{TryFrom, TryInto}; const MANIFEST_FILE: &str = "Cargo.toml"; +/// Path to a Cargo.toml file +#[derive(Clone, Debug)] +pub struct ManifestPath { + path: PathBuf, +} + +impl ManifestPath { + /// Create a new ManifestPath, errors if not path to `Cargo.toml` + pub fn new>(path: P) -> Result { + let manifest = path.as_ref(); + if let Some(file_name) = manifest.file_name() { + if file_name != MANIFEST_FILE { + anyhow::bail!("Manifest file must be a Cargo.toml") + } + } + Ok(ManifestPath { path: manifest.into() }) + } + + /// Create an arg `--manifest-path=` for `cargo` command + pub fn cargo_arg(&self) -> String { + format!("--manifest-path={}", self.path.to_string_lossy()) + } +} + +impl TryFrom<&PathBuf> for ManifestPath { + type Error = anyhow::Error; + + fn try_from(value: &PathBuf) -> Result { + ManifestPath::new(value) + } +} + +impl Default for ManifestPath { + fn default() -> ManifestPath { + ManifestPath::new(MANIFEST_FILE).expect("it's a valid manifest file") + } +} + +impl AsRef for ManifestPath { + fn as_ref(&self) -> &Path { + self.path.as_ref() + } +} + /// Create an amended copy of `Cargo.toml`. /// /// Relative paths are rewritten to absolute paths. pub struct Manifest { - path: PathBuf, + path: ManifestPath, toml: value::Table, } @@ -38,18 +82,16 @@ impl Manifest { /// Create new CargoToml for the given manifest path. /// /// The path *must* be to a `Cargo.toml`. - pub fn new(path: &PathBuf) -> Result { - if let Some(file_name) = path.file_name() { - if file_name != MANIFEST_FILE { - anyhow::bail!("Manifest file must be a Cargo.toml") - } - } - - let toml = fs::read_to_string(&path).context("Loading Cargo.toml")?; + pub fn new

(path: P) -> Result + where + P: TryInto + { + let manifest_path = path.try_into()?; + let toml = fs::read_to_string(&manifest_path).context("Loading Cargo.toml")?; let toml: value::Table = toml::from_str(&toml)?; Ok(Manifest { - path: path.clone(), + path: manifest_path, toml, }) } @@ -106,7 +148,7 @@ impl Manifest { I: IntoIterator, S: AsRef, { - let abs_path = self.path.canonicalize()?; + let abs_path = self.path.as_ref().canonicalize()?; let abs_dir = abs_path .parent() .expect("The manifest path is a file path so has a parent; qed"); @@ -200,18 +242,8 @@ impl Manifest { } /// Writes the amended manifest to the given path. - /// - /// # Errors - /// - /// If the path is not for a `Cargo.toml` file - pub fn write>(&self, path: P) -> Result { + pub fn write(&self, path: &ManifestPath) -> Result<()> { let manifest_path = path.as_ref(); - if manifest_path.file_name() != Some(OsStr::new(MANIFEST_FILE)) { - anyhow::bail!( - "{} should be a Cargo.toml file path", - manifest_path.display() - ) - } if let Some(dir) = manifest_path.parent() { fs::create_dir_all(&dir).context(format!("Creating directory '{}'", dir.display()))?; @@ -222,7 +254,7 @@ impl Manifest { "Writing updated manifest to '{}'", manifest_path.display() ))?; - Ok(manifest_path.into()) + Ok(()) } } @@ -291,7 +323,7 @@ impl Workspace { /// intra-workspace relative dependency paths which will be preserved. /// /// Returns the paths of the new manifests. - pub fn write>(&mut self, target: P) -> Result> { + pub fn write>(&mut self, target: P) -> Result> { let exclude_member_package_names = self .members .iter() @@ -302,11 +334,12 @@ impl Workspace { // replace the original workspace root with the temporary directory let mut new_path: PathBuf = target.as_ref().into(); new_path.push(package.manifest_path.strip_prefix(&self.workspace_root)?); + let new_manifest = ManifestPath::new(new_path)?; manifest.rewrite_relative_paths(&exclude_member_package_names)?; - manifest.write(&new_path)?; + manifest.write(&new_manifest)?; - new_manifest_paths.push((package_id.clone(), new_path.into())); + new_manifest_paths.push((package_id.clone(), new_manifest)); } Ok(new_manifest_paths) } @@ -315,7 +348,7 @@ impl Workspace { /// supplied function with the root manifest path before the directory is cleaned up. pub fn using_temp(&mut self, f: F) -> Result<()> where - F: FnOnce(&Path) -> Result<()>, + F: FnOnce(&ManifestPath) -> Result<()>, { let tmp_dir = tempfile::Builder::new() .prefix(".cargo-contract_") diff --git a/src/util.rs b/src/util.rs index c04dbc1b..6469130a 100644 --- a/src/util.rs +++ b/src/util.rs @@ -17,15 +17,15 @@ use anyhow::{Context, Result}; use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand, PackageId}; use rustc_version::Channel; -use std::{ffi::OsStr, path::PathBuf, process::Command}; +use std::{ffi::OsStr, process::Command}; +use crate::manifest::ManifestPath; /// Get the result of `cargo metadata`, together with the root package id. -pub fn get_cargo_metadata(working_dir: Option<&PathBuf>) -> Result<(CargoMetadata, PackageId)> { +pub fn get_cargo_metadata(manifest_path: &ManifestPath) -> Result<(CargoMetadata, PackageId)> { let mut cmd = MetadataCommand::new(); - if let Some(dir) = working_dir { - cmd.current_dir(dir); - } - let metadata = cmd.exec().context("Error invoking `cargo metadata`")?; + let metadata = cmd + .manifest_path(manifest_path) + .exec().context("Error invoking `cargo metadata`")?; let root_package_id = metadata .resolve .as_ref() @@ -55,7 +55,6 @@ pub fn assert_channel() -> Result<()> { pub(crate) fn invoke_cargo( command: &str, args: I, - working_dir: Option<&PathBuf>, ) -> Result<()> where I: IntoIterator + std::fmt::Debug, @@ -63,9 +62,6 @@ where { let cargo = std::env::var("CARGO").unwrap_or("cargo".to_string()); let mut cmd = Command::new(cargo); - if let Some(working_dir) = working_dir { - cmd.current_dir(working_dir); - } cmd.arg(command); cmd.args(args); -- GitLab From 7103d601187a858f4e1c1986d29aea1775d529cc Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 12:17:00 +0000 Subject: [PATCH 73/98] Fmt --- src/cmd/build.rs | 6 ++++-- src/cmd/metadata.rs | 10 ++++++++-- src/manifest.rs | 8 +++++--- src/util.rs | 10 ++++------ 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index f1985734..95528de1 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -21,12 +21,14 @@ use std::{ process::Command, }; -use crate::{manifest::Workspace, util}; +use crate::{ + manifest::{ManifestPath, Workspace}, + util, +}; use anyhow::{Context, Result}; use cargo_metadata::Package; use colored::Colorize; use parity_wasm::elements::{External, MemoryType, Module, Section}; -use crate::manifest::ManifestPath; /// This is the maximum number of pages available for a contract to allocate. const MAX_MEMORY_PAGES: u32 = 16; diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 5a3a75e5..581ca6b0 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use crate::{manifest::{ManifestPath, Workspace}, util}; +use crate::{ + manifest::{ManifestPath, Workspace}, + util, +}; use anyhow::Result; /// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. @@ -31,7 +34,10 @@ pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath) -> Result(path: P) -> Result where - P: TryInto + P: TryInto, { let manifest_path = path.try_into()?; let toml = fs::read_to_string(&manifest_path).context("Loading Cargo.toml")?; diff --git a/src/util.rs b/src/util.rs index 6469130a..367c2d6a 100644 --- a/src/util.rs +++ b/src/util.rs @@ -14,18 +14,19 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . +use crate::manifest::ManifestPath; use anyhow::{Context, Result}; use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand, PackageId}; use rustc_version::Channel; use std::{ffi::OsStr, process::Command}; -use crate::manifest::ManifestPath; /// Get the result of `cargo metadata`, together with the root package id. pub fn get_cargo_metadata(manifest_path: &ManifestPath) -> Result<(CargoMetadata, PackageId)> { let mut cmd = MetadataCommand::new(); let metadata = cmd .manifest_path(manifest_path) - .exec().context("Error invoking `cargo metadata`")?; + .exec() + .context("Error invoking `cargo metadata`")?; let root_package_id = metadata .resolve .as_ref() @@ -52,10 +53,7 @@ pub fn assert_channel() -> Result<()> { } /// Run cargo with the supplied args -pub(crate) fn invoke_cargo( - command: &str, - args: I, -) -> Result<()> +pub(crate) fn invoke_cargo(command: &str, args: I) -> Result<()> where I: IntoIterator + std::fmt::Debug, S: AsRef, -- GitLab From e02c5c9eee99eb85903b8a1f0db5d97b9b4ba034 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 12:27:33 +0000 Subject: [PATCH 74/98] cargo update --- Cargo.lock | 1182 +++++++++++++++++++++++----------------------------- 1 file changed, 525 insertions(+), 657 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0149234d..b4c54dc3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,12 +17,20 @@ dependencies = [ "const-random 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ahash" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "const-random 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "aho-corasick" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -66,16 +74,16 @@ name = "async-std" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "async-task 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "async-task 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "kv-log-macro 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -87,10 +95,10 @@ dependencies = [ [[package]] name = "async-task" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -99,9 +107,9 @@ name = "async-tls" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustls 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", - "webpki 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", "webpki-roots 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -110,8 +118,8 @@ name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -127,12 +135,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.43" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -142,7 +150,7 @@ version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -155,7 +163,7 @@ name = "base64" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -194,7 +202,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -213,15 +221,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bstr" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bumpalo" -version = "3.1.2" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -236,18 +244,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.3.2" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "bytes" version = "0.5.4" @@ -268,20 +267,20 @@ dependencies = [ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "async-std 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo-xbuild 0.5.26 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo-xbuild 0.5.28 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "colored 1.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "colored 1.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", "pwasm-utils 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "structopt 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-subxt 0.4.0 (git+https://github.com/paritytech/substrate-subxt/?rev=b7565ff435b9499ca1ff4dad519009e94a13111c)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -295,20 +294,20 @@ dependencies = [ [[package]] name = "cargo-xbuild" -version = "0.5.26" +version = "0.5.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -319,7 +318,7 @@ dependencies = [ "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -372,7 +371,7 @@ dependencies = [ [[package]] name = "colored" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -413,40 +412,43 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-deque" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -470,7 +472,7 @@ name = "curve25519-dalek" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -482,7 +484,7 @@ name = "curve25519-dalek" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -491,23 +493,12 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "derive_more" -version = "0.99.2" +version = "0.99.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -547,29 +538,19 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "err-derive" -version = "0.1.6" +name = "error-chain" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "error-chain" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "failure" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -580,7 +561,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -594,8 +575,8 @@ name = "fixed-hash" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -608,86 +589,86 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "frame-metadata" -version = "11.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "11.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "frame-support" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "frame-metadata 11.0.0 (git+https://github.com/paritytech/substrate/)", - "frame-support-procedural 2.0.0 (git+https://github.com/paritytech/substrate/)", + "frame-metadata 11.0.0-dev (git+https://github.com/paritytech/substrate/)", + "frame-support-procedural 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "once_cell 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-arithmetic 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-inherents 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-io 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-state-machine 0.8.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-arithmetic 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-inherents 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-io 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-runtime 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-state-machine 0.8.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "tracing 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "frame-support-procedural" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ - "frame-support-procedural-tools 2.0.0 (git+https://github.com/paritytech/substrate/)", + "frame-support-procedural-tools 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "frame-support-procedural-tools" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ - "frame-support-procedural-tools-derive 2.0.0 (git+https://github.com/paritytech/substrate/)", + "frame-support-procedural-tools-derive 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "frame-support-procedural-tools-derive" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "frame-system" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ - "frame-support 2.0.0 (git+https://github.com/paritytech/substrate/)", + "frame-support 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-io 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-version 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-io 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-runtime 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-version 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] @@ -695,7 +676,7 @@ name = "fs2" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -720,66 +701,66 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-channel 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-channel" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-core" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-executor" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-io" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-macro" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-sink" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-task" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -787,18 +768,23 @@ name = "futures-timer" version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "futures-util" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-channel 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-macro 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -819,7 +805,7 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -833,8 +819,8 @@ name = "globset" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)", - "bstr 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -847,11 +833,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -873,20 +859,20 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.1.8" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ahash 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hashbrown" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ahash 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ahash 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -899,15 +885,15 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hex" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -967,9 +953,9 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1035,12 +1021,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "indexmap" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1056,7 +1042,7 @@ name = "iovec" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1075,53 +1061,50 @@ dependencies = [ [[package]] name = "jsonrpsee" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0e2b03fbdede31eb8d988c701eb08bf13480ebaa" +source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" dependencies = [ "async-std 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpsee-core 1.0.0 (git+https://github.com/paritytech/jsonrpsee/)", "jsonrpsee-http 1.0.0 (git+https://github.com/paritytech/jsonrpsee/)", "jsonrpsee-proc-macros 1.0.0 (git+https://github.com/paritytech/jsonrpsee/)", "jsonrpsee-ws 1.0.0 (git+https://github.com/paritytech/jsonrpsee/)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpsee-core" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0e2b03fbdede31eb8d988c701eb08bf13480ebaa" +source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" dependencies = [ "bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hashbrown 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpsee-http" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0e2b03fbdede31eb8d988c701eb08bf13480ebaa" +source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" dependencies = [ - "async-std 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpsee-core 1.0.0 (git+https://github.com/paritytech/jsonrpsee/)", "jsonrpsee-server-utils 1.0.0 (git+https://github.com/paritytech/jsonrpsee/)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1129,22 +1112,21 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0e2b03fbdede31eb8d988c701eb08bf13480ebaa" +source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" dependencies = [ "Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpsee-server-utils" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0e2b03fbdede31eb8d988c701eb08bf13480ebaa" +source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" dependencies = [ "globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpsee-core 1.0.0 (git+https://github.com/paritytech/jsonrpsee/)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1153,25 +1135,25 @@ dependencies = [ [[package]] name = "jsonrpsee-ws" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0e2b03fbdede31eb8d988c701eb08bf13480ebaa" +source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" dependencies = [ "async-std 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "async-tls 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-timer 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpsee-core 1.0.0 (git+https://github.com/paritytech/jsonrpsee/)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "soketto 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webpki 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1203,12 +1185,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.66" +version = "0.2.67" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libsecp256k1" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1221,20 +1203,12 @@ dependencies = [ "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "lock_api" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "lock_api" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1245,16 +1219,6 @@ dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "malloc_size_of_derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "matches" version = "0.1.8" @@ -1267,7 +1231,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memchr" -version = "2.3.0" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1280,13 +1244,13 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.18.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ahash 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-util-mem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-util-mem 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1299,7 +1263,7 @@ name = "merlin" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1315,7 +1279,7 @@ dependencies = [ "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1329,7 +1293,7 @@ version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1350,7 +1314,7 @@ version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1364,7 +1328,7 @@ name = "nom" version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1411,28 +1375,18 @@ name = "num_cpus" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "once_cell" -version = "0.1.8" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "once_cell" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "once_cell" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "opaque-debug" version = "0.2.3" @@ -1440,18 +1394,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pallet-indices" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ - "frame-support 2.0.0 (git+https://github.com/paritytech/substrate/)", - "frame-system 2.0.0 (git+https://github.com/paritytech/substrate/)", + "frame-support 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "frame-system 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-io 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-keyring 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-io 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-keyring 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-runtime 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] @@ -1474,19 +1428,32 @@ dependencies = [ "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parity-util-mem" -version = "0.3.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-util-mem-derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "primitive-types 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parity-util-mem-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parity-wasm" version = "0.41.0" @@ -1494,30 +1461,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parking_lot" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parking_lot" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parking_lot_core" -version = "0.4.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1525,36 +1494,35 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "paste-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste-impl" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1562,7 +1530,7 @@ name = "pbkdf2" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1591,7 +1559,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1635,35 +1603,25 @@ dependencies = [ [[package]] name = "proc-macro-error" -version = "0.2.6" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro-error" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro-error-attr 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error-attr 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "proc-macro-error-attr" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1674,7 +1632,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1682,14 +1640,6 @@ name = "proc-macro-nested" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "proc-macro2" version = "1.0.8" @@ -1703,7 +1653,7 @@ name = "pwasm-utils" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1713,14 +1663,6 @@ name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "quote" version = "1.0.2" @@ -1735,7 +1677,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1747,7 +1689,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1765,7 +1707,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1839,7 +1781,7 @@ name = "rand_jitter" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1851,7 +1793,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1892,8 +1834,8 @@ name = "regex" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1913,12 +1855,12 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.9" +version = "0.16.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1931,22 +1873,14 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-serialize" -version = "0.3.24" +name = "rustc-hash" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "rustc_version" -version = "0.1.7" +name = "rustc-hex" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "rustc_version" @@ -1963,9 +1897,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.16.11 (registry+https://github.com/rust-lang/crates.io-index)", "sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "webpki 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1975,7 +1909,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1983,15 +1917,6 @@ name = "ryu" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "same-file" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "same-file" version = "1.0.6" @@ -2018,12 +1943,7 @@ dependencies = [ [[package]] name = "scopeguard" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "scopeguard" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2031,15 +1951,10 @@ name = "sct" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.16.11 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "semver" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "semver" version = "0.9.0" @@ -2069,12 +1984,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.45" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2123,7 +2038,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2131,7 +2046,7 @@ dependencies = [ "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2141,75 +2056,76 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "sp-api" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-api-proc-macro 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-state-machine 0.8.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-version 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-api-proc-macro 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-runtime 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-state-machine 0.8.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-version 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "sp-api-proc-macro" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-application-crypto" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-io 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-io 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "sp-arithmetic" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "integer-sqrt 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-debug-derive 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-debug-derive 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "sp-core" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "ed25519-dalek 1.0.0-pre.3 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "hash256-std-hasher 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libsecp256k1 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libsecp256k1 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-util-mem 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2217,13 +2133,13 @@ dependencies = [ "schnorrkel 0.8.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-debug-derive 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-externalities 0.8.0 (git+https://github.com/paritytech/substrate/)", - "sp-runtime-interface 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-storage 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-debug-derive 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-externalities 0.8.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-runtime-interface 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-storage 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "substrate-bip39 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-bip39 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "twox-hash 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmi 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2232,211 +2148,212 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-externalities" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "0.8.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "environmental 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-storage 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-storage 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "sp-inherents" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ - "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", + "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "sp-io" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libsecp256k1 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libsecp256k1 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-externalities 0.8.0 (git+https://github.com/paritytech/substrate/)", - "sp-runtime-interface 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-state-machine 0.8.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-trie 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-wasm-interface 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-externalities 0.8.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-runtime-interface 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-state-machine 0.8.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-trie 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-wasm-interface 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "sp-keyring" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-runtime 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "strum 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-panic-handler" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ - "backtrace 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-rpc" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "sp-runtime" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-util-mem 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-application-crypto 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-arithmetic 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-inherents 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-io 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-application-crypto 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-arithmetic 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-inherents 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-io 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "sp-runtime-interface" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.8.0 (git+https://github.com/paritytech/substrate/)", - "sp-runtime-interface-proc-macro 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-wasm-interface 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-externalities 0.8.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-runtime-interface-proc-macro 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-wasm-interface 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-state-machine" -version = "0.8.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "0.8.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-externalities 0.8.0 (git+https://github.com/paritytech/substrate/)", - "sp-panic-handler 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-trie 2.0.0 (git+https://github.com/paritytech/substrate/)", - "trie-db 0.19.2 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-root 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-externalities 0.8.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-panic-handler 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-trie 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "trie-db 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-root 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-std" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" [[package]] name = "sp-storage" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-debug-derive 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-debug-derive 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "sp-transaction-pool" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ - "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-api 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-api 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-runtime 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "sp-trie" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", - "memory-db 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memory-db 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", - "trie-db 0.19.2 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-root 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "trie-db 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-root 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-version" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-runtime 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", ] [[package]] name = "sp-wasm-interface" -version = "2.0.0" -source = "git+https://github.com/paritytech/substrate/#95089bbb079c4533cca607464df0b5883713861c" +version = "2.0.0-dev" +source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" dependencies = [ "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)", + "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "wasmi 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2471,10 +2388,10 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-error 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2493,7 +2410,7 @@ dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2512,23 +2429,23 @@ name = "substrate-subxt" version = "0.4.0" source = "git+https://github.com/paritytech/substrate-subxt/?rev=b7565ff435b9499ca1ff4dad519009e94a13111c#b7565ff435b9499ca1ff4dad519009e94a13111c" dependencies = [ - "frame-metadata 11.0.0 (git+https://github.com/paritytech/substrate/)", - "frame-support 2.0.0 (git+https://github.com/paritytech/substrate/)", - "futures 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "frame-metadata 11.0.0-dev (git+https://github.com/paritytech/substrate/)", + "frame-support 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpsee 1.0.0 (git+https://github.com/paritytech/jsonrpsee/)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "pallet-indices 2.0.0 (git+https://github.com/paritytech/substrate/)", + "pallet-indices 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-rpc 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-transaction-pool 2.0.0 (git+https://github.com/paritytech/substrate/)", - "sp-version 2.0.0 (git+https://github.com/paritytech/substrate/)", - "thiserror 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-rpc 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-runtime 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-transaction-pool 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "sp-version 2.0.0-dev (git+https://github.com/paritytech/substrate/)", + "thiserror 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2544,17 +2461,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "0.15.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2569,7 +2476,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2579,7 +2486,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2598,7 +2505,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2623,20 +2530,20 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "thiserror-impl 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror-impl 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror-impl" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2652,22 +2559,22 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tiny-bip39" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2688,7 +2595,7 @@ dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2700,21 +2607,13 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "toml" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "toml" version = "0.5.6" @@ -2744,7 +2643,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2757,20 +2656,19 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "trie-root" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2799,7 +2697,7 @@ name = "uint" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2839,11 +2737,6 @@ name = "unicode-width" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-xid" version = "0.2.0" @@ -2896,7 +2789,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wabt-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2910,16 +2803,6 @@ dependencies = [ "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "walkdir" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "walkdir" version = "2.3.1" @@ -2958,12 +2841,12 @@ name = "wasm-bindgen-backend" version = "0.2.58" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bumpalo 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2983,7 +2866,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3003,7 +2886,7 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3013,7 +2896,7 @@ name = "wasmi" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3043,10 +2926,10 @@ dependencies = [ [[package]] name = "webpki" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.16.11 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3055,7 +2938,7 @@ name = "webpki-roots" version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "webpki 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3072,7 +2955,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3141,7 +3024,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3157,7 +3040,8 @@ dependencies = [ [metadata] "checksum Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" "checksum ahash 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "6f33b5018f120946c1dcf279194f238a9f146725593ead1c08fa47ff22b0b5d3" -"checksum aho-corasick 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "5f56c476256dc249def911d6f7580b5fc7e875895b5d7ee88f5d602208035744" +"checksum ahash 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0989268a37e128d4d7a8028f1c60099430113fdbc70419010601ce51a228e4fe" +"checksum aho-corasick 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "743ad5a418686aad3b87fd14c43badd828cf26e214a00f92a384291cf22e1811" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c" "checksum arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" @@ -3165,12 +3049,12 @@ dependencies = [ "checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" "checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" "checksum async-std 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "538ecb01eb64eecd772087e5b6f7540cbc917f047727339a472dafed2185b267" -"checksum async-task 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f20c6fda19d0fc02406779587ca4f9a4171cd32e4a5bda0bd016f0a1334c8d4a" +"checksum async-task 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0ac2c016b079e771204030951c366db398864f5026f84a44dafb0ff20f02085d" "checksum async-tls 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce6977f57fa68da77ffe5542950d47e9c23d65f5bc7cb0a9f8700996913eec7" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" "checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" -"checksum backtrace 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)" = "7f80256bc78f67e7df7e36d77366f636ed976895d91fe2ab9efa3973e8fe8c4f" +"checksum backtrace 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e4036b9bf40f3cf16aba72a3d65e8a520fc4bafcdc7079aea8f848c58c5b5536" "checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491" "checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" @@ -3182,15 +3066,14 @@ dependencies = [ "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" "checksum bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b170cd256a3f9fa6b9edae3e44a7dfdfc77e8124dbc3e2612d75f9c3e2396dae" -"checksum bstr 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "fe8a65814ca90dfc9705af76bb6ba3c6e2534489a72270e797e603783bb4990b" -"checksum bumpalo 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5fb8038c1ddc0a5f73787b130f4cc75151e96ed33e417fde765eb5a81e3532f4" +"checksum bstr 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "502ae1441a0a5adb8fbd38a5955a6416b9493e92b465de5e4a9bde6a539c2c48" +"checksum bumpalo 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f359dc14ff8911330a51ef78022d376f25ed00248912803b58f00cb1c27f742" "checksum byte-slice-cast 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" -"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" -"checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" -"checksum cargo-xbuild 0.5.26 (registry+https://github.com/rust-lang/crates.io-index)" = "cbc751c3ab120b385e0e0e6ea8d75709d4ef867c47481960ea5e01eafe93a718" +"checksum cargo-xbuild 0.5.28 (registry+https://github.com/rust-lang/crates.io-index)" = "b8cf1fcfab5ef1b3aeacb5bc16c248ecc4ef9e3e81ed96087e3801b81b305ca0" "checksum cargo_metadata 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "46e3374c604fb39d1a2f35ed5e4a4e30e60d01fab49446e08f1b3e9a90aef202" "checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" @@ -3198,52 +3081,51 @@ dependencies = [ "checksum clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum cmake 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62" -"checksum colored 1.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8815e2ab78f3a59928fc32e141fbeece88320a240e43f47b2fd64ea3a88a5b3d" +"checksum colored 1.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" "checksum const-random 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "2f1af9ac737b2dd2d577701e59fd09ba34822f6f2ebdb30a7647405d9e55e16a" "checksum const-random-macro 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "25e4c606eb459dd29f7c57b2e0879f2b6f14ee130918c2b78ccb58a9624e6c7a" "checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -"checksum crossbeam-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "acec9a3b0b3559f15aee4f90746c4e5e293b701c0f7d3925d24e01645267b68c" -"checksum crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3aa945d63861bfe624b55d153a39684da1e8c0bc8fba932f7ee3a3c16cea3ca" -"checksum crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5064ebdbf05ce3cb95e45c8b086f72263f4166b29b97f6baff7ef7fe047b55ac" -"checksum crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce446db02cdc3165b94ae73111e570793400d0794e46125cc4056c81cbb039f4" +"checksum crossbeam-channel 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061" +"checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" +"checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" "checksum crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" "checksum curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8b7dcd30ba50cdf88b55b033456138b7c0ac4afdc436d82e1b79f370f24cc66d" "checksum curve25519-dalek 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26778518a7f6cffa1d25a44b602b62b979bd88adb9e99ffec546998cf3404839" -"checksum derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871" -"checksum derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2159be042979966de68315bce7034bb000c775f22e3e834e1c52ff78f041cae8" +"checksum derive_more 0.99.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a806e96c59a76a5ba6e18735b6cf833344671e61e7863f2edb5c518ea2cac95c" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum ed25519-dalek 1.0.0-pre.3 (registry+https://github.com/rust-lang/crates.io-index)" = "978710b352437433c97b2bff193f2fb1dfd58a093f863dd95e225a19baa599a2" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" "checksum environmental 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "516aa8d7a71cb00a1c4146f0798549b93d083d4f189b3ced8f3de6b8f11ee6c4" -"checksum err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b41487fadaa500d02a819eefcde5f713599a01dd51626ef25d2d72d87115667b" -"checksum error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "318cb3c71ee4cdea69fdc9e15c173b245ed6063e1709029e8fd32525a881120f" +"checksum error-chain 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd" "checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9" "checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fixed-hash 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3367952ceb191f4ab95dd5685dc163ac539e36202f9fcfd0cb22f9f9c542fefc" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" -"checksum frame-metadata 11.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum frame-support 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum frame-support-procedural 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum frame-support-procedural-tools 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum frame-support-procedural-tools-derive 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum frame-system 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" +"checksum frame-metadata 11.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum frame-support 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum frame-support-procedural 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum frame-support-procedural-tools 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum frame-support-procedural-tools-derive 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum frame-system 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" "checksum fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum futures 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dda826c2f9351e68bc87b9037d91d818f24384993ecbb37f711e1f71a83182b5" -"checksum futures-channel 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c92c2137e8e1ebf1ac99453550ab46eb4f35c5c53476d57d75eb782fb4d71e84" -"checksum futures-core 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ccfb301b0b09e940a67376cf40d1b0ac4db9366ee737f65c02edea225057e91e" -"checksum futures-executor 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f085a4c6508baef1f70ec2e0232a09edc649a3b86551fe92555e3a9e43939e4c" -"checksum futures-io 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c0ff098c09c30cc42b88a67d9fb27435e8456fb8b2483c904340ed499736931c" -"checksum futures-macro 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ebecc4204c719ca7140a3253676f1321e6fa17b1752a94a4a436d308be293e87" -"checksum futures-sink 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0485279d763e8a3669358f500e805339138b7bbe90f5718c80eedfdcb2ea36a4" -"checksum futures-task 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cefffab2aacc73845afd3f202e09fc775a55e2e96f46c8b1a46c117ae1c126ca" +"checksum futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" +"checksum futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" +"checksum futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" +"checksum futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" +"checksum futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" +"checksum futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" +"checksum futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" +"checksum futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" "checksum futures-timer 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6" -"checksum futures-util 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2c3f8c59707f898b8b6f0b54c2aef5408ae90a560b7bf0fbf1b95b3c652b0171" +"checksum futures-timer 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +"checksum futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" "checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" @@ -3251,11 +3133,11 @@ dependencies = [ "checksum h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1" "checksum hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" "checksum hash256-std-hasher 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" -"checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum hashbrown 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead" +"checksum hashbrown 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "728e7d31e63d53c436094370f1e6fa249f60a4bb318cc5dfbbbe0aa2bc5a29d7" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772" -"checksum hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "023b39be39e3a2da62a94feb433e91e8bcd37676fbc8bea371daf52b7a769a3e" +"checksum hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8" +"checksum hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" "checksum hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" "checksum hmac-drbg 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" "checksum http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b" @@ -3269,7 +3151,7 @@ dependencies = [ "checksum impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "58e3cae7e99c7ff5a995da2cf78dd0a5383740eda71d98cf7b1910c301ac69b8" "checksum impl-serde 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5bbe9ea9b182f0fb1cabbd61f4ff9b7b7b9197955e95a7e4c27de5055eb29ff8" "checksum impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" -"checksum indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b54058f0a6ff80b6803da8faf8997cde53872b38f4023728f6830b06cd3c0dc" +"checksum indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" "checksum integer-sqrt 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f65877bf7d44897a473350b1046277941cee20b263397e90869c50b6e766088b" "checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" "checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" @@ -3284,17 +3166,15 @@ dependencies = [ "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kv-log-macro 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c54d9f465d530a752e6ebdc217e081a7a614b48cb200f6f0aee21ba6bc9aabb" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" -"checksum libsecp256k1 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "df6edf84fd62aad1c93932b39324eaeda3912c1d26bc18dfaee6293848e49a50" -"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)" = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" +"checksum libsecp256k1 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" "checksum lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -"checksum malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e37c5d4cd9473c5f4c9c111f033f15d4df9bd378fdf615944e360a4f55a05f0b" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -"checksum memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" +"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" "checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9" -"checksum memory-db 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "881736a0f68a6fae1b596bb066c5bd16d7b3ed645a4dd8ffaefd02f585abaf71" +"checksum memory-db 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "198831fe8722331a395bc199a5d08efbc197497ef354cb4c77b969c02ffc0fc4" "checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" "checksum merlin 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2b0942b357c1b4d0dc43ba724674ec89c3218e6ca2b3e8269e7cb53bcecd2f6e" "checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" @@ -3308,21 +3188,20 @@ dependencies = [ "checksum num-rational 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "da4dc79f9e6c81bef96148c8f6b8e72ad4541caa4a24373e900a36da07de03a3" "checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" "checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6" -"checksum once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "532c29a261168a45ce28948f9537ddd7a5dd272cc513b3017b1e82a88f962c37" -"checksum once_cell 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d584f08c2d717d5c23a6414fc2822b71c651560713e54fa7eace675f758a355e" "checksum once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b" "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" -"checksum pallet-indices 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" +"checksum pallet-indices 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" "checksum parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f747c06d9f3b2ad387ac881b9667298c81b1243aa9833f086e05996937c35507" "checksum parity-scale-codec-derive 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34e513ff3e406f3ede6796dcdc83d0b32ffb86668cea1ccf7363118abeb00476" -"checksum parity-util-mem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8174d85e62c4d615fddd1ef67966bdc5757528891d0742f15b131ad04667b3f9" +"checksum parity-util-mem 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ef1476e40bf8f5c6776e9600983435821ca86eb9819d74a6207cca69d091406a" +"checksum parity-util-mem-derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" "checksum parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" -"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" +"checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc" "checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" -"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" "checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" -"checksum paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "423a519e1c6e828f1e73b720f9d9ed2fa643dce8a7737fb43235ce0b41eeaa49" -"checksum paste-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4214c9e912ef61bf42b81ba9a47e8aad1b2ffaf739ab162bf96d1e011f54e6c5" +"checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" +"checksum paste 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "63e1afe738d71b1ebab5f1207c055054015427dbfc7bbe9ee1266894156ec046" +"checksum paste-impl 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc4a7f6f743211c5aab239640a65091535d97d43d92a52bca435a640892bb" "checksum pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" @@ -3334,16 +3213,13 @@ dependencies = [ "checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" "checksum primitive-types 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e4336f4f5d5524fa60bcbd6fe626f9223d8142a50e7053e979acdf0da41ab975" "checksum proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e10d4b51f154c8a7fb96fd6dad097cb74b863943ec010ac94b9fd1be8861fe1e" -"checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097" -"checksum proc-macro-error 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "875077759af22fa20b610ad4471d8155b321c89c3f2785526c9839b099be4e0a" -"checksum proc-macro-error-attr 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c5717d9fa2664351a01ed73ba5ef6df09c01a521cb42cb65a061432a826f3c7a" +"checksum proc-macro-error 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "052b3c9af39c7e5e94245f820530487d19eb285faedcb40e0c3275132293f242" +"checksum proc-macro-error-attr 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d175bef481c7902e63e3165627123fff3502f06ac043d3ef42d08c1246da9253" "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" "checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" "checksum pwasm-utils 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" @@ -3365,27 +3241,23 @@ dependencies = [ "checksum regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8" "checksum regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06" "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" -"checksum ring 0.16.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6747f8da1f2b1fabbee1aaa4eb8a11abf9adef0bf58a41cee45db5d59cecdfac" +"checksum ring 0.16.11 (registry+https://github.com/rust-lang/crates.io-index)" = "741ba1704ae21999c00942f9f5944f801e977f54302af346b596287599ad1862" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" "checksum rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rustls 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" "checksum rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6" "checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" -"checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7" "checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" "checksum schnorrkel 0.8.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eacd8381b3c37840c9c9f40472af529e49975bdcbc24f83c31059fd6539023d3" -"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" +"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" -"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" "checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" -"checksum serde_json 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "eab8f15f15d6c41a154c1b128a22f2dfabe350ef53c40953d84e36155c91192b" +"checksum serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" @@ -3393,28 +3265,28 @@ dependencies = [ "checksum smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" "checksum soketto 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c9dab3f95c9ebdf3a88268c19af668f637a3c5039c2c56ff2d40b1b2d64a25b" "checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" -"checksum sp-api 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-api-proc-macro 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-application-crypto 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-arithmetic 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-core 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-debug-derive 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-externalities 0.8.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-inherents 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-io 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-keyring 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-panic-handler 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-rpc 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-runtime 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-runtime-interface 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-runtime-interface-proc-macro 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-state-machine 0.8.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-std 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-storage 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-transaction-pool 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-trie 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-version 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" -"checksum sp-wasm-interface 2.0.0 (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-api 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-api-proc-macro 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-application-crypto 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-arithmetic 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-debug-derive 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-externalities 0.8.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-inherents 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-io 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-keyring 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-panic-handler 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-rpc 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-runtime 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-runtime-interface 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-runtime-interface-proc-macro 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-state-machine 0.8.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-storage 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-transaction-pool 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-trie 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-version 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" +"checksum sp-wasm-interface 2.0.0-dev (git+https://github.com/paritytech/substrate/)" = "" "checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" "checksum static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" @@ -3426,30 +3298,28 @@ dependencies = [ "checksum substrate-subxt 0.4.0 (git+https://github.com/paritytech/substrate-subxt/?rev=b7565ff435b9499ca1ff4dad519009e94a13111c)" = "" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" "checksum subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c65d530b10ccaeac294f349038a597e435b18fb456aadd0840a623f83b9e941" -"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" +"checksum syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a0294dc449adc58bb6592fff1a23d3e5e6e235afc6a0ffca2657d19e7bbffe5" "checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" "checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thiserror 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "205684fd018ca14432b12cce6ea3d46763311a571c3d294e71ba3f01adcf1aad" -"checksum thiserror-impl 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "57e4d2e50ca050ed44fb58309bdce3efa79948f84f9993ad1978de5eebdce5a7" +"checksum thiserror 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ee14bf8e6767ab4c687c9e8bc003879e042a96fd67a3ba5934eadb6536bef4db" +"checksum thiserror-impl 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "a7b51e1fbc44b5a0840be594fbc0f960be09050f2617e61e6aa43bef97cd3ef4" "checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c1c5676413eaeb1ea35300a0224416f57abc3bd251657e0fafc12c47ff98c060" +"checksum tiny-bip39 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1cd1fb03fe8e07d17cd851a624a9fff74642a997b67fbd1ccd77533241640d92" "checksum tiny-keccak 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2953ca5148619bc99695c1274cb54c5275bbb913c6adad87e72eaf8db9787f69" "checksum tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8fdd17989496f49cdc57978c96f0c9fe5e4a58a8bddc6813c449a4624f6a030b" "checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" -"checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" "checksum tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" "checksum tracing 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e213bd24252abeb86a0b7060e02df677d367ce6cb772cef17e9214b8390a8d3" "checksum tracing-attributes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04cfd395def5a60236e187e1ff905cb55668a59f29928dec05e6e1b1fd2ac1f3" "checksum tracing-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "13a46f11e372b8bd4b4398ea54353412fdd7fd42a8370c7e543e218cf7661978" -"checksum trie-db 0.19.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a0d747ae5b6f078df7e46477fcc7df66df9eb4f27a031cf4a7c890a8dd03d8e6" -"checksum trie-root 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0b779f7c1c8fe9276365d9d5be5c4b5adeacf545117bb3f64c974305789c5c0b" +"checksum trie-db 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de9222c50cc325855621271157c973da27a0dcd26fa06f8edf81020bd2333df0" +"checksum trie-root 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "652931506d2c1244d7217a70b99f56718a7b4161b37f04e7cd868072a99f68cd" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" "checksum twox-hash 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bfd5b7557925ce778ff9b9ef90e3ade34c524b5ff10e239c69a42d546d2af56" "checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" @@ -3459,7 +3329,6 @@ dependencies = [ "checksum unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" "checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" "checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60369ef7a31de49bcb3f6ca728d4ba7300d9a1658f94c727d4cab8c8d9f4aece" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" @@ -3469,7 +3338,6 @@ dependencies = [ "checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" "checksum wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3c5c5c1286c6e578416982609f47594265f9d489f9b836157d403ad605a46693" "checksum wabt-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "af5d153dc96aad7dc13ab90835b892c69867948112d95299e522d370c4e13a08" -"checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff" "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" "checksum want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" @@ -3482,7 +3350,7 @@ dependencies = [ "checksum wasmi 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bf617d864d25af3587aa745529f7aaa541066c876d57e050c0d0c85c61c92aff" "checksum wasmi-validation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea78c597064ba73596099281e2f4cfc019075122a65cdda3205af94f0b264d93" "checksum web-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "aaf97caf6aa8c2b1dac90faf0db529d9d63c93846cca4911856f78a83cebf53b" -"checksum webpki 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d7e664e770ac0110e2384769bcc59ed19e329d81f555916a6e072714957b81b4" +"checksum webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1f50e1972865d6b1adb54167d1c8ed48606004c2c9d0ea5f1eeb34d95e863ef" "checksum webpki-roots 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a262ae37dd9d60f60dd473d1158f9fbebf110ba7b6a5051c8160460f6043718b" "checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164" "checksum which 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5475d47078209a02e60614f7ba5e645ef3ed60f771920ac1906d7c1cc65024c8" -- GitLab From 81db4732d670380a943ad36224e1e4f9aec34536 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 12:37:21 +0000 Subject: [PATCH 75/98] Rename manifest to workspace --- src/cmd/build.rs | 2 +- src/cmd/metadata.rs | 4 ++-- src/main.rs | 2 +- src/util.rs | 2 +- src/{manifest.rs => workspace.rs} | 0 5 files changed, 5 insertions(+), 5 deletions(-) rename src/{manifest.rs => workspace.rs} (100%) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 95528de1..7a148cce 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -22,7 +22,7 @@ use std::{ }; use crate::{ - manifest::{ManifestPath, Workspace}, + workspace::{ManifestPath, Workspace}, util, }; use anyhow::{Context, Result}; diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 581ca6b0..5daa42af 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -15,7 +15,7 @@ // along with ink!. If not, see . use crate::{ - manifest::{ManifestPath, Workspace}, + workspace::{ManifestPath, Workspace}, util, }; use anyhow::Result; @@ -65,7 +65,7 @@ pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath) -> Result. mod cmd; -mod manifest; +mod workspace; mod util; #[cfg(feature = "extrinsics")] diff --git a/src/util.rs b/src/util.rs index 367c2d6a..7beabb30 100644 --- a/src/util.rs +++ b/src/util.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use crate::manifest::ManifestPath; +use crate::workspace::ManifestPath; use anyhow::{Context, Result}; use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand, PackageId}; use rustc_version::Channel; diff --git a/src/manifest.rs b/src/workspace.rs similarity index 100% rename from src/manifest.rs rename to src/workspace.rs -- GitLab From a3af59660d0a0c78d7552ee7c5cc71272320f14f Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 12:44:23 +0000 Subject: [PATCH 76/98] Fix test compilation and fmt --- src/cmd/build.rs | 8 +++++--- src/cmd/metadata.rs | 4 ++-- src/main.rs | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 7a148cce..f222b4e2 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -22,8 +22,8 @@ use std::{ }; use crate::{ - workspace::{ManifestPath, Workspace}, util, + workspace::{ManifestPath, Workspace}, }; use anyhow::{Context, Result}; use cargo_metadata::Package; @@ -296,13 +296,15 @@ pub(crate) fn execute_build(manifest_path: ManifestPath) -> Result { #[cfg(feature = "test-ci-only")] #[cfg(test)] mod tests { - use crate::{cmd::execute_new, util::tests::with_tmp_dir}; + use crate::{cmd::execute_new, util::tests::with_tmp_dir, workspace::ManifestPath}; #[test] fn build_template() { with_tmp_dir(|path| { execute_new("new_project", Some(path)).expect("new project creation failed"); - super::execute_build(Some(&path.join("new_project"))).expect("build failed"); + let manifest_path = + ManifestPath::new(&path.join("new_project").join("Cargo.toml")).unwrap(); + super::execute_build(manifest_path).expect("build failed"); }); } } diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 5daa42af..8fef1ec5 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -15,8 +15,8 @@ // along with ink!. If not, see . use crate::{ - workspace::{ManifestPath, Workspace}, util, + workspace::{ManifestPath, Workspace}, }; use anyhow::Result; @@ -65,8 +65,8 @@ pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath) -> Result. mod cmd; -mod workspace; mod util; +mod workspace; #[cfg(feature = "extrinsics")] use sp_core::{crypto::Pair, sr25519, H256}; -- GitLab From 0310ce99700e9989d44617e9be61843ba4e6b6a8 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 12:47:20 +0000 Subject: [PATCH 77/98] Fix link --- src/util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.rs b/src/util.rs index 7beabb30..b5f0b9d2 100644 --- a/src/util.rs +++ b/src/util.rs @@ -45,7 +45,7 @@ pub fn assert_channel() -> Result<()> { anyhow::bail!( "cargo-contract cannot build using the {:?} channel. \ Switch to nightly. \ - See https://github.com/paritytech/cargo-contract/tree/aj-xargo#build-requires-the-nightly-toolchain", + See https://github.com/paritytech/cargo-contract#build-requires-the-nightly-toolchain", format!("{:?}", meta.channel).to_lowercase(), ); } -- GitLab From 7cf71c7541d0072a5f85641ce0411e33f5ef8380 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 12:59:48 +0000 Subject: [PATCH 78/98] Add prerequisites section to readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 68934523..190b9410 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,11 @@ A small CLI tool for helping setting up and managing WebAssembly smart contracts ## Installation +### Prerequisites + +- **rust-src**: `rustup component add rust-src` +- **wasm-opt**: https://github.com/WebAssembly/binaryen#tools + `cargo install --git https://github.com/paritytech/cargo-contract cargo-contract --force` Use the --force to ensure you are updated to the most recent cargo-contract version. -- GitLab From c5eba00fb01de1cbf6da2594c71ae8e33d6d66a1 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 13:06:36 +0000 Subject: [PATCH 79/98] Remove rust-src component (added to image) --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 119a5531..f1fdf8e8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,7 +40,6 @@ variables: # global RUSTFLAGS overrides the linker args so this way is better to pass the flags - printf '[build]\nrustflags = ["-C", "link-dead-code"]\n' | tee ${CARGO_HOME}/config - sccache -s - - rustup component add rust-src only: - master - /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 -- GitLab From e8b227de28543c67cb8497b9fae70c9d3d290cb6 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 13:09:29 +0000 Subject: [PATCH 80/98] Fix deploy build --- src/cmd/deploy.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/deploy.rs b/src/cmd/deploy.rs index 64ba155f..733a93cc 100644 --- a/src/cmd/deploy.rs +++ b/src/cmd/deploy.rs @@ -28,7 +28,7 @@ use crate::{cmd::build, ExtrinsicOpts}; fn load_contract_code(path: Option<&PathBuf>) -> Result> { let contract_wasm_path = match path { Some(path) => path.clone(), - None => build::collect_crate_metadata(path)?.dest_wasm, + None => build::collect_crate_metadata(&Default::default())?.dest_wasm, }; log::info!("Contract code path: {}", contract_wasm_path.display()); let mut data = Vec::new(); -- GitLab From 4b827560c05bcf87e1743ce99a3dd36070597aaf Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 14:26:10 +0000 Subject: [PATCH 81/98] Use builder like method for amending root manifest --- src/cmd/build.rs | 12 ++++++------ src/cmd/metadata.rs | 17 ++++++++++------- src/workspace.rs | 14 ++++++++++---- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index f222b4e2..6b408eae 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -129,12 +129,12 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { Ok(()) }; - let mut workspace = - Workspace::new(&crate_metadata.cargo_meta, &crate_metadata.root_package.id)?; - workspace - .root_package_manifest_mut() - .with_removed_crate_type("rlib")?; - workspace.using_temp(xbuild)?; + Workspace::new(&crate_metadata.cargo_meta, &crate_metadata.root_package.id)? + .with_root_package_manifest(|manifest| { + manifest.with_removed_crate_type("rlib")?; + Ok(()) + })? + .using_temp(xbuild)?; Ok(()) } diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 8fef1ec5..47ce6b86 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -29,11 +29,7 @@ pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath) -> Result Result &mut Manifest { - self.members + pub fn with_root_package_manifest(&mut self, f: F) -> Result<&mut Self> + where + F: FnOnce(&mut Manifest) -> Result<()>, + { + let root_package_manifest = self + .members .get_mut(&self.root_package) .map(|(_, m)| m) - .expect("The root package should be a workspace member") + .expect("The root package should be a workspace member"); + f(root_package_manifest)?; + Ok(self) } /// Writes the amended manifests to the `target` directory, retaining the workspace directory -- GitLab From ca3a8e91dd229eec984cc0828a80c421603abafb Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 16:23:10 +0000 Subject: [PATCH 82/98] List installed components --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f1fdf8e8..a0191887 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,6 +34,7 @@ variables: - cargo -vV - rustc -vV - rustup show + - rustup component list - bash --version - mkdir -p ${CARGO_HOME}; touch ${CARGO_HOME}/config - mkdir -p ${CARGO_TARGET_DIR} -- GitLab From bde09c79d599d3cff661f152647a8942fcd398db Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 16:31:24 +0000 Subject: [PATCH 83/98] Show active-toolchain and whether rust-src installed --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a0191887..445c7b12 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,7 +34,8 @@ variables: - cargo -vV - rustc -vV - rustup show - - rustup component list + - rustup show active-toolchain + - rustup component list | grep rust-src - bash --version - mkdir -p ${CARGO_HOME}; touch ${CARGO_HOME}/config - mkdir -p ${CARGO_TARGET_DIR} -- GitLab From f4fff3ab0415d21a6d1fb52d2238e868246a645b Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 16:41:48 +0000 Subject: [PATCH 84/98] Install nightly rust-src (temporary) --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 445c7b12..563d271d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,6 +31,7 @@ variables: .docker-env: &docker-env image: ${REGISTRY}/contracts-ci-linux:latest before_script: + - rustup component add rust-src rustfmt --toolchain nightly - cargo -vV - rustc -vV - rustup show -- GitLab From 5aae77bb89ca3263b8d9a4b8dd05cd1ae88e3b0b Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 17:28:26 +0000 Subject: [PATCH 85/98] Fix metadata test --- src/cmd/metadata.rs | 31 ++++++++++++++++++------------- src/util.rs | 8 ++++++-- src/workspace.rs | 5 +++++ 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 47ce6b86..39b07e6b 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -20,6 +20,8 @@ use crate::{ }; use anyhow::Result; +const METADATA_FILE: &str = "metadata.json"; + /// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. /// /// It does so by invoking build by cargo and then post processing the final binary. @@ -29,21 +31,25 @@ pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath) -> Result Result<()> { + let target_dir_arg = format!("--target-dir={}", target_dir.to_string_lossy()); util::invoke_cargo( "run", &[ "--package", "abi-gen", - &manifest_path.cargo_arg(), - &target_dir, + &tmp_manifest_path.cargo_arg(), + &target_dir_arg, "--release", // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! ], + working_dir, ) }; @@ -54,12 +60,9 @@ pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath) -> Result Result<(CargoMetadata, PackageId)> { @@ -53,13 +53,17 @@ pub fn assert_channel() -> Result<()> { } /// Run cargo with the supplied args -pub(crate) fn invoke_cargo(command: &str, args: I) -> Result<()> +pub(crate) fn invoke_cargo(command: &str, args: I, working_dir: Option

) -> Result<()> where I: IntoIterator + std::fmt::Debug, S: AsRef, + P: AsRef, { let cargo = std::env::var("CARGO").unwrap_or("cargo".to_string()); let mut cmd = Command::new(cargo); + if let Some(path) = working_dir { + cmd.current_dir(path); + } cmd.arg(command); cmd.args(args); diff --git a/src/workspace.rs b/src/workspace.rs index 01cc1b6d..82024c34 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -50,6 +50,11 @@ impl ManifestPath { pub fn cargo_arg(&self) -> String { format!("--manifest-path={}", self.path.to_string_lossy()) } + + /// The directory path of the manifest path + pub fn directory(&self) -> &Path { + self.path.parent().expect("Manifest path is a file so has a parent directory") + } } impl TryFrom<&PathBuf> for ManifestPath { -- GitLab From a3b0e6db63902b18ed79448b72bea58a18027fc0 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 17:31:21 +0000 Subject: [PATCH 86/98] Fmt --- src/cmd/metadata.rs | 8 ++++++-- src/workspace.rs | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 39b07e6b..8f9d0c34 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -82,13 +82,17 @@ mod tests { execute_new("new_project", Some(path)).expect("new project creation failed"); let working_dir = path.join("new_project"); let manifest_path = ManifestPath::new(working_dir.join("Cargo.toml")).unwrap(); - let message = execute_generate_metadata(manifest_path).expect("generate metadata failed"); + let message = + execute_generate_metadata(manifest_path).expect("generate metadata failed"); println!("{}", message); let mut abi_file = working_dir; abi_file.push("target"); abi_file.push("metadata.json"); - assert!(abi_file.exists(), format!("Missing metadata file '{}'", abi_file.display())) + assert!( + abi_file.exists(), + format!("Missing metadata file '{}'", abi_file.display()) + ) }); } } diff --git a/src/workspace.rs b/src/workspace.rs index 82024c34..62fd2f84 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -53,7 +53,9 @@ impl ManifestPath { /// The directory path of the manifest path pub fn directory(&self) -> &Path { - self.path.parent().expect("Manifest path is a file so has a parent directory") + self.path + .parent() + .expect("Manifest path is a file so has a parent directory") } } -- GitLab From 8a2cfeb990f7bf8a74d76558f993d0cc7bea5630 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 24 Feb 2020 17:33:29 +0000 Subject: [PATCH 87/98] Remove manual install of rust-src and diagnostics --- .gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 563d271d..f1fdf8e8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,12 +31,9 @@ variables: .docker-env: &docker-env image: ${REGISTRY}/contracts-ci-linux:latest before_script: - - rustup component add rust-src rustfmt --toolchain nightly - cargo -vV - rustc -vV - rustup show - - rustup show active-toolchain - - rustup component list | grep rust-src - bash --version - mkdir -p ${CARGO_HOME}; touch ${CARGO_HOME}/config - mkdir -p ${CARGO_TARGET_DIR} -- GitLab From fb6722ad288ea1594f44cdb305a4c8f68f1d44b2 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 25 Feb 2020 10:24:05 +0000 Subject: [PATCH 88/98] More doc comments --- src/workspace.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/workspace.rs b/src/workspace.rs index 62fd2f84..33de9085 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -79,9 +79,7 @@ impl AsRef for ManifestPath { } } -/// Create an amended copy of `Cargo.toml`. -/// -/// Relative paths are rewritten to absolute paths. +/// Create, amend and save a copy of the specified `Cargo.toml`. pub struct Manifest { path: ManifestPath, toml: value::Table, @@ -273,6 +271,12 @@ fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { .any(|v| v.as_str().map_or(false, |s| s == crate_type)) } +/// Make a copy of a cargo workspace, maintaing only with the directory structure and manifest +/// files. Relative paths to source files and non-workspace dependencies are rewritten to absolute +/// paths to the original locations. +/// +/// This allows custom amendments to be made to the manifest files without editing the originals +/// directly. pub struct Workspace { workspace_root: PathBuf, root_package: PackageId, -- GitLab From 5bba2f161102ec0829a6a32c2ad94636f503dce5 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 25 Feb 2020 11:26:54 +0000 Subject: [PATCH 89/98] Add verbosity flags --- src/cmd/build.rs | 15 +++++++++++---- src/main.rs | 40 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 6b408eae..f4b08c84 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -24,6 +24,7 @@ use std::{ use crate::{ util, workspace::{ManifestPath, Workspace}, + Verbosity, }; use anyhow::{Context, Result}; use cargo_metadata::Package; @@ -93,7 +94,7 @@ pub fn collect_crate_metadata(manifest_path: &ManifestPath) -> Result Result<()> { +fn build_cargo_project(crate_metadata: &CrateMetadata, verbosity: Option) -> Result<()> { util::assert_channel()?; // set RUSTFLAGS, read from environment var by cargo-xbuild @@ -102,10 +103,16 @@ fn build_cargo_project(crate_metadata: &CrateMetadata) -> Result<()> { "-C link-arg=-z -C link-arg=stack-size=65536 -C link-arg=--import-memory", ); + let verbosity = verbosity.map(|v| { + match v { + Verbosity::Verbose => xargo_lib::Verbosity::Verbose, + Verbosity::Quiet => xargo_lib::Verbosity::Quiet, + } + }); + let xbuild = |manifest_path: &ManifestPath| { let manifest_path = Some(manifest_path); let target = Some("wasm32-unknown-unknown"); - let verbosity = Some(xargo_lib::Verbosity::Verbose); let target_dir = crate_metadata.target_dir(); let other_args = [ "--no-default-features", @@ -261,7 +268,7 @@ fn optimize_wasm(crate_metadata: &CrateMetadata) -> Result<()> { /// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. /// /// It does so by invoking build by cargo and then post processing the final binary. -pub(crate) fn execute_build(manifest_path: ManifestPath) -> Result { +pub(crate) fn execute_build(manifest_path: ManifestPath, verbosity: Option) -> Result { println!( " {} {}", "[1/4]".bold(), @@ -273,7 +280,7 @@ pub(crate) fn execute_build(manifest_path: ManifestPath) -> Result { "[2/4]".bold(), "Building cargo project".bright_green().bold() ); - build_cargo_project(&crate_metadata)?; + build_cargo_project(&crate_metadata, verbosity)?; println!( " {} {}", "[3/4]".bold(), diff --git a/src/main.rs b/src/main.rs index a4d0c59b..c743bd24 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,9 +20,12 @@ mod workspace; #[cfg(feature = "extrinsics")] use sp_core::{crypto::Pair, sr25519, H256}; -use std::path::PathBuf; +use std::{ + convert::{TryFrom, TryInto}, + path::PathBuf +}; -use anyhow::Result; +use anyhow::{Error, Result}; use colored::Colorize; use structopt::{clap, StructOpt}; @@ -86,6 +89,32 @@ impl ExtrinsicOpts { } } +#[derive(Debug, StructOpt)] +struct VerbosityFlags { + #[structopt(long)] + quiet: bool, + #[structopt(long)] + verbose: bool, +} + +enum Verbosity { + Quiet, + Verbose, +} + +impl TryFrom<&VerbosityFlags> for Option { + type Error = Error; + + fn try_from(value: &VerbosityFlags) -> Result { + match (value.quiet, value.verbose) { + (false, false) => Ok(None), + (true, false) => Ok(Some(Verbosity::Quiet)), + (false, true) => Ok(Some(Verbosity::Verbose)), + (true, true) => anyhow::bail!("Cannot pass both --quiet and --verbose flags") + } + } +} + #[derive(Debug, StructOpt)] enum Command { /// Setup and create a new smart contract project @@ -99,7 +128,10 @@ enum Command { }, /// Compiles the smart contract #[structopt(name = "build")] - Build {}, + Build { + #[structopt(flatten)] + verbosity: VerbosityFlags + }, /// Generate contract metadata artifacts #[structopt(name = "generate-metadata")] GenerateMetadata {}, @@ -162,7 +194,7 @@ fn main() { fn exec(cmd: Command) -> Result { match &cmd { Command::New { name, target_dir } => cmd::execute_new(name, target_dir.as_ref()), - Command::Build {} => cmd::execute_build(Default::default()), + Command::Build { verbosity} => cmd::execute_build(Default::default(), verbosity.try_into()?), Command::GenerateMetadata {} => cmd::execute_generate_metadata(Default::default()), Command::Test {} => Err(anyhow::anyhow!("Command unimplemented")), #[cfg(feature = "extrinsics")] -- GitLab From c73dab7e6ef0f22b9e1c962967d06e56338b802c Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 25 Feb 2020 11:45:32 +0000 Subject: [PATCH 90/98] Add verbosity flags to metadata command --- src/cmd/metadata.rs | 4 +++- src/main.rs | 7 +++++-- src/util.rs | 13 +++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 8f9d0c34..123e365e 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -17,6 +17,7 @@ use crate::{ util, workspace::{ManifestPath, Workspace}, + Verbosity, }; use anyhow::Result; @@ -25,7 +26,7 @@ const METADATA_FILE: &str = "metadata.json"; /// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. /// /// It does so by invoking build by cargo and then post processing the final binary. -pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath) -> Result { +pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath, verbosity: Option) -> Result { util::assert_channel()?; println!(" Generating metadata"); @@ -50,6 +51,7 @@ pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath) -> Result Result { match &cmd { Command::New { name, target_dir } => cmd::execute_new(name, target_dir.as_ref()), Command::Build { verbosity} => cmd::execute_build(Default::default(), verbosity.try_into()?), - Command::GenerateMetadata {} => cmd::execute_generate_metadata(Default::default()), + Command::GenerateMetadata { verbosity } => cmd::execute_generate_metadata(Default::default(), verbosity.try_into()?), Command::Test {} => Err(anyhow::anyhow!("Command unimplemented")), #[cfg(feature = "extrinsics")] Command::Deploy { diff --git a/src/util.rs b/src/util.rs index ff13df00..03299744 100644 --- a/src/util.rs +++ b/src/util.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use crate::workspace::ManifestPath; +use crate::{ + workspace::ManifestPath, + Verbosity, +}; use anyhow::{Context, Result}; use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand, PackageId}; use rustc_version::Channel; @@ -53,7 +56,7 @@ pub fn assert_channel() -> Result<()> { } /// Run cargo with the supplied args -pub(crate) fn invoke_cargo(command: &str, args: I, working_dir: Option

) -> Result<()> +pub(crate) fn invoke_cargo(command: &str, args: I, working_dir: Option

, verbosity: Option) -> Result<()> where I: IntoIterator + std::fmt::Debug, S: AsRef, @@ -64,8 +67,14 @@ where if let Some(path) = working_dir { cmd.current_dir(path); } + cmd.arg(command); cmd.args(args); + match verbosity { + Some(Verbosity::Quiet) => cmd.arg("--quiet"), + Some(Verbosity::Verbose) => cmd.arg("--verbose"), + None => { &mut cmd }, + }; let status = cmd .status() -- GitLab From 6579826c7c6a3d33809c9d08812ac3f8c419584e Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 25 Feb 2020 14:37:31 +0000 Subject: [PATCH 91/98] Fix working dir for generate-metadata --- src/cmd/metadata.rs | 3 +-- src/util.rs | 1 + src/workspace.rs | 21 ++++++++++++--------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 123e365e..913e2be8 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -36,7 +36,6 @@ pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath, verbosity: let out_path_display = format!("{}", out_path.display()); let target_dir = metadata.target_directory.clone(); - let working_dir = Some(manifest_path.directory()); let generate_metadata = move |tmp_manifest_path: &ManifestPath| -> Result<()> { let target_dir_arg = format!("--target-dir={}", target_dir.to_string_lossy()); @@ -50,7 +49,7 @@ pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath, verbosity: "--release", // "--no-default-features", // Breaks builds for MacOS (linker errors), we should investigate this issue asap! ], - working_dir, + manifest_path.directory(), verbosity, ) }; diff --git a/src/util.rs b/src/util.rs index 03299744..f760c294 100644 --- a/src/util.rs +++ b/src/util.rs @@ -65,6 +65,7 @@ where let cargo = std::env::var("CARGO").unwrap_or("cargo".to_string()); let mut cmd = Command::new(cargo); if let Some(path) = working_dir { + log::debug!("Setting cargo working dir to '{}'", path.as_ref().display()); cmd.current_dir(path); } diff --git a/src/workspace.rs b/src/workspace.rs index 33de9085..9b272dea 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -51,11 +51,16 @@ impl ManifestPath { format!("--manifest-path={}", self.path.to_string_lossy()) } - /// The directory path of the manifest path - pub fn directory(&self) -> &Path { - self.path - .parent() - .expect("Manifest path is a file so has a parent directory") + /// The directory path of the manifest path. + /// + /// Returns `None` if the path is just the plain file name `Cargo.toml` + pub fn directory(&self) -> Option<&Path> { + let just_a_file_name = self.path.iter().collect::>() == vec![Path::new(MANIFEST_FILE)]; + if !just_a_file_name { + self.path.parent() + } else { + None + } } } @@ -257,10 +262,8 @@ impl Manifest { } let updated_toml = toml::to_string(&self.toml)?; - fs::write(&manifest_path, updated_toml).context(format!( - "Writing updated manifest to '{}'", - manifest_path.display() - ))?; + log::debug!("Writing updated manifest to '{}'", manifest_path.display()); + fs::write(&manifest_path, updated_toml)?; Ok(()) } } -- GitLab From 848197a40cf47986044728598c137a3379d4978a Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 25 Feb 2020 14:40:26 +0000 Subject: [PATCH 92/98] Add verbosity to tests --- src/cmd/build.rs | 2 +- src/cmd/metadata.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index f4b08c84..d35443ae 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -311,7 +311,7 @@ mod tests { execute_new("new_project", Some(path)).expect("new project creation failed"); let manifest_path = ManifestPath::new(&path.join("new_project").join("Cargo.toml")).unwrap(); - super::execute_build(manifest_path).expect("build failed"); + super::execute_build(manifest_path, None).expect("build failed"); }); } } diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 913e2be8..9a8594b4 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -84,7 +84,7 @@ mod tests { let working_dir = path.join("new_project"); let manifest_path = ManifestPath::new(working_dir.join("Cargo.toml")).unwrap(); let message = - execute_generate_metadata(manifest_path).expect("generate metadata failed"); + execute_generate_metadata(manifest_path, None).expect("generate metadata failed"); println!("{}", message); let mut abi_file = working_dir; -- GitLab From 6c7a8cd2bc587ee84d0d866f62f748e55a3a53ce Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 25 Feb 2020 15:03:49 +0000 Subject: [PATCH 93/98] Add verbosity to tests --- src/cmd/build.rs | 13 +++++++------ src/cmd/metadata.rs | 5 ++++- src/main.rs | 16 ++++++++++------ src/util.rs | 14 ++++++++------ src/workspace.rs | 3 ++- 5 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/cmd/build.rs b/src/cmd/build.rs index d35443ae..20671fff 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -103,11 +103,9 @@ fn build_cargo_project(crate_metadata: &CrateMetadata, verbosity: Option xargo_lib::Verbosity::Verbose, - Verbosity::Quiet => xargo_lib::Verbosity::Quiet, - } + let verbosity = verbosity.map(|v| match v { + Verbosity::Verbose => xargo_lib::Verbosity::Verbose, + Verbosity::Quiet => xargo_lib::Verbosity::Quiet, }); let xbuild = |manifest_path: &ManifestPath| { @@ -268,7 +266,10 @@ fn optimize_wasm(crate_metadata: &CrateMetadata) -> Result<()> { /// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. /// /// It does so by invoking build by cargo and then post processing the final binary. -pub(crate) fn execute_build(manifest_path: ManifestPath, verbosity: Option) -> Result { +pub(crate) fn execute_build( + manifest_path: ManifestPath, + verbosity: Option, +) -> Result { println!( " {} {}", "[1/4]".bold(), diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 9a8594b4..87d5cb2e 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -26,7 +26,10 @@ const METADATA_FILE: &str = "metadata.json"; /// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. /// /// It does so by invoking build by cargo and then post processing the final binary. -pub(crate) fn execute_generate_metadata(manifest_path: ManifestPath, verbosity: Option) -> Result { +pub(crate) fn execute_generate_metadata( + manifest_path: ManifestPath, + verbosity: Option, +) -> Result { util::assert_channel()?; println!(" Generating metadata"); diff --git a/src/main.rs b/src/main.rs index bbef52d5..7bd4cf92 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,7 +22,7 @@ mod workspace; use sp_core::{crypto::Pair, sr25519, H256}; use std::{ convert::{TryFrom, TryInto}, - path::PathBuf + path::PathBuf, }; use anyhow::{Error, Result}; @@ -110,7 +110,7 @@ impl TryFrom<&VerbosityFlags> for Option { (false, false) => Ok(None), (true, false) => Ok(Some(Verbosity::Quiet)), (false, true) => Ok(Some(Verbosity::Verbose)), - (true, true) => anyhow::bail!("Cannot pass both --quiet and --verbose flags") + (true, true) => anyhow::bail!("Cannot pass both --quiet and --verbose flags"), } } } @@ -130,13 +130,13 @@ enum Command { #[structopt(name = "build")] Build { #[structopt(flatten)] - verbosity: VerbosityFlags + verbosity: VerbosityFlags, }, /// Generate contract metadata artifacts #[structopt(name = "generate-metadata")] GenerateMetadata { #[structopt(flatten)] - verbosity: VerbosityFlags + verbosity: VerbosityFlags, }, /// Test the smart contract off-chain #[structopt(name = "test")] @@ -197,8 +197,12 @@ fn main() { fn exec(cmd: Command) -> Result { match &cmd { Command::New { name, target_dir } => cmd::execute_new(name, target_dir.as_ref()), - Command::Build { verbosity} => cmd::execute_build(Default::default(), verbosity.try_into()?), - Command::GenerateMetadata { verbosity } => cmd::execute_generate_metadata(Default::default(), verbosity.try_into()?), + Command::Build { verbosity } => { + cmd::execute_build(Default::default(), verbosity.try_into()?) + } + Command::GenerateMetadata { verbosity } => { + cmd::execute_generate_metadata(Default::default(), verbosity.try_into()?) + } Command::Test {} => Err(anyhow::anyhow!("Command unimplemented")), #[cfg(feature = "extrinsics")] Command::Deploy { diff --git a/src/util.rs b/src/util.rs index f760c294..ba9c4ee6 100644 --- a/src/util.rs +++ b/src/util.rs @@ -14,10 +14,7 @@ // You should have received a copy of the GNU General Public License // along with ink!. If not, see . -use crate::{ - workspace::ManifestPath, - Verbosity, -}; +use crate::{workspace::ManifestPath, Verbosity}; use anyhow::{Context, Result}; use cargo_metadata::{Metadata as CargoMetadata, MetadataCommand, PackageId}; use rustc_version::Channel; @@ -56,7 +53,12 @@ pub fn assert_channel() -> Result<()> { } /// Run cargo with the supplied args -pub(crate) fn invoke_cargo(command: &str, args: I, working_dir: Option

, verbosity: Option) -> Result<()> +pub(crate) fn invoke_cargo( + command: &str, + args: I, + working_dir: Option

, + verbosity: Option, +) -> Result<()> where I: IntoIterator + std::fmt::Debug, S: AsRef, @@ -74,7 +76,7 @@ where match verbosity { Some(Verbosity::Quiet) => cmd.arg("--quiet"), Some(Verbosity::Verbose) => cmd.arg("--verbose"), - None => { &mut cmd }, + None => &mut cmd, }; let status = cmd diff --git a/src/workspace.rs b/src/workspace.rs index 9b272dea..29f40072 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -55,7 +55,8 @@ impl ManifestPath { /// /// Returns `None` if the path is just the plain file name `Cargo.toml` pub fn directory(&self) -> Option<&Path> { - let just_a_file_name = self.path.iter().collect::>() == vec![Path::new(MANIFEST_FILE)]; + let just_a_file_name = + self.path.iter().collect::>() == vec![Path::new(MANIFEST_FILE)]; if !just_a_file_name { self.path.parent() } else { -- GitLab From 24d085c39c8340af480cfaa1b6a5cd484d1bd886 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 25 Feb 2020 15:18:33 +0000 Subject: [PATCH 94/98] Make url optional and cargo update --- Cargo.lock | 206 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 4 +- 2 files changed, 105 insertions(+), 105 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4c54dc3..b8a3e73c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -496,9 +496,9 @@ name = "derive_more" version = "0.99.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -559,9 +559,9 @@ name = "failure_derive" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -590,7 +590,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "frame-metadata" version = "11.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", @@ -601,7 +601,7 @@ dependencies = [ [[package]] name = "frame-support" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "frame-metadata 11.0.0-dev (git+https://github.com/paritytech/substrate/)", @@ -625,40 +625,40 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "frame-support-procedural-tools 2.0.0-dev (git+https://github.com/paritytech/substrate/)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "frame-support-procedural-tools" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "frame-support-procedural-tools-derive 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "frame-support-procedural-tools-derive" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "frame-system" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "frame-support 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -748,9 +748,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1019,9 +1019,9 @@ name = "impl-trait-for-tuples" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1061,7 +1061,7 @@ dependencies = [ [[package]] name = "jsonrpsee" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" +source = "git+https://github.com/paritytech/jsonrpsee/#f0f9d4b23ec7694f4de1a360200d9887bf31436d" dependencies = [ "async-std 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1077,7 +1077,7 @@ dependencies = [ [[package]] name = "jsonrpsee-core" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" +source = "git+https://github.com/paritytech/jsonrpsee/#f0f9d4b23ec7694f4de1a360200d9887bf31436d" dependencies = [ "bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1093,7 +1093,7 @@ dependencies = [ [[package]] name = "jsonrpsee-http" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" +source = "git+https://github.com/paritytech/jsonrpsee/#f0f9d4b23ec7694f4de1a360200d9887bf31436d" dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1112,18 +1112,18 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" +source = "git+https://github.com/paritytech/jsonrpsee/#f0f9d4b23ec7694f4de1a360200d9887bf31436d" dependencies = [ "Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpsee-server-utils" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" +source = "git+https://github.com/paritytech/jsonrpsee/#f0f9d4b23ec7694f4de1a360200d9887bf31436d" dependencies = [ "globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1135,7 +1135,7 @@ dependencies = [ [[package]] name = "jsonrpsee-ws" version = "1.0.0" -source = "git+https://github.com/paritytech/jsonrpsee/#0486b10c68423264ec159f239713460641df688d" +source = "git+https://github.com/paritytech/jsonrpsee/#f0f9d4b23ec7694f4de1a360200d9887bf31436d" dependencies = [ "async-std 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "async-tls 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1395,7 +1395,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pallet-indices" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "frame-support 2.0.0-dev (git+https://github.com/paritytech/substrate/)", "frame-system 2.0.0-dev (git+https://github.com/paritytech/substrate/)", @@ -1426,9 +1426,9 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1449,8 +1449,8 @@ name = "parity-util-mem-derive" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1520,9 +1520,9 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1557,9 +1557,9 @@ name = "pin-project-internal" version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1607,10 +1607,10 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-error-attr 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1618,10 +1618,10 @@ name = "proc-macro-error-attr" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1630,9 +1630,9 @@ name = "proc-macro-hack" version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1642,7 +1642,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro2" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1668,7 +1668,7 @@ name = "quote" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1907,9 +1907,9 @@ name = "rustversion" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1982,9 +1982,9 @@ name = "serde_derive" version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2057,7 +2057,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "sp-api" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2072,19 +2072,19 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-application-crypto" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2096,7 +2096,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "integer-sqrt 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2109,7 +2109,7 @@ dependencies = [ [[package]] name = "sp-core" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2149,17 +2149,17 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-externalities" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "environmental 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "sp-std 2.0.0-dev (git+https://github.com/paritytech/substrate/)", @@ -2169,7 +2169,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "derive_more 0.99.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2181,7 +2181,7 @@ dependencies = [ [[package]] name = "sp-io" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2199,7 +2199,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", @@ -2210,7 +2210,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "backtrace 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2219,7 +2219,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "sp-core 2.0.0-dev (git+https://github.com/paritytech/substrate/)", @@ -2228,7 +2228,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2248,7 +2248,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2262,19 +2262,19 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sp-state-machine" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2293,12 +2293,12 @@ dependencies = [ [[package]] name = "sp-std" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" [[package]] name = "sp-storage" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2309,7 +2309,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "derive_more 0.99.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2323,7 +2323,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "hash-db 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2337,7 +2337,7 @@ dependencies = [ [[package]] name = "sp-version" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2349,7 +2349,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate/#2406f796dc61d425f1a725db11390891d84865c6" +source = "git+https://github.com/paritytech/substrate/#71d10b4564d1ffcb74ee8058c76d7f279a8a3842" dependencies = [ "impl-trait-for-tuples 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2389,9 +2389,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-error 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2408,9 +2408,9 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2461,10 +2461,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2474,9 +2474,9 @@ name = "syn-mid" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2484,9 +2484,9 @@ name = "synstructure" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2541,9 +2541,9 @@ name = "thiserror-impl" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2634,7 +2634,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "tracing-attributes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tracing-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2643,12 +2643,12 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tracing-core" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2844,9 +2844,9 @@ dependencies = [ "bumpalo 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2864,9 +2864,9 @@ name = "wasm-bindgen-macro-support" version = "0.2.58" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2884,9 +2884,9 @@ dependencies = [ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3022,9 +3022,9 @@ name = "zeroize_derive" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3217,7 +3217,7 @@ dependencies = [ "checksum proc-macro-error-attr 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d175bef481c7902e63e3165627123fff3502f06ac043d3ef42d08c1246da9253" "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" "checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" +"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" "checksum pwasm-utils 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" @@ -3298,7 +3298,7 @@ dependencies = [ "checksum substrate-subxt 0.4.0 (git+https://github.com/paritytech/substrate-subxt/?rev=b7565ff435b9499ca1ff4dad519009e94a13111c)" = "" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" "checksum subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c65d530b10ccaeac294f349038a597e435b18fb456aadd0840a623f83b9e941" -"checksum syn 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a0294dc449adc58bb6592fff1a23d3e5e6e235afc6a0ffca2657d19e7bbffe5" +"checksum syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859" "checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" "checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" @@ -3317,7 +3317,7 @@ dependencies = [ "checksum tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" "checksum tracing 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e213bd24252abeb86a0b7060e02df677d367ce6cb772cef17e9214b8390a8d3" "checksum tracing-attributes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04cfd395def5a60236e187e1ff905cb55668a59f29928dec05e6e1b1fd2ac1f3" -"checksum tracing-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "13a46f11e372b8bd4b4398ea54353412fdd7fd42a8370c7e543e218cf7661978" +"checksum tracing-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" "checksum trie-db 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de9222c50cc325855621271157c973da27a0dcd26fa06f8edf81020bd2333df0" "checksum trie-root 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "652931506d2c1244d7217a70b99f56718a7b4161b37f04e7cd868072a99f68cd" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" diff --git a/Cargo.toml b/Cargo.toml index a2e692c9..06b7052f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,6 @@ cargo-xbuild = "0.5.26" rustc_version = "0.2.3" serde_json = "1.0" tempfile = "3.1.0" -url = "2.1.1" # dependencies for optional extrinsics feature async-std = { version = "1.5.0", optional = true } @@ -40,6 +39,7 @@ sp-core = { git = "https://github.com/paritytech/substrate/", package = "sp-core subxt = { git = "https://github.com/paritytech/substrate-subxt/", rev = "b7565ff435b9499ca1ff4dad519009e94a13111c", package = "substrate-subxt", optional = true } futures = { version = "0.3.2", optional = true } hex = { version = "0.4.0", optional = true } +url = { version = "2.1.1", optional = true } [build-dependencies] anyhow = "1.0.26" @@ -52,5 +52,5 @@ wabt = "0.9.2" [features] default = [] -extrinsics = ["sp-core", "subxt", "async-std", "futures", "hex"] +extrinsics = ["sp-core", "subxt", "async-std", "futures", "hex", "url"] test-ci-only = [] -- GitLab From 7897f8f06424538e2d2712bc193a891c5dfd39c3 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 25 Feb 2020 15:59:56 +0000 Subject: [PATCH 95/98] Remove bk file from gitignore --- template/.gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/template/.gitignore b/template/.gitignore index 5b286f57..8de8f877 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -7,6 +7,3 @@ # Remove Cargo.lock when creating an executable, leave it for libraries # More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock Cargo.lock - -# The backup file created by `cargo contract` when modiying the Cargo.toml for the build -.Cargo.toml.bk -- GitLab From 4db24be0777daa1f525e37a4dd8f76289779e457 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 25 Feb 2020 17:02:28 +0000 Subject: [PATCH 96/98] Bump version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b8a3e73c..5551e7e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -262,7 +262,7 @@ dependencies = [ [[package]] name = "cargo-contract" -version = "0.3.0" +version = "0.4.0" dependencies = [ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 06b7052f..6a73707c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-contract" -version = "0.3.0" +version = "0.4.0" authors = ["Parity Technologies "] build = "build.rs" edition = "2018" -- GitLab From 574ee00b54ce99becceb788f3be99bb78be3d71a Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 26 Feb 2020 09:24:24 +0000 Subject: [PATCH 97/98] Fix comment and formatting --- src/util.rs | 4 ++-- src/workspace.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util.rs b/src/util.rs index ba9c4ee6..4dd25602 100644 --- a/src/util.rs +++ b/src/util.rs @@ -44,8 +44,8 @@ pub fn assert_channel() -> Result<()> { Channel::Stable | Channel::Beta => { anyhow::bail!( "cargo-contract cannot build using the {:?} channel. \ - Switch to nightly. \ - See https://github.com/paritytech/cargo-contract#build-requires-the-nightly-toolchain", + Switch to nightly. \ + See https://github.com/paritytech/cargo-contract#build-requires-the-nightly-toolchain", format!("{:?}", meta.channel).to_lowercase(), ); } diff --git a/src/workspace.rs b/src/workspace.rs index 29f40072..37f74d8f 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -275,7 +275,7 @@ fn crate_type_exists(crate_type: &str, crate_types: &value::Array) -> bool { .any(|v| v.as_str().map_or(false, |s| s == crate_type)) } -/// Make a copy of a cargo workspace, maintaing only with the directory structure and manifest +/// Make a copy of a cargo workspace, maintaining only the directory structure and manifest /// files. Relative paths to source files and non-workspace dependencies are rewritten to absolute /// paths to the original locations. /// -- GitLab From ab40adb500f463a55b88b9ddc1154a5aabafa356 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 26 Feb 2020 09:41:39 +0000 Subject: [PATCH 98/98] Add CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..38923c68 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Version 0.4.0 (2020-02-26) + +- Minimize contract wasm binary size: + - Uses [`cargo-xbuild`](https://github.com/rust-osdev/cargo-xbuild) to build custom sysroot crates without panic string +bloat. + - Automatically removes the `rlib` crate type from `Cargo.toml`, removing redundant metadata. +- Removes requirement for linker args specified in `.cargo/config`. +- Added `--verbose` and `--quiet` flags for `build` and `generate-metadata` commands. -- GitLab