-
Notifications
You must be signed in to change notification settings - Fork 483
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
SCP-1514 Extract scripts #2499
SCP-1514 Extract scripts #2499
Conversation
f1726ee
to
4ca46e8
Compare
Depends on #2314, so probably no point in reviewing it yet. But it does work and it writes out all the scripts. |
plutus-use-cases/scripts/Main.hs
Outdated
, ("multisig-success", MultiSig.succeedingTrace) | ||
, ("multisig-failure", MultiSig.failingTrace) | ||
, ("multisig-sm_1", MultiSigStateMachine.lockProposeSignPay 3 1) | ||
, ("multisig-sm_2", MultiSigStateMachine.lockProposeSignPay 3 3) |
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.
Just a remark, but I found a lot more distinct validations when I was experimenting with the use cases: for example in the multisig state machine example ten different combinations of scripts appeared (see https://github.com/input-output-hk/plutus/tree/master/plutus-benchmark/validation/data/multisigSM). I just got those by writing out all the scripts appearing in Ledger.Scripts.runScript
and manually eliminating duplicates. Admittedly I was never able to work out exactly which stages of the contract those corresponded to! Maybe some of them were for subsidiary transactions?
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.
Thanks for the link, I didn't know about that README.
lockProposeSignPay k n
should result in up to (k+2)*n script validations - there are n rounds, and for each round we have k steps where a signature is added, 1 step for the proposal and 1 step for the payment transition. The actual number may be smaller because attempting to make an invalid transition doesn't produce a transaction.
Actually I think that lockProposeSignPay 3 2
covers all ten variations you got.
The cases where the transition is invalid (for example lockProposeSignPay 2 1
) don't result in an invalid transaction because the client realises that the transaction would fail and doesn't submit it.
a26c48b
to
80025d6
Compare
6978c80
to
9f0f729
Compare
2ed4410
to
0310d58
Compare
0b39381
to
e309d1a
Compare
3fcd551
to
277ca32
Compare
What do you think of this one @michaelpj ? |
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.
Looks fine to me!
@@ -341,3 +349,33 @@ mkIn TxIn{txInRef, txInType} = do | |||
let witness = (Scripts.validatorHash v, Scripts.redeemerHash r, Scripts.datumHash d) | |||
in Validation.TxInInfo txInRef (Just witness) vl | |||
ConsumePublicKeyAddress -> Validation.TxInInfo txInRef Nothing vl | |||
|
|||
data ScriptType = ValidatorScript | MonetaryPolicyScript |
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.
Hmm, kind of makes me want to turn the various XScript
types into a Script (ty :: ScriptType
GADT. But that's probably overkill...
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.
Or maybe we need a class? Anyway, probably not worth it :D
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 made an issue for it (https://jira.iohk.io/browse/SCP-1667), I think it's a good thing to do
plutus-use-cases
to${folder}
withcabal new-run plutus-use-cases-scripts -- ${folder}
Pre-submit checklist:
$(nix-build default.nix -A pkgsLocal.updateMaterialized)
to update the materialized Nix fileshie-*.yaml
files if needed$(nix-shell shell.nix --run fix-stylish-haskell)
to fix any formatting issues$(nix-shell shell.nix --run fix-purty)
to fix any formatting issuesPre-merge checklist: