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

[BUG] - makeTransactionBodyAutoBalance underestimates execution units when the change has native tokens #302

Closed
fallen-icarus opened this issue Oct 5, 2023 · 4 comments
Assignees
Labels

Comments

@fallen-icarus
Copy link

fallen-icarus commented Oct 5, 2023

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:

  1. Create a UTxO with native assets locked at a plutus script address.
  2. 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):

  • OS Name: Ubuntu
  • OS Version 22.04
$ cardano-cli --version
cardano-cli 8.1.2 - linux-x86_64 - ghc-8.10
git rev d2d90b48c5577b4412d5c9c9968b55f8ab4b9767 
Copy link

github-actions bot commented Nov 5, 2023

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

@github-actions github-actions bot added the Stale label Nov 5, 2023
@newhoggy newhoggy self-assigned this Jan 4, 2024
@github-actions github-actions bot removed the Stale label Jan 5, 2024
Copy link

github-actions bot commented Feb 5, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

@github-actions github-actions bot added the Stale label Feb 5, 2024
newhoggy pushed a commit that referenced this issue Mar 11, 2024
…parser

Disambiguate 2-n flags in governance new-committee action
Copy link

github-actions bot commented Jun 4, 2024

This issue was closed because it has been stalled for 120 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@carbolymer
Copy link
Contributor

carbolymer commented Oct 30, 2024

Appears to be fixed by

Let us know if this issue if this needs reopening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants