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

Refactor TxMintValue #663

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

carbolymer
Copy link
Contributor

Changelog

- description: |
    <insert-changelog-description-here>
# 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

Additional context for the PR goes here. If the PR fixes a particular issue please provide a link to the issue.

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

@carbolymer carbolymer force-pushed the mgalazyn/feature/refactor-txmintvalue branch 2 times, most recently from 8b36408 to ef2b00c Compare October 31, 2024 11:26
@carbolymer carbolymer force-pushed the mgalazyn/feature/refactor-txmintvalue branch from ef2b00c to c2c740b Compare October 31, 2024 11:49
@carbolymer carbolymer force-pushed the mgalazyn/feature/refactor-txmintvalue branch 7 times, most recently from 555e92d to 6e860f9 Compare November 4, 2024 19:38
@carbolymer carbolymer force-pushed the mgalazyn/feature/refactor-txmintvalue branch from 6e860f9 to fefbe40 Compare November 4, 2024 20:31
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.

This looks good to me. One gripe regarding traverseScriptWitnesses. Clean up and I'll have a final look before approving.

, (assetName', quantity, _) <- assets
]

-- | Index the assets with witnesses in the order of policy ids.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment here referencing the spec and why we have to index on the order of policy ids?

@@ -1588,7 +1619,7 @@ data TxBodyError
| TxBodyOutputNegative !Quantity !TxOutInAnyEra
| TxBodyOutputOverflow !Quantity !TxOutInAnyEra
| TxBodyMetadataError ![(Word64, TxMetadataRangeError)]
| TxBodyMintAdaError
| TxBodyMintAdaError -- TODO remove - case nonexistent
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


traverseScriptWitnesses
:: [(a, Either (TxBodyErrorAutoBalance era) (ScriptWitness ctx era))]
-> Either (TxBodyErrorAutoBalance era) [(a, ScriptWitness ctx era)]
:: [(a, Either (TxBodyErrorAutoBalance era) b)]
Copy link
Contributor

Choose a reason for hiding this comment

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

This may be "neater" Haskell but making this more generic doesn't really help the reader IMO. Also it's only instantiated to ScriptWitness ctx era.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not only instantiated to ScriptWitness ctx era - in line 1629 is used against

        [ (Value, Either (TxBodyErrorAutoBalance era)
          ( AssetName
          , Quantity
          , BuildTxWith build (ScriptWitness WitCtxMint era)
          )
        ]

(Map PolicyId (ScriptWitness WitCtxMint era))
-> Map
PolicyId
[ ( AssetName
Copy link
Contributor

Choose a reason for hiding this comment

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

A 3-tuple is less than ideal but I can't think of what to call this instead.

@@ -676,6 +677,17 @@ data WitCtx witctx where
WitCtxMint :: WitCtx WitCtxMint
WitCtxStake :: WitCtx WitCtxStake

-- TODO: not needed anymore - remove
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

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