Open minhnd-dev opened 2 years ago
I deployed the flipper contract in a local node. I tried to call the flip() method but I got this error:
flip()
Traceback (most recent call last): File "shibuya_interface.py", line 34, in <module> contract_receipt = contract.exec(keypair, 'flip', args={}, gas_limit=5*1000000000000) File "/home/minhnd/anaconda3/lib/python3.8/site-packages/substrateinterface/contracts.py", line 884, in exec receipt = self.substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True) File "/home/minhnd/anaconda3/lib/python3.8/site-packages/substrateinterface/base.py", line 1823, in submit_extrinsic response = self.rpc_request( File "/home/minhnd/anaconda3/lib/python3.8/site-packages/substrateinterface/base.py", line 575, in rpc_request raise SubstrateRequestException(message['error']) substrateinterface.exceptions.SubstrateRequestException: {'code': 1010, 'message': 'Invalid Transaction', 'data': 'Transaction would exhaust the block limits'}
This is the code I used to call the flipper contract:
from substrateinterface import Keypair from pprint import pprint substrate = SubstrateInterface( url="ws://127.0.0.1:9944", ss58_format=42, type_registry_preset='substrate-node-template' ) contract = ContractInstance.create_from_address( contract_address="5FLDbYpNbP3SLQPDsXUvY5tMkf67NaqChiFJLzUiNZAnAJgh", metadata_file="./flipper_metadata.json", substrate=substrate ) keypair = Keypair.create_from_uri('//Alice') contract_receipt = contract.exec(keypair, 'flip', args={}, gas_limit=5*1000000000000) if contract_receipt.is_success: print(f'Events triggered in contract: {contract_receipt.contract_events}') else: print(f'Call failed: {contract_receipt.error_message}')
I deployed the flipper contract in a local node. I tried to call the
flip()
method but I got this error:This is the code I used to call the flipper contract: