ink! 3.0.0 RC 7
Pre-release
Pre-release
Version 3.0-rc7
This is the 7th release candidate for ink! 3.0.
Since our last release candidate we implemented a number of contract size improvements.
With those improvements the size of our erc20 example has reduced significantly:
Release Build with cargo-contract |
||
|---|---|---|
erc20 |
3.0.0-rc6 |
29.3 K |
erc20 |
3.0.0-rc7 |
10.4 K |
The savings apply partly to our other examples; for erc20 they are most
significant since it has been migrated to use a new Mapping
data structure, which we introduce with this release candidate.
The other examples will be migrated to this new data structure as a next step.
Removed
- Removed the state rent API ‒ #1036.
Added
- Added support for wildcard selectors ‒ #1020.
- This enables writing upgradable smart contracts using the proxy/forward pattern.
We added a new example to illustrate this ‒ the proxy example. - Annotating a wildcard selector in traits is not supported.
- This enables writing upgradable smart contracts using the proxy/forward pattern.
- The ink! codegen now heavily relies on static type information based on traits defined in
ink_lang‒ #665.- Some of those traits and their carried information can be used for static reflection of ink!
smart contracts. Those types and traits reside in the newink_lang::reflectmodule and is
publicly usable by ink! smart contract authors.
- Some of those traits and their carried information can be used for static reflection of ink!
Changed
- Upgraded to the
seal_callv1 API ‒ #960.- This API now enables control over the behavior of cross-contract calls, e.g. to forward/clone input,
enable tail calls and control reentrancy.
The crate documentation contains more details on theCallFlags. - Note: The default behavior of cross-contract calls now disallows reentering the calling contract.
- This API now enables control over the behavior of cross-contract calls, e.g. to forward/clone input,
- ink! contract definitions via
#[ink::contract]‒ #665.
For ink! smart contracts we now generate two contract types. GivenMyContract:MyContractwill still be the storage struct.
However, it can now additionally be used as static dependency in other smart contracts.
Static dependencies can be envisioned as being directly embedded into a smart contract.MyContractRefis pretty much the same of what we had gotten with the oldink-as-dependency.
It is a typed thin-wrapper around anAccountIdthat is mirroring the ink! smart contract's API
and implemented traits.
- ink! trait definitions via
#[ink::trait_definition]‒ #665.- ink! trait definitions no longer can define trait constructors.
- ink! trait implementations now inherit
selectorandpayableproperties for trait messages.- Now explicitly setting
selectororpayableproperty for an implemented ink! trait method
will only act as a guard that the set property is in fact the same as defined by the ink!
trait definition.
- Now explicitly setting
- Improved some ink! specific compile errors ‒ #665.
- For example, when using ink! messages and constructors which have inputs (or
outputs) that cannot be encoded (or decoded) using the SCALE codec.
- For example, when using ink! messages and constructors which have inputs (or
- Simplified selector computation for ink! trait methods ‒ #665.
- Now selectors are encoded as
blake2b({namespace}::{trait_identifier}::{message_identifier})[0..4].
If nonamespaceis set for the ink! trait definition then the formula is
blake2b({trait_identifier}::{message_identifier})[0..4].
Wheretrait_identifierandmessage_identifierboth refer to the identifiers of the ink! trait
definition and ink! trait message respectively.
- Now selectors are encoded as
- We switched to Rust edition 2021 ‒ #977.
- Update chain extension example to show argument passing ‒ #1029.
Fixed
- Contracts now revert the transaction if an ink! message returns
Result::Err‒ #975, #998.- It is still possible to match against a
Resultreturn type for a called dependency contract
‒ i.e. a sub-contract specified in the contract'sCargo.toml.
- It is still possible to match against a
- We implemented a number of Wasm contract size improvements: