Skip to content

Commit

Permalink
Release 4.1.2 (#1791)
Browse files Browse the repository at this point in the history
* 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`
  • Loading branch information
cmichi authored Nov 6, 2024
1 parent 3d74a06 commit 6c987ca
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 31 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/analyze/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "contract-analyze"
version = "4.1.1"
version = "4.1.2"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"

Expand All @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions crates/build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "contract-build"
version = "4.1.1"
version = "4.1.2"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"

Expand Down Expand Up @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions crates/cargo-contract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-contract"
version = "4.1.1"
version = "4.1.2"
authors = ["Parity Technologies <[email protected]>"]
build = "build.rs"
edition = "2021"
Expand All @@ -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"] }
Expand Down
42 changes: 36 additions & 6 deletions crates/cargo-contract/src/cmd/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,29 +218,59 @@ 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::<Vec<_>>()
.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)
)))
},
}
};
}

/// 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,
Expand Down
8 changes: 4 additions & 4 deletions crates/extrinsics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "contract-extrinsics"
version = "4.1.1"
version = "4.1.2"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"
rust-version = "1.70"
Expand All @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/metadata/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "contract-metadata"
version = "4.1.1"
version = "4.1.2"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion crates/metadata/compatibility_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"=5.0.0-rc.1"
]
},
"4.1.1": {
"4.1.2": {
"ink": [
">=5.0.0-rc.2",
"5.0.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/transcode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "contract-transcode"
version = "4.1.1"
version = "4.1.2"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"

Expand All @@ -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"
Expand Down

0 comments on commit 6c987ca

Please sign in to comment.