Skip to content

Version 9.0.0

Choose a tag to compare

@mmontin mmontin released this 29 May 11:14
· 11 commits to main since this release
d834b33

cooked-validators v9.0.0 comes with 3 major upgrades:

  • A better balancing mechanism, with more options, bug fixes, and optimizations.
  • A full rewrite using Polysemy. This stable effect system makes cooked-validators more expressive, more consistent and with better separation of concerns.
  • An expansion of the LTL DSL to modify traces, with the addition of negation and derived idioms such as implication.

Full CHANGELOG below.

[9.0.0] - 2026-05-28

Added

  • New LtlNot primtive, to negate Ltl expressions. This allows to ensure a
    specific tweak will result in mzero and marks a new milestone in the
    expressiveness of the Tweak/Attack DSL.
  • New Ltl combinators resulting from the addition of LtlNot, such as
    nowhere, whenAble, ...
  • ExtendedStagedMockChain: It is not possible to extend a mockchain run with
    arbitrary effects, while the associated tweaks will also have access to the
    added effects.
  • A new capability in a mockchain run, which allows to take note (basically log)
    anything. Functions note(|p|s|w|l) support this functionality.
  • A new capability in a mockchain run, which allows to make assertions which
    will be displayed in the final result, and taken into account during
    tests. Functions assert(|') support his functionality.
  • A new testBoolMsg function which outputs an error message when given
    False.
  • Functions testCookedFromInitDistTemplate and
    testCookedQCFromInitDistTemplate to build tests from the initial
    distribution template (the old default initial distribution).
  • The ability to enable/disable everything from the printing of the final result
    of running a mockchain. The pretty printer per se has also been improved.
  • New HList type for heterogeneous lists, used to return type-retaining
    results for Utxo searches.
  • New TxSkel option txSkelOptDeferFailures to defer validation failures
    occurring during the balancing process. This has the upside of visualizing the
    last modified transaction sent for validation in the log, with the downside of
    a (huge) loss in performance. To be used for debugging purpose only.
  • New TxSkel option txSkelOptMaxNbOfBalancingUtxos to limit the total
    maximum number of UTxOs that can be picked as extra inputs during
    balancing. This will only matter if the number of UTxOs owned by the balancing
    wallet is huge, to limit exponential growth, which rarely happens.

Removed

  • Tweaks can no longer issue write action such as waiting a certain amount of
    time. As a consequence, waitUntilValidTweak has been removed.

Changed

  • The datum hijacking attack has been updated: all the sub-tweaks directly set
    the new outputs, and they all return only the modified outputs.
  • The module Ltl.Combinators has been integrated to Ltl. The combinators have
    been enriched and renamed to better match the rest of the Ltl API.
  • cooked-validators has been fully migrated from mtl to polysemy. Type class
    MonadBlockChain and its variants have been replaced by DirectMockChain,
    StagedMockChain, ExtendedStagedMockChain and FullMockChain.
  • Some datum hijacking params have been changed. ownedByDatumHijackingParams
    now takes a specific user as parameter, while its old behavior is now given by
    typedByDatumHijackingParams. Also, txSkelOutPredDatumHijackingParams has
    been renamed outPredDatumHijackingParams.
  • The whole file tree has been updated, in particular under
    Cooked.MockChain. Each effect is given its own file, such as
    Cooked.MockChain.Read, Cooked.MockChain.Error ...
  • Generation functions which use to live under
    Cooked.MockChain.GenerateTx.Witness now live in their own
    Cooked.MockChain.GenerateTx.Credential file.
  • All the auto adjustment made by cooked are now implemented using tweaks, such
    as autofilling of min ada, auto assignement of reference script...
  • Initial distributions have been downgraded from a first class citizen to a
    mere helping structure equivalent to using forceOutputs. By default, the
    mockchain runs now have an empty state, and non-empty initial distribution can
    be fed to runs in one of the following 3 ways: 1. use forceOutputs at the
    beginning of a run. 2. Use runMockChainFromConf or
    runMockChainFromInitiDist while running a trace. 3. use withInitDist when
    running tests. The old default initial distribution still exists as
    initialDistributionTemplate and is simply directly a list of outputs.
  • The UTxO searches have been fully reworked. They now happen in 3
    steps: 1. bootstrap the search with a set of UTxOs (beginSearch and
    beginSearchP) 2. filter (ensure, ensurePure, ensureAFoldIs and
    ensureAFoldIsn't) and/or extract elements from the selected outputs
    (extract, extractPure,extractAFold, extractTotal, extractPureTotal
    and extractGetter) in an type-retaining heterogeneous list. 2. retrieve the
    result of the search (getOutputs, getOutputsAndExtracts, getExtracts,
    getTxOutRefs and getTxOutRefandOutputs). Some additional helpers are
    provided for basic searches (utxosAtSearch, allUtxosSearch,
    txSkelOutByRefSearch and txSkelOutByRefSearch') and for basic filters
    (ensureOnlyValueOutputs, ensureVanillaOutputs and
    ensureProperReferenceScript).
  • txSkelLabel has been renamed txSkelLabels

Fixed

  • The condition for which a balancing solution is considered optimal: The main
    balancing function reachValue which picks the inputs to add and creates an
    additionnal output when needed has been updated. It used to pick the optimal
    result based on how small the additional UTxO was, and it now properly
    minimizes the total overhead in terms of size (and thus cost) that balancing
    adds to the transaction. This process is more involved but also more accurate.
  • An optimization bug in the optimal fee computation.