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

Remove unneeded ScriptHash in PReferenceScript/SReferenceScript #959

Draft
wants to merge 3 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/chore/remove-script-hash-in-policy-id branch 2 times, most recently from 4b665a1 to edbad42 Compare November 4, 2024 20:16
@carbolymer carbolymer force-pushed the mgalazyn/chore/remove-script-hash-in-policy-id branch from edbad42 to e797b17 Compare November 4, 2024 20:34
@carbolymer carbolymer force-pushed the mgalazyn/chore/remove-script-hash-in-policy-id branch from e797b17 to c461679 Compare November 4, 2024 20:36
-> [(PolicyId, ScriptWitness WitCtxMint era)]
gatherMintingWitnesses [] = []
gatherMintingWitnesses (sWit : rest) =
case scriptWitnessPolicyId sWit of
gatherMintingWitnesses ((mPid, sWit) : rest) =
Copy link
Contributor

@Jimbo4350 Jimbo4350 Nov 6, 2024

Choose a reason for hiding this comment

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

We need a new data definition.

fetchReferenceMintingScriptWitness :: UTxO era -> ScriptWitness WitCtxMint era -> UpdatedReferenceScriptWitness

and in the case where the user chooses to supply it

updateReferenceScriptWitness :: PolicyId -> ScriptWitness WitCtxMint era -> UpdatedReferenceScriptWitness

Propagating Maybe PolicyId may work but it results in poor readability. If the user does not supply the policy id we want the ability to query the UTxO to get the reference script witnesses so we can calculate the policy ID.

Copy link
Contributor

Choose a reason for hiding this comment

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

This would be the short to medium term fix until we can figure out how to encapsulate this in cardano-api.

Copy link
Contributor Author

@carbolymer carbolymer Nov 6, 2024

Choose a reason for hiding this comment

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

I agree about the first case with fetchReferenceMintingScriptWitness. I'd do this in a follow-up PR.

What is not clear to me is how to thread in Maybe PolicyId from the CLI argument parser to this place in a clean way. What's your idea about this scenario, when the user provides Maybe PolicyId manually?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would start with something like: data MintingReferenceScriptWitness era = MintingReferenceScriptWitness PolicyId (ScriptWitness WitCtxMint era)

I'd do this in a follow-up PR.

In this instance I would insist its done in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries, let me push some changes tomorrow to make sure what I am suggesting can actually work.

Copy link
Contributor Author

@carbolymer carbolymer Nov 6, 2024

Choose a reason for hiding this comment

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

I've removed my comment as I'm still wrapping my head around the idea and experimenting with it. Feel free to push.

@carbolymer carbolymer force-pushed the mgalazyn/chore/remove-script-hash-in-policy-id branch 3 times, most recently from eab98ec to 37c99ec Compare November 8, 2024 15:51
@carbolymer carbolymer force-pushed the mgalazyn/chore/remove-script-hash-in-policy-id branch from 37c99ec to 1450d80 Compare November 8, 2024 16:45
Comment on lines +1384 to +1385
-> ( TxIn
-> ExceptT
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
-> ( TxIn
-> ExceptT
-> ( Set TxIn
-> ExceptT

we can have multiple txins, so for performance reasons this should be one query for all witnesses

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