Test uploaded contract for compatibility with `contract` pallet
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
.contractfile already contains the ink! version undersource.language. - AFAIK the
contractpallet 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.
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