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

Fix incorrect fees estimation when balancing transaction minting assets #622

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Aug 23, 2024

Changelog

- description: |
    Deprecate `valueFromList` and valueToList. Add `IsList Value` instance.
    Fix fee estimation when autobalancing assets minted in the transaction.
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
   - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
   - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

This PR should be reviewed on commit-by-commit basis.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@carbolymer carbolymer changed the title Add test case Fix incorrect fees estimation when balancing assets Aug 23, 2024
@carbolymer carbolymer changed the title Fix incorrect fees estimation when balancing assets Fix incorrect fees estimation when balancing transaction minting assets Aug 23, 2024
@carbolymer carbolymer marked this pull request as ready for review August 23, 2024 18:22
@carbolymer carbolymer marked this pull request as draft August 23, 2024 18:22
@carbolymer carbolymer force-pushed the mgalazyn/fix/invalid-fee-when-autobalancing-minting branch 3 times, most recently from 10c5809 to fdc91b3 Compare August 26, 2024 15:09
@carbolymer carbolymer force-pushed the mgalazyn/fix/invalid-fee-when-autobalancing-minting branch 7 times, most recently from a83f93b to 88aceab Compare August 29, 2024 07:28
@carbolymer carbolymer force-pushed the mgalazyn/fix/invalid-fee-when-autobalancing-minting branch from 88aceab to dc5d4cb Compare August 29, 2024 14:55
@carbolymer carbolymer marked this pull request as ready for review August 29, 2024 14:59
UnsignedTx unsignedTx0 <-
first TxBodyError
$ makeUnsignedTx
availableEra
$ obtainShimConstraints bEraOnwards
$ txbodycontent
{ txOuts =
txOuts txbodycontent
++ [TxOut changeaddr (lovelaceToTxOutValue sbe 0) TxOutDatumNone ReferenceScriptNone]
-- TODO: think about the size of the change output
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jimbo4350 What does this TODO mean? This PR changes the TxOut to include all assets from TxIns and minted ones, so I guess this TODO is fixed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duncan left that there and I can't remember why.

address
Nothing
-- the correct amount with manual balancing of assets
335_729 === feeWithTxoutAsset
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR does not change the value of the fee here.

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but one comment regarding the change output

UnsignedTx unsignedTx0 <-
first TxBodyError
$ makeUnsignedTx
availableEra
$ obtainShimConstraints bEraOnwards
$ txbodycontent
{ txOuts =
txOuts txbodycontent
++ [TxOut changeaddr (lovelaceToTxOutValue sbe 0) TxOutDatumNone ReferenceScriptNone]
-- TODO: think about the size of the change output
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duncan left that there and I can't remember why.

++ [TxOut changeaddr (lovelaceToTxOutValue sbe 0) TxOutDatumNone ReferenceScriptNone]
-- TODO: think about the size of the change output
-- 1,2,4 or 8 bytes?
TxOut changeaddr (TxOutValueShelleyBased sbe change) TxOutDatumNone ReferenceScriptNone
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we had an issue in the past where users were expecting the change output to be appended to the list of tx outs. We best not change it. There may be an issue about this floating around somewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just an intermediary txbodycontent for execution units calculation. I'll change the order.

@carbolymer carbolymer force-pushed the mgalazyn/fix/invalid-fee-when-autobalancing-minting branch from dc5d4cb to 7535526 Compare August 29, 2024 17:12
@carbolymer carbolymer added this pull request to the merge queue Aug 29, 2024
Merged via the queue into main with commit 00bb673 Aug 29, 2024
25 checks passed
@carbolymer carbolymer deleted the mgalazyn/fix/invalid-fee-when-autobalancing-minting branch August 29, 2024 17:39
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

Successfully merging this pull request may close these issues.

2 participants