Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v4.0.0-beta #1508

Merged
merged 7 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 59 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,66 @@ 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]
- Allows to use `Result<Self, Error>` as a return type in constructors - [#1446](https://github.com/paritytech/ink/pull/1446)
- Checks if `#[ink_e2e::test(ws_url = "…")]` is reachable and throws meaningful error otherwise - [#1490](https://github.com/paritytech/ink/pull/1490)
- Fix E2E dry-run for `Mapping::insert()` - [#1494](https://github.com/paritytech/ink/pull/1494)
## Unreleased
- Add E2E testing framework MVP ‒ [#1395](https://github.com/paritytech/ink/pull/1395)

## Version 4.0.0-beta

The focus of the first `beta` release is to establish the stable ABI for the final `4.0.0`
release. It means that whilst subsequent `beta` releases may contain breaking contract
*code* changes, the ABI will remain the same so that any contract compiled and deployed
with `4.0.0-beta` continue to be compatible with all future `4.0.0` versions.

### Compatibility
In order to build contracts which use ink! `v4.0.0-beta` you need to use
`cargo-contract`
[`v2.0.0-beta`](https://github.com/paritytech/cargo-contract/releases/tag/v2.0.0-beta).
You can install it as follows:

`cargo install cargo-contract --version 2.0.0-beta`

You will also need to use a version of [`pallet-contracts`](https://github.com/paritytech/substrate/tree/master/frame/contracts)
later than [265e3f1](https://github.com/paritytech/substrate/commit/265e3f12a2937fe4f71280b3652471627609d04f)
(Nov 3, 2022) in your node.

The [`v0.22.1`](https://github.com/paritytech/substrate-contracts-node/releases/tag/v0.22.1)
release of the [`substrate-contracts-node`](https://github.com/paritytech/substrate-contracts-node) is
compatible with the ink! `4.0.0-beta` release.

### Breaking Changes

## Constructors and Messages now return `LangError`s

We have added a way to handle errors that are neither specific to a particular contract,
nor from the underlying execution environment (e.g `pallet-contracts`). Instead these are
errors that may come from the smart contracting language itself.

For example, take the case where a contract message is called using an invalid selector.
This is not something a smart contract author should need to define as failure case, nor
is it something that the Contracts pallet needs to be aware of.

Previously, the contract execution would trap if an invalid selector was used, leaving
callers with no way to handle the error gracefully. This can now be handled with the help
of the newly added `LangError`.

In short, this change means that all ink! messages and constructors now return a
`Result<R, LangError>`, where `R` is the original return type. Contract callers can
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to specify that for constructors R can also be Result<Self, Error> which will result in Result<Result<Self, Error>, LangError>

choose to handle the `LangError`.

In order to make this error compatible with other languages we have also added a
`lang_error` field to the metadata format. This will be the central registry of all the
different error variants which languages may want to emit in the future.

Related pull-requests:
- https://github.com/paritytech/ink/pull/1450
- https://github.com/paritytech/ink/pull/1504

Related discussions:
- https://github.com/paritytech/ink/issues/1207
- https://github.com/paritytech/substrate/issues/11018
- https://github.com/paritytech/ink/issues/1002

## Random function removed
We had to remove [`ink_env::random`](https://docs.rs/ink_env/3.3.1/ink_env/fn.random.html)
with [#1442](https://github.com/paritytech/ink/pull/1442).
This function allowed contract developers getting random entropy.
Expand All @@ -28,11 +81,11 @@ protocol for future versions of Polkadot.

### Added
- Allow using `Result<Self, Error>` as a return type in constructors ‒ [#1446](https://github.com/paritytech/ink/pull/1446)
- Introduce conditional compilation for messages, constructors and events ‒ [#1458](https://github.com/paritytech/ink/pull/1458)
- Add `Mapping::take()` function allowing to get a value removing it from storage ‒ [#1461](https://github.com/paritytech/ink/pull/1461)


### Changed
- Add support for language level errors (`LangError`) ‒ [#1450](https://github.com/paritytech/ink/pull/1450)
- Return `LangError`s from constructors ‒ [#1504](https://github.com/paritytech/ink/pull/1504)
- Update `scale-info` requirement to `2.3` ‒ [#1467](https://github.com/paritytech/ink/pull/1467)
- Merge `Mapping::insert(key, val)` and `Mapping::insert_return_size(key, val)` into one method - [#1463](https://github.com/paritytech/ink/pull/1463)

Expand Down
2 changes: 1 addition & 1 deletion crates/allocator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_allocator"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

Expand Down
7 changes: 4 additions & 3 deletions crates/e2e/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
name = "ink_e2e"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"
publish = false

license = "Apache-2.0"
readme = "README.md"
Expand All @@ -15,8 +16,8 @@ categories = ["no-std", "embedded"]
include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]

[dependencies]
ink_e2e_macro = { version = "4.0.0-alpha.3", path = "./macro" }
ink_env = { version = "4.0.0-alpha.3", path = "../env" }
ink_e2e_macro = { version = "4.0.0-beta", path = "./macro" }
ink_env = { version = "4.0.0-beta", path = "../env" }

contract-metadata = { version = "2.0.0-alpha.4" }
impl-serde = { version = "0.3.1", default-features = false }
Expand Down
7 changes: 4 additions & 3 deletions crates/e2e/macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[package]
name = "ink_e2e_macro"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"
publish = false

license = "Apache-2.0"
readme = "README.md"
readme = "../README.md"
repository = "https://github.com/paritytech/ink"
documentation = "https://docs.rs/ink_macro/"
homepage = "https://www.parity.io/"
Expand All @@ -19,7 +20,7 @@ name = "ink_e2e_macro"
proc-macro = true

[dependencies]
ink_ir = { version = "4.0.0-alpha.3", path = "../../ink/ir" }
ink_ir = { version = "4.0.0-beta", path = "../../ink/ir" }
derive_more = "0.99.17"
env_logger = "0.9.1"
log = "0.4.17"
Expand Down
4 changes: 2 additions & 2 deletions crates/engine/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_engine"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>", "Michael Müller <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_primitives = { version = "4.0.0-alpha.3", path = "../../crates/primitives", default-features = false }
ink_primitives = { version = "4.0.0-beta", path = "../../crates/primitives", default-features = false }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] }
derive_more = { version = "0.99", default-features = false, features = ["from", "display"] }

Expand Down
14 changes: 7 additions & 7 deletions crates/env/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_env"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_metadata = { version = "4.0.0-alpha.3", path = "../metadata", default-features = false, features = ["derive"], optional = true }
ink_allocator = { version = "4.0.0-alpha.3", path = "../allocator", default-features = false }
ink_storage_traits = { version = "4.0.0-alpha.3", path = "../storage/traits", default-features = false }
ink_prelude = { version = "4.0.0-alpha.3", path = "../prelude", default-features = false }
ink_primitives = { version = "4.0.0-alpha.3", path = "../primitives", default-features = false }
ink_metadata = { version = "4.0.0-beta", path = "../metadata", default-features = false, features = ["derive"], optional = true }
ink_allocator = { version = "4.0.0-beta", path = "../allocator", default-features = false }
ink_storage_traits = { version = "4.0.0-beta", path = "../storage/traits", default-features = false }
ink_prelude = { version = "4.0.0-beta", path = "../prelude", default-features = false }
ink_primitives = { version = "4.0.0-beta", path = "../primitives", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] }
derive_more = { version = "0.99", default-features = false, features = ["from", "display"] }
Expand All @@ -33,7 +33,7 @@ static_assertions = "1.1"
rlibc = "1"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
ink_engine = { version = "4.0.0-alpha.3", path = "../engine/", optional = true }
ink_engine = { version = "4.0.0-beta", path = "../engine/", optional = true }

# Hashes for the off-chain environment.
sha2 = { version = "0.10", optional = true }
Expand Down
14 changes: 7 additions & 7 deletions crates/ink/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_env = { version = "4.0.0-alpha.3", path = "../env", default-features = false }
ink_storage = { version = "4.0.0-alpha.3", path = "../storage", default-features = false }
ink_primitives = { version = "4.0.0-alpha.3", path = "../primitives", default-features = false }
ink_metadata = { version = "4.0.0-alpha.3", path = "../metadata", default-features = false, optional = true }
ink_prelude = { version = "4.0.0-alpha.3", path = "../prelude", default-features = false }
ink_macro = { version = "4.0.0-alpha.3", path = "macro", default-features = false }
ink_env = { version = "4.0.0-beta", path = "../env", default-features = false }
ink_storage = { version = "4.0.0-beta", path = "../storage", default-features = false }
ink_primitives = { version = "4.0.0-beta", path = "../primitives", default-features = false }
ink_metadata = { version = "4.0.0-beta", path = "../metadata", default-features = false, optional = true }
ink_prelude = { version = "4.0.0-beta", path = "../prelude", default-features = false }
ink_macro = { version = "4.0.0-beta", path = "macro", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] }
derive_more = { version = "0.99", default-features = false, features = ["from"] }
Expand Down
6 changes: 3 additions & 3 deletions crates/ink/codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_codegen"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

Expand All @@ -18,8 +18,8 @@ include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
name = "ink_codegen"

[dependencies]
ink_primitives = { version = "4.0.0-alpha.3", path = "../../primitives" }
ir = { version = "4.0.0-alpha.3", package = "ink_ir", path = "../ir", default-features = false }
ink_primitives = { version = "4.0.0-beta", path = "../../primitives" }
ir = { version = "4.0.0-beta", package = "ink_ir", path = "../ir", default-features = false }
quote = "1"
syn = { version = "1.0", features = ["parsing", "full", "extra-traits"] }
proc-macro2 = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/ink/ir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_ir"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

Expand Down
8 changes: 4 additions & 4 deletions crates/ink/macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_macro"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_ir = { version = "4.0.0-alpha.3", path = "../ir", default-features = false }
ink_codegen = { version = "4.0.0-alpha.3", path = "../codegen", default-features = false }
ink_primitives = { version = "4.0.0-alpha.3", path = "../../primitives/", default-features = false }
ink_ir = { version = "4.0.0-beta", path = "../ir", default-features = false }
ink_codegen = { version = "4.0.0-beta", path = "../codegen", default-features = false }
ink_primitives = { version = "4.0.0-beta", path = "../../primitives/", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
syn = "1"
Expand Down
6 changes: 3 additions & 3 deletions crates/metadata/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_metadata"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_prelude = { version = "4.0.0-alpha.3", path = "../prelude/", default-features = false }
ink_primitives = { version = "4.0.0-alpha.3", path = "../primitives/", default-features = false }
ink_prelude = { version = "4.0.0-beta", path = "../prelude/", default-features = false }
ink_primitives = { version = "4.0.0-beta", path = "../primitives/", default-features = false }

serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
impl-serde = "0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/prelude/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_prelude"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_primitives"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

Expand All @@ -16,7 +16,7 @@ include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]

[dependencies]
derive_more = { version = "0.99", default-features = false, features = ["from", "display"] }
ink_prelude = { version = "4.0.0-alpha.3", path = "../prelude/", default-features = false }
ink_prelude = { version = "4.0.0-beta", path = "../prelude/", default-features = false }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
xxhash-rust = { version = "0.8", features = ["const_xxh32"] }
Expand Down
12 changes: 6 additions & 6 deletions crates/storage/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_storage"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_env = { version = "4.0.0-alpha.3", path = "../env/", default-features = false }
ink_metadata = { version = "4.0.0-alpha.3", path = "../metadata/", default-features = false, features = ["derive"], optional = true }
ink_primitives = { version = "4.0.0-alpha.3", path = "../primitives/", default-features = false }
ink_storage_traits = { version = "4.0.0-alpha.3", path = "traits", default-features = false }
ink_prelude = { version = "4.0.0-alpha.3", path = "../prelude/", default-features = false }
ink_env = { version = "4.0.0-beta", path = "../env/", default-features = false }
ink_metadata = { version = "4.0.0-beta", path = "../metadata/", default-features = false, features = ["derive"], optional = true }
ink_primitives = { version = "4.0.0-beta", path = "../primitives/", default-features = false }
ink_storage_traits = { version = "4.0.0-beta", path = "traits", default-features = false }
ink_prelude = { version = "4.0.0-beta", path = "../prelude/", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] }
derive_more = { version = "0.99", default-features = false, features = ["from", "display"] }
Expand Down
8 changes: 4 additions & 4 deletions crates/storage/traits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_storage_traits"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"

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

[dependencies]
ink_metadata = { version = "4.0.0-alpha.3", path = "../../metadata", default-features = false, features = ["derive"], optional = true }
ink_primitives = { version = "4.0.0-alpha.3", path = "../../primitives", default-features = false }
ink_prelude = { version = "4.0.0-alpha.3", path = "../../prelude", default-features = false }
ink_metadata = { version = "4.0.0-beta", path = "../../metadata", default-features = false, features = ["derive"], optional = true }
ink_primitives = { version = "4.0.0-beta", path = "../../primitives", default-features = false }
ink_prelude = { version = "4.0.0-beta", path = "../../prelude", default-features = false }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
syn = { version = "1", features = ["full"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/contract-terminate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "contract_terminate"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion examples/contract-transfer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "contract_transfer"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion examples/delegator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "delegator"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion examples/delegator/accumulator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "accumulator"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion examples/delegator/adder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "adder"
version = "4.0.0-alpha.3"
version = "4.0.0-beta"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"

Expand Down
Loading