Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction would exhaust block limits Error when calling flipper contract #199

Open
minhnd-dev opened this issue Feb 28, 2022 · 0 comments

Comments

@minhnd-dev
Copy link

I deployed the flipper contract in a local node. I tried to call the flip() method but I got this error:

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}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant