polkascan / py-substrate-interface

Python Substrate Interface
https://polkascan.github.io/py-substrate-interface/
Apache License 2.0
241 stars 115 forks source link

Unsupported Metadata Version in substrate-interface #393

Closed I-Corinthian closed 3 months ago

I-Corinthian commented 3 months ago

Description:

I am using the substrate-interface library to interact with an ink! contract, but I am encountering the following error:

raise ContractMetadataParseException("Unsupported metadata version")
substrateinterface.exceptions.ContractMetadataParseException: Unsupported metadata version

Code Causing the Error:

contract = ContractInstance.create_from_address(
    contract_address=self.contract_address,
    metadata_file=self.metadata,
    substrate=self.substrate,
)

Rustup Show Output:

rustup show
Default host: x86_64-unknown-linux-gnu
rustup home: /home/icorinthian/.rustup

installed toolchains
stable-x86_64-unknown-linux-gnu (default)
nightly-2023-12-21-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu

installed targets for active toolchain
wasm32-unknown-unknown
x86_64-unknown-linux-gnu

active toolchain
stable-x86_64-unknown-linux-gnu (default)
rustc 1.79.0 (129f3b996 2024-06-10)

The new ink! contract has a metadata version of 5. When I change the metadata version to 4, the code works without any issues.

Request:

Please provide support for metadata version 5 in the substrate-interface library.

Thank you!

arjanz commented 3 months ago

I noticed events are not being parsed correctly because Contract events now use event topics: https://use.ink/faq/migrating-from-ink-4-to-5/#metadata-changes

This will require changes