Skip to main content

Announcing ink! 4.x to 5.0 migration features, and other major improvements

ยท 3 min read
David Semakula

ink! 4.x to 5.0 cover image

I am happy to announce new features for migrating ink! 4.x projects to ink! 5.0, along with other major improvements, for ink! analyzer - a collection of modular and reusable libraries and tools for semantic analysis of ink! smart contracts.

If you're new to ink! analyzer (or if you need a refresher ๐Ÿ™‚), you can refer to the introductory blog post for a deep dive into the problem, solution and technical descriptions of each of the architectural components of the project.

What's new?โ€‹

The latest updates introduce features for migrating ink! 4.x projects to ink! 5.0, along with other major improvements, across all ink! analyzer components including:

  • Command and code action for migrating ink! 4.x projects to ink! 5.0 including:
    • Migrating ink! events to "2.0" syntax.
    • Migrating ink! chain extension attribute macro and associated fn attribute argument to ink! 5.0 syntax.
    • Replacing "built-in" derives of SCALE codec traits with ink! 5.0 scale_derive attribute macro equivalents.
    • Migrating ink! e2e tests including:
      • Updating e2e fn signatures to include new E2EBackend trait.
      • Removing deprecated attribute arguments (i.e. additional_contracts and keep_attr).
      • Using new "builder" APIs and ContractsBackend trait for instantiate, instantiate_dry_run, call, call_dry_run, upload e.t.c.
      • Using new ChainBackend trait for create_and_fund_account, balance, runtime_call e.t.c.
      • Replacing deprecated build_message fn, MessageBuilder type, and related call callback with new API equivalents.
      • Removing ink! e2e deprecated imports i.e. build_message, MessageBuilder e.t.c.
    • Migrating cross-contract host function calls to new API equivalents to preserve semantics including:
      • Replacing call from CallBuilder via build_call with call_v1.
      • Adding an instantiate_v1 call before other method calls on CreateBuilders via build_create.
      • Replacing instantiate_contract and invoke_contract with instantiate_contract_v1 and invoke_contract_v1 for direct calls in any function.
      • Replacing instantiate_contract and invoke_contract with instantiate_contract_v1 and invoke_contract_v1 for indirect calls via Self::env() and self.env() in ink! constructors and messages.
      • Replacing Call constructors with CallV1.
    • Migrating ink! project Cargo.toml to ink! 5.0 (i.e. updating ink and ink_e2e dependencies, removing SCALE dependencies and related features e.t.c).
  • Completions for full ink! entities (i.e. inserting full Rust items not just ink! attribute macros and arguments e.g. ink! constructor and message fn items as completions when typing fn inside impl blocks e.t.c).
  • Command and code action for extracting ink! events into standalone packages (only for ink! v5 projects).
  • Completions and code actions for ink::combine_extensions! declarative macro.
  • Support for ink! workspace dependencies.

Conclusionโ€‹

You can learn more about all ink! analyzer components in the introductory blog post (including links to all available project resources in the "Diving Deeper" section), and/or checkout the ink! analyzer organization on GitHub for: installation, development, usage and testing instructions, library documentation, low-level technical and architectural descriptions, access to the source code, and distributable releases of the ink! Language Server and VSIX packages for the VS Code extension (if you prefer not to use the VS Code marketplace) for most of the major platforms/architectures.

Issues, bug reports, PRs and feature requests are welcome at the respective GitHub repositories ๐Ÿ™‚.