-
Notifications
You must be signed in to change notification settings - Fork 15
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
Minting script witness refactor #971
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after first pass 👍🏻 Nice work.
, createOnDiskSimpleOfPlutusScriptCliArgs | ||
, createOnDiskSimpleReferenceScriptCliArgs | ||
, createOnDiskPlutusReferenceScriptCliArgs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should switch to either using OnDiskXXXXThing
or FileXXXXThing
names convention for the consistency, eventually. It would make navigating codebase easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
createSimpleOrPlutusScriptFromCliArgs
createSimpleReferenceScriptFromCliArgs
createPlutusReferenceScriptFromCliArgs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine I think. I had in mind the type names as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this module is in the right place. Can we split it into two:
cardano-cli/src/Cardano/CLI/Types/Plutus.hs
withMintScriptWitWithPolId
,CliMintScriptRequirements
andcreateOnDiskXXX
functionscardano-cli/src/Cardano/CLI/Read/Plutus.hs
withreadMintScriptWitness
andCliScriptWitnessError
?
I'm not a fan of the current module structure, but it never felt like a good moment to turn everything upside down.
For the moment I think we should follow it rather than introducing different changes.
I propose the following change:
https://gist.github.com/carbolymer/63b23d0df940c61d1501a6763d86134c
I'm not insisting on keeping EraBased
if we have a better alternative here.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100% agree with the new structure and the module split.
So then based on what you suggested we would have:
Cardano/CLI
├── Byron
├── Commands
├── EraBased
│ └── Plutus
│ └── Read.hs
│ └── Types.hs
│
│
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
├── Commands
could be organised by domains too I think.
708410b
to
672b332
Compare
Define the data definition CliMintScriptRequirements This type makes it clearer that we require the policy id for transaction construction when using a minting script
AnyScriptLanguage Replace ScriptWitnessFiles WitCtxMint with CliMintScriptRequirements
AnyPlutusScriptVersion instead of AnyScriptLanguage
Refactor readScriptWitness and eliminate invalid states Factor out fromSomeTypeSimpleScript and fromSomeTypePlutusScripts fromSomeTypePlutusScripts should automatically be updated as soon as the Enum AnyPlutusScriptVersion instance is updated in cardano-api
Add ScriptDecodeUnknownPlutusScriptVersion to ScriptDecodeError
672b332
to
1d7728e
Compare
1d7728e
to
d09f60b
Compare
d09f60b
to
4ff64a8
Compare
4ff64a8
to
424ad7b
Compare
- Cardano.CLI.Types.Errors.PlutusScriptDecodeError - Cardano.CLI.Types.Errors.ScriptDataError
7e08bf1
to
c157954
Compare
handle all minting scripts (simple and plutus) we no longer have to accomodate for the PolicyId in the constructors PlutusReferenceScriptWitnessFiles and SimpleReferenceScriptWitnessFiles This is evidenced by the diff of this commit The goal is to deprecate ScriptWitnessFiles and replace it with a collection of types for the different script purposes. The first example of this is MintScriptWitnessWithPolicyId era
from PReferenceScript and SReferenceScript constructors Co-authored-by: Mateusz Gałażyn <[email protected]>
c157954
to
5649c78
Compare
"Version mismatch in code: script version that was read" | ||
<> pretty version | ||
<> " but tried to decode script version: " | ||
<> pshow v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Version mismatch in code: script version that was read" | |
<> pretty version | |
<> " but tried to decode script version: " | |
<> pshow v | |
"Version mismatch in code: script version that was read" | |
<+> pretty version | |
<+> "but tried to decode script version:" | |
<+> pshow v |
-- which says nothing about the script type (simple vs plutus) or script version. | ||
-- As a result need to separate the different script purposes into | ||
-- their own separate data definitions where we can make changes specific to that script purpose | ||
-- more easily without affecting the rest of the api. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful 🤩
@@ -1230,9 +1248,9 @@ getAllReferenceInputs | |||
:: ScriptWitness witctx era -> Maybe TxIn | |||
getReferenceInput sWit = | |||
case sWit of | |||
PlutusScriptWitness _ _ (PReferenceScript refIn _) _ _ _ -> Just refIn | |||
PlutusScriptWitness _ _ (PReferenceScript refIn) _ _ _ -> Just refIn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function can be removed, as this functionality is provided by getScriptWitnessReferenceInput
from cardano-api.
Changelog
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