-
Notifications
You must be signed in to change notification settings - Fork 23
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
Introduce new witness api #763
Draft
Jimbo4350
wants to merge
7
commits into
master
Choose a base branch
from
jordan/new-scripts-api
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cardano-api/src/Cardano/Api/Internal/Experimental/Plutus/ScriptWitness.hs
Fixed
Show fixed
Hide fixed
cardano-api/src/Cardano/Api/Internal/Experimental/Plutus/ScriptWitness.hs
Fixed
Show fixed
Hide fixed
cardano-api/src/Cardano/Api/Internal/Experimental/Plutus/ScriptWitness.hs
Fixed
Show fixed
Hide fixed
cardano-api/src/Cardano/Api/Internal/Experimental/Plutus/ScriptWitness.hs
Fixed
Show fixed
Hide fixed
cardano-api/src/Cardano/Api/Internal/Experimental/Plutus/ScriptWitness.hs
Fixed
Show fixed
Hide fixed
41613bf
to
ee59574
Compare
cardano-api/src/Cardano/Api/Internal/Experimental/Plutus/Shim/LegacyScripts.hs
Fixed
Show fixed
Hide fixed
53e997c
to
8b9e4cd
Compare
cardano-api/src/Cardano/Api/Internal/Experimental/Plutus/ScriptWitness.hs
Fixed
Show fixed
Hide fixed
cardano-api/src/Cardano/Api/Internal/Experimental/Plutus/ScriptWitness.hs
Fixed
Show fixed
Hide fixed
5e14d8f
to
e00ddf0
Compare
cardano-api/src/Cardano/Api/Internal/Experimental/Plutus/IndexedPlutusScriptWitness.hs
Fixed
Show fixed
Hide fixed
|
||
constructRedeeemerPointerMap | ||
:: AlonzoEraOnwards era | ||
-> [AnyIndexedPlutusScriptWitness ((ShelleyLedgerEra era))] |
Check notice
Code scanning / HLint
Redundant bracket Note
cardano-api/src/Cardano/Api/Internal/Experimental/Plutus/IndexedPlutusScriptWitness.hs:169:38-59: Suggestion: Redundant bracket
Found:
((ShelleyLedgerEra era))
Perhaps:
(ShelleyLedgerEra era)
Found:
((ShelleyLedgerEra era))
Perhaps:
(ShelleyLedgerEra era)
cardano-api/src/Cardano/Api/Internal/Experimental/Witness/TxScriptWitnessRequirements.hs
Fixed
Show fixed
Hide fixed
This allows us to use the new plutus script api with the legacy api and our new api without modifying other existing types
e00ddf0
to
ad6e828
Compare
:: TxScriptWitnessRequirements (ShelleyLedgerEra era) <- | ||
caseShelleyToMaryOrAlonzoEraOnwards | ||
(const $ error "Impossible to construct TxScriptWitnessRequirements in pre-Alonzo era") | ||
(\eon -> collectTxBodyScriptWitnessRequirements eon bc) |
Check notice
Code scanning / HLint
Avoid lambda using `infix` Note
cardano-api/src/Cardano/Api/Internal/Tx/Body.hs:2107:9-63: Suggestion: Avoid lambda using infix
Found:
(\ eon -> collectTxBodyScriptWitnessRequirements eon bc)
Perhaps:
(collectTxBodyScriptWitnessRequirements bc)
Found:
(\ eon -> collectTxBodyScriptWitnessRequirements eon bc)
Perhaps:
(collectTxBodyScriptWitnessRequirements bc)
7954288
to
2882c59
Compare
This is intended to replace the type `Witness witctx era` but if you look closely they are similar. The main difference is we do away with `witctx` type parameter because this only really pertains to plutus script witnesses. The witness context is now relfected in the purpose type parameter of the `PlutusScriptWitness` type of the `AnyPlutusScriptWitness` constructor.
…sociated type synonym NativeScript era.
…pt lang` which wrapped a `ShortByteString` which essentially means if our script it malformed we will be informed of this upon deserialization in the ledger i.e at transaction submission or when using transaction build. `PlutusScriptInEra lan era` wraps cardano-ledger's `PlutusRunnable lang`. This allows us to fail early as the deserialization to `PlutusRunnable` will error for malformed scripts. NB: Before the introduction of the new api we did implement a `PlutusScriptInEra era lang` in the old api but this simply wrapped `PlutusScript lang` and utilized the serialization instances of `PlutusRunnable lang`.
feeb2f9
to
c1d7f9b
Compare
`PlutusScriptWitness lang era` is almost identical to the old api's notion of plutus script witnesses except: - It's treated as a separate type to simple script witnesses vs as a constructor of a sum type - A type family is used to represent the presense of a script datum depending on the plutus script language and purpose The `PlutusScriptDatumF` type family has been introduced to capture what script type can have a datum and if that datum can be optional.
c1d7f9b
to
3520bd4
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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