8000 Releases · use-ink/cargo-contract · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Releases: use-ink/cargo-contract

v6.0.0-alpha

02 May 16:46
a259142
Compare
Choose a tag to compare
v6.0.0-alpha Pre-release
Pre-release

This is our first alpha release for cargo-contract v6. We release it together
with ink! v6.0.0-alpha.

The biggest change is that we are in the process of migrating from pallet-contracts +
WebAssembly (executed in wasmi) to pallet-revive +
RISC-V (executed in PolkaVM).
This is a major breaking change, cargo-contract will only be compatible with ink! >= v6
and chains that include pallet-revive.

We did a detailed write-up of the background to this development and the reasoning
here.

Compatibility of this release:

In the following we'll describe some breaking changes on a high-level. The
context to understand them is that the pallet-revive team has Ethereum/Solidity
support as the number one priority. All their design decisions derive from that,
they don't want to maintain code that is unnecessary for that objective.

Updated structs + function arguments

We had to change a number of structs and function arguments. Some notable ones:

SourceWasm -> SourceContractBytecode
dest_wasm -> dest_polkavm
optimization_result -> linker_size_result

And v5 ExecuteArgs
v6.0.0-alpha ExecuteArgs.

We won't describe the other ones here. The best course is to see if you encounter
compilation errors upon upgrading to 6.0.0-alpha. If so, please check our Rust
docs or the cargo-contract source code for how the new format looks and what
the comments say.

The commit that applied the majority of naming changes was
this one.

Types

Contract Balance: U256

For the type of a contract's balance, pallet-revive uses depending on the context

  • either the configured pallet_revive::Config::Currency type (which corresponds
    to the ink::Environment::Balance type.
  • or a hardcoded U256 (which corresponds to what Ethereum uses).
    In this alpha release we just adhere to requiring the types that pallet-revive uses.
    In an upcoming beta release this could be simplified to reduce UX friction by just
    using one type everywhere and converting to the pallet-revive one.

Contract Address: H160

For a contract's account, pallet-revive is using either the configured AccountId type
of the polkadot-sdk runtime, or H160.

Finding the H160 for an AccountId is done via an address derivation scheme derived in
#7662.
After instantiating a contract, the address is no longer returned by pallet-revive.
Instead one has to derive it from given parameters (see the linked PR). cargo-contract
does that automatically.

For contract instantiations and contract calls the pallet requires that a 1-to-1 mapping
of an AccountId to a H160 has been created. This can be done via the map_account/
unmap_account API.
The PR #6096 contains more
information.

Besides the publicly exposed crate functions, we've introduced a new subcommand
cargo contract account that allows resolving the H160 contract address to the
Substrate AccountId which it is mapped to.

Contract Hash: H256

For a contract's hash value, pallet-revive uses a fixed H256, Previously,
the ink::Environment::Hash type referenced the hash type being used for the
contract's hash. Now it's just a fixed H160.

Events

In #7164, Parity removed
most smart-contract-specific events: Called, ContractCodeUpdated, CodeStored,
CodeRemoved, Terminated, Instantiated, DelegateCalled,
StorageDepositTransferredAndHeld, StorageDepositTransferredAndReleased.

The ContractEmitted event (for events a contract emits) is still available.

Debugging

Previously, pallet-contracts returned a debug_message field with contract
instantiations and dry-runs.
Whenever ink::env::debug_println was invoked in a contract, ink! wrote debugging
info to this field. This functionality has been removed. Instead pallet-revive now
supports other means of debugging.

The most relevant for this release is the tracing API. There are a number of PRs
that implemented it, so we won't link a specific one here. A good starting point
to look deeper into it is the tracing.rs.

We have implemented barebones support for this tracing API in the 6.0.0-alpha
versions of ink! + cargo-contract. But it's really barebones and should
certainly be improved before a production release.

Detection of contract language disabled

The heuristic detection of a contract's language in cargo contract info
has been temporarily disabled; it's not yet implemented.

Contract sizes

Contracts compiled with v6.0.0-alpha will have a large file size. This is due to a number
of bugs in PolkaVM that prohibit us from using e.g. LTO. The contract sizes will eventually
get much smaller again, once those bugs are fixed.

Linting

Linting of a contract can be executed by running the lint command:

➜ cargo contract lint --help
Lint a contract

Usage: cargo contract lint [OPTIONS]

Options:
      --manifest-path <MANIFEST_PATH>
          Path to the `Cargo.toml` of the contract to build

      --quiet
          No output printed to stdout

      --verbose
          Use verbose output

      --extra-lints
          Performs extra linting checks during the build process. Basic clippy lints are deemed important and run anyway.

  -h, --help
          Print help (see a summary with '-h')

Or can be executed programmatically:

let crate_metadata = CrateMetadata::collect(manifest_path)?;
let verbosity = TryFrom::<&VerbosityFlags>::try_from(&self.verbosity)?;

contract_build::lint(extra_lint, &crate_metadata, &verbosity);

Please see #2013 for more information.

Ability to generate Solidity metadata for a contract

ink! v6 will have the ability to speak Solidity, you'll be able to integrate
with tools like Metamask and call ink! contracts from Solidity as if they were
a pre-compile.

We added a new subcommand for this:

cargo contract build ---metadata <ink|solidity>

Please see #1930 for more information.

Changed

  • Target pallet-revive instead of pallet-contracts - #1851
  • Retrieve PolkaVM target spec from linker - #1939

Added

  • Add option to generate Solidity compatible metadata (via cargo contract build ---metadata <ink|solidity>) - #1930
  • Deny overflowing (and lossy) integer type cast operations - #1895
  • Remove linting by default, --skip-linting and --lint flag in cargo contract build and add a new command lint - #2013

Fixed

  • Resolved verifiable-build image failures within release-verifiable-image workflow - #2018

v5.0.3

24 Jan 13:32
v5.0.3
81420a5
Compare
Choose a tag to compare

Added

  • Deny overflowing (and lossy) integer type cast operations - #1895

Fixed

  • Use latest ink! release version in new contract template - #1896

v5.0.2

17 Dec 12:41
6f7671c
Compare
Choose a tag to compare

Changed

  • Made extrinsic call types, upload, and events public - #1873

v5.0.1

17 Dec 10:48
v5.0.1
8a464c7
Compare
Choose a tag to compare

Changed

  • Bumped the ink! dependencies to ink! 5.1.0 - #1837
  • Synchronized the sp-* dependencies with the ones used in ink! 5.1.0 - #1837

v5.0.0

22 Nov 12:28
v5.0.0
191d23c
Compare
Choose a tag to compare

This release concludes the migration of ink! from Parity to the outside world. It doesn't come with any new features, we just:

  • …changed the Parity URLs to ones for our new GitHub organization
    @use-ink.
  • …upgraded many dependencies to newer versions, which results in two particular
    breaking changes regarding compatibility:
    • We had to remove support for Substrate metadata that is below
      V14 in #1722. Metadata formats below V14 are quite old and we hope this doesn't affect anyone.
    • cargo-contract v5 works only with Rust >= 1.81.

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

Changed

  • Updated the toolchain version used by ink_linting - #1616
  • Update repository URLs & references from paritytech GitHub organization to new use-ink one ‒ #1663
  • Bump the version of subxt and subxt-signer - #1722

Removed

  • Remove support for V11 metadata #1722

v4.1.3

20 Nov 14:55
v4.1.3
ac10464
Compare
Choose a tag to compare

Fixed

  • Fix "chain configuration not found" error (Rust 1.79) - #1821
  • Validate externally passed Rust toolchain identifiers - #1817
  • For contract verification: don't rely on Wasm hash in metadata - #1820

v4.1.2

06 Nov 09:28
v4.1.2
6c987ca
Compare
Choose a tag to compare

Fixed

  • Fix "chain configuration not found" error - #1786

v5.0.0-alpha

30 Sep 13:18
b183e9e
Compare
Choose a tag to compare

What's Changed

Fixed

  • Remove parity-wasm dependency from contract-build crate - #1594
  • chore: Update toolchain for ink_linting - #1616
  • chore: bump subxt and subxt-signer versions - #1722

Added

  • Add support for cargo build --verifiable --lint command - #1512
  • Add new image deployment repo - #1620
  • Switch to useink image in verifiable build command - #1622

Full Changelog: v4.1.1...v5.0.0-alpha

v4.1.1

17 Apr 11:34
v4.1.1
3d74a06
Compare
Choose a tag to compare

Fixed

  • Remove mention of non-existent argument, improve clarity of warning message - #1590

v4.1.0

10 Apr 13:41
v4.1.0
e7a43cc
Compare
Choose a tag to compare

Fixed

  • Fix the instantiate command for Substrate 0.9.42 based chains - #1564

Added

  • Add cargo contract storage --version command - #1564
  • Add cargo contract verify --wasm argument - #1551
  • Add cargo contract instantiate --chain with production chain endpoints - #1290
  • Warn when uploading unverifiable contract builds to production - #1290
0