Skip to content

Releases: tweag/cooked-validators

Version 4.0.0

28 Jun 14:05
Compare
Choose a tag to compare

Added

  • File IMPORTS to specify how modules should be imported and prefixed
  • Instaured a standard for naming imports, homogenized all modules accordingly
  • Default language extensions in package.yaml
  • A new set of tests Cooked.BasicUsageSpec to cover basic use cases
  • A new validate function validateTxSkel' that directly returns a list of utxos
  • An actual content to hie.yaml (automatically generated by gen-hie)
  • Support for collaterals in skeleton options, with three options: auto from
    first signer, auto from given wallet, or given set of utxos.
  • Top-level comments to all modules
  • currencySymbolFromLanguageAndMP to get the right Currency symbol based on a
    plutus version and a minting policy
  • setParams in MonadBlockChainWithoutValidation to account for future
    changes of parameters following votes.
  • txOptCollateralUtxos to control which utxos should be used as collaterals
  • Missing Eq instance for MockChainError
  • Full support in ShowBS for printing into bytestring the whole transaction
    context within on-chain code
  • validatorToTypedValidator which does what its name indicates
  • Adding support for PrettyCooked for TxLbl
  • A set of modules (in Conversion) that each defines a typeclass of elements
    that can be converted to a certain type. For example ToPubKeyHash or
    ToAddress.
  • New utxos searches vanillaOutputsAtSearch, scriptOutputsSearch,
    onlyValueOutputsAtSearch and referenceScriptOutputsSearch
  • A test file Cooked/BalancingSpec.hs that covers the new balancing mechanism
    extensively.
  • A new module Cooked/MockChain/MinAda.hs to separate min ada computation from
    the balancing mechanism.
  • A new documentation file doc/BALANCING.md that extensively describes the new
    balancing mechanism and the available options.
  • A new skeleton option to manage fees called FeePolicy. It makes it possible
    to successfully validate transactions that have not been automatically
    balanced.
  • Auto computation of total and return collaterals based on fees and protocol
    parameters now fully handled during balancing and transaction generation.
  • Two filters in Output.hs, isScriptOutput and isPKOutput
  • A new helper function to get the full output value of a skeleton,
    txSkelOutputsValue
  • Proposal procedures can now be issued and described in transaction
    skeletons. If they contain parameter changes or treasury withdrawals, a
    witness script can be attached and will be run.
  • TxSkelRedeemer is now used for all kinds of scripts.
  • File CONWAY to document which Conway features are currently
    supported.
  • A new option txOptAnchorResolution to decide whether to resolve urls
    locally or on the web (unsafe). The default is to resolve them locally with a
    given map from urls to page content as bytestring.

Removed

  • Extraneous dependencies in package.yaml
  • File Cooked.TestUtils, its content has been added to Cooked.MockChain.Testing
  • Support for importing scripts from bytestring in module Cooked.RawUPLC, to be
    added back later on
  • Deprecated skeleton option: txOptAwaitTxConfirmed
  • Deprecated use of * instead of Type
  • Many unused pragmas
  • Orphan default instance for Ledger.Slot
  • MintsRedeemer (replaced by TxSkelRedeemer)

Changed

  • Default era from Babbage to Conway
  • No longer rely on deprecated plutus-apps, but instead
    cardano-node-emulator
  • From GHC 8.10.4 to 9.6.5 and associated versions of HLS
  • Rely mostly on
    CHaP
    instead of direct git sources
  • Update the cheatsheet to account for various small changes + collaterals
  • ImportQualifiedPost by default
  • MockChainEnv is gone, replaced by the new mcstParams field in MockChainSt
  • The structure of the various steps around transaction validation (fee
    generation, ensuring min ada...)
  • Regrouped all important validation steps, including modifications requested in
    skeleton options in the direct implementation of validateTxSkel.
  • Homogenized and simplified the functions to generate transaction parts from a
    TxSkel by using a reader monad over various parameters.
  • Fully reworked the balancing process and associated balancing options.
    See in the dedicated documentation.
  • Reworked MockChain errors related to balancing.

Fixed

  • A bug where the ledger state would not be updated by consumed collaterals
  • A curious choice where parameter changes for single transactions would be
    applied several times instead of one
  • Various warnings around incomplete pattern matches when selecting utxos for
    balancing, with more suitable algorithms

Version 3.0.0

22 Mar 10:55
Compare
Choose a tag to compare

Added

  • Modifiers to ease specification of payments in transaction skeletons:
    • withDatum, withInlineDatum, and withDatumHash to add or override datums in payments, regardless of whether the type matches the validator type in case of scripts
    • paysScriptNoDatum to be used with withDatum, withInlineDatum and withDatumHash.
    • withReferenceScript and withStakingCredential to add a reference script or staking credential to a payment
  • Export Cooked.UtxoState
  • A module Cooked.ShowBS to provide a Plutus-level analogue of Show with BuiltinString as its codomain. This is very inefficient due to limitations of BuiltinString, but potentially useful for "printf-debugging" of scripts.
  • An option txOptEmulatorParamsModification to temporarily change protocol parameters for balancing and validation of a transaction
  • A function combineModsTweak to construct branching tweaks depending on the different combinations of foci of an optic on TxSkel
  • New PrettyCooked instances for common Plutus types
  • Tweaks on signers in the non-lens tweak API
  • A function resolveTypedDatum to recover typed data on UTxOs in MonadBlockChainBalancing.
  • A UtxoSearch that starts from a list of TxOutRefs
  • A transaction option to choose which UTxOs can be spent for balancing
  • Lenses for the fields of TxOpts
  • Cheatsheet
  • API now exposes: Cooked.Tweak.ValidityRange, interpretAndRun, interpretAndRunWith, runTweak, runTweakFrom and datumHijackingTarget
  • there modifier to apply a tweak at a precise place in a trace
  • New tweaks to change the start or end of the transaction validity range: setValidityStartTweak and setValidityEndTweak
  • UTxo searches with predicates over values, including only ada, or not only ada: filterWithValuePred, filterWithOnlyAda and filterWithNotOnlyAda
  • New pretty-printing options related to hashes in pcOptHashes including the possibility to assign human readable names to hashes (pubkeys, scripts, minting policies)
  • Initial distributions of funds can now include arbitrat payments instead of only consisting of values belonging to wallets. In particular, we can now initially pay to scripts and have utxos with datums and reference scripts. We can still create an initial distribution in the old fashion way with distributionFromList or directly provide a list of payments with InitialDistribution.
  • Dummy pre-existing validators in Cooked.Validators to be used for testing purposes mainly but also as targets for attacks and tweaks.
  • Small QOL helpers (ada, lovelace and adaAssetClass) to create values in Cooked.ValueUtils.

Removed

  • paysPKWithReferenceScript (superseded by the withReferenceScript modifier)
  • Do not export Cooked.UtxoPayloadSet

Changed

  • Cooked.holdingInState is relpaced by Cooked.holdsInState which takes an address instead of a wallet as argument.

  • Failure testing is slightly modified so that every test has to check that the right error is thrown

    • Cooked.testFailsFrom' is renamed to Cooked.testFailsFrom
    • Cooked.testFails is (the new) Cooked.testFailsFrom with the default distribution.

    To update their code, users must

    1. Adapt invokations of Cooked.testFails and Cooked.testFailsFrom adding a predicate that must hold on the error returned by running the transaction,
    2. Rename Cooked.testFailsFrom' into Cooked.testFailsFrom.
    3. (Bonus) simplify, knowing that Cooked.testFailsFrom o x def == Cooked.testFails o x
  • Quick and permanent value minting policies have been migrated to PlutusV2.

  • Default initial distribution only provides 5 UTxOs per wallet instead of 10.

Fixes

  • Add forgotten export of permanentValue
  • In MockChainT: don't delete data on transaction inputs if there are still UTxOs with that datum around.
  • Prettyprint unresolved transaction inputs

Version 2.0.0

01 Mar 17:23
6716e09
Compare
Choose a tag to compare

This major update overhauls the entire library to: handle Plutus V2 features, improve transaction generation, the API, and the internal module structure and code quality.

New features

  • Reference inputs can be declared in transaction skeletons.
  • Reference scripts can be declared in outputs of transaction skeletons and one can spend inputs from a script that a transaction references.
  • Datums in outputs of transaction skeletons can be declared as
    • inlined,
    • hashed, with the resolved datum included on the transaction (i.e. as in Plutus V1), or
    • hashed, without the resolved datum on the transaction.
  • New framework to search for UTxOs in the state using chainable filters that bring more type information.
  • Parameterizable and revamped pretty-printing relying on prettyprinter

Changes

  • Transaction skeletons are now defined declaratively, no longer using lists of constraints.
  • Balancing and transaction generation no longer rely on plutus-apps, they are performed entirely by cooked.
  • Transaction skeletons need an explicit signer (no longer signed by a default wallet).
  • Modules have been reorganized in a flatter tree and cleaned up.