-
Notifications
You must be signed in to change notification settings - Fork 0
Split v2 and v3 scripts #94
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
base: main
Are you sure you want to change the base?
Conversation
| IO () | ||
| writePlutusScript filename (CompiledCodeLang compiledCode) = do | ||
| let serialisedScript = serialiseCompiledCode compiledCode | ||
| let serialisedScript = V2.serialiseCompiledCode compiledCode |
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.
serialiseCompiledCode is the same on V3, V2, and V1.
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.
Yep, I know, it was a part of the investigation why V3 doesn't work.
| FilePath -> | ||
| CompiledCode a -> | ||
| IO () | ||
| writePlutusScriptV3 filename compiledCode = do |
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 is the same as writePlutusScript.
CompiledCodeLang lang a is a custom type I introduced to encode lang as a proxy.
writePlutusScript should work (hopefully - I'll verify this.) for all the options.
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.
Same as above
| @@ -1,4 +1,6 @@ | |||
| module Onchain.Escrow where | |||
| {-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-} | |||
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 does this plugin affect?
My (uneducated) guess is that it only affects the logic where compile is used.
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.
Yeah, it changes the version of the generated plutus code in the module
| import PlutusLedgerApi.V3 qualified as V3 | ||
| import PlutusTx qualified | ||
| import PlutusTx.Builtins (unsafeDataAsI) | ||
| import PlutusTx.Builtins.Internal qualified as BI ( |
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.
We should try to avoid using Internal stuff.
I assume you've used this for testing/hacking.
| @@ -1,3 +1,5 @@ | |||
| {-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-} | |||
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.
We can either use macros, or if it becomes too hairy, we can move this to V2/Compiled
| @@ -0,0 +1,8 @@ | |||
| { | |||
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.
You can send datum inline as well.
Using a file will, however, avoid the quirks of shell escaping.
Is it a good idea to generate the datum on demand using dev-local instead?
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 was just playing with different datums, can be removed
| makeAppEnv = do | ||
| let policyFilePath = env_LOCAL_CONFIG_DIR </> "policy.plutus" | ||
| validatorFilePath = env_LOCAL_CONFIG_DIR </> "validator.plutus" | ||
| validatorFilePath = env_LOCAL_CONFIG_DIR </> "validator-v3.plutus" |
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.
We should probably abstract this out properly.
Creating a PR for furthering the discussion.