Cardano Plutus Team Finalizes Cost Models for New Dijkstra Functions

The team added 65 test cases for token-value operations and corrected compiler behavior. The update also covers Plutus V4 compilation and tools for checking the system’s formal models.

By SongMarketCap

Updated:

Cardano News - Cardano Plutus Team Finalizes Cost Models for New Dijkstra Functions

The Plutus team has finalized cost models for keepPolicies and dropPolicies, two built-in functions being developed for Cardano’s Dijkstra era. In a November 4 update, Software Engineering Lead Ziyang Liu also reported new tests, specification updates, and compiler fixes.

The work covers how smart contracts handle token values and account for execution resources. These are development changes supporting Dijkstra preparation; the report does not announce their activation on Cardano mainnet.

New Functions Filter Tokens by Policy

The two functions belong to CIP-0168, a proposal extending operations on BuiltinValue, the data type used to represent asset quantities within Plutus smart contracts. Built-in functions provide operations directly supported by the execution system.

Cardano groups native tokens under policy identifiers associated with their minting rules. keepPolicies retains the portions of a value associated with selected identifiers, while dropPolicies removes them. A contract processing several groups of tokens could use these functions to isolate the assets relevant to a particular check.

The merged changes limit the policy list accepted by either function to 256 identifiers. Their completed cost models define how execution is accounted for in CPU and memory units, which form part of a smart contract’s execution budget.

Tests and Compiler Fixes Address Program Behavior

The team added 65 conformance cases for the new Value builtins. These tests compare the implementation’s output with the expected result for defined inputs. The new functions and multiIndexArray have also been documented in the Plutus Core specification, providing a written reference for their behavior.

A separate correction addresses constant folding, an optimization that calculates suitable expressions during compilation instead of leaving them for execution. The affected compiler passes could previously simplify certain expressions in a way that incorrectly discarded computations that fail. The fix preserves those computations when the required conditions for simplification are not met.

The update also corrects compilation of Plutus V4 context types, which describe information available to scripts when validating transactions. In addition, the memory models for lookupCoin and valueContains have been aligned with existing cost-model parameters.

[NEWSBREAK]

Formal Checks Expand as Implementation Continues

The team introduced a tool that generates typechecking tests in Agda from the existing conformance suite. Agda is a programming language and proof assistant used to express formal models and check their consistency. The tool allows test cases already used for the implementation to support checks in that formal environment.

The new builtins have also been added to the metatheory, the mathematical description used to reason about Plutus programs. They currently appear as postulates, meaning the model assumes their specified behavior while further implementation work continues. Another merged change extends a tool that checks whether a compiler optimization preserves program behavior.

Remaining work includes implementing arrays and byte strings in the formal model, correcting certification of a separate compiler optimization, and improving the CEK machine that executes Plutus Core programs. These items remain listed as work in progress in the November 4 report.