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 #1653

Merged
merged 9 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
91 changes: 88 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,98 @@ 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]
## Version 4.0.0

The latest stable release of ink! is here πŸ₯³

This version brings a lot of usability improvements, making the language better suited
for the needs of production parachains.

A couple of highlights include:
- Changes to how contract storage works, which significantly reduced the sizes of
contract binaries
- A new end-to-end testing framework, letting you easily write integration tests
- Changes to the metadata format, which (in part) makes error handling more expressive

There's a lot more to dig through, so take some time to poke around the `CHANGELOG`
(including the `4.0.0-alpha` and `4.0.0-beta` releases).

You may notice there have been a few breaking changes. No need to be scared though, we
wrote up a [migration guide](https://use.ink/faq/migrating-from-ink-3-to-4) covering all
of the breaking changes and how to update your ink! 3.x contract accordingly.

Thanks to everyone that helped make this release possible ❀️

### Compatibility

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

`cargo install cargo-contract --forced --locked`

You will also need to use a version of [`pallet-contracts`](https://github.com/paritytech/substrate/tree/master/frame/contracts)
later than [polkadot-v0.9.37](https://github.com/paritytech/substrate/tree/polkadot-v0.9.37)
in your node.

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

For full compatibility requirements see the [migration guide](https://use.ink/faq/migrating-from-ink-3-to-4/#compatibility).

### Added
- Support custom environment in E2E tests - [#1645](https://github.com/paritytech/ink/pull/1645)
- Add `Mapping::contains(key)` and `Mapping::insert_return_size(key, val)` β€’ [#1224](https://github.com/paritytech/ink/pull/1224)
- Add [`payment-channel`](https://github.com/paritytech/ink/tree/master/examples/payment-channel) example β€’ [#1248](https://github.com/paritytech/ink/pull/1248) (thanks [@kanishkatn](https://github.com/kanishkatn)!)
- Add `version` field to ink! metadata β€’ [#1313](https://github.com/paritytech/ink/pull/1313)
- The `rand-extension` example has been adapted to an updated version of the `ChainExtension` API β€’ [#1356](https://github.com/paritytech/ink/pull/1356)
- Add `ink_env::pay_with_call!` helper macro for off-chain emulation of sending payments with contract message calls β€’ [#1379](https://github.com/paritytech/ink/pull/1379)
- Allow using `Result<Self, Error>` as a return type in constructors β€’ [#1446](https://github.com/paritytech/ink/pull/1446)
- Add `Mapping::take()` function allowing to get a value removing it from storage β€’ [#1461](https://github.com/paritytech/ink/pull/1461)
- Add E2E testing framework MVP β€’ [#1395](https://github.com/paritytech/ink/pull/1395)
- Add E2E tests for `Mapping` functions - [#1492](https://github.com/paritytech/ink/pull/1492)
- E2E: expose call dry-run method β€’ [#1624](https://github.com/paritytech/ink/pull/1624)
- Make cross-contract callee non-optional β€’ [#1636](https://github.com/paritytech/ink/pull/1636)
- Support custom environment in E2E tests - [#1645](https://github.com/paritytech/ink/pull/1645) (thanks [@pmikolajczyk41](https://github.com/pmikolajczyk41)!)

### Changed
- Contract size optimization in case contract doesn't accept payment β€’ [#1267](https://github.com/paritytech/ink/pull/1267) (thanks [@xgreenx](https://github.com/xgreenx)!)
- Move ink! linter into `ink` repository β€’ [#1361](https://github.com/paritytech/ink/pull/1267)
- Introduce `ink` entrance crate β€’ [#1223](https://github.com/paritytech/ink/pull/1223)
- Use `XXH32` instead of `sha256` for calculating storage keys β€’ [#1393](https://github.com/paritytech/ink/pull/1393)
- Storage Refactoring β€’ [#1331](https://github.com/paritytech/ink/pull/1331)
- Add support for language level errors (`LangError`) β€’ [#1450](https://github.com/paritytech/ink/pull/1450)
ascjones marked this conversation as resolved.
Show resolved Hide resolved
- 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)
- FFI: no more `__unstable__` wasm import module β€’ [#1522](https://github.com/paritytech/ink/pull/1522)
- Clean up CallBuilder `return()` type β€’ [#1525](https://github.com/paritytech/ink/pull/1525)
- Fix trait message return type metadata β€’ [#1531](https://github.com/paritytech/ink/pull/1531)
- Bump Dylint dependencies β€’ [#1551](https://github.com/paritytech/ink/pull/1551)
- Stabilize `take_storage` β€’ [#1568](https://github.com/paritytech/ink/pull/1568)
- Chain Extension: Evaluation of method return type at compile time β€’ [#1569](https://github.com/paritytech/ink/pull/1569)
- Make more functions be const β€’ [#1574](https://github.com/paritytech/ink/pull/1574) (thanks [@yjhmelody](https://github.com/yjhmelody)!)
- Unify fallible and non fallible `instantiate` methods β€’ [#1591](https://github.com/paritytech/ink/pull/1591)
- Make `CallBuilder` and `CreateBuilder` error handling optional β€’ [#1602](https://github.com/paritytech/ink/pull/1602)
- Rename `CallBuilder::fire()` method to `invoke()` β€’ [#1604](https://github.com/paritytech/ink/pull/1604)
- chore: add minimum rust version to the ink crate β€’ [#1609](https://github.com/paritytech/ink/pull/1609) (thanks [@Kurtsley](https://github.com/Kurtsley)!)
- Rename `_checked` codegen call methods with `try_` β€’ [#1621](https://github.com/paritytech/ink/pull/1621)
- Bump Substrate and `subxt` dependencies β€’ [#1549](https://github.com/paritytech/ink/pull/1549)
- E2E: spawn a separate contracts node instance per test β€’ [#1642](https://github.com/paritytech/ink/pull/1642)

### Fixed
- Trim single whitespace prefix in the metadata `docs` field β€’ [#1385](https://github.com/paritytech/ink/pull/1385)
- Allow pay_with_call to take multiple arguments β€’ [#1401](https://github.com/paritytech/ink/pull/1401)
- Add Determinism enum from pallet-contracts β€’ [#1547](https://github.com/paritytech/ink/pull/1547)
- Added missed `WhereClosure` for the generics into `storage_item` β€’ [#1536](https://github.com/paritytech/ink/pull/1536) (thanks [@xgreenx](https://github.com/xgreenx)!)

### Removed
- Implement `ecdsa_to_eth_address()` and remove `eth_compatibility` crate β€’ [#1233](https://github.com/paritytech/ink/pull/1233)
- Remove `wee-alloc` β€’ [#1403](https://github.com/paritytech/ink/pull/1403)
- Remove `ink_env::random` function β€’ [#1442](https://github.com/paritytech/ink/pull/1442)
- Remove `Default` implementation for AccountId β€’ [#1255](https://github.com/paritytech/ink/pull/1255)

## Version 4.0.0-rc

The first release candidate is here! This is the first release which could become the final
Expand Down Expand Up @@ -41,7 +125,7 @@ breaking or otherwise.
- Remove `Default` implementation for AccountId β€’ [#1255](https://github.com/paritytech/ink/pull/1255)

## Version 4.0.0-beta.1
The coolest feature included in this release is the first first published version of
The coolest feature included in this release is the first published version of
ink!'s native ["end-to-end" (E2E) testing framework](https://github.com/paritytech/ink/issues/1234).

This enables testing of a contract by deploying and calling it on a Substrate node with
Expand Down Expand Up @@ -204,6 +288,7 @@ through a feature flag. `wee-alloc` is no longer maintained and we removed suppo
### Changed
- Introduce `ink` entrance crate β€’ [#1223](https://github.com/paritytech/ink/pull/1223)
- Use `XXH32` instead of `sha256` for calculating storage keys β€’ [#1393](https://github.com/paritytech/ink/pull/1393)
- Storage Refactoring β€’ [#1331](https://github.com/paritytech/ink/pull/1331)

### Fixed
- Trim single whitespace prefix in the metadata `docs` field β€’ [#1385](https://github.com/paritytech/ink/pull/1385)
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-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
edition = "2021"

Expand Down
10 changes: 5 additions & 5 deletions crates/e2e/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_e2e"
version = "4.0.0-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"

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

[dependencies]
ink_e2e_macro = { version = "4.0.0-rc", path = "./macro" }
ink = { version = "4.0.0-rc", path = "../ink" }
ink_env = { version = "4.0.0-rc", path = "../env" }
ink_primitives = { version = "4.0.0-rc", path = "../primitives" }
ink_e2e_macro = { version = "4.0.0", path = "./macro" }
ink = { version = "4.0.0", path = "../ink" }
ink_env = { version = "4.0.0", path = "../env" }
ink_primitives = { version = "4.0.0", path = "../primitives" }

contract-metadata = { version = "2.0.0-rc.1" }
funty = "2.0.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/e2e/macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink_e2e_macro"
version = "4.0.0-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"

Expand All @@ -19,7 +19,7 @@ name = "ink_e2e_macro"
proc-macro = true

[dependencies]
ink_ir = { version = "4.0.0-rc", path = "../../ink/ir" }
ink_ir = { version = "4.0.0", path = "../../ink/ir" }
contract-build = "2.0.0-rc.1"
derive_more = "0.99.17"
env_logger = "0.10.0"
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-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>", "Michael MΓΌller <michi@parity.io>"]
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-rc", path = "../../crates/primitives", default-features = false }
ink_primitives = { version = "4.0.0", 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-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
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-rc", path = "../metadata", default-features = false, features = ["derive"], optional = true }
ink_allocator = { version = "4.0.0-rc", path = "../allocator", default-features = false }
ink_storage_traits = { version = "4.0.0-rc", path = "../storage/traits", default-features = false }
ink_prelude = { version = "4.0.0-rc", path = "../prelude", default-features = false }
ink_primitives = { version = "4.0.0-rc", path = "../primitives", default-features = false }
ink_metadata = { version = "4.0.0", path = "../metadata", default-features = false, features = ["derive"], optional = true }
ink_allocator = { version = "4.0.0", path = "../allocator", default-features = false }
ink_storage_traits = { version = "4.0.0", path = "../storage/traits", default-features = false }
ink_prelude = { version = "4.0.0", path = "../prelude", default-features = false }
ink_primitives = { version = "4.0.0", 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-rc", path = "../engine/", optional = true }
ink_engine = { version = "4.0.0", 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-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
edition = "2021"
rust-version = "1.63"
Expand All @@ -16,12 +16,12 @@ categories = ["no-std", "embedded"]
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]

[dependencies]
ink_env = { version = "4.0.0-rc", path = "../env", default-features = false }
ink_storage = { version = "4.0.0-rc", path = "../storage", default-features = false }
ink_primitives = { version = "4.0.0-rc", path = "../primitives", default-features = false }
ink_metadata = { version = "4.0.0-rc", path = "../metadata", default-features = false, optional = true }
ink_prelude = { version = "4.0.0-rc", path = "../prelude", default-features = false }
ink_macro = { version = "4.0.0-rc", path = "macro", default-features = false }
ink_env = { version = "4.0.0", path = "../env", default-features = false }
ink_storage = { version = "4.0.0", path = "../storage", default-features = false }
ink_primitives = { version = "4.0.0", path = "../primitives", default-features = false }
ink_metadata = { version = "4.0.0", path = "../metadata", default-features = false, optional = true }
ink_prelude = { version = "4.0.0", path = "../prelude", default-features = false }
ink_macro = { version = "4.0.0", 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-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
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-rc", path = "../../primitives" }
ir = { version = "4.0.0-rc", package = "ink_ir", path = "../ir", default-features = false }
ink_primitives = { version = "4.0.0", path = "../../primitives" }
ir = { version = "4.0.0", 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-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
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-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
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-rc", path = "../ir", default-features = false }
ink_codegen = { version = "4.0.0-rc", path = "../codegen", default-features = false }
ink_primitives = { version = "4.0.0-rc", path = "../../primitives/", default-features = false }
ink_ir = { version = "4.0.0", path = "../ir", default-features = false }
ink_codegen = { version = "4.0.0", path = "../codegen", default-features = false }
ink_primitives = { version = "4.0.0", 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-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
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-rc", path = "../prelude/", default-features = false }
ink_primitives = { version = "4.0.0-rc", path = "../primitives/", default-features = false }
ink_prelude = { version = "4.0.0", path = "../prelude/", default-features = false }
ink_primitives = { version = "4.0.0", 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-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
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-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
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-rc", path = "../prelude/", default-features = false }
ink_prelude = { version = "4.0.0", 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-rc"
version = "4.0.0"
authors = ["Parity Technologies <admin@parity.io>", "Robin Freyler <robin@parity.io>"]
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-rc", path = "../env/", default-features = false }
ink_metadata = { version = "4.0.0-rc", path = "../metadata/", default-features = false, features = ["derive"], optional = true }
ink_primitives = { version = "4.0.0-rc", path = "../primitives/", default-features = false }
ink_storage_traits = { version = "4.0.0-rc", path = "traits", default-features = false }
ink_prelude = { version = "4.0.0-rc", path = "../prelude/", default-features = false }
ink_env = { version = "4.0.0", path = "../env/", default-features = false }
ink_metadata = { version = "4.0.0", path = "../metadata/", default-features = false, features = ["derive"], optional = true }
ink_primitives = { version = "4.0.0", path = "../primitives/", default-features = false }
ink_storage_traits = { version = "4.0.0", path = "traits", default-features = false }
ink_prelude = { version = "4.0.0", 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
Loading