diff --git a/Cargo.toml b/Cargo.toml index 057effc733582c841190fc173d0d2a5372e18710..7768fbb8d340596ac33f1bcf2ea166008b0925f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,6 @@ version = "0.17.0" authors = ["Parity Technologies "] build = "build.rs" edition = "2021" -rust-version = "1.56.1" license = "GPL-3.0" readme = "README.md" diff --git a/build.rs b/build.rs index dc79aa3f4c229610682acb84e38d62c14b24d4b7..fd0c5fd31b064593df90a49c385f699c074d742a 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify @@ -95,7 +95,7 @@ fn zip_dir(src_dir: &Path, dst_file: &Path, method: CompressionMethod) -> Result let path = entry.path(); let mut name = path.strip_prefix(&src_dir)?.to_path_buf(); - // Cargo.toml files cause the folder to excluded from `cargo package` so need to be renamed + // `Cargo.toml` files cause the folder to excluded from `cargo package` so need to be renamed if name.file_name() == Some(OsStr::new("_Cargo.toml")) { name.set_file_name("Cargo.toml"); } diff --git a/metadata/Cargo.toml b/metadata/Cargo.toml index d2507a42b3db13b070f68a9e803f84021433aad8..c6ef91437b809ea868fea86e46138c6392830da0 100644 --- a/metadata/Cargo.toml +++ b/metadata/Cargo.toml @@ -3,7 +3,6 @@ name = "contract-metadata" version = "0.5.1" authors = ["Parity Technologies "] edition = "2021" -rust-version = "1.56.1" license = "Apache-2.0" readme = "README.md" @@ -11,7 +10,7 @@ repository = "https://github.com/paritytech/cargo-contract" documentation = "https://docs.rs/contract-metadata" homepage = "https://www.substrate.io/" description = "Library defining metadata for smart contracts on substrate" -keywords = ["parity", "blockchain"] +keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] include = ["Cargo.toml", "*.rs", "LICENSE"] [lib] diff --git a/metadata/byte_str.rs b/metadata/byte_str.rs index 7ebff356b568f1484724676325037d0312519d3d..020c2b2a40a257c7bc82ad2e1b0e513488bd255b 100644 --- a/metadata/byte_str.rs +++ b/metadata/byte_str.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify diff --git a/metadata/lib.rs b/metadata/lib.rs index 776c55ee033232f58befba32399fccf13d2a75d0..990b8339c8951774ed3c5dd8db0241d9326e2e65 100644 --- a/metadata/lib.rs +++ b/metadata/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify diff --git a/src/cmd/build.rs b/src/cmd/build.rs index 808822659a0e0c678051890f6ee1d2e551f3f6a7..8f40212f808ba6038333c49a2daf8978b5df58e3 100644 --- a/src/cmd/build.rs +++ b/src/cmd/build.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify @@ -54,13 +54,13 @@ pub(crate) struct ExecuteArgs { output_type: OutputType, } -/// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. +/// Executes build of the smart contract which produces a Wasm binary that is ready for deploying. /// /// It does so by invoking `cargo build` and then post processing the final binary. #[derive(Debug, StructOpt)] #[structopt(name = "build")] pub struct BuildCommand { - /// Path to the Cargo.toml of the contract to build + /// Path to the `Cargo.toml` of the contract to build #[structopt(long, parse(from_os_str))] manifest_path: Option, /// By default the contract is compiled with debug functionality @@ -91,7 +91,7 @@ pub struct BuildCommand { verbosity: VerbosityFlags, #[structopt(flatten)] unstable_options: UnstableOptions, - /// Number of optimization passes, passed as an argument to wasm-opt. + /// Number of optimization passes, passed as an argument to `wasm-opt`. /// /// - `0`: execute no optimization passes /// @@ -187,7 +187,7 @@ impl BuildCommand { #[derive(Debug, StructOpt)] #[structopt(name = "check")] pub struct CheckCommand { - /// Path to the Cargo.toml of the contract to build + /// Path to the `Cargo.toml` of the contract to build #[structopt(long, parse(from_os_str))] manifest_path: Option, #[structopt(flatten)] @@ -226,9 +226,9 @@ impl CheckCommand { /// to build the standard library with [`panic_immediate_abort`](https://github.com/johnthagen/min-sized-rust#remove-panic-string-formatting-with-panic_immediate_abort) /// which reduces the size of the Wasm binary by not including panic strings and formatting code. /// -/// # Cargo.toml optimizations +/// # `Cargo.toml` optimizations /// -/// The original Cargo.toml will be amended to remove the `rlib` crate type in order to minimize +/// The original `Cargo.toml` will be amended to remove the `rlib` crate type in order to minimize /// the final Wasm binary size. /// /// Preferred default `[profile.release]` settings will be added if they are missing, existing @@ -304,7 +304,7 @@ fn exec_cargo_for_wasm_target( Ok(()) } -/// Ensures the wasm memory import of a given module has the maximum number of pages. +/// Ensures the Wasm memory import of a given module has the maximum number of pages. /// /// Iterates over the import section, finds the memory import entry if any and adjusts the maximum /// limit. @@ -363,7 +363,7 @@ fn strip_exports(module: &mut Module) { } } -/// Load and parse a wasm file from disk. +/// Load and parse a Wasm file from disk. fn load_module>(path: P) -> Result { let path = path.as_ref(); parity_wasm::deserialize_file(path).context(format!( @@ -372,9 +372,9 @@ fn load_module>(path: P) -> Result { )) } -/// Performs required post-processing steps on the wasm artifact. +/// Performs required post-processing steps on the Wasm artifact. fn post_process_wasm(crate_metadata: &CrateMetadata) -> Result<()> { - // Deserialize wasm module from a file. + // Deserialize Wasm module from a file. let mut module = load_module(&crate_metadata.original_wasm).context("Loading of original wasm failed")?; @@ -393,9 +393,9 @@ fn post_process_wasm(crate_metadata: &CrateMetadata) -> Result<()> { Ok(()) } -/// Attempts to perform optional wasm optimization using `binaryen`. +/// Attempts to perform optional Wasm optimization using `binaryen`. /// -/// The intention is to reduce the size of bloated wasm binaries as a result of missing +/// The intention is to reduce the size of bloated Wasm binaries as a result of missing /// optimizations (or bugs?) between Rust and Wasm. fn optimize_wasm( crate_metadata: &CrateMetadata, @@ -439,7 +439,7 @@ fn optimize_wasm( /// The supplied `optimization_level` denotes the number of optimization passes, /// resulting in potentially a lot of time spent optimizing. /// -/// If successful, the optimized wasm is written to `dest_optimized`. +/// If successful, the optimized Wasm is written to `dest_optimized`. fn do_optimization( dest_wasm: &OsStr, dest_optimized: &OsStr, @@ -510,7 +510,7 @@ fn do_optimization( Ok(()) } -/// Checks if the wasm-opt binary under `wasm_opt_path` returns a version +/// Checks if the `wasm-opt` binary under `wasm_opt_path` returns a version /// compatible with `cargo-contract`. /// /// Currently this must be a version >= 99. @@ -643,7 +643,7 @@ pub fn assert_debug_mode_supported(ink_version: &Version) -> anyhow::Result<()> Ok(()) } -/// Executes build of the smart-contract which produces a wasm binary that is ready for deploying. +/// Executes build of the smart contract which produces a Wasm binary that is ready for deploying. /// /// It does so by invoking `cargo build` and then post processing the final binary. pub(crate) fn execute(args: ExecuteArgs) -> Result { diff --git a/src/cmd/extrinsics/call.rs b/src/cmd/extrinsics/call.rs index a67b324177e8dbd17934e655a31214f4eb8a05cc..59291544f92d63f9e9b6222d02e98359477222a0 100644 --- a/src/cmd/extrinsics/call.rs +++ b/src/cmd/extrinsics/call.rs @@ -157,9 +157,9 @@ impl CallCommand { } } -/// A struct that encodes RPC parameters required for a call to a smart-contract. +/// A struct that encodes RPC parameters required for a call to a smart contract. /// -/// Copied from pallet-contracts-rpc +/// Copied from `pallet-contracts-rpc`. #[derive(Serialize)] #[serde(rename_all = "camelCase")] pub struct RpcCallRequest { diff --git a/src/cmd/extrinsics/instantiate.rs b/src/cmd/extrinsics/instantiate.rs index c2acdd76a78b7c5731efbdbe8fc77b59de95b347..6068919d04fe3af80d80fcc5a610a81c3ccc3f9b 100644 --- a/src/cmd/extrinsics/instantiate.rs +++ b/src/cmd/extrinsics/instantiate.rs @@ -37,7 +37,7 @@ type ContractInstantiateResult = #[derive(Debug, StructOpt)] pub struct InstantiateCommand { - /// Path to wasm contract code, defaults to `./target/ink/.wasm`. + /// Path to Wasm contract code, defaults to `./target/ink/.wasm`. /// Use to instantiate contracts which have not yet been uploaded. /// If the contract has already been uploaded use `--code-hash` instead. #[structopt(parse(from_os_str))] @@ -302,7 +302,7 @@ impl<'a> Exec<'a> { } } -/// A struct that encodes RPC parameters required to instantiate a new smart-contract. +/// A struct that encodes RPC parameters required to instantiate a new smart contract. #[derive(Serialize)] #[serde(rename_all = "camelCase")] struct InstantiateRequest { @@ -315,13 +315,13 @@ struct InstantiateRequest { salt: Bytes, } -/// Reference to an existing code hash or a new wasm module. +/// Reference to an existing code hash or a new Wasm module. #[derive(Serialize)] #[serde(rename_all = "camelCase")] enum Code { - /// A wasm module as raw bytes. + /// A Wasm module as raw bytes. Upload(Bytes), - /// The code hash of an on-chain wasm blob. + /// The code hash of an on-chain Wasm blob. Existing(::Hash), } diff --git a/src/cmd/extrinsics/mod.rs b/src/cmd/extrinsics/mod.rs index 77c49dfbfa52cb668d9dccfa0720d56f869ab34a..0d064b00d4704b23f7e9e9c287bad3b95b194a88 100644 --- a/src/cmd/extrinsics/mod.rs +++ b/src/cmd/extrinsics/mod.rs @@ -49,13 +49,13 @@ type PairSigner = subxt::PairSigner; type RuntimeApi = runtime_api::api::RuntimeApi; -/// Arguments required for creating and sending an extrinsic to a substrate node +/// Arguments required for creating and sending an extrinsic to a substrate node. #[derive(Clone, Debug, StructOpt)] pub struct ExtrinsicOpts { - /// Path to the Cargo.toml of the contract + /// Path to the `Cargo.toml` of the contract. #[structopt(long, parse(from_os_str))] manifest_path: Option, - /// Websockets url of a substrate node + /// Websockets url of a substrate node. #[structopt( name = "url", long, @@ -66,7 +66,7 @@ pub struct ExtrinsicOpts { /// Secret key URI for the account deploying the contract. #[structopt(name = "suri", long, short)] suri: String, - /// Password for the secret key + /// Password for the secret key. #[structopt(name = "password", long, short)] password: Option, #[structopt(flatten)] diff --git a/src/cmd/extrinsics/upload.rs b/src/cmd/extrinsics/upload.rs index b05bd7df92f37d503172054f4306facbc3632c55..2f374e74a3f210bbd93a9bdede9624c4b96f3eeb 100644 --- a/src/cmd/extrinsics/upload.rs +++ b/src/cmd/extrinsics/upload.rs @@ -33,7 +33,7 @@ type CodeUploadReturnValue = pallet_contracts_primitives::CodeUploadReturnValue< #[derive(Debug, StructOpt)] #[structopt(name = "upload", about = "Upload a contract's code")] pub struct UploadCommand { - /// Path to wasm contract code, defaults to `./target/ink/.wasm`. + /// Path to Wasm contract code, defaults to `./target/ink/.wasm`. #[structopt(parse(from_os_str))] wasm_path: Option, #[structopt(flatten)] diff --git a/src/cmd/metadata.rs b/src/cmd/metadata.rs index 539077afbb05b3ce43ebe7d922bd7d0af2392507..19f183fde321cb005e18e924ab141fa8592fba0c 100644 --- a/src/cmd/metadata.rs +++ b/src/cmd/metadata.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify @@ -53,7 +53,7 @@ struct ExtendedMetadataResult { user: Option, } -/// Generates a file with metadata describing the ABI of the smart-contract. +/// Generates a file with metadata describing the ABI of the smart contract. /// /// It does so by generating and invoking a temporary workspace member. pub(crate) fn execute( diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index c40b2f11486f2f8882bcc646892c49c2c0ca4f8a..aadc8619e33ec812bfb0cbbdf033f90d0dd936dc 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify diff --git a/src/cmd/new.rs b/src/cmd/new.rs index 75482bb058a986c1d5ef6860b0f13ccc4e2787b3..271f19ac1a81360607cbc30da6a79c2bd586e3d6 100644 --- a/src/cmd/new.rs +++ b/src/cmd/new.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify diff --git a/src/cmd/test.rs b/src/cmd/test.rs index 98b9dae139323e2ddd158987e0e30666a75f2072..a242bbabb058f9b29af20695c4979137eea7704b 100644 --- a/src/cmd/test.rs +++ b/src/cmd/test.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ use colored::Colorize; use std::{convert::TryFrom, path::PathBuf}; use structopt::StructOpt; -/// Executes smart-contract tests off-chain by delegating to `cargo test`. +/// Executes smart contract tests off-chain by delegating to `cargo test`. #[derive(Debug, StructOpt)] #[structopt(name = "test")] pub struct TestCommand { diff --git a/src/crate_metadata.rs b/src/crate_metadata.rs index 1b7a1ec243e87cbd5743acaf586e418d83658380..a4503449941f2f171b1aa5a49b4750b698c3aee5 100644 --- a/src/crate_metadata.rs +++ b/src/crate_metadata.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify diff --git a/src/main.rs b/src/main.rs index 774061d41e0c91af78cccd2df5f404039a006dfd..241a2eed5e9cb9c2177b956ad033cba63b377dcd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify @@ -339,7 +339,7 @@ pub struct BuildResult { /// Result of the optimization process. #[derive(serde::Serialize)] pub struct OptimizationResult { - /// The path of the optimized wasm file. + /// The path of the optimized Wasm file. pub dest_wasm: PathBuf, /// The original Wasm size. pub original_size: f64, diff --git a/src/util.rs b/src/util.rs index d373db1cd89f19601a426424ca1f7febbd7b3287..26dbbfcb1f6d5a5120a3dbc16e75809ceb0c7f9e 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify diff --git a/src/validate_wasm.rs b/src/validate_wasm.rs index 2d0fe74d86ac9cfaa082b555263647c3ed95f890..250b31eb94ff358acf0a70ba8178274495f65ac7 100644 --- a/src/validate_wasm.rs +++ b/src/validate_wasm.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify diff --git a/src/workspace/manifest.rs b/src/workspace/manifest.rs index ad0f02ca9c90a9d6d6c6e3b4641cd119d04302c3..dc0bdd30477d58aaf964b84bc2f52f94d2654d52 100644 --- a/src/workspace/manifest.rs +++ b/src/workspace/manifest.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify @@ -31,14 +31,14 @@ const MANIFEST_FILE: &str = "Cargo.toml"; const LEGACY_METADATA_PACKAGE_PATH: &str = ".ink/abi_gen"; const METADATA_PACKAGE_PATH: &str = ".ink/metadata_gen"; -/// Path to a Cargo.toml file +/// 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` + /// 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() { diff --git a/src/workspace/metadata.rs b/src/workspace/metadata.rs index 76d356ecabb6bd92455c65328fd1ec023dd3e299..7d8715bcd882f93b08cf511a5c0dac01fd874637 100644 --- a/src/workspace/metadata.rs +++ b/src/workspace/metadata.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify diff --git a/src/workspace/mod.rs b/src/workspace/mod.rs index 733e8700ffa5bfd9d6a839dcf6cf1061d0a11450..5b9ccbcdae77df26ddc7b36193f4093fda9ef378 100644 --- a/src/workspace/mod.rs +++ b/src/workspace/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify @@ -85,7 +85,7 @@ impl Workspace { /// # 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). + /// the workspace root (where the top level workspace `Cargo.toml` is defined). pub fn with_root_package_manifest(&mut self, f: F) -> Result<&mut Self> where F: FnOnce(&mut Manifest) -> Result<()>, diff --git a/src/workspace/profile.rs b/src/workspace/profile.rs index df40e526863ee2e7d9b5f295515a507a40265475..e38f5f22d44ee010472bbd761aef30288d0e96ff 100644 --- a/src/workspace/profile.rs +++ b/src/workspace/profile.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 Parity Technologies (UK) Ltd. +// Copyright 2018-2022 Parity Technologies (UK) Ltd. // This file is part of cargo-contract. // // cargo-contract is free software: you can redistribute it and/or modify diff --git a/templates/new/_Cargo.toml b/templates/new/_Cargo.toml index df1c2da4a708c8195262f363c65abaddecb738fc..0b1a583b992d0fd5488e6db6d9803980eff93d17 100644 --- a/templates/new/_Cargo.toml +++ b/templates/new/_Cargo.toml @@ -3,7 +3,6 @@ name = "{{name}}" version = "0.1.0" authors = ["[your_name] <[your_email]>"] edition = "2021" -rust-version = "1.56.1" [dependencies] ink_primitives = { version = "3.0.0-rc8", default-features = false } diff --git a/templates/tools/generate-metadata/_Cargo.toml b/templates/tools/generate-metadata/_Cargo.toml index 179262d070703b13f4e3ea81aa3c8f2f5be97195..5b8b7c841f198f463540d88a1de314ac983144af 100644 --- a/templates/tools/generate-metadata/_Cargo.toml +++ b/templates/tools/generate-metadata/_Cargo.toml @@ -3,7 +3,6 @@ name = "metadata-gen" version = "0.1.0" authors = ["Parity Technologies "] edition = "2021" -rust-version = "1.56.1" publish = false [[bin]]