Description
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