Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Test uploaded contract for compatibility with contract pallet #74

Open
cmichi opened this issue Mar 22, 2021 · 1 comment
Open

Test uploaded contract for compatibility with contract pallet #74

cmichi opened this issue Mar 22, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@cmichi
Copy link

cmichi commented Mar 22, 2021

Motivation

The UI should output a warning when trying to upload a contract that was written in an incompatible ink! ⇿ contract pallet version.

This is an issue which will become only more prevalent in the future. It is already a recurring source of confusion for users and we regularly get questions about which versions are compatible.

My hunch is that the output should be a warning, not an error, since a user could write a contract in a newer version of ink! which would still be compatible to old versions of the contract pallet. There are arguments to be made for an error message though, not entirely sure what the best option is.

Implementation

  • The .contract file already contains the ink! version under source.language.
  • AFAIK the contract pallet does not currently not expose its version. (cc @athei)

I guess in an ideal world we would take semver into account when checking for compatibility.

@cmichi cmichi added the enhancement New feature or request label Mar 22, 2021
@athei
Copy link
Member

athei commented Mar 22, 2021

I think the situation is getting better in the future as the contracts pallets is now backwards compatible. So the situation that arise in the future is having a too new ink! version or having a unsupported feature enabled. That said, I think this check is useful.

AFAIK the contract pallet does not currently not expose its version. (cc @athei)

Each pallet's version is can be read from storage:
https://github.com/paritytech/substrate/blob/master/frame/support/src/traits.rs#L2183

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants