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

Error message misleading when execution/mem cost largely exceeds allowed cost #337

Open
nielstron opened this issue Apr 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nielstron
Copy link
Contributor

Describe the bug
The blockchain puts some requirements on the execution and memory steps of contracts in a transaction. when the amount largely exceeds the amount of allowed steps two things happen: a) the transaction is rejected because of this exceeding b) the collateral required for the transaction gets very large.

Because pycardano makes a conservative estimate on the collateral (assuming the maximum steps) the error message in this case is often "Collateral return too small" or something similar - but the issue is not the collateral but actually the contract amount!

To Reproduce
TBD

Logs

    tx = builder.build_and_sign([batcher_skey], change_address=batcher_address)
  File "/home/niels/.cache/pypoetry/virtualenvs/--smart-contract-w9-IdXo4-py3.10/lib/python3.10/site-packages/pycardano/txbuilder.py", line 1373, in build_and_sign
    tx_body = self.build(
  File "/home/niels/.cache/pypoetry/virtualenvs/--smart-contract-w9-IdXo4-py3.10/lib/python3.10/site-packages/pycardano/txbuilder.py", line 1179, in build
    self._set_collateral_return(collateral_change_address or change_address)
  File "/home/niels/.cache/pypoetry/virtualenvs/--smart-contract-w9-IdXo4-py3.10/lib/python3.10/site-packages/pycardano/txbuilder.py", line 1268, in _set_collateral_return
    raise ValueError(
ValueError: Minimum lovelace amount for collateral return 1086120 is greater than collateral change 737025. Please provide more collateral inputs.

Expected behavior
Should inform the user that the smart contracts being spent are too large/expensive.

Environment and software version (please complete the following information):

  • OS: Ubuntu 22
  • PyCardano Version 0.10.0

Additional context
None

@nielstron nielstron added the bug Something isn't working label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant