0

A customer has a substrate blockchain based on Tag 3.0.0 It uses pallet-contracts = { git = "https://github.com/paritytech/substrate.git", tag = "v3.0.0" }

The problem is that when I compile a smart contract with cargo contract and try to upload it (it uses the old-ui, see image below), it complains that the ABI is invalid.

'''Invalid ABI file — Error: Invalid JSON ABI structure supplied, expected a recent metadata version'''

It works Ok with the last version of substrate from the repo.

So my questions are: .- Is it possible for cargo contract build contracts compatible with 3.0.0? .- Is it possible to upgrade just the contract pallet on a substrate based on 3.0.0?

Thanks very much. Regads; Fernando

Code Upload Functionality

1 Answer 1

1

Is it possible to upgrade just the contract pallet on a substrate based on 3.0.0?

Yes, this is definitely possible! Substrate enables forkless runtime upgrades. This tutorial here walks through the steps of upgrading Substrate. Just be cautious when doing this and ensure the pallet_contracts is configured correctly for the new version. I recommend comparing the current substrate-contracts-node with your Substrate node and adding any differences relating to pallet_contracts. Note: The substrate-contracts-node uses instant block sealing, so make sure not to edit your node's consensus when comparing.

Is it possible for cargo contract build contracts compatible with 3.0.0?

Yes, it is also possible to use a cargo-contract version that is compatible with ink! v3.0.0. To do this, you will likely need to downgrade cargo-contract. However, it is recommended to use the newest release of ink! (upgrade pallet_contracts, see above).

See here for cargo-contract releases.

For example, to downgrade:

cargo install cargo-contract --version 1.4.0 --force
3
  • Thanks a lot! Really appreciate it. Ill test both options. Sep 19, 2022 at 22:27
  • I've been trying to compile this way, but I got the same error. Debugging the UI, it seems it check if the contract bundle has: a metadataVestion string, which is missimg a spec object at the root level, but the compiler generates a V3: { spec: ... } Maybe for substrate v3 (i mean the V3.0.0 tag in the repo) there is another way of writing smart contracts? Thanks very much Sep 20, 2022 at 18:01
  • 1
    @FernandoRuscitti If you are still having issues with this, upgrading from v3.0.0 and start following Polkadot releases should work. Currently this is polkadot-v0.9.29. The polkadot releases are the most up-to-date. Simply update all of the dependencies to follow that branch. Any changes to the client will require using a new binary for the nodes. Sep 29, 2022 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.