polkascan / py-substrate-interface

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

Add moonbeam to type_registry #172

Closed johnuopini closed 2 years ago

johnuopini commented 2 years ago

I tested signing an extrinsic in moonbase alpha and its working just fine, the very same code fails on moonbeam with the error below. I have tried the transaction via JS and it works as expected. I guess it might be related on type_registry not being updated for moonbeam in the library.

DEBUG:substrateinterface.base:RPC request #10: "chain_getHead"
DEBUG:substrateinterface.base:RPC request #11: "chain_getHeader"
DEBUG:substrateinterface.base:RPC request #12: "chain_getRuntimeVersion"
DEBUG:substrateinterface.base:RPC request #13: "chain_getHead"
DEBUG:substrateinterface.base:RPC request #14: "chain_getHeader"
DEBUG:substrateinterface.base:RPC request #15: "chain_getRuntimeVersion"
DEBUG:substrateinterface.base:RPC request #16: "system_accountNextIndex"
DEBUG:substrateinterface.base:RPC request #17: "chain_getBlockHash"
DEBUG:substrateinterface.base:RPC request #18: "author_submitAndWatchExtrinsic"
Traceback (most recent call last):
  File "app/main.py", line 91, in set_mapping
    receipt = self.substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
  File "direnv/python3/lib/python3.9/site-packages/substrateinterface/base.py", line 1767, in submit_extrinsic
    response = self.rpc_request(
  File "direnv/python3/lib/python3.9/site-packages/substrateinterface/base.py", line 553, in rpc_request
    raise SubstrateRequestException(message['error'])
substrateinterface.exceptions.SubstrateRequestException: {'code': 1002, 'message': 'Verification Error: Runtime error: Execution failed: Other("Wasm execution trapped: wasm trap: unreachable\\nwasm backtrace:\\n    0: 0x3953 - <unknown>!rust_begin_unwind\\n    1: 0x2f0d - <unknown>!core::panicking::panic_fmt::h3ab5417155b7ba3b\\n    2: 0x1027fa - <unknown>!TaggedTransactionQueue_validate_transaction\\n")', 'data': 'RuntimeApi("Execution failed: Other(\\"Wasm execution trapped: wasm trap: unreachable\\\\nwasm backtrace:\\\\n    0: 0x3953 - <unknown>!rust_begin_unwind\\\\n    1: 0x2f0d - <unknown>!core::panicking::panic_fmt::h3ab5417155b7ba3b\\\\n    2: 0x1027fa - <unknown>!TaggedTransactionQueue_validate_transaction\\\\n\\")")'}
arjanz commented 2 years ago

Did you update package scalecodec to latest version (v1.0.27)? Latest version I added specific changes for Moonbeam, in next release of substrate-interface I make sure I'll bump this package requirement to latest version as well

johnuopini commented 2 years ago

Updated from 1.0.26 to 1.0.27 and it works perfectly, good stuff!!!