Skip to content

Commit 1b2e7cf

Browse files
authored
Release v4.2.1 (#1808)
* Merge pull request from GHSA-853p-5678-hv8f * Handle `LangError` from `DelegateCall` * Add basic delegate E2E test * Get test working with integration flipper * Use `incrementer` for test instead * Add tests to make sure that `LangError`s can be handled * Get rid of references to the interation Flipper * Bump version numbers to `4.2.1` * Add `CHANGELOG` entry Add more info to the `CHANGELOG` * Fix doc test related to delegate call (#1809) * Mention extra `Result` return type * Try using old CI image * Bump codec version in UI tests * Add German's CHANGELOG suggestion
1 parent 55088cc commit 1b2e7cf

File tree

60 files changed

+374
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+374
-106
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ variables:
2828
CARGO_TARGET_DIR: "/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}"
2929
# CI_IMAGE is changed to "-:staging" when the CI image gets rebuilt
3030
# read more https://github.com/paritytech/scripts/pull/244
31-
CI_IMAGE: "paritytech/ink-ci-linux:production"
31+
CI_IMAGE: "paritytech/ink-ci-linux:a1f03f4b-20230420"
3232
PURELY_STD_CRATES: "ink/codegen metadata engine e2e e2e/macro ink/ir"
3333
ALSO_WASM_CRATES: "env storage storage/traits allocator prelude primitives ink ink/macro"
3434
ALL_CRATES: "${PURELY_STD_CRATES} ${ALSO_WASM_CRATES}"

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## Version 4.2.1
10+
11+
This release contains a low-severity security related fix. Users of the `4.x` series of
12+
releases are advised to update.
13+
14+
Note that this release contains a breaking change since the API of
15+
`ink_env::invoke_contract_delegate` and `CallBuilder::try_invoke` now return an extra
16+
`ink_primitives::MessageResult` which must be handled.
17+
18+
We decided to release this breaking change as a `PATCH` release to ensure that affected
19+
users are upgrading to the fixed API.
20+
21+
See the [published advisory](https://github.com/paritytech/ink/security/advisories/GHSA-853p-5678-hv8f)
22+
for more info.
23+
24+
### Fixed
25+
- Handle `LangError` from `DelegateCall`
26+
927
## Version 4.2.0
1028

1129
### Added

crates/allocator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ink_allocator"
3-
version = "4.2.0"
3+
version = "4.2.1"
44
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
55
edition = "2021"
66

crates/e2e/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ink_e2e"
3-
version = "4.2.0"
3+
version = "4.2.1"
44
authors = ["Parity Technologies <[email protected]>"]
55
edition = "2021"
66

@@ -15,10 +15,10 @@ categories = ["no-std", "embedded"]
1515
include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]
1616

1717
[dependencies]
18-
ink_e2e_macro = { version = "4.2.0", path = "./macro" }
19-
ink = { version = "4.2.0", path = "../ink" }
20-
ink_env = { version = "4.2.0", path = "../env" }
21-
ink_primitives = { version = "4.2.0", path = "../primitives" }
18+
ink_e2e_macro = { version = "4.2.1", path = "./macro" }
19+
ink = { version = "4.2.1", path = "../ink" }
20+
ink_env = { version = "4.2.1", path = "../env" }
21+
ink_primitives = { version = "4.2.1", path = "../primitives" }
2222

2323
funty = "2.0.0"
2424
impl-serde = { version = "0.3.1", default-features = false }

crates/e2e/macro/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ink_e2e_macro"
3-
version = "4.2.0"
3+
version = "4.2.1"
44
authors = ["Parity Technologies <[email protected]>"]
55
edition = "2021"
66

@@ -19,7 +19,7 @@ name = "ink_e2e_macro"
1919
proc-macro = true
2020

2121
[dependencies]
22-
ink_ir = { version = "4.2.0", path = "../../ink/ir" }
22+
ink_ir = { version = "4.2.1", path = "../../ink/ir" }
2323
cargo_metadata = "0.15.3"
2424
contract-build = "2.0.2"
2525
derive_more = "0.99.17"

crates/engine/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ink_engine"
3-
version = "4.2.0"
3+
version = "4.2.1"
44
authors = ["Parity Technologies <[email protected]>", "Michael Müller <[email protected]>"]
55
edition = "2021"
66

@@ -15,7 +15,7 @@ categories = ["no-std", "embedded"]
1515
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
1616

1717
[dependencies]
18-
ink_primitives = { version = "4.2.0", path = "../../crates/primitives", default-features = false }
18+
ink_primitives = { version = "4.2.1", path = "../../crates/primitives", default-features = false }
1919
scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] }
2020
derive_more = { version = "0.99", default-features = false, features = ["from", "display"] }
2121

crates/env/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ink_env"
3-
version = "4.2.0"
3+
version = "4.2.1"
44
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
55
edition = "2021"
66
rust-version = "1.68"
@@ -16,10 +16,10 @@ categories = ["no-std", "embedded"]
1616
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
1717

1818
[dependencies]
19-
ink_allocator = { version = "4.2.0", path = "../allocator", default-features = false }
20-
ink_storage_traits = { version = "4.2.0", path = "../storage/traits", default-features = false }
21-
ink_prelude = { version = "4.2.0", path = "../prelude", default-features = false }
22-
ink_primitives = { version = "4.2.0", path = "../primitives", default-features = false }
19+
ink_allocator = { version = "4.2.1", path = "../allocator", default-features = false }
20+
ink_storage_traits = { version = "4.2.1", path = "../storage/traits", default-features = false }
21+
ink_prelude = { version = "4.2.1", path = "../prelude", default-features = false }
22+
ink_primitives = { version = "4.2.1", path = "../primitives", default-features = false }
2323

