Skip to content

ink! 3.0.0 RC 7

Pre-release
Pre-release
Compare
Choose a tag to compare
@cmichi cmichi released this 25 Nov 12:47
· 875 commits to master since this release
6cde90c

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.
  • 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 new ink_lang::reflect module and is
      publicly usable by ink! smart contract authors.

Changed

  • Upgraded to the seal_call v1 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 the CallFlags.
    • Note: The default behavior of cross-contract calls now disallows reentering the calling contract.
  • ink! contract definitions via #[ink::contract]#665.

    For ink! smart contracts we now generate two contract types. Given MyContract:
    • MyContract will 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.
    • MyContractRef is pretty much the same of what we had gotten with the old ink-as-dependency.
      It is a typed thin-wrapper around an AccountId that 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 selector and payable properties for trait messages.
      • Now explicitly setting selector or payable property 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.
  • 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.
  • Simplified selector computation for ink! trait methods ‒ #665.
    • Now selectors are encoded as blake2b({namespace}::{trait_identifier}::{message_identifier})[0..4].
      If no namespace is set for the ink! trait definition then the formula is
      blake2b({trait_identifier}::{message_identifier})[0..4].
      Where trait_identifier and message_identifier both refer to the identifiers of the ink! trait
      definition and ink! trait message respectively.
  • 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 Result return type for a called dependency contract
      ‒ i.e. a sub-contract specified in the contract's Cargo.toml.
  • We implemented a number of Wasm contract size improvements:
    • Simple Mapping Storage Primitive ‒ #946.
    • Remove always from inline to allow compiler decide that to do ‒ #1012 (thanks @xgreenx).
    • Add a way to allocate a storage facility using spread (and packed) layouts ‒ #978.
    • Extract non-generic part of push_topic to reduce code size ‒ #1026.