Skip to content

Contract interactions not supported on Weight V2 chains #334

Description

@DamianStraszak

First of all -- huge kudos for developing this library -- it's absolutely great, I have been using it quite a lot.

As for the issue I encountered. It seems to me that the support for WeightsV2 is not there yet for Smart Contracts (ContractInstance and related classes). In particular the example https://github.com/polkascan/py-substrate-interface/blob/master/examples/create_and_exec_contract.py does not work on WeightsV2 chains.

I have dug into it a little, and it seems that's because in places like https://github.com/polkascan/py-substrate-interface/blob/1f558e6a5fa9a1ea71ae25211989ebf858a14075/substrateinterface/contracts.py#L772 or more specifically https://github.com/polkascan/py-substrate-interface/blob/1f558e6a5fa9a1ea71ae25211989ebf858a14075/substrateinterface/contracts.py#L797 there is still a one-dimensional gas_limit.

Changing this unfortunately does not fix the problem, there is something else to fix also -- which I haven't figured out yet.

The question is whether there is a plan to add this support? My two comments here:

  • I think it's fine to drop the compatibility with WeightsV1 for Contracts, because there will never be a chain that launches Contracts on the old Weights. Currently the only production chains that have contracts are Aleph Zero and Astar, both on WeightsV2
  • I can try sending you a PR with the fix for this issue once I figure out what all needs to be done. But in such a case, there might be some work required for a reviewer on your side to help me bring it to an acceptable form, as I'm not python-native :P

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions