PlutusScriptEvaluator

scalus.cardano.ledger.PlutusScriptEvaluator
See thePlutusScriptEvaluator companion trait

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply(evalBudget: (Redeemer, String, PlutusVM, PlutusScript, Seq[Data]) => ExUnits): PlutusScriptEvaluator

Factory method to create a PlutusScriptEvaluator instance with custom evaluation logic.

Factory method to create a PlutusScriptEvaluator instance with custom evaluation logic.

This allows injecting custom evaluation behavior for testing or specialized scenarios.

Value parameters

evalBudget

Function that computes execution units for a given redeemer and script

Attributes

Returns

PlutusScriptEvaluator instance using the provided evaluation function

def apply(slotConfig: SlotConfig, initialBudget: ExUnits, protocolMajorVersion: MajorProtocolVersion, costModels: CostModels, mode: EvaluatorMode = ..., debugDumpFilesForTesting: Boolean = ..., logBudgetDifferences: Boolean = ...): PlutusScriptEvaluator

Factory method to create a PlutusScriptEvaluator instance.

Factory method to create a PlutusScriptEvaluator instance.

Value parameters

logBudgetDifferences

If true, logs differences between original redeemer budgets and computed budgets. Useful for debugging budget discrepancies. Default is false.

Attributes

Creates a PlutusScriptEvaluator from CardanoInfo.

Creates a PlutusScriptEvaluator from CardanoInfo.

Value parameters

cardanoInfo

The CardanoInfo containing protocol parameters and slot configuration

mode

The evaluator mode

Attributes

def buildScriptContexts(tx: Transaction, utxos: Utxos, slotConfig: SlotConfig, protocolVersion: MajorProtocolVersion): Map[Redeemer, ScriptContext]

Build all script contexts for Plutus scripts in a transaction without evaluation.

Build all script contexts for Plutus scripts in a transaction without evaluation.

This method extracts all Plutus script redeemers from a transaction and builds their corresponding script contexts (V1, V2, or V3) based on the script version.

Useful for testing and debugging scenarios where you need to inspect script contexts without actually executing the scripts.

Value parameters

protocolVersion

Protocol version for validation rules

slotConfig

Slot configuration for time conversions

tx

The transaction containing Plutus scripts and redeemers

utxos

The UTxO set for resolving spent outputs

Attributes

Returns

Map from Redeemer to ScriptContext (union type: v1 | v2 | v3)

Throws
java.lang.IllegalStateException

if script resolution fails or required data is missing

Factory method to create a PlutusScriptEvaluator instance that always returns a constant budget.

Factory method to create a PlutusScriptEvaluator instance that always returns a constant budget.

This is useful for testing scenarios where you want to simulate script evaluations without executing actual logic.

Value parameters

budget

The constant execution units to return for any script evaluation

Attributes

Returns

PlutusScriptEvaluator instance that always returns the specified budget

Factory method to create a PlutusScriptEvaluator instance that uses the maximum budget defined in Cardano protocol parameters.

Factory method to create a PlutusScriptEvaluator instance that uses the maximum budget defined in Cardano protocol parameters.

This is useful for testing scenarios where you want to simulate script evaluations with the maximum allowed resources.

Value parameters

cardanoInfo

The CardanoInfo containing protocol parameters

Attributes

Returns

PlutusScriptEvaluator instance that always returns the maximum budget

Concrete fields

A no-op evaluator that returns empty sequences.

A no-op evaluator that returns empty sequences.

Useful for testing scenarios where script evaluation is not needed, such as transaction building tests that don't require actual Plutus script execution.

Attributes