-
Notifications
You must be signed in to change notification settings - Fork 214
PLT-271: Use of pure cardano-api transaction in emulator #503
PLT-271: Use of pure cardano-api transaction in emulator #503
Conversation
eddec40
to
7700412
Compare
setValidity :: Bool -> C.Tx era -> C.Tx era | ||
setValidity validity (C.Tx (C.ShelleyTxBody C.ShelleyBasedEraAlonzo txBody scripts dat aux _) era) = | ||
C.Tx (C.ShelleyTxBody C.ShelleyBasedEraAlonzo txBody scripts dat aux (toTxScriptValidity validity)) era | ||
setValidity _ tx = tx -- only applies in Alonzo era |
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 understand the comment. You mean this "applies to eras pre-Alonzo"?
(fromOnChainCardanoTx False) | ||
ctx | ||
|
||
fromOnChainCardanoTx :: Bool -> SomeCardanoApiTx -> ChainIndexTx |
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.
Comment on why we need to manually set the script validity when converting from CardanoTx to ChainIndexTx?
pure (e, events) | ||
|
||
validateL :: Params -> Slot -> Validation.UTxO Index.EmulatorEra -> SomeCardanoApiTx -> Maybe Index.ValidationErrorInPhase | ||
validateL params slot idx (CardanoApiEmulatorEraTx tx) = Validation.hasValidationErrors params (fromIntegral slot) idx tx | ||
-- TODO: generate ScriptValidationEvents |
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 do that refer to exactly? Do we have a story for that?
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.
Good point, I will make one.
LGTM :) |
* Deeper support for Cardano API Tx's in the emulator * Implement getCardanoTxData * Update Utxo index for cardano api txs * Restore normal behavior * Add a testcase * Remove NFData instance, it seems to be unused * Fix build * Remove acidental change * Generate PureScript * Revert Rollup changes and throw error instead * Fix temp change * plutus-chain-index: Use fromCardanoTx in fromOnChainTx * plutus-chain-index: with Both, use emulator tx in fromOnChainTx * Fix build * PR and Hoogle feedback
Actual new code is mostly just the changes in plutus-ledger/src/Ledger/Tx.hs.
The big change is that the emulated blockchain now also contains
CardanoTx
, so either transaction type or both.Pre-submit checklist: