Skip to content

Releases: use-ink/ink

v5.0.0

13 Mar 10:21
v5.0.0
1645903
Compare
Choose a tag to compare

ℹ️ We have created a migration guide from ink! 4 to ink! 5. It also contains an overview over all breaking changes and newly added features.
You can view it here.

Summary

This release addresses the rest of the severities described in the OpenZeppelin security review of ink! and cargo-contract.
One of the notable addressed issues is the proxy selector clashing attack.
As of this release, ink! only allows exactly one other message with a well-known reserved selector to be defined.
You can read more about the change in the #1827 and #2031.

ink! 5.0.0 features a significant number of new features:

  • We have introduced a new API based on the calculated or specified selectors for the event definition. This allows events to be defined in separate files and modules, and be shared across multiple ink! contracts - #1827 and #2031.
  • @pmikolajczyk41 has introduced an alternative E2E testing framework, DRink!, that support quasi-testing model, it allows the test simulate a running node as part of the E2E test while improving debugging experience such as allowing to set breakpoint and step through each stage of execution cycle.
  • Following improvements in E2E, we have added a call builder API that allows to easily build calls while significantly reducing boilerplate code - #1917 and #2075
  • Another notable introduction in 5.0.0 release is the support for multiple chain extensions that empower developers
    to build even more sophisticated and advanced contracts for supported chains - #1958.
  • To further address our consideration of the intrinsic security of ink! smart contracts,
    we have disallowed unchecked arithmetic expressions. cargo-contract will fail to compile the contract with the raw arithmetic operation - #1831.

These are the main features we have introduced in this release. We also encourage developers
to have a look at more detailed changelog entries to find out about any breaking changes that may affect
the development of new ink! contracts.

Compatibility

See the compatibility section of our migration guide for a detailed description. On a high level:

  • Rust: >= 1.70
  • cargo-contract: >= 4.0.0
  • polkadot-sdk: >= 0.9.3. But if using the new functions introduced in #2123 and #2077 >= 1.8.0 and if using the new functions introduced in #2076 >= 1.9.0.
  • polkadot-js/api and polkadot-js/api-contract: >= 10.12.1
  • substrate-contracts-node: >= 0.39.0

Changelog

Added

  • Add Hash trait to Selector struct - #2149
  • instantiate_v2 with additional limit parameters #2123
  • Custom signature topic in Events - #2031
  • [Linter] non_fallible_api lint - #2004
  • [Linter] Publish the linting crates on crates.io - #2060
  • [E2E] Added create_call_builder for testing existing contracts - #2075
  • call_v2 cross-contract calls with additional limit parameters - #2077
  • delegate_dependency api calls - #2076
  • Allow mutable parameters in messages - #2004
  • Clean E2E configuration parsing - #1922
  • Make set_code_hash generic - #1906
  • Provide a StorageVec datastructure built on top of Lazy - #1995
  • Add fallible methods for Mapping and Lazy - #1910
  • [E2E] Allow testing with live-chain state - #1949
  • [E2E] Call builders and extra gas margin option - #1917
  • [Linter] storage_never_freed lint - #1932
  • [Linter] strict_balance_equality lint - #1914
  • [Linter] no_main lint - #2001
  • Reexport scale dependencies, introduce #[ink::scale_derive] - #1890
  • Upgradeable contracts example - #1889
  • Persist static buffer size in metadata - #1880
  • Modify static buffer size via environmental variables - #1869
  • Added sr25519_verify function to ink_env #1840
  • Events 2.0 - #1827
  • Add set_block_number to off-chain test api Engine - #1806
  • Stabilize call_runtime#1749
  • Schema generation - #1765
  • Restrict wildcard selectors to have exactly one other message - #1708
  • [Linter] Warn when primitive number is annotated as event topic - #1837
  • [Drink backend] allow for arbitrary runtime - #1892
  • [Drink backend] support runtime call - #1891
  • [Drink backend] Make tests generic E2EBackend trait - #1867
  • [Drink backend] Backend choice ‒ #1864
  • [Drink backend] Backend traits - #1857
  • [Drink backend] Abstract error and result structs - #1844

Changed

  • Use name-only syntax for anonymous ink! event item configuration argument - #2140
  • Restrict syntax for setting default ink! e2e test runtime-only emulator - #2143
  • Restrict syntax for setting ink! e2e test node to auto - #2146
  • Bump Substrate crates - #2141
  • Minor fixes - #2144,
    #2137, #2132
  • Bump metadata version to 5 #2126
  • Use MaxEncodedLen for output buffer size #2128
  • Mapping: Reflect all possible failure cases in comments ‒ #2079
  • [E2E] Rename .call to .call_builder#2078
  • Improve syntax for ink! e2e runtime_only attribute argument - #2083
  • [E2E] Remove additional_contracts parameter #2098
  • [E2E] change node url backend config - #2101
  • Messages return TypeSpec directly - #1999
  • Fail when decoding from storage and not all bytes consumed - #1897
  • Support multiple chain extensions - #1958
    • New example of how to use multiple chain extensions in one contract.
    • Affects the usage of the #[ink::chain_extension] macro and the definition of the chain extension.
  • Split up ink_linting to mandatory and extra libraries - #2032
  • [E2E] resolve DispatchError error details for dry-runs - #1994
  • [E2E] update to new drink API - #2005
  • Reexport scale dependencies, introduce #[ink::scale_derive]#1890
  • Use of workspace dependencies and properties - #1835
  • Remove of unchecked arithmetic - #1831
  • Use decode_all for decoding cross contract call result - #1810
  • [E2E] build contracts at runtime instead of during codegen - #1881
  • [E2E] crate refactoring - #1830
  • [E2E] improve call API, remove build_message + callback - #1782

Fixed

  • Fix alignment in allocator [#2100](...
Read more

v5.0.0-rc.3

09 Mar 19:11
v5.0.0-rc.3
c14d00d
Compare
Choose a tag to compare
v5.0.0-rc.3 Pre-release
Pre-release

Changed

  • Use name-only syntax for anonymous ink! event item configuration argument - #2140
  • Restrict syntax for setting default ink! e2e test runtime-only emulator - #2143
  • Bump Substrate crates - #2141
  • Minor fixes - #2144,
    #2137, #2132

v5.0.0-rc.2

01 Mar 00:22
v5.0.0-rc.2
6f3e8e7
Compare
Choose a tag to compare
v5.0.0-rc.2 Pre-release
Pre-release

Added

  • instantiate_v2 with additional limit parameters #2123

Changed

  • Bump metadata version to 5 #2126
  • Use MaxEncodedLen for output buffer size #2128

Fixed

  • Fix alignment in allocator #2100

v5.0.0-rc.1

13 Feb 18:02
6c94c09
Compare
Choose a tag to compare
v5.0.0-rc.1 Pre-release
Pre-release

Added

  • Custom signature topic in Events - #2031
  • [Linter] non_fallible_api lint - #2004
  • [Linter] Publish the linting crates on crates.io - #2060
  • [E2E] Added create_call_builder for testing existing contracts - #2075
  • call_v2 cross-contract calls with additional limit parameters - #2077

Changed

  • Mapping: Reflect all possible failure cases in comments ‒ #2079
  • [E2E] Rename .call to .call_builder#2078
  • Improve syntax for ink! e2e runtime_only attribute argument - #2083
  • [E2E] Remove additional_contracts parameter #2098
  • [E2E] change node url backend config - #2101

Fixed

  • Fix the StorageVec type by excluding the len_cached field from its type info - #2052
  • Fix panic in approve_for in the ERC-721 example - #2092
  • ERC-721: transfer_token_from now ensures the token owner is correct - #2093

v5.0.0-rc

05 Dec 12:43
d969617
Compare
Choose a tag to compare
v5.0.0-rc Pre-release
Pre-release

This is a release candidate for ink! 5.0. Notable changes include:

  • Support for multiple chain extensions - #1958. This is a breaking change. Developers need to update their code utilising new API.
  • Lazy StorageVec structure that allows access vector data efficiently - #1995
  • E2E framework introduced a new builder API to simplify the call building - #1917

Added

  • Allow mutable parameters in messages - #2004
  • [E2E] Allow testing with live-chain state - #1949
  • [E2E] Call builders and extra gas margin option - #1917
  • Linter: storage_never_freed lint - #1932
  • Linter: strict_balance_equality lint - #1914
  • Linter: no_main lint - #2001
  • Clean E2E configuration parsing - #1922
  • Make set_code_hash generic - #1906
  • Provide a StorageVec datastructure built on top of Lazy - #1995

Changed

  • Messages return TypeSpec directly - #1999
  • Fail when decoding from storage and not all bytes consumed - #1897
  • [E2E] resolve DispatchError error details for dry-runs - #1944
  • [E2E] update to new drink API - #2005
  • Support multiple chain extensions - #1958
    • New example of how to use multiple chain extensions in one contract.
    • Affects the usage of the #[ink::chain_extension] macro and the definition of the chain extension.

v5.0.0-alpha

09 Sep 21:43
09f5fba
Compare
Choose a tag to compare
v5.0.0-alpha Pre-release
Pre-release

The preview release of the ink! 5.0.0 release.
This release addresses the majority of issues raised in the OpenZeppelin audit
in particular, we addressed the proxy selector clashing attack.
As of this release, ink! only allows exactly one other message with a well-known reserved selector to be defined.
You can read more about the change in the PR

There are also other notable changes:

  • Rework of event definitions - #1827.
  • Updated upgradeable contract example illustrating delegate_call
  • Removal of unchecked arithmetic. cargo-contract will fail compiling the contract with raw arithmetic operations.
  • Introduction of an alternative off-chain E2E testing backend, drink!
    Big thanks to @pmikolajczyk41 for this massive contribution!

You can see a more detailed log of changes below:

Added

  • [Drink backend]: allow for arbitrary runtime - #1892
  • [Drink backend]: support runtime call - #1891
  • Reexport scale dependencies, introduce #[ink::scale_derive] - #1890
  • Upgradeable contracts example - #1889
  • Persist static buffer size in metadata - #1880
  • Modify static buffer size via environmental variables - #1869
  • [Drink backend]: Make tests generic E2EBackend trait - #1867
  • [Drink backend]: Backend choice ‒ #1864
  • [Drink backend]: Backend traits - #1857
  • [Drink backend]: Abstract error and result structs - #1844
  • Added sr25519_verify function to ink_env #1840
  • Warn when primitive number is annotated as event topic - #1837
  • Events 2.0 - #1827
  • Add set_block_number to off-chain test api Engine - #1806
  • Stabilize call_runtime#1749
  • Schema generation - #1765
  • Restrict wildcard selectors to have exactly one other message - #1708

Changed

  • Reexport scale dependencies, introduce #[ink::scale_derive]#1890
  • [ink_e2e] build contracts at runtime instead of during codegen - #1881
  • Use of workspace dependencies and properties - #1835
  • Remove of unchecked arithmetic - #1831
  • E2E crate refactoring - #1830
  • Use `decode_all`` for decoding cross contract call result - #1810
  • E2E: improve call API, remove build_message + callback - #1782

v4.3.0

24 Aug 08:28
71c817c
Compare
Choose a tag to compare

Version 4.3.0

This release is to fix compatibility of ink_e2e with newer (> 1.69) versions of Rust,
which produce signext instructions, and older versions of pallet_contracts which do
not yet support these instructions.

  • Backport use of contract-build to 3.2.0 to include signext lowering, and update
    subxt to remove incompatible wasmi-instrument transient dependency ‒ #1884

v4.2.1

14 Jun 19:50
v4.2.1
1b2e7cf
Compare
Choose a tag to compare

Version 4.2.1

This release contains a low-severity security related fix. Users of the 4.x series of releases are advised to update.

Note that this release contains a breaking change since the API of ink_env::invoke_contract_delegate and CallBuilder::try_invoke now return an extra ink_primitives::MessageResult which must be handled.

We decided to release this breaking change as a PATCH release to ensure that affected users are upgrading to the fixed API.

See the published advisory for more info.

Fixed

  • Handle LangError from DelegateCall

v4.2.0

20 Apr 08:23
v4.2.0
55088cc
Compare
Choose a tag to compare

ink!-4 2 0

Added

  • Persist Environment in metadata ‒ #1741
  • Added possibility for runtime_call in E2E tests ‒ #1736
  • Added default attribute to constructors and messages ‒ #1724
  • Added clarification about Mapping::size unit ‒ #1735

Changed

  • Upgraded syn to version 2#1731
  • Update scale-info requirement to 2.5#1733
  • Bump subxt to 0.28.0#1750

v4.1.0

23 Mar 17:59
d068d18
Compare
Choose a tag to compare

Added

  • Basic support for dyn Trait to allow cross-contract calls only with trait - #1673
  • E2E: auto detect contracts to be built - #1691
  • Add set_code_hash to EnvAccess - #1698
  • Add set_block_timestamp to off-chain test api Engine - #1721

Changed

  • Support conditional compilation - #1707