2424
scale = { package = "parity-scale-codec", version = "3.4", default-features = false, features = ["derive"] }
2525
derive_more = { version = "0.99", default-features = false, features = ["from", "display"] }
@@ -33,7 +33,7 @@ static_assertions = "1.1"
3333
rlibc = "1"
3434

3535
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
36-
ink_engine = { version = "4.2.0", path = "../engine/", optional = true }
36+
ink_engine = { version = "4.2.1", path = "../engine/", optional = true }
3737

3838
# Hashes for the off-chain environment.
3939
sha2 = { version = "0.10", optional = true }

crates/env/src/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ where
300300
/// - If the called code execution has trapped.
301301
pub fn invoke_contract_delegate<E, Args, R>(
302302
params: &CallParams<E, DelegateCall<E>, Args, R>,
303-
) -> Result<R>
303+
) -> Result<ink_primitives::MessageResult<R>>
304304
where
305305
E: Environment,
306306
Args: scale::Encode,

crates/env/src/backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ pub trait TypedEnvBackend: EnvBackend {
433433
fn invoke_contract_delegate<E, Args, R>(
434434
&mut self,
435435
call_data: &CallParams<E, DelegateCall<E>, Args, R>,
436-
) -> Result<R>
436+
) -> Result<ink_primitives::MessageResult<R>>
437437
where
438438
E: Environment,
439439
Args: scale::Encode,

crates/env/src/call/call_builder.rs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,17 @@ where
151151
///
152152
/// # Panics
153153
///
154-
/// This method panics if it encounters an [`ink::env::Error`][`crate::Error`]. If you
155-
/// want to handle those use the [`try_invoke`][`CallParams::try_invoke`] method
156-
/// instead.
154+
/// This method panics if it encounters an [`ink::env::Error`][`crate::Error`] or an
155+
/// [`ink::primitives::LangError`][`ink_primitives::LangError`]. If you want to handle
156+
/// those use the [`try_invoke`][`CallParams::try_invoke`] method instead.
157157
pub fn invoke(&self) -> R {
158-
crate::invoke_contract_delegate(self).unwrap_or_else(|env_error| {
159-
panic!("Cross-contract call failed with {env_error:?}")
160-
})
158+
crate::invoke_contract_delegate(self)
159+
.unwrap_or_else(|env_error| {
160+
panic!("Cross-contract call failed with {env_error:?}")
161+
})
162+
.unwrap_or_else(|lang_error| {
163+
panic!("Cross-contract call failed with {lang_error:?}")
164+
})
161165
}
162166

163167
/// Invoke the contract using Delegate Call semantics with the given built-up call
@@ -167,9 +171,10 @@ where
167171
///
168172
/// # Note
169173
///
170-
/// On failure this returns an [`ink::env::Error`][`crate::Error`] which can be
174+
/// On failure this returns an outer [`ink::env::Error`][`crate::Error`] or inner
175+
/// [`ink::primitives::LangError`][`ink_primitives::LangError`], both of which can be
171176
/// handled by the caller.
172-
pub fn try_invoke(&self) -> Result<R, crate::Error> {
177+
pub fn try_invoke(&self) -> Result<ink_primitives::MessageResult<R>, crate::Error> {
173178
crate::invoke_contract_delegate(self)
174179
}
175180
}
@@ -712,7 +717,7 @@ where
712717
///
713718
/// On failure this an [`ink::env::Error`][`crate::Error`] which can be handled by the
714719
/// caller.
715-
pub fn try_invoke(self) -> Result<(), Error> {
720+
pub fn try_invoke(self) -> Result<ink_primitives::MessageResult<()>, Error> {
716721
self.params().try_invoke()
717722
}
718723
}
@@ -759,9 +764,9 @@ where
759764
///
760765
/// # Panics
761766
///
762-
/// This method panics if it encounters an [`ink::env::Error`][`crate::Error`]
763-
/// If you want to handle those use the [`try_invoke`][`CallBuilder::try_invoke`]
764-
/// method instead.
767+
/// This method panics if it encounters an [`ink::env::Error`][`crate::Error`] or an
768+
/// [`ink::primitives::LangError`][`ink_primitives::LangError`]. If you want to handle
769+
/// those use the [`try_invoke`][`CallBuilder::try_invoke`] method instead.
765770
pub fn invoke(self) -> R {
766771
self.params().invoke()
767772
}
@@ -771,9 +776,10 @@ where
771776
///
772777
/// # Note
773778
///
774-
/// On failure this an [`ink::env::Error`][`crate::Error`] which can be handled by the
775-
/// caller.
776-
pub fn try_invoke(self) -> Result<R, Error> {
779+
/// On failure this returns an outer [`ink::env::Error`][`crate::Error`] or inner
780+
/// [`ink::primitives::LangError`][`ink_primitives::LangError`], both of which can be
781+
/// handled by the caller.
782+
pub fn try_invoke(self) -> Result<ink_primitives::MessageResult<R>, Error> {
777783
self.params().try_invoke()
778784
}
779785
}

0 commit comments

Comments
 (0)