Skip to content

Update Rust crate ink to v5 - #6

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/ink-5.x
Open

Update Rust crate ink to v5#6
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/ink-5.x

Conversation

@renovate

@renovate renovate Bot commented Mar 15, 2024

Copy link
Copy Markdown

This PR contains the following updates:

Package Type Update Change
ink (source) dependencies major 4.25.0

Release Notes

use-ink/ink (ink)

v5.1.1

Compare Source

Fixed

  • [E2E] Have port parsing handle comma-separated list ‒ #​2336

v5.1.0

Compare Source

This is the first ink! release outside of Parity. ink! was started at Parity and
during this year became a community project maintained by the ink! Alliance, a
loose group of former Parity employees and teams who want ink! to ensure a bright
future for ink!.

You can find more details about the community handover in
this X post.
Generally, the only thing changing on the user-facing side is that the repositories
have been moved from paritytech to the new GitHub organization use-ink.

We want to say a big thank you to our Polkadot community, which recently decided on
funding the continued maintenance and development of ink! with
a Polkadot Treasury grant.

Highlights

This version of ink! comes with three highlights plus some minor fixes.

(1) XCM Support

ink! 5.1 supports the usage of XCM in contracts, developers are no longer limited
to cross-contract calls, but can now execute cross-parachain calls.

We added a contract example that demonstrates the usage:
contract-xcm

We also added a new page on our documentation website:
https://use.ink/basics/xcm.

You can view the Rust docs of the two functions here:

(2) Call an ink! contract from a polkadot-sdk runtime

ink! 5.1 comes with basic support for calling contracts from a Polkadot runtime.
We've added this example
that demonstrates how to call flipper from a polkadot-sdk runtime pallet.

Calling a contract from the runtime is an interesting application for parachains,
as they can put logic into a contract instead of their runtime. Contracts have
a number of advantages, as they are easier to upgrade and allow for
faster development iteration cycles.

The limitations currently are:

  • Contract calls can only be made to trait messages. This makes sense in the
    pallet-contracts context, as it is better to depend on a trait rather
    than a contract impl, since you are working against an interface.
  • Only contract messages can be called currently, no constructors.
  • The API could be nicer.
(3) E2E Testing

We replaced our drink sandbox dependency with an internal ink! crate.
In case you use DRink!:

First, you should upgrade your drink dependency to version = "0.18.0".
Second, these are the two changes you have to make:

- #[ink_e2e::test(backend(runtime_only(sandbox = ink_e2e::MinimalSandbox)))]
+ #[ink_e2e::test(backend(runtime_only(sandbox = ink_e2e::DefaultSandbox)))]
- ink_e2e = { version = "5", features = ["drink"] }
+ ink_e2e = { version = "5", features = ["sandbox"] }
Compatibility

The compatibility changes a bit to ink! 5.0:

  • Rust: >= 1.81
  • cargo-contract: >= 5.0.0
  • polkadot-sdk: >= v1.12.0
    (this release stabilized the pallet-contracts XCM functions that ink! uses)
  • substrate-contracts-node: >= 0.42.0
  • DRink!: >= 0.18.0

For the linter in cargo-contract the Rust toolchain version changed.
To upgrade:

export TOOLCHAIN_VERSION=nightly-2024-09-05
rustup install $TOOLCHAIN_VERSION
rustup component add rust-src --toolchain $TOOLCHAIN_VERSION
rustup run $TOOLCHAIN_VERSION cargo install cargo-dylint dylint-link
Added
  • [Runtime-to-Contract Calls] Environment agnostic contract invocation API, for calling contracts from runtime ‒ #​2219
  • [Runtime-to-Contract Calls] Add no-panic-handler feature ‒ #​2164
  • [Runtime-to-Contract Calls] Add example for calling a contract from a runtime pallet ‒ #​2189
  • [XCM] Add xcm_execute and xcm_send support ‒ #​1912
  • [Linter] Add links to detailed lint description ‒ #​2170
  • [E2E] Adds a message to SandboxErr to add context for easier debugging ‒ #​2218
  • [E2E] Add ability to take and restore snapshots ‒ #​2261 (thanks @​0xLucca!)
  • [E2E] Demonstrate usage of seeds for secret URIs in E2E test for chain snapshots ‒ #​2163
Changed
  • Update repository URLs & references from paritytech GitHub organization to new use-ink one ‒ #​2220 and #​2248
  • [E2E] Update subxt and polkadot-sdk dependencies ‒ #​2174
  • [Drink backend] Replace drink sandbox with internal ink_sandbox#​2158
Fixed
  • [XCM] Fix XCM-support to single encode the XCM message ‒ #​2278
  • [Examples] ERC-721: burn() clears token approval ‒ #​2099
  • [E2E] Fix outdated docs for [ink_e2e::test]#​2162
  • [E2E] Build contracts before initializing node rpc ‒ #​2168
  • [E2E] set_account_balance now can't set balance below existential deposit ‒ #​1983 (thanks @​0xLucca!)
  • [E2E] Fix outdated docs for [ink_e2e::test]#​2162

v5.0.0

Compare Source

ℹ️ We've 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
  • 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
  • RootLayout::new() is generic again to allow using ink_metadata in pure PortableForm contexts - #​1989

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot force-pushed the renovate/ink-5.x branch 2 times, most recently from af4e9e4 to dbeb918 Compare May 5, 2024 11:35
@renovate
renovate Bot force-pushed the renovate/ink-5.x branch from dbeb918 to 0507e88 Compare July 25, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants