You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue involves makeTransactionBodyAutoBalance found in cardano-api which is why I am opening the issue here.
Summary
This is a duplicate of this bug submitted to the cardano-node repo. The TLDR is that whenever plutus scripts are used in a transaction where the change output contains native tokens, the makeTransactionBodyAutoBalance function will underestimate the execution units for the scripts present.
I believe the issue is that when makeTransactionBodyAutoBalance creates the first intermediate transaction here to submit for execution unit estimations, it only includes a dummy value of lovelace for the change output in the temporary transaction. The native tokens that will ultimately be present in the change output are simply missing from this intermediate transaction - they are not present anywhere in the outputs. This results in a transaction that is smaller in size than it ultimately will be once the native tokens are added to the change output. Currently, makeTransactionBodyAutoBalance only adds the native tokens for the second intermediate transaction here. This has now changed the overall size of the transaction which means the previously calculated script execution budgets are inaccurate. The first intermediate transaction also needs to include any native tokens that will go to the change output in order to better reflect the ultimate size of the transaction.
Steps to reproduce
Steps to reproduce the behavior:
Create a UTxO with native assets locked at a plutus script address.
Spend the above UTxO and have cardano-cli transaction build automatically calculate the change output which should contain the native asset.
Expected behavior cardano-cli transaction build should properly balance the transaction and properly estimate the necessary script execution budgets.
System info (please complete the following information):
Internal/External
External
Area
Other
cardano-cli transaction build
This issue involves
makeTransactionBodyAutoBalance
found in cardano-api which is why I am opening the issue here.Summary
This is a duplicate of this bug submitted to the cardano-node repo. The TLDR is that whenever plutus scripts are used in a transaction where the change output contains native tokens, the
makeTransactionBodyAutoBalance
function will underestimate the execution units for the scripts present.I believe the issue is that when
makeTransactionBodyAutoBalance
creates the first intermediate transaction here to submit for execution unit estimations, it only includes a dummy value of lovelace for the change output in the temporary transaction. The native tokens that will ultimately be present in the change output are simply missing from this intermediate transaction - they are not present anywhere in the outputs. This results in a transaction that is smaller in size than it ultimately will be once the native tokens are added to the change output. Currently,makeTransactionBodyAutoBalance
only adds the native tokens for the second intermediate transaction here. This has now changed the overall size of the transaction which means the previously calculated script execution budgets are inaccurate. The first intermediate transaction also needs to include any native tokens that will go to the change output in order to better reflect the ultimate size of the transaction.Steps to reproduce
Steps to reproduce the behavior:
cardano-cli transaction build
automatically calculate the change output which should contain the native asset.Expected behavior
cardano-cli transaction build
should properly balance the transaction and properly estimate the necessary script execution budgets.System info (please complete the following information):
The text was updated successfully, but these errors were encountered: