I add pallet-contract into substrate-node-template, and use polkadot-JS to upload ink! contracts. But I get something wrong when I upload a contract.

logs like this:

createType(Call):: Call: failed decoding contracts.instantiateWithCode:: Struct: failed on args: 
{"value":"Lookup115","gas_limit":"Lookup82","storage_deposit_limit":"Option<Compact>","code":"Bytes","data":"Bytes","salt":"Bytes"}:: Struct: failed on gas_limit: Compact:: Unable to construct number from multi-key object

enter image description here

I tried substrate-contracts-node to generate blocks, and it can upload a contract successfully using polkadot-JS.

I have to use substrate-node-template to complete my work, what should I do to solve this problem?

Besides, I've seen other people have this problem: https://github.com/polkadot-js/apps/issues/8427

1 Answer 1


The current version of substrate supports a new version of "weights", whereby it is no longer just the execution time (a.k.a "gas") but also accounts for the "proof size" i.e. the size of the data sent as part of the message from a parachain to the relaychain for validation. This is know as Weights V2, or 2D Weights.

The reason for the error you are seeing is that the contract instantiation first does a "dry-run" to estimate some values for the gas/weight limit. Previously it returned a plain u64, now it returns a struct with a pair of values: exection_time and proof_size: hence the decoding error.

There is an issue relating to upgrading the polkadot-js to Weights V2, see https://github.com/polkadot-js/apps/issues/8364.

Hope that will be fixed soon, but in the meantime you can try with https://contracts-ui.substrate.io/, or cargo-contract

Your Answer

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

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