From 6c987ca83e5f3121f864e19656bb4bcf778c9524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Wed, 6 Nov 2024 10:24:17 +0100 Subject: [PATCH] Release 4.1.2 (#1791) * Fix "chain configuration not found" error (#1786) * Account for spaced and non-spaced behavior of `stringify!` * For user output: remove spaces from object path * Output the chain configuration that was searched * Apply `cargo fmt` * Add changelog entry * Switch spaces clean-up * Fix string handling * Apply `cargo fmt` * Improve comment * Improve formatting * Improve assert error message * Shorten code * Update changelog * Bump version number * Update `Cargo.lock` --- CHANGELOG.md | 14 ++++++++- Cargo.lock | 12 +++---- crates/analyze/Cargo.toml | 4 +-- crates/build/Cargo.toml | 4 +-- crates/cargo-contract/Cargo.toml | 12 +++---- crates/cargo-contract/src/cmd/config.rs | 42 +++++++++++++++++++++---- crates/extrinsics/Cargo.toml | 8 ++--- crates/metadata/Cargo.toml | 2 +- crates/metadata/compatibility_list.json | 2 +- crates/transcode/Cargo.toml | 4 +-- 10 files changed, 73 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e55cb0374..78bb44487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [5.0.0-alpha] + +### Changed +- Updated the toolchain version used by `ink_linting` - [#1616](https://github.com/paritytech/cargo-contract/pull/1616) +- Bump the version of `subxt` and `subxt-signer` - [#1722](https://github.com/use-ink/cargo-contract/pull/1722) + +### Removed +- Remove support for `V11` metadata [#1722](https://github.com/use-ink/cargo-contract/pull/1722) + +## [4.1.2] + +### Fixed +- Fix "chain configuration not found" error - [#1786](https://github.com/paritytech/cargo-contract/pull/1786) ## [4.1.1] diff --git a/Cargo.lock b/Cargo.lock index 728bf5eca..963601a8d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -884,7 +884,7 @@ dependencies = [ [[package]] name = "cargo-contract" -version = "4.1.1" +version = "4.1.2" dependencies = [ "anyhow", "assert_cmd", @@ -1147,7 +1147,7 @@ checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" [[package]] name = "contract-analyze" -version = "4.1.1" +version = "4.1.2" dependencies = [ "anyhow", "contract-metadata", @@ -1157,7 +1157,7 @@ dependencies = [ [[package]] name = "contract-build" -version = "4.1.1" +version = "4.1.2" dependencies = [ "anyhow", "blake2", @@ -1197,7 +1197,7 @@ dependencies = [ [[package]] name = "contract-extrinsics" -version = "4.1.1" +version = "4.1.2" dependencies = [ "anyhow", "assert_cmd", @@ -1235,7 +1235,7 @@ dependencies = [ [[package]] name = "contract-metadata" -version = "4.1.1" +version = "4.1.2" dependencies = [ "anyhow", "impl-serde", @@ -1248,7 +1248,7 @@ dependencies = [ [[package]] name = "contract-transcode" -version = "4.1.1" +version = "4.1.2" dependencies = [ "anyhow", "assert_matches", diff --git a/crates/analyze/Cargo.toml b/crates/analyze/Cargo.toml index 29ea32cec..71af0f104 100644 --- a/crates/analyze/Cargo.toml +++ b/crates/analyze/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "contract-analyze" -version = "4.1.1" +version = "4.1.2" authors = ["Parity Technologies "] edition = "2021" @@ -14,7 +14,7 @@ keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] include = ["Cargo.toml", "*.rs", "LICENSE"] [dependencies] -contract-metadata = { version = "4.1.1", path = "../metadata" } +contract-metadata = { version = "4.1.2", path = "../metadata" } parity-wasm = { version = "0.45.0" } anyhow = "1.0.81" diff --git a/crates/build/Cargo.toml b/crates/build/Cargo.toml index bc45659ec..2d5dd682a 100644 --- a/crates/build/Cargo.toml +++ b/crates/build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "contract-build" -version = "4.1.1" +version = "4.1.2" authors = ["Parity Technologies "] edition = "2021" @@ -44,7 +44,7 @@ tokio-stream = "0.1" bollard = "0.16" crossterm = "0.27.0" -contract-metadata = { version = "4.1.1", path = "../metadata" } +contract-metadata = { version = "4.1.2", path = "../metadata" } [target.'cfg(unix)'.dependencies] uzers = "0.11" diff --git a/crates/cargo-contract/Cargo.toml b/crates/cargo-contract/Cargo.toml index afb8b3052..d5d757a90 100644 --- a/crates/cargo-contract/Cargo.toml +++ b/crates/cargo-contract/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-contract" -version = "4.1.1" +version = "4.1.2" authors = ["Parity Technologies "] build = "build.rs" edition = "2021" @@ -18,11 +18,11 @@ include = [ ] [dependencies] -contract-build = { version = "4.1.1", path = "../build" } -contract-extrinsics = { version = "4.1.1", path = "../extrinsics" } -contract-transcode = { version = "4.1.1", path = "../transcode" } -contract-metadata = { version = "4.1.1", path = "../metadata" } -contract-analyze = { version = "4.1.1", path = "../analyze" } +contract-build = { version = "4.1.2", path = "../build" } +contract-extrinsics = { version = "4.1.2", path = "../extrinsics" } +contract-transcode = { version = "4.1.2", path = "../transcode" } +contract-metadata = { version = "4.1.2", path = "../metadata" } +contract-analyze = { version = "4.1.2", path = "../analyze" } anyhow = "1.0.81" clap = { version = "4.5.4", features = ["derive", "env"] } diff --git a/crates/cargo-contract/src/cmd/config.rs b/crates/cargo-contract/src/cmd/config.rs index 57e02a97f..5c2872719 100644 --- a/crates/cargo-contract/src/cmd/config.rs +++ b/crates/cargo-contract/src/cmd/config.rs @@ -218,14 +218,14 @@ macro_rules! call_with_config_internal { stringify!($config) => $obj.$function::<$config>().await, )* _ => { - - let configs = vec![$(stringify!($config)),*].iter() - .map(|s| s.trim_start_matches("crate::cmd::config::")) + let configs = vec![$(stringify!($config)),*].iter() + .map(|s| s.replace(" ", "")) + .map(|s| s.trim_start_matches("$crate::cmd::config::").to_string()) .collect::>() .join(", "); Err(ErrorVariant::Generic( contract_extrinsics::GenericError::from_message( - format!("Chain configuration not found, Allowed configurations: {configs}") + format!("Chain configuration {} not found, allowed configurations: {configs}", $config_name) ))) }, } @@ -233,14 +233,44 @@ macro_rules! call_with_config_internal { } /// Macro that allows calling the command member function with chain configuration +/// +/// # Developer Note +/// +/// In older Rust versions the macro `stringify!($crate::foo)` expanded to +/// `"$crate::foo"`. This behavior changed with https://github.com/rust-lang/rust/pull/125174, +/// `stringify!` expands to `"$crate :: foo"` now. In order to support both older and +/// newer Rust versions our macro has to handle both cases, spaced and non-spaced. +/// +/// # Known Limitation +/// +/// The `$config_name:expr` has to be in the `$crate::cmd::config` crate and cannot +/// contain another `::` sub-path. #[macro_export] macro_rules! call_with_config { ($obj:tt, $function:ident, $config_name:expr) => {{ - let config_name = format!("crate::cmd::config::{}", $config_name); + assert!( + !format!("{}", $config_name).contains("::"), + "The supplied config name `{}` is not allowed to contain `::`.", + $config_name + ); + + let res_nonspaced = $crate::call_with_config_internal!( + $obj, + $function, + format!("$crate::cmd::config::{}", $config_name).as_str(), + // All available chain configs need to be specified here + $crate::cmd::config::Polkadot, + $crate::cmd::config::Substrate, + $crate::cmd::config::Ecdsachain + ); + if !res_nonspaced.is_err() { + return res_nonspaced + } + $crate::call_with_config_internal!( $obj, $function, - config_name.as_str(), + format!("$crate :: cmd :: config :: {}", $config_name).as_str(), // All available chain configs need to be specified here $crate::cmd::config::Polkadot, $crate::cmd::config::Substrate, diff --git a/crates/extrinsics/Cargo.toml b/crates/extrinsics/Cargo.toml index 8b9453444..085ad13cb 100644 --- a/crates/extrinsics/Cargo.toml +++ b/crates/extrinsics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "contract-extrinsics" -version = "4.1.1" +version = "4.1.2" authors = ["Parity Technologies "] edition = "2021" rust-version = "1.70" @@ -15,9 +15,9 @@ keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"] include = ["Cargo.toml", "*.rs", "LICENSE",] [dependencies] -contract-build = { version = "4.1.1", path = "../build" } -contract-metadata = { version = "4.1.1", path = "../metadata" } -contract-transcode = { version = "4.1.1", path = "../transcode" } +contract-build = { version = "4.1.2", path = "../build" } +contract-metadata = { version = "4.1.2", path = "../metadata" } +contract-transcode = { version = "4.1.2", path = "../transcode" } anyhow = "1.0.81" blake2 = { version = "0.10.6", default-features = false } diff --git a/crates/metadata/Cargo.toml b/crates/metadata/Cargo.toml index 20b030baa..37162e67e 100644 --- a/crates/metadata/Cargo.toml +++ b/crates/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "contract-metadata" -version = "4.1.1" +version = "4.1.2" authors = ["Parity Technologies "] edition = "2021" diff --git a/crates/metadata/compatibility_list.json b/crates/metadata/compatibility_list.json index 6e128996b..e33c49637 100644 --- a/crates/metadata/compatibility_list.json +++ b/crates/metadata/compatibility_list.json @@ -22,7 +22,7 @@ "=5.0.0-rc.1" ] }, - "4.1.1": { + "4.1.2": { "ink": [ ">=5.0.0-rc.2", "5.0.0" diff --git a/crates/transcode/Cargo.toml b/crates/transcode/Cargo.toml index a75bb933b..884d22a65 100644 --- a/crates/transcode/Cargo.toml +++ b/crates/transcode/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "contract-transcode" -version = "4.1.1" +version = "4.1.2" authors = ["Parity Technologies "] edition = "2021" @@ -20,7 +20,7 @@ path = "src/lib.rs" anyhow = "1.0.81" base58 = { version = "0.2.0" } blake2 = { version = "0.10.6", default-features = false } -contract-metadata = { version = "4.1.1", path = "../metadata" } +contract-metadata = { version = "4.1.2", path = "../metadata" } escape8259 = "0.5.2" hex = "0.4.3" indexmap = "2.2.6"