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

Tidy up "New calculateMinTxFee function" #490

Merged
merged 2 commits into from
Mar 21, 2024

Conversation

newhoggy
Copy link
Collaborator

@newhoggy newhoggy commented Mar 20, 2024

Changelog

- description: |
    Re-implement `evaluateTransactionFee` using ledger's `calcMinFeeTx`
    The `evaluateTransactionFee` takes an additional `utxo` parameter and no longer takes `byronwitcount`.
# 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
  # - improvement    # QoL changes e.g. refactoring
  # - 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 improves the accurate of the evaluateTransactionFee function.

See IntersectMBO/cardano-cli#534 (comment)

Impact on cardano-cli

cardano-cli uses evaluateTransactionFee here.

This usage does not have utxo in scope which will be required after this change is introduced.

A possible solution is to query for the utxo like this.

How to trust this PR

Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.

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

@newhoggy
Copy link
Collaborator Author

CC @gitmachtl @GeorgeFlerovsky @lehins

@carbolymer
Copy link
Contributor

cc: @dnadales

@@ -197,16 +197,16 @@ estimateTransactionFee sbe nw txFeeFixed txFeePerByte = \case
--
evaluateTransactionFee :: forall era. ()
=> ShelleyBasedEra era
-> UTxO era
Copy link
Member

Choose a reason for hiding this comment

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

Is this only the UTXO associated with the inputs in the parameter TxBody era?

We should probably add a comment specifying this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment updated.

@newhoggy newhoggy force-pushed the newhoggy/re-implement-evaluateTransactionFee branch 2 times, most recently from 1a1473c to d575460 Compare March 21, 2024 11:08
@newhoggy newhoggy force-pushed the newhoggy/re-implement-evaluateTransactionFee branch from d575460 to e0247a8 Compare March 21, 2024 11:10
@newhoggy newhoggy requested a review from dnadales March 21, 2024 11:10
@newhoggy newhoggy changed the title Re-implement evaluateTransactionFee using ledger's calcMinFeeTx Tidy up "New calculateMinTxFee function" Mar 21, 2024
-- transaction in order to lookup any txins included in the transaction.
--
-- The only type of witnesses that it cannot figure out reliably is the
-- witnesses needed for satisfying native scripts included in the transaction.
Copy link
Member

Choose a reason for hiding this comment

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

"Satisfying" or "validating"?

@newhoggy newhoggy added this pull request to the merge queue Mar 21, 2024
Merged via the queue into main with commit 7d9239a Mar 21, 2024
24 checks passed
@newhoggy newhoggy deleted the newhoggy/re-implement-evaluateTransactionFee branch March 21, 2024 14:58
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.

👍

-> Ledger.PParams (ShelleyLedgerEra era)
-> UTxO era
-> TxBody era
-> Word -- ^ The number of Shelley key witnesses
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be made more clear with something like the following: "The number of Shelley key witnesses needed for native scripts or additional redundant key witnesses". Currently it reads like the total number of key witnesses for the transaction.

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.

None yet

4 participants