-
Notifications
You must be signed in to change notification settings - Fork 157
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
Support for Plutus V2 (ledger API) #2485
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ import Cardano.Binary | |
serialize', | ||
serializeEncoding', | ||
) | ||
import Cardano.Ledger.Alonzo.Language (Language (PlutusV1), ppLanguage) | ||
import Cardano.Ledger.Alonzo.Language (Language (..), ppLanguage) | ||
import Cardano.Ledger.Alonzo.Scripts | ||
( CostModel, | ||
ExUnits (..), | ||
|
@@ -517,6 +517,10 @@ getLanguageView pp lang@PlutusV1 = | |
LangDepView | ||
(serialize' lang) | ||
(serializeEncoding' $ maybe encodeNull toCBOR $ Map.lookup lang (_costmdls pp)) | ||
getLanguageView pp lang@PlutusV2 = | ||
LangDepView | ||
(serialize' lang) | ||
(serializeEncoding' $ maybe encodeNull toCBOR $ Map.lookup lang (_costmdls pp)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we expect this implementation to change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not think we could assume that every language view would contain the same data. And I wanted to make sure that GHC would at least make us think about each new language. |
||
|
||
encodeLangViews :: Set LangDepView -> Encoding | ||
encodeLangViews views = | ||
|
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.
Is there a strong reason to serialise plutus scripts in segregated blocks in this way? I just imagine this will get tiresome when we add even more versions.
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 believe this was the original plan all along, but indeed this code is a bit messy, it wasn't pleasant to write...
I'm open to other ideas, but this change does need to be backwards compatible, and we do not currently have the language version in the script serialization.