v4.0.0
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 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
. You can install it as follows:
cargo install cargo-contract --forced --locked
You will also need to use a version of pallet-contracts
later than polkadot-v0.9.37 in your node.
The v0.24.0
release of the substrate-contracts-node
is compatible with the ink! 4.0.0
release.
For full compatibility requirements see the migration guide.
Added
- Add
Mapping::contains(key)
andMapping::insert_return_size(key, val)
β #1224 - Add
payment-channel
example β #1248 (thanks @kanishkatn!) - Add
version
field to ink! metadata β #1313 - The
rand-extension
example has been adapted to an updated version of theChainExtension
API β #1356 - Add
ink_env::pay_with_call!
helper macro for off-chain emulation of sending payments with contract message calls β #1379 - Allow using
Result<Self, Error>
as a return type in constructors β #1446 - Add
Mapping::take()
function allowing to get a value removing it from storage β #1461 - Add E2E testing framework MVP β #1395
- Add E2E tests for
Mapping
functions - #1492 - E2E: expose call dry-run method β #1624
- Make cross-contract callee non-optional β #1636
- Support custom environment in E2E tests - #1645 (thanks @pmikolajczyk41!)
Changed
- Contract size optimization in case contract doesn't accept payment β #1267 (thanks @xgreenx!)
- Move ink! linter into
ink
repository β #1361 - Introduce
ink
entrance crate β #1223 - Use
XXH32
instead ofsha256
for calculating storage keys β #1393 - Storage Refactoring β #1331
- Add support for language level errors (
LangError
) β #1450 - Return
LangError
s from constructors β #1504 - Update
scale-info
requirement to2.3
β #1467 - Merge
Mapping::insert(key, val)
andMapping::insert_return_size(key, val)
into one method - #1463 - FFI: no more
__unstable__
wasm import module β #1522 - Clean up CallBuilder
return()
type β #1525 - Fix trait message return type metadata β #1531
- Bump Dylint dependencies β #1551
- Stabilize
take_storage
β #1568 - Chain Extension: Evaluation of method return type at compile time β #1569
- Make more functions be const β #1574 (thanks @yjhmelody!)
- Unify fallible and non fallible
instantiate
methods β #1591 - Make
CallBuilder
andCreateBuilder
error handling optional β #1602 - Rename
CallBuilder::fire()
method toinvoke()
β #1604 - chore: add minimum rust version to the ink crate β #1609 (thanks @Kurtsley!)
- Rename
_checked
codegen call methods withtry_
β #1621 - Bump Substrate and
subxt
dependencies β #1549 - E2E: spawn a separate contracts node instance per test β #1642
Fixed
- Trim single whitespace prefix in the metadata
docs
field β #1385 - Allow pay_with_call to take multiple arguments β #1401
- Add Determinism enum from pallet-contracts β #1547
- Added missed
WhereClosure
for the generics intostorage_item
β #1536 (thanks @xgreenx!)