cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cometa.Evaluation

Description

Inject script evaluation independently from balancing and signing. Evaluators return budgets keyed by existing redeemer identifiers; they cannot replace script arguments through their result. Applying budgets and recomputing commitments remain explicit transaction-building operations.

import qualified Cometa.Evaluation as Evaluation

noScripts = Evaluation.Evaluator (_ _ _ -> pure (Evaluation.mkBudgets []))
Synopsis

Documentation

data Target Source #

Transaction level whose execution budgets are requested. A sub-transaction evaluator still receives the complete enclosing transaction and resolved UTxOs.

Constructors

TopLevel

Redeemers in the outer transaction witness set.

SubTransaction !Word64

Zero-based serialized position in the body's sub-transaction list.

Instances

Instances details
Show Target Source # 
Instance details

Defined in Cometa.Internal.Evaluation

Eq Target Source # 
Instance details

Defined in Cometa.Internal.Evaluation

Methods

(==) :: Target -> Target -> Bool #

(/=) :: Target -> Target -> Bool #

Ord Target Source # 
Instance details

Defined in Cometa.Internal.Evaluation

data RedeemerId Source #

A redeemer's purpose and zero-based index in its corresponding body field. The index is bounded by 2^32-1, matching serializable redeemer identifiers.

Constructors

RedeemerId !Purpose !Word32 

Instances

Instances details
Show RedeemerId Source # 
Instance details

Defined in Cometa.Internal.Evaluation

Eq RedeemerId Source # 
Instance details

Defined in Cometa.Internal.Evaluation

Ord RedeemerId Source # 
Instance details

Defined in Cometa.Internal.Evaluation

data Budgets Source #

Unique sorted execution budgets. Equality compares identifiers and both budget components. No script argument or transaction bytes occur in a result.

Instances

Instances details
Show Budgets Source # 
Instance details

Defined in Cometa.Internal.Evaluation

Eq Budgets Source # 
Instance details

Defined in Cometa.Internal.Evaluation

Methods

(==) :: Budgets -> Budgets -> Bool #

(/=) :: Budgets -> Budgets -> Bool #

mkBudgets :: [(RedeemerId, ExUnits)] -> Either Error Budgets Source #

Reject duplicate identifiers, then sort by purpose and index. Budgets contain unsigned 64-bit memory units and CPU steps; this does not run a script.

budgets :: Budgets -> [(RedeemerId, ExUnits)] Source #

Budgets in ascending purpose/index order.

newtype Evaluator Source #

An application-supplied evaluator. Expected failures use Either; thrown exceptions retain ordinary IO behavior. It receives the complete immutable transaction and caller-supplied resolved UTxO snapshot. Implementations must return exactly one budget for each redeemer at the requested level.

Constructors

Evaluator 

Fields

evaluate :: Evaluator -> Target -> Transaction -> [Utxo] -> IO (Either Error Budgets) Source #

Validate the target and resolved-input uniqueness, call the injected evaluator, and require complete identifier correspondence. Missing or unknown identifiers return InvalidEvaluationResult. Duplicate resolved references return InvalidEvaluationRequest. This neither checks chain freshness nor requires all spending/reference inputs to resolve; that is evaluator-specific. No body, script argument, witness or commitment is modified.