Skip to content

Release Notes

Each section below is a release, newest first.

Reference script hashes in the evaluator’s context are the ledger’s (#243)

Section titled “Reference script hashes in the evaluator’s context are the ledger’s (#243)”

JulcTransactionEvaluator now hashes a transaction output’s reference script from the script’s bytes as they appear in the transaction, as the ledger does. Before, it decoded a native script and hashed CCL’s re-encoding of it. For a script with a non-canonical encoding, such as an indefinite-length list or an integer in a wider head than it needs, TxOut.referenceScript then held a hash the ledger never computes, so a validator that checks it could pass in JuLC’s evaluation and fail on-chain, or the other way round. Canonically encoded scripts, and every Plutus script, get the same hash as before.

The evaluator also refuses a reference script the era’s ledger cannot decode. The ledger rejects such a transaction before any script runs, and the evaluation now fails too. Before, most of these evaluated:

  • A Plutus V3 reference script before protocol version 9, because Babbage cannot decode PlutusV3. The evaluator takes the version from your ProtocolParamsSupplier, so make sure it reports the current one.
  • A script reference that is not [type, script], for example one with three items. Before, the extra items were ignored. An indefinite-length [type, script] is still read, as the ledger reads it.
  • A chunked (indefinite-length) byte string: the script reference itself, a Plutus script, or a key hash in a native script.
  • A tag on a native script or anywhere inside it, or on a Plutus script.
  • A native script with Dijkstra’s RequireGuard (constructor 6), which no era before Dijkstra decodes.

julc-cardano-client-lib now depends on cardano-client-lib 0.8.0-pre8 (was 0.8.0-pre7), and julc new scaffolds projects with it. If your build pins cardano-client-lib itself, move it to 0.8.0-pre8 too.

The new version adds two Dijkstra-era constants. JulcTransactionEvaluator refuses both:

  • A redeemer with the new RedeemerTag.Guarding (guard scripts) fails the evaluation, naming the redeemer, because a Plutus V3 ScriptContext has no script purpose for it.
  • Language.PLUTUS_V4 is not evaluated.

Each validator loads its own script, whatever its simple name (#326)

Section titled “Each validator loads its own script, whatever its simple name (#326)”

JulcScriptLoader.load(Class) and the annotation processor used to key a compiled script by the class’s simple name only, so com.a.VaultValidator and com.b.VaultValidator on one class path both loaded the first copy of META-INF/plutus/VaultValidator.plutus.json.

  • The processor now also writes each script and source map under the class’s qualified name, for example META-INF/plutus/com/b/VaultValidator.plutus.json, and records the class in the JSON ("validator": "com.b.VaultValidator"). It still writes the simple-name copy, for older loaders.
  • JulcScriptLoader reads the qualified copy. For a module compiled before this release, it reads the simple-name copy that sits beside the class’s .class file. It never uses a copy that records another class. When no copy is the class’s own, or two different copies are, it throws an IllegalArgumentException that names them. The source map always comes from beside the script that was used.
  • ValidatorOutput gains a validator component, the class’s binary name, which is empty for older metadata. The existing constructors are kept, and toJson() writes the field only when it is known.
  • Two validators with one simple name in one compilation now fail with an error that names both, instead of a FilerException.

Migration: recompile the modules that hold your validators. Until you do, one case still goes undetected: a fat jar that merges two such older modules with same-named validators keeps one simple-name copy, which both classes read. Exclude validator packages from relocation by shading plugins. A validator whose package gained a prefix is now refused, because its script records its original name. One whose package was replaced is not detected.

Smaller scripts at the default level (#325)

Section titled “Smaller scripts at the default level (#325)”

Two rewrites at pv11-safe and pv11-costed make scripts smaller (ADR-076):

  • A multi-purpose validator binds once the methods every purpose uses, around its purpose dispatch. Before, each purpose’s handler had its own copy.
  • A repeated forced builtin (headList, tailList, sndPair, …) and the fixpoint combinator of recursive methods are bound once at the script’s root.

Results:

  • The counter validator of issue #325 goes from 3,862 to 2,749 bytes, 1.55 times Aiken’s 1,769 for the same checks.
  • Every accepting transaction of its benchmark is cheaper.
  • Across the compiler’s recorded test corpus, the second rewrite alone shrinks programs by 10 %.

What a script computes, where it fails and what it traces do not change. Script hashes change at these levels. The first rewrite keeps the budget of every run that reaches its purpose’s handler, and adds a few machine steps to a run that fails before it: no handler for the purpose, or a redeemer or datum of the wrong shape. The second can add a few machine steps to a run that uses few of the shared values, such as a transaction that fails early. Each rewrite can be turned off with CompilerOptions.disableOptimizationRule("pv11.o16.shared-handler-bindings") or disableOptimizationRule("pv11.o17.shared-closed-values").

Long programs compile on small stacks (#327)

Section titled “Long programs compile on small stacks (#327)”

The compiler’s walks over a program no longer recurse on the Java stack as deep as the program is long. This covers:

  • the PIR passes, UPLC generation and the optimizer;
  • the verifier;
  • FLAT encoding and decoding, and source maps;
  • the call graph;
  • the front end’s lowering of a block’s statements.

Before, a validator with a few hundred helper methods, early returns or else if branches could exhaust the stack. In the WebAssembly engine on Node’s default stack, that showed as an opaque TypeError: type incompatibility when transforming from/to JS. Programs with a few hundred helper methods or early returns now compile on a 256 KB stack. In the WebAssembly engine on a 1 MB stack, 600 helpers or 1,500 early returns compile, which used to fail.

This change leaves compiled scripts as they were: a replay of about 55,000 recorded compilations gives the same bytes, source maps, diagnostics and debug metadata as before. Compilation takes about 12 % longer. Nesting inside the Java source is still limited by javac’s own parser: an expression inside an expression, and an else if chain, which javac parses as nested statements. JuLC used to overflow first, at about 88 branches on a 256 KB stack; now javac does, at about 186 branches on 256 KB and 3,999 on 1 MB (ADR-074).

The script no longer depends on import order (#328)

Section titled “The script no longer depends on import order (#328)”

A validator binds the library methods it uses with lets, each method’s dependencies outside it. Their order used to follow the order the methods were found in. That came from the validator’s import declarations and from the order of the library sources passed to the compiler. So reordering imports, passing libraries in another order, or moving a library class to another package could change the script hash although nothing else changed.

The order is now fixed by the methods themselves: by their dependencies, then by a digest of each method’s body that leaves out names and packages (ADR-075). Imports and the order of library sources no longer reach the script. A library class’s package and name no longer decide the order either, except between methods whose bodies are equal, and in the numbering of shared strict-boundary shape checks (ADR-075 I2).

  • Script hashes change on recompilation for most validators that use two or more library methods. Redeploy, or pin the compiler version, if a script hash matters to you.
  • What a script computes, where it fails, what it traces and its execution budget do not change: only the order of bindings that are closed functions or total values moves.

Ed25519 verification on BouncyCastle; bcprov 1.86 (#322)

Section titled “Ed25519 verification on BouncyCastle; bcprov 1.86 (#322)”

The Java VM and the testkit verify Ed25519 signatures (verifyEd25519Signature) with libsodium’s input checks and equation, now computed on BouncyCastle’s field arithmetic. The verdicts do not change: they agreed with libsodium before and still do. Each verification allocates about 8 KB instead of about 636 KB, and takes about 47 µs instead of about 125 µs.

  • BouncyCastle bcprov-jdk18on is 1.86 in every published module: julc-vm (a new dependency), julc-vm-java (was 1.78.1), julc-testkit and julc-tools (were 1.83).
  • Ed25519 verification needs bcprov 1.67 or later. Before its first verification it checks itself against libsodium’s verdicts. On an older bcprov, or one that disagrees, every verification throws a LinkageError that names the bcprov version and jar. If your build resolves an older bcprov, for example through another library that pins one, make 1.67 or later win; 1.86 is the tested version, and 1.78.1 and 1.83 are also tested.

Builtins are charged without sizing arguments their cost ignores (#323)

Section titled “Builtins are charged without sizing arguments their cost ignores (#323)”

The Java VM now sizes a builtin’s arguments only when its cost function reads them, as Haskell’s costing does. Constant-cost builtins such as unConstrData, chooseData and headList no longer walk their Data argument on every call, byte strings are measured without being copied, and a Data value of any nesting depth is sized without using the call stack. Budgets do not change; scripts that pass large Data values to constant-cost builtins run faster and allocate less.

The macOS builds of the CLI and the playground are now made on macOS 15, because GitHub retired its macOS 14 runners. They are Apple-silicon binaries, as before, and need macOS 15.0 or later; 0.1.0-pre20’s needed macOS 14.0. The artifact names and the Homebrew formulas do not change. On macOS 14, keep using 0.1.0-pre20’s binaries or compile through Gradle or Maven, which need only a JDK.

An attribution query for tools that embed the compiler (#313)

Section titled “An attribution query for tools that embed the compiler (#313)”

JavacFrontend.attribute(roots, pool, query) attributes sources the way a JuLC compilation does, runs query over a read-only view of javac’s model (Attributed: result(), roots(), trees(), elements(), types()), and returns what the query returns. It is experimental, for tools that generate validators from attributed source. Use the model only inside the query and on the calling thread, and keep no Element, TypeMirror or Tree after it returns. The model is null when the roots are rejected before javac runs. result().diagnostics() then holds JuLC’s rejection; otherwise it holds javac’s errors, followed by notes on shadowed library sources, and javac’s warnings are not kept. Compilation does not change.

JulcList.any and all stop at the deciding element (#312)

Section titled “JulcList.any and all stop at the deciding element (#312)”

The compiled any and all used to test every element of the list, where the JVM’s stop at the element that decides the answer: any at the first that passes, all at the first that fails. A predicate that failed or traced on a later element made the script disagree with its Java tests: parts.any(p -> 100 / p > 10) over [5, 0] returned true on the JVM and failed on-chain (#312, ADR-070 D5). Both now stop where the JVM stops, at every optimisation level.

  • A predicate no longer needs an && guard for the elements after the answer.
  • A conditional choosing the function, xs.map(c ? x -> … : x -> …), evaluates its condition once, after the list and before the first element, as Java does, for map, filter, find, any and all. It used to run once per element tested, and not at all on an empty list.
  • Cost: less at every level. Each tested element costs a little less, and the elements after the answer cost nothing; a 10-element any whose first element passes costs about a tenth of what it did. Scripts are about 5 bytes smaller per any or all (10 at NONE).
  • Blueprint hashes of validators that call any or all change.

A cast to a sealed-interface variant is checked (#288, #309)

Section titled “A cast to a sealed-interface variant is checked (#288, #309)”

A downcast from a sealed interface to one of its record variants used to lower to its operand, with no check. Where Java throws ClassCastException, the script read the other variant’s fields through the target’s layout and carried on: A a = (A) s; on a B(10, 4) returned 10 (#288, #309, ADR-070). It now tests the variant’s tag and fails the script on another variant, as the JVM throws:

ScriptInfo.MintingScript mint = (ScriptInfo.MintingScript) ctx.scriptInfo(); // fails unless minting
Withdraw w = (Withdraw) redeemer; // fails on any other action
  • Every optimisation level, the operand evaluated once. Casts that need no check keep their bytes: upcasts and same-type casts.
  • A cast from a type JuLC cannot relate to the sealed interface stays an unchecked view, as before: (V)(Object) x, PlutusData.cast(x, V.class), casts to PlutusData’s own variants, and an operand of an unbounded type variable or an open super-interface. instanceof does not accept those operands either: obtain a value typed as the sealed interface first (a typed datum, redeemer or record component), then cast or branch on it.
  • Cost: 14 to 19 bytes of script per checked cast (measured on 13 example validators, which grow by 0.3% to 3%), and a tag test at run time. Blueprint hashes of validators that downcast change.
  • A cast inside a JulcList.any or all predicate runs on the elements the JVM tests, and no further (see the section above).

instanceof pattern variables wherever Java has them in scope (#204)

Section titled “instanceof pattern variables wherever Java has them in scope (#204)”

JuLC used to bind an instanceof pattern variable only when x instanceof T v was the whole condition of an if outside a loop body with accumulators. Everywhere else a use of the variable was Undefined variable (#204, ADR-069). It now follows Java’s scope rules (JLS 6.3.1, 6.3.2.2):

if (x instanceof Bid b && b.amount().signum() > 0) { ... } // &&, ||, !, parentheses
long n = x instanceof Bid b ? b.amount().longValue() : 0; // ?: and any value position
outputs.any(o -> o.datum() instanceof OutputDatumInline d && ...); // lambdas
for (var x : actions) { if (x instanceof Bid b) { total = total + ...; } } // loops with accumulators
if (!(x instanceof Bid b)) { return false; } // the early-exit guard:
return b.amount().signum() > 0; // b is in scope after it

A bare type test, x instanceof Bid, now works wherever an expression may stand.

  • Unchanged bytes: programs that compiled before compile to the same bytes. The new lowering runs only where a variable is used in a position that was rejected before.
  • Bound once, under its test: a variable is bound only where its test passed, and its operand is evaluated once, in Java’s order.
  • Still rejected, now with a rewrite: a variable carried out of a while condition into the loop body or past the loop is JULC0139, which replaces Undefined variable for pattern variables. Reassigning a pattern variable is JULC0140, except in the form that compiled before: the variable of an if whose whole condition is its test, outside a loop with accumulators, updated by a loop in that if. Switch-guard bindings stay JULC0074. JULC0077 no longer covers a test of a variant: it is left for record patterns and for a test of a type that is no variant, such as the sealed interface itself.

Build native BLS point and scalar lists one element at a time (#240)

Section titled “Build native BLS point and scalar lists one element at a time (#240)”

Builtins gains six producers for the native lists that bls12_381_G1_multiScalarMul and bls12_381_G2_multiScalarMul take (#240, ADR-047 amendment):

Method Lowering
scalarsEmpty(), g1PointsEmpty(), g2PointsEmpty() the empty native list constant, the same one scalars(), g1Points(), g2Points() produce
scalarsCons(BigInteger, JulcScalars), g1PointsCons(JulcG1, JulcG1Points), g2PointsCons(JulcG2, JulcG2Points) one MkCons, the new element first

They can be used inside recursive helpers and returned from them, so a contract that has already uncompressed and checked each point can multiply those same points instead of decompressing them a second time with g1PointsFromCompressed. On the pinned PV11 costs, validating 24 compressed G1 points and then calling g1PointsFromCompressed and the multiplication costs 3,633,587,600 CPU; validating each point once and consing it costs 2,342,911,604 CPU (one 52.9 million CPU decompression saved per point). Building the list by cons costs 48,000 CPU and 300 memory per element after the first more than the converter or the literal g1Points(...) chain: each cons is bound once, as the literal chain is, so the compiler can type it.

The ADR-047 typing rules apply unchanged: the element must be a point of the list’s group (or an integer for scalars) and the list must be the native list of that group, so a G2 point on a G1 list, compressed bytes, Data, or a JulcList where a native list is required is JULC0041. The lists stay opaque: no Data encoding, no datum, redeemer, record or Data list, no ==, and no isEmpty/head/tail. This is an addition: programs that do not call the new methods compile to the same bytes and hashes.

A Java cast or PlutusData.cast that changes a native type (for example (JulcG1Points)(Object) g2PointsEmpty(), PlutusData.cast(d, JulcG1Points.class), the same through a variable whose type is Object, or a cast of a native value to long) is now JULC0041. Such casts compiled before, for the existing producers as well, and always failed at runtime; a cast is never a decoder. Most other misuse, such as a G2 point consed onto a G1 list, is rejected by javac itself (JULC0085). A switch expression that yields one group’s native list compiles, with or without a cast to its own type.

abs, signum, max, min and compareTo evaluate each operand once (#146)

Section titled “abs, signum, max, min and compareTo evaluate each operand once (#146)”

These read an operand more than once: abs and signum their receiver, and max, min and compareTo both operands. An operand that was more than a variable or a literal was evaluated again at each read. A traced operand traced twice, and nesting one of these inside another doubled the script at each level: six nested abs() calls made a 4,792-byte script at PV11_SAFE (#146). The compareTo(...) OP 0 form was already fixed.

  • BigInteger’s abs, signum, max, min and compareTo, and Math.abs, Math.max and Math.min, now evaluate an operand that is not a variable or a literal once, receiver first, as Java does. So does the operand of if (x instanceof T t). A trace in it shows once, and nested calls grow the script linearly: the six nested abs() calls now make 106 bytes.
  • Script bytes change for programs that pass such an operand: a call, a record field or arithmetic, such as x.v().signum() or a.add(b).abs(). That includes stdlib methods kept in the script. Programs whose operands are variables, literals or arithmetic on literals are unchanged. In every shape measured, the new script is no larger. Where the operand is read twice it costs less CPU, and usually less memory. max or min of two cheap operands, such as a.add(b).max(b.multiply(a)), can use up to about 200 more memory units. Where only one read runs (a negative signum receiver, or compareTo taking its “less than” branch), it costs 48,000 more CPU units and 300 more memory units. A new hash means a new script address or policy ID. BASELINE changes too.

julc-wasm and julc-tools are published (#252)

Section titled “julc-wasm and julc-tools are published (#252)”

org.julclang:julc-wasm and org.julclang:julc-tools are now on Maven Central, so a language built on JuLC’s backend can compile its own WebAssembly engine from these jars, without copying JuLC’s code. Both are experimental.

  • JsApi.install(ApiRegistry, EngineInfo) takes the engine’s global name, variant, version and operation groups, and checks them. JuLC’s own images pass the values they used before.
  • Operation names are group.operation; duplicates, groups the engine does not advertise and reserved names are rejected.
  • The JavaScript client refuses an engine whose variant, API version or groups differ from its manifest.
  • The images now carry the cost model parameter files, so costModel: '<profile-id>' works; it failed in every image before.
  • slf4j-nop is no longer a dependency of the published jar: JuLC’s images add it themselves, and an embedder chooses its own logging provider.

No compiler, UPLC, ledger or VM behavior changes. See JavaScript and WebAssembly.

On an import line, the playground editor suggests the next package or class: import org.julclang. offers core, ledger and stdlib, and choosing a class ends the line with ;. Type a letter or press Ctrl+Space to open the list.

javac is JuLC’s only Java reader (ADR-068 M5, M6)

Section titled “javac is JuLC’s only Java reader (ADR-068 M5, M6)”

JuLC now reads every Java source with javac, on every host: the compiler API, the Gradle plugin, the annotation processor, the testkit (JulcEval, ValidatorTest, ContractTest), the CLI (julc build, julc check, the REPL, the MCP tools), the playground and julc-wasm, and Elci’s JavaLibraryProvider and LedgerTypeProvider. javac resolves every name, type, overload and literal, and JuLC lowers javac’s attributed trees. The tools that read Java source without compiling it (lint, test discovery, the MCP tools’ arity check, the metadata extractor, the verification resolvers) read it with javac’s parser too.

A validator whose bytes change gets a new script hash, so a new address or policy ID. Rebuild every validator you have deployed, compare its hash with the deployed one, and treat a change as a new script: funds locked at the old address and tokens minted under the old policy stay with the old script.

On ADR-068’s migration corpus (24,167 compilations), 14,405 give the JavaParser frontend’s bytes exactly; 396 give other bytes, each classified in the ADR’s ledger (a semantic fix, a cost change or a representation change); and 1,075 that the JavaParser frontend accepted are rejected with a code (below). Of the 102 external example programs in that corpus, 43 keep their bytes, 11 change them, and 48 are rejected until rewritten; the examples held 125 byte[].equals call sites.

The JavaParser frontend and the frontend option are gone (ADR-068 M6)

Section titled “The JavaParser frontend and the frontend option are gone (ADR-068 M6)”

There is no way back to the JavaParser frontend: javaparser-core is on no class path, and a build that fails on javac is fixed by the rewrites below. What opted back is removed:

Host Removed What a build that still names it gets
Compiler API CompilerFrontend, CompilerOptions.setFrontend, getFrontend, setJavacGate, getJavacGate, setMethodObserver A compile error
Lint rules BigIntegerParamRule, a retired no-op kept for code that referenced it A compile error: remove the reference
Gradle plugin julc { frontend = ... } javac builds; anything else stops, saying the option is gone
Annotation processor -Ajulc.frontend javac compiles; anything else is an error, saying the option is gone
CLI julc build --frontend javac builds; anything else stops, saying the option is gone
Testkit JulcEval.frontend(...); ValidatorTest.compile(src, frontend), compileValidator(cls, root, frontend), compileValidatorByName(fqcn, root, frontend); ContractTest.compileValidator(cls, root, frontend) A compile error: drop the argument
Source-reading tools -Djulc.tools.reader Ignored
The javac gate -Djulc.javacGate, -Pjulc.javacGate, CompilerOptions.setJavacGate Ignored, or a compile error for the method: javac reads every compilation

Retired codes, never reused: JULC0084 (a construct the javac frontend had not ported; nothing reaches it), JULC0100 (a name the JavaParser frontend read by its spelling), and JULC0005, JULC0071, JULC0073 and JULC0082 (a switch that is not exhaustive, a dominated label, a guard’s variable that is reassigned and a second default, which javac rejects itself, as JULC0085). A compilation no longer reports them. JULC0101 now holds only a record’s declared toPlutusData or explicit accessor, and a generated accessor that implements ToPlutusData.toPlutusData; its other rows were rules of the JavaParser frontend’s gate. So these compile on javac, where each name binds to its declaration, and give Java’s answer: a method or component named fromPlutusData, of or like a method of the type a @NewType lowers to, a variable or type named Boolean, BigInteger, Math or another name of the API. A record’s body stays JULC0080, and a @NewType’s instance call keeps its own rejection where there is one.

A rule written outside JuLC: LintRule.check takes javac’s tree (JavacSyntax), and supports is gone. JavaSourceIntrospector’s methods on JavaParser nodes and JavaSourceParser are gone, and DiagnosticCollector reports by line and column. JavacProvenance has no gate. CompilerFrontend.DEFAULT is gone.

Each of these compiled on the JavaParser frontend, which read it otherwise than Java does or produced a script that fails where the Java code returns. Each now stops with a code and a fix:

Code Rejected Write instead
JULC0087 An equals, contains, get, lookup, containsKey or delete whose JVM equality compares an array by identity: byte[].equals, and a record, variant, Optional, tuple or java.util collection that holds a byte[]; a comparison at a type the check cannot read (a raw collection, Object, a type variable); equals between two containers of unrelated arguments Builtins.equalsByteString(a, b), or compare the components; see the guide below
JULC0086 == or != on BigInteger, byte[], String, boxed values or records (reference equality in Java), and a comparison of constant strings that is not built from literals and + alone a.equals(b); Builtins.equalsByteString(a, b) for bytes
JULC0078 equals or a collection operation between two types Java keeps distinct (PubKeyHash.equals(BigInteger), Optional<R1>.equals(Optional<R2>)’s records) Compare through one typed value, or compare the components
JULC0090 String + with a non-String operand ("a" + 1, #296) Concatenate Strings only
JULC0012 A conditional, switch expression or set of returns whose values have two types, or two on-chain representations; a type parameter no call specializes Give the arms one type, or convert explicitly
JULC0014 An array type other than a byte[] literal, including a varargs record component (record R(BigInteger... a)) JulcList
JULC0123 A static call through a package-qualified class name (java.math.BigInteger.valueOf(1)) Import the class and use its simple name
JULC0124 A byte, short, char, float or double type, or a cast to one; (char), (short) or (byte) of an integer literal stays, with its Java value int, long or BigInteger
JULC0125 A char literal, a text block, a class literal outside PlutusData.cast, a function that is not a lambda at the call A string literal, a lambda at the call
JULC0126 instanceof of a variant on a value whose static type is not the variant’s sealed interface ((Object) x instanceof V v) Test a value of the sealed interface’s type
JULC0127 A variant of a sealed interface that is a class or a @NewType record Make the variant a plain record
JULC0128 A value whose on-chain form is not the one the operation reads (Data where a builtin takes bytes, a native list in a Data component, a new Value(...) of a map) Convert explicitly (Builtins.unBData, listData, mapData) or use ValuesLib and MapLib
JULC0129 new of a class that is not a record Declare a record
JULC0130 int x; x += someLong (any compound assignment of a long, or of a Long javac inferred as in var z : JulcList.of(y), to an int): Java narrows it without saying so, and the on-chain integer does not Declare x as long, or write x = (int) (x + y) for Java’s 32-bit result
JULC0079, JULC0080 A record with two sealed parents; a record member other than a nested type (ADR-067) One sealed parent; move logic to a static method
JULC0088 A @Param field that is a Java constant variable (static final boolean P = true) Drop final, or Boolean.valueOf(true)
JULC0092 A sealed interface with no permits clause whose permitted classes are not exactly its nested records Add a permits clause in tag order
JULC0093 A string literal with an unpaired surrogate A surrogate pair, or remove it
JULC0096, JULC0097 Two validator classes in a source, two entry points in a single-purpose validator, a non-static entry point One validator; a static entry point
JULC0104–JULC0122, and JULC0001, JULC0002, JULC0004, JULC0006, JULC0011, JULC0020, JULC0024, JULC0077 The subset’s rejections the JavaParser frontend made without a code, in its words As before
JULC0055 equals on a value read as Data whose decoded type has no equals (a boolean, a list or a map read from a generic head()) Compare at the value’s declared type

Troubleshooting has the codes’ causes and fixes. A few shapes the JavaParser frontend ran correctly also stop, failing closed, until a rule for them is written: a for-each variable wider than the element, such as for (Number o : xs) with o.longValue() (JULC0055), and r.a().abs() where a is an integer @NewType read from a record (JULC0055).

Each of these compiled on the JavaParser frontend to a script that disagreed with its Java code; on javac it agrees:

  • A name binds to the declaration Java binds it to: a local, a field, a type of your own named like a ledger type (TxId, PubKeyHash, …), a library class named like a variable (#209, #284, #286, #291).
  • Types are Java’s (#287, #290, #292): a method dispatches on its resolved declaration; a conditional’s arms are typed by both branches, not by the first.
  • A ledger type’s fromPlutusData checks the shape of its Data on-chain; contains on a nested collection encodes its target (#297); a reference == in a guard, a lambda or an argument is JULC0086 as anywhere else.
  • (int) of a long keeps Java’s low 32 bits, where it was the whole value.
  • A constant field read in a switch guard has Java’s value; a local that shadows a constant field reads the local.
  • PlutusData accumulators that hold lists in loops, and an element read as javac types it, no longer cons or read the list as Data.

The ADR-068 ledger (adr/evidence/068/lowering-accepted-differences.tsv) gives each difference its class and test.

The narrowing cast costs only where it can change the value

Section titled “The narrowing cast costs only where it can change the value”

(int) x of a non-constant long computes Java’s value, with three builtins at the cast: about 527k CPU, 1.2k memory and 107 lovelace each time it runs, and about 26 bytes in the script. Where the compiler can show the value is already in int’s range, the cast costs nothing: it has no builtin, and the script is the one the JavaParser frontend gives. The compiler shows it for:

  • an integer constant, Builtins.indexByteString and ByteStringLib.at (0 to 255);
  • x % k and a.mod(k) by a constant k from 1 to 231, and a value already narrowed;
  • any of these read through a local, or returned by a method that is not recursive.

Anything else keeps the builtins: a parameter, a length, arithmetic, a choice, a loop’s result, or a recursive method. A program with such a cast has different bytes and a different hash than on the JavaParser frontend, where the cast was erased and the value could differ from Java’s. MerklePatriciaForestry, whose nibble writes (int) ByteStringLib.at(...), keeps its bytes.

A ledger type’s fromPlutusData pays for its check

Section titled “A ledger type’s fromPlutusData pays for its check”

TxCert.fromPlutusData(d), and the same call on the other ledger types, now checks the exact shape of d on-chain, as it does on the JVM. It used to read d as it stood, and so accepted Data the JVM refuses (ADR-068 D6, r15). The check costs +87 to +967 bytes in the script, depending on the type, and up to about 28M CPU per call. A program that does not call it pays nothing: none of the 43 external example validators does, and their bytes do not change.

  • Use it where Data comes from outside the script’s typed values and a wrong shape must fail the transaction.
  • Call it once and keep the result. Do not call it inside a loop or on every path of a helper.
  • Skip it where you already hold the value in its type. PlutusData.cast(d, T.class) is a view that checks nothing and costs nothing, so a wrong shape is not refused there: it fails or misreads later, where the value is read.

On the JVM, byte[].equals is Object.equals: it compares references, so two arrays with the same bytes are not equal. The JavaParser frontend compiled it to a byte comparison, so a JVM test of the validator and the script disagreed. javac’s frontend rejects it with JULC0087:

JULC0087: Object.equals compares byte[], whose equality on the JVM compares an array by identity

Compare the bytes with Builtins.equalsByteString, which compares contents on the JVM and is the same builtin call the JavaParser frontend made for a.equals(b), so the script keeps its bytes and its hash:

// Before: identity on the JVM, a byte comparison on-chain
boolean signed = signer.equals(expected); // byte[] signer, expected
boolean same = !txId.equals(utxoRef.txId().hash());
// After: the same script, and a JVM test that tests it
import org.julclang.stdlib.Builtins;
boolean signed = Builtins.equalsByteString(signer, expected);
boolean same = !Builtins.equalsByteString(txId, utxoRef.txId().hash());

ByteStringLib.equals(a, b) is equivalent on the JVM and on-chain, but it is a library method the compiler binds once and calls through a variable, so a script that uses it is a few bytes larger (2 to 30 bytes on the external examples) and gets a new hash. Use Builtins.equalsByteString to keep a deployed script’s hash. The external examples were migrated that way, and every hash stayed the same.

A ledger hash (PubKeyHash, ScriptHash, TxId, PolicyId, TokenName, …) compares by value, so a.equals(b) between two hashes of one type stays. A @NewType byte wrapper is a record, whose equals compares its component by identity; JuLC never accepted it under the default gate, so compare its component:

@NewType record OrderId(byte[] value) { }
// Rejected: JULC0087
boolean same = a.equals(b); // OrderId a, b
// Write
boolean same = Builtins.equalsByteString(a.value(), b.value());

A record or sealed variant with a byte[] component has the same problem through its generated equals, and so does contains, get or containsKey on a java.util collection of byte[]: compare the components, or keep the bytes in a JulcList, JulcMap or JulcArray, whose JVM equality compares byte[] by content (since ADR-068 M1). A source with the old form stops at compile time, so there is nothing to look for at run time. The diagnostic’s fix names the same replacements.

  • Clearer errors. Script bytes do not change.
    • An error from the compiler, the CLI, the Gradle plugin or the annotation processor now shows the source line with the problem underlined.
    • JULC0076 and JULC0077 show a record pattern’s rewrite with your own names: case A(var amount) on record A(BigInteger v) suggests write `case A a`, then use `a.v()` for `amount` .
    • Messages no longer mention design documents or internal names such as AssignExpr. JULC0125 says a char literal, and JULC0110 says a nested block.
    • CompilerDiagnostic has a new component, excerpt. Its constructors and accessors keep working, but a record pattern over it needs eight components, and two diagnostics that differ only in excerpt are not equal.
    • These errors now have codes: JULC0131 to JULC0138. Some rejections that had no code now report an existing one, such as JULC0012 and JULC0114.
  • The tools read with javac. Lint, julc check’s test discovery, the MCP tools, the metadata extractor and the verification resolvers read sources with javac’s parser. Lint and test discovery read the corpus as JavaParser read it; the metadata extractor (the playground’s check) now reports the javac frontend’s diagnostics (ADR-068 M6a).
  • LedgerTypeProvider() and JavaLibraryProvider(..., new CompilerOptions()) describe the ledger and libraries as javac reads them; their types and named definitions are equal to the JavaParser frontend’s (ADR-068 M2).
  • JRL support has been removed. The experimental JRL rule language, its transpiler, julc build’s compilation of .jrl files and the JRL guide are gone; julc build warns that it ignores any .jrl file it finds. Write the contract in Java, as the first contract guide shows. JRL was never published, so no Maven artifact disappears. The playground reads only JULC_PLAYGROUND_PORT, JULC_MAX_COMPILE_THREADS and JULC_COMPILE_TIMEOUT_SECONDS; the older names starting with JRL_ are no longer read.
  • The annotation processor and the Gradle plugin’s compileJulc print each diagnostic with its code, position and fix (CompilerException.describe()); before, a rejection made of one diagnostic showed its words alone.
  • A sealed interface whose permitted class is a class or a @NewType record is JULC0127 wherever it is declared in a unit the compilation reads, whether or not the program uses it: such a variant has no layout, and the compiler dropped its value wherever the sum was read (a parameter, a datum and its blueprint schema, a record component, a library’s exports). Before, only a new, instanceof or case of the variant was rejected.

An entry point takes the script context last

Section titled “An entry point takes the script context last”

An @Entrypoint method’s last parameter is ScriptContext or PlutusData; anything else is JULC0103. The script receives the script context there, undecoded, so a last parameter typed BigInteger, int, a record or a subtype of PlutusData read the context as that type, and the method’s JVM test did not test the script. A spending entry point that needs two values takes them as datum and redeemer: validate(BigInteger datum, BigInteger redeemer, ScriptContext ctx). An entry point with a parameter count its purpose does not take is still JULC0008. Scripts that compile do not change.

The subset’s rejections carry codes: JULC0104–JULC0122 for synchronized, method references, calls through a functional local, this and super, array access, inheritance, unsupported statements, the loop and switch-arm rules and unsupported operators, and JULC0001, JULC0002, JULC0004, JULC0006, JULC0011, JULC0014, JULC0020, JULC0024 and JULC0077 for the rest. A source with several such errors reports each of them. A record that implements two sealed interfaces is JULC0079, and a record that declares any member but a nested type is JULC0080 (ADR-067), so record R(BigInteger a) { R { } }, accepted there before, is rejected. See Troubleshooting.

String.length counts as Java does, and a method with no parameters runs when called

Section titled “String.length counts as Java does, and a method with no parameters runs when called”

s.length() counts UTF-16 code units, as Java does. It counted the bytes of the string’s UTF-8 encoding, so "é".length() was 2 and "😀".length() was 4. A constant string folds to Java’s value. Any other string is now counted byte by byte, so length costs in proportion to the string: about 1.1M CPU and 4,800 memory per UTF-8 byte at PV11_SAFE, and 1.7M CPU and 6,900 memory at BASELINE.

A method with no parameters whose body may fail, or traces, now runs at each call, and only if it is called, as in Java. It ran once at script start, whether or not it was called, so c ? boom() : 2 failed with c false. Such a method now costs a call each time, and a trace in it shows at each call. A body the compiler can show cannot fail stays one shared value: constants, what the literal folds reduce to one, the listed builtins that cannot fail, and calls of non-recursive functions whose bodies it can read. Any other body, including a read of a @Param field, is delayed. A library reached through a provider import stays as it was: its method with no parameters runs once when the program starts. A conversion in a helper that may fail is no longer shared with its callers.

A script that uses length on a string that is not a constant, or has such a method, changes its bytes and its script hash.

On the JVM, these now do what the script does: lessThanByteString and lessThanEqualsByteString compare unsigned bytes; andByteString, orByteString and xorByteString align from the first byte, and padding keeps the longer string’s tail; sliceByteString clamps its counts; indexByteString, consByteString and replicateByte throw outside their ranges; decodeUtf8 throws on bytes that are not UTF-8. JulcList.take and drop throw on any negative count, and JulcList.get and JulcArray.get on an index past an int. These change no script, but a test that relied on the old result changes.

a.mod(b) with b below 1, and take(n) and drop(n) with n below 0, throw in Java. They now fail in the script too. Before this change mod took a negative modulus and take and drop took a negative count.

A literal constant that passes, such as x.mod(BigInteger.TEN) or take(3), takes no check and compiles as before. A named constant takes one, like any other argument, so a script that calls one of these methods that way changes its bytes and costs slightly more, and its script hash changes.

Two differences from Java stay. Neither changes what a script accepts, since both sides still run: prepend, contains and insert evaluate their argument before their receiver, and abs, min, max, signum and compareTo outside compareTo(...) OP 0 can evaluate an operand twice. Only the order of traces, which failure shows, and cost differ.

"a" + "b" of string constants now warns: Java joins them when it compiles, and JuLC keeps the + as written, so the script joins them when it runs. The warning rejects nothing, and script bytes do not change. Write one literal.

A conditional lowers to Case on a proven boolean

Section titled “A conditional lowers to Case on a proven boolean”

A conditional lowers to Case when the compiler proves its condition produces a real boolean: a boolean constant, a comparison or another builtin with a boolean result, a decoded boolean field, a local bound to one of these, or a call of a function whose result is one of these. Any other condition, such as a method parameter or a loop’s accumulator, lowers to builtin ifThenElse. The two agree on every boolean.

Recompiling can change script bytes and budgets at pv11-safe and pv11-costed, so a script hash can change: about 4 bytes at each conditional on the builtin, and 188,049 CPU and 701 memory each time it runs.

Sources must be Java that javac accepts (ADR-068 M1)

Section titled “Sources must be Java that javac accepts (ADR-068 M1)”

Every compilation now has javac analyze its sources first, on every host (the compiler API, the Gradle plugin, the annotation processor, the testkit, the CLI and its REPL, the playground and julc-wasm). Source javac rejects is rejected with JULC0085: javac’s message, its key (such as compiler.err.operator.cant.be.applied.1) and its position. A runtime without a supported javac (JDK 25 with jdk.compiler) is rejected with JULC0089.

JuLC’s dialect beyond Java is no longer accepted. Write it as Java:

Dialect Java
a + b, a - b, a * b on BigInteger a.add(b), a.subtract(b), a.multiply(b)
a > b, a <= b on BigInteger a.compareTo(b) > 0, a.compareTo(b) <= 0
BigInteger x = 5; BigInteger x = BigInteger.valueOf(5);
ledger and stdlib types used without an import explicit imports (import org.julclang.ledger.TxInfo;)
MyHash.of(bytes) for a @NewType new MyHash(bytes)
a @Param field read from a static method declare the field static
a for-each over a JulcMap, or head() entries loop over keys() or values()
ListsLib.any, all, filter, map, find the JulcList instance method
ListsLib.foldl, zip a loop with an accumulator; for zip, stop at the shorter list
var f = x -> ... pass the lambda at the call, or write a named method
implicit Data/byte[] coercion at a call Builtins.unBData, Builtins.bData and their kin
.hash() or .length() on byte[] Builtins.sha2_256, Builtins.lengthOfByteString
MyRecord.fromPlutusData(d) PlutusData.cast(d, MyRecord.class) on-chain
  • Script bytes do not change for a source javac accepts: the gate only reads the source. A source rewritten from the dialect can compile to different bytes where its meaning needs another call, such as a decode that moves. a.compareTo(b) > 0 compiles to the same script as the dialect’s a > b.
  • Diagnostics change for invalid Java that JuLC used to reject with its own code. For example, a non-exhaustive or dominated switch, a missing return, or an undefined name or label is now reported as JULC0085 with javac’s key.
  • REPL: javac types each expression. An int or long result is returned as a BigInteger. Integer arithmetic is still JuLC’s, which is unbounded on-chain.
  • Subset rules, with their codes: an entry point returns boolean (JULC0094). A field initializer that nothing lowers holds only a constant, and an initializer block is empty (JULC0095). A value reaches boolean or Boolean through a cast only from a boolean (JULC0098). A constructor holds no statement (JULC0099). A name JuLC reads by its spelling binds at every use to the type JuLC reads, not to a variable, a type parameter or another type, a variable does not take the name of a type of the compilation, a top-level type of the unnamed package takes no name of the ledger, of another type or of a package of the compilation, no class or record is named Value, new has no class body, and instanceof tests a variant of its operand’s sealed interface (JULC0100, retired at ADR-068 M6: javac binds each name to its declaration). A sealed interface with no permits clause holds its variants (JULC0092). A method does not take a name JuLC reads in place of its body, and a @NewType takes no instance call but its accessor and no field read (JULC0101).
  • Two fixes. instanceof on a qualified variant reads that variant, and a library’s unsupported statement or unknown method is a compile error, as in a root. The same rule covers a record component: a @NewType of byte[] names its component value, so rename record MyHash(byte[] hash) to record MyHash(byte[] value). See Compiler Limitations.
  • Value operations are key-based. ValuesLib.lovelaceOf and Value.lovelaceOf() look up the empty policy and token name, as assetOf does, and give 0 for a Value without them. ValuesLib.add, subtract and negate keep each (policy, token) once with its amounts summed, keep sorted inputs sorted, and keep an amount of 0 as an entry; an input holds no repeated key. geqMultiAsset, leq and eq compare over the keys of both Values, with a missing key as 0, and each key takes one lookup, so eq costs about what geqMultiAsset costs. The helpers adjustOuterForAdd, adjustInnerForAdd, extraOuterEntries, extraInnerEntries and checkPolicyGeq are gone; use add and geqMultiAsset.
  • PlutusData.cast views Data as a type on-chain. It is an unchecked cast, not a decoder: on the JVM it throws ClassCastException for a ConstrData.
  • CompileResult has a new component, javacProvenance(): the javac version, the platform and stub digests, and what the gate did in that compilation. Its constructors keep working, but a record pattern on CompileResult needs the new arity. Generated artifacts are unchanged, so plutus.json is the same across JDK patch releases.

Comparisons evaluate each operand once, left to right (#146, #295)

Section titled “Comparisons evaluate each operand once, left to right (#146, #295)”

a.compareTo(b) OP 0 lowered to the three-way compareTo result compared with zero, which evaluated a non-trivial receiver or argument more than once: a traced operand traced twice, and nested comparisons grew the script exponentially (#146). And a > b and a >= b evaluated the right operand first, so traces came in the wrong order and, when both operands could fail, the script reported a different failure than the Java code (#295).

  • a.compareTo(b) OP 0 and 0 OP a.compareTo(b), where 0 is the int literal zero and OP is <, <=, >, >=, == or !=, now compile to one integer comparison that evaluates a, then b, once each. Other uses of compareTo (> 0L, == -1, a parenthesized call, or the result stored in a variable) keep the previous lowering.
  • > and >= on int, long and BigInteger evaluate the left operand first, as Java does. When both operands are more than a variable or a literal, the left one is bound once first.
  • Script bytes change for validators and libraries that compare with compareTo(...) OP 0 (the stdlib does, so programs that keep unused stdlib methods change at NONE too) and for > or >= between two computed operands. Scripts that use the compareTo form get smaller and cheaper; the >/>= change can add a few bytes. A new hash means a new script address or policy ID. The two Blaster state-thread verification fixtures use the compareTo form; their locked artifacts and counterexample binding are refreshed with the same property outcomes.

JulcArray in a Data-encoded position is rejected (JULC0091, #298)

Section titled “JulcArray in a Data-encoded position is rejected (JULC0091, #298)”

A JulcArray is a native UPLC array, which has no Data encoding. A record or sealed-variant component, a type argument of Optional, Tuple2, Tuple3, JulcList, List, JulcMap or JulcArray, and a @Param or compileMethod input are Data-encoded, so an array in any of them compiled but failed on-chain where the Java code succeeds (#298). A JulcArray is now rejected with JULC0091 wherever a native array would be Data-encoded: where such a type is written, and where lowering encodes a value whose type is inferred, such as JulcList.of(xs.toArray()), JulcList.<JulcArray<BigInteger>>of(a), Optional.of(array), a map key or value, a diamond new Tuple2<>(array, …) or a lambda result of map. The diagnostic points at the value that would be encoded. Store a JulcList and build the array where it is used (xs.toArray() in a local). Arrays of Data-encodable elements, such as JulcArray<JulcList<BigInteger>> in a local, stay supported. A datum or redeemer type that holds an array, already rejected by strict boundary validation, now reports JULC0091.

Diamond tuples encode their components (#299)

Section titled “Diamond tuples encode their components (#299)”

new Tuple2<>(a, b) and new Tuple3<>(a, b, c) resolved to tuples with Data components, so a BigInteger, byte[], boolean or String component was put into the constructor unencoded and the script failed on-chain (MkCons: element type … does not match list element type Data) where the Java code returns (#299). This happened with and without a declared target type (Tuple2<BigInteger, BigInteger> t = new Tuple2<>(x, y), var t = …, a return, an argument).

  • A diamond’s component types are now taken from a declared local, return, assignment or method-parameter target, else from the arguments, and each component is encoded by its type, exactly as the explicit new Tuple2<BigInteger, BigInteger>(x, y) does. var t = new Tuple2<>(x, y) reads its components with those types. A switch expression used as a component keeps the type its arms agree on.
  • A raw tuple (new Tuple2(a, b)) or a diamond whose destination is raw (Tuple2 t = (new Tuple2<>(…)), a raw loop variable, a raw parameter or return type) keeps working when its components are already Data (Builtins.iData(...), a record, a sealed value, an Optional), as MathLib.divMod uses it; any other component is rejected with JULC0012: write the type arguments. An explicit new Tuple2<BigInteger, BigInteger>(…) keeps its types wherever it is assigned.
  • A value whose type JuLC cannot determine (a switch whose arms have different types) is rejected with JULC0012 where it would be Data-encoded or be a diamond’s component, rather than encoded as Data.
  • Script bytes change for programs with such a diamond, which failed on-chain before, and for programs that call a method on a switch expression whose arms all have one type, such as (switch (s) { case A a -> a.n(); case B b -> b.n(); }).equals(x): the result now has the arms’ type, so the call is the integer one and the comparison evaluates correctly, where it used the Data representation before.

JuLC collections compare byte[] by content on the JVM

Section titled “JuLC collections compare byte[] by content on the JVM”

On-chain, JulcList, JulcMap and JulcArray compare elements and keys by Data equality, so an equal byte[] is found. Off-chain, JulcArrayList, JulcAssocMap and JulcArrayImpl compared byte[] by identity, so JulcList<byte[]>.contains(p) or JulcMap<byte[], V>.get(k) was false/null for a distinct but equal array, and the JVM tests did not test the validator. They now compare byte[] elements, keys and values by content in contains, get, lookup, getOrDefault, containsKey, delete, equals and hashCode; nested JuLC collections compare deeply.

  • Off-chain behaviour change: a JVM test that relied on identity matching now gets the on-chain result. With duplicate equal keys the most recently inserted entry wins, as on-chain.
  • Arrays are not copied: mutating a byte[] after adding it changes the collection’s lookups, equality and hash.
  • Scripts are unchanged.

Integer literals have Java’s value (#270)

Section titled “Integer literals have Java’s value (#270)”

Integer literals were decoded by hand, not as the JLS defines them (§3.10.1):

  • A hexadecimal, octal or binary int literal with its top bit set was read as unsigned, so 0xFFFFFFFF compiled to 4294967295 where Java has -1, and 0x80000000 to 2147483648 where Java has -2147483648.
  • An octal long literal was read as decimal: 0777L compiled to 777 where Java has 511.
  • Underscores (1_000), non-decimal long literals (0xFFL) and binary literals with underscores were rejected with a NumberFormatException message.
  • A byte[] element out of the byte range compiled: new byte[]{0x100} gave a zero byte, where javac rejects it, and new byte[]{-1}, which javac accepts, was rejected.

Each literal now has the value javac gives it. A literal javac rejects (too large for its type, an octal digit 8 or 9, or a byte[] element outside -128 to 127) is rejected with JULC0070.

  • Script bytes change for validators and libraries with a hexadecimal, octal or binary int literal whose top bit is set, or an octal long literal. A new hash means a new script address or policy ID. Write 0xFFFFFFFFL or a BigInteger where the unsigned value was meant.

Unicode escapes are read as Java reads them (#268)

Section titled “Unicode escapes are read as Java reads them (#268)”

javac translates Unicode escapes (a backslash, u and four hex digits, such as \u0061) before it reads anything else. So an escape in a comment can be a line break or the end of the comment, and \u0061 is the name a. JuLC’s parsers left escapes untranslated, so a source with such an escape could compile to a script that computes something other than the Java code. Every JuLC parser now reads source through JavaSourceParser, which translates escapes first: the compiler, library sources, the CLI, the linter, julc-tools and the verification resolvers.

  • Script bytes change only for sources with a Unicode escape outside a string literal, and for a literal with several u (\uuu0041), which is now accepted as javac accepts it.
  • Newly rejected, as javac rejects them:
    • a malformed Unicode escape anywhere, comments included: \u00G1, a lone \u, or an escape cut off by the end of the file;
    • a backslash outside a literal or comment, such as the name \u005cu0061;
    • an illegal escape sequence written with a Unicode backslash, such as \u005cq, which the parser now reports.
  • Rejected although javac accepts them, because javac’s reading differs from the JLS or cannot be kept. Each applies anywhere in the source:
    • an escape whose digits are not ASCII hex digits;
    • a backslash written as \u005c, after an odd run of such escapes, followed by two or more raw backslashes and then u;
    • an unpaired surrogate.
  • Positions in diagnostics, source maps and debug metadata refer to the source as written. This covers node and comment ranges, parse-error locations and lexical-error messages. A range that ends on an escape ends on the escape’s last character.
  • Pre-filters: before parsing, the Gradle plugin, the CLI and the testkit look for an annotation name in the text. They now also look in the text with its Unicode escapes translated, without validating them, so an escaped annotation name is no longer skipped. A source that names no JuLC annotation is still skipped, so off-chain code that javac compiles but JuLC’s stricter reading rejects does not fail the build. A source that only mentions one (in a Javadoc, an import or a link) and cannot be read strictly is read again leniently, and skipped if it declares none. It still fails with its diagnostic if it declares one, or if javac could read it differently from the lenient reading.

String literals are decoded as Java decodes them (#256)

Section titled “String literals are decoded as Java decodes them (#256)”

A string literal compiled to its source text, escapes included, so "a\nb" held a backslash and an n on chain where Java holds a line break. Literals now compile to the string javac gives them: escape sequences (\b \s \t \n \f \r \" \' \\ and octal escapes) and Unicode escapes (\u00e9) are decoded. The same applies to the argument of new BigInteger("...").

  • Script bytes change for validators and libraries with a string literal that contains a backslash, for example a trace message with \n or a token name written as caf\u00e9. A new hash means a new script address or policy ID. Keep the previously compiled script to spend UTxOs locked at the old address. Literals without a backslash are unchanged.
  • Newly rejected, where the literal used to compile to its raw text:
    • literals javac rejects: a Unicode escape that produces a quote or a line terminator (\u0022, \u000a), and a backslash written as \u005c that starts no escape sequence (\u005cq, \u005cu0041, or a \u005c that ends the literal);
    • literals javac accepts that JuLC cannot keep or cannot read as javac does: an unpaired surrogate such as \uD800, because a UPLC string is Unicode text and the script’s FLAT encoding would carry ? in its place; and a backslash written as \u005c followed by two or more raw backslashes and then u, such as \u005c\\\u0030. javac counts the escaped backslash toward the parity of the raw backslashes after it and the JLS does not, so they disagree on whether that u starts a Unicode escape.
  • Still rejected, as before, although javac accepts them: \u005c before a raw ", and a Unicode escape whose digits are not ASCII hex digits. A Unicode escape with more than one u (\uuu0041) is now accepted (#268, above).

Coded diagnostics for rejected loop and statement forms (#257)

Section titled “Coded diagnostics for rejected loop and statement forms (#257)”

Seven forms outside the on-chain subset were already rejected, but without a diagnostic code, and two of the messages named the wrong problem. Each now has a code, the location of the construct and a remedy:

Construct Code Message
continue JULC0060 continue is not supported on-chain
return inside while JULC0003 'return' is not supported inside while loop body (located at the return)
reassignment outside a loop JULC0061 Reassigning '<name>' is not supported outside a loop
JulcMap.of(...) in contract code JULC0062 JulcMap.of is off-chain only and has no on-chain implementation
break in a loop that updates no earlier variable JULC0063 break is not supported in a loop that updates no variable declared before the loop
a nested loop in a loop with break that updates one earlier variable JULC0064 A nested while loop is not supported in a loop that contains break and updates one variable declared before the loop
a loop with break whose only update is inside a switch statement, an expression or a lambda JULC0065 Updating '<name>' inside a switch statement is not supported in this loop (located at the update)
a labelled statement JULC0066 Labels are not supported on-chain: 'outer:'

JulcMap.of used to report Undefined variable: JulcMap, and the break case break statement outside of a loop, although the break is inside one.

  • Newly rejected: a nested loop with break that updates nothing (#273). A for-each or while whose body has a break but updates no variable declared before it, nested inside a loop that updates one, used to be accepted with its break ignored, so the inner loop ran to its end and could fail where Java returns. It is now rejected with JULC0063, as the same loop is on its own. The rejection applies whether or not the ignored break changed the result, so a program that happened to work is rejected too, for example an inner for (var y : xs) { if (y.equals(x)) { break; } }. It applies also to such a loop inside a lambda inside a loop that updates a variable. To keep the early exit, record it in a variable declared before the inner loop (boolean stopped = false; and stopped = true; break;).
  • Newly rejected: a break or continue that names a label (#201). Labelled statements were already rejected, but a break that named a label, even one that no statement carries, was accepted and compiled as a plain break of the innermost loop. javac rejects such source, so a Gradle build stopped, but tools that compile source text without javac (the testkit’s compileMethod, the playground) silently gave it another meaning: break outer; in a nested loop left only the inner loop. A labelled statement, a break that names a label and a continue that names one now report JULC0066 (Labels are not supported on-chain: 'break outer'); the labelled statement used to report Unsupported statement: LabeledStmt, without a code. To leave an outer loop, set a variable declared before the loops where the inner loop breaks, and skip the rest of the outer loop while it is set.
  • Otherwise no program changes outcome. Every other program is rejected or accepted as before, and script bytes of accepted programs are unchanged. continue and labels inside a loop are reported when the compiler lowers that loop, and labels outside any loop when it lowers the statement, so code JuLC never compiles, such as a nested off-chain helper class, still compiles. The exception is a labelled break outside any loop: subset validation rejects it in every class, as it did before without a code.
  • Tools that match message text see new text for every form except return inside while. Match the code instead. See the troubleshooting guide for each code’s fix.

Loops with break continue after an if (GHSA-p9v9-f3g2-cqv9)

Section titled “Loops with break continue after an if (GHSA-p9v9-f3g2-cqv9)”

In a loop body that contains break, a path that did not break could leave the loop, or skip the statements after its if. The script then computed something other than the Java code its tests run. In a loop that scans for a forbidden item behind an outer check, for example

for (var output : outputs) {
if (!isScript(output)) {
if (hasTokens(output)) { clean = false; break; }
}
}

the script stopped at the first output that passed the outer check without being forbidden, never examined the rest, and accepted. The same lowering made some while loops never terminate (#254) and some for-each loops return a wrong value (#255). A path that does not break now continues with the statements after the if, then with the next iteration, as in Java.

  • Recompile and redeploy validators and libraries with a loop that contains break inside a nested if, or an if with one breaking branch followed by more statements. Their scripts change hash; a new hash means a new script address or policy ID, and funds at the old address stay governed by the old script.
  • if (c) { ...; break; } without else, the common search loop, keeps its bytes.
  • A local that shadows a field or @Param accumulator, declared in a loop body or in one of its if branches, no longer replaces the accumulator after its declaration, in loops with or without break. Java scopes such a local to its block; the script used the local’s value as the accumulator’s from then on. Only loops with such a local change bytes.
  • A local declared in an if branch of a loop body no longer changes how a field or @Param of the same name is read after that if (#209). The script used the local’s record type for the field, so it read the wrong component, or failed at run time. Each branch now has its own scope, as the method-level if already had.

On-chain JulcMap.keys() and values() keep map order

Section titled “On-chain JulcMap.keys() and values() keep map order”

On chain, keys() and values() returned the entries in reverse order, while off chain JulcAssocMap returns them in map order. A test run off chain could therefore pass while the deployed script read a different first key. Both now return map order on chain too.

  • Script bytes change for validators that call keys() or values(), directly or through MapLib.keys/MapLib.values. A new hash means a new script address or policy ID. Keep the previously compiled script to spend UTxOs locked at the old address.
  • Builds that keep unused library methods also change when they import MapLib: optimization level NONE, and any level with source maps enabled. Optimized builds without source maps are unchanged unless they use keys()/values().
  • Results change only for logic that depends on position, such as keys().head() or comparing against an ordered list. Membership checks, all/any and totals give the same answer either way.

Plutus Data byte decoding is as strict as plutus decodeData (#237)

Section titled “Plutus Data byte decoding is as strict as plutus decodeData (#237)”

PlutusDataCborDecoder now accepts exactly the CBOR that plutus decodeData accepts. JuLC used to accept Data that the ledger rejects, so a FLAT program, inline datum or redeemer could decode in JuLC and fail on chain.

  • decode() rejects trailing bytes. It requires exactly one Data item, as the ledger decodes inline datums. The new decodeFirst() decodes one item and ignores what follows, as plutus reads FLAT data constants (FlatViaSerialise / deserialiseOrFail); UplcFlatDecoder uses it.
  • Newly rejected by decode() and decodeFirst():
    • byte strings or byte-string chunks over 64 bytes;
    • tags other than bignums (c2/c3 headers only) and constructors (102, 121–127, 1280–1400);
    • nested tags, and tags that don’t wrap a byte string (bignum) or an array (constructor);
    • indefinite integers and tags;
    • text strings and simple values, also inside lists and maps.
  • Newly rejected by fromDataItem(), which sees an already-decoded cbor-java tree: unrecognized and nested tags, and simple values inside lists (previously dropped silently).
  • Untrusted headers don’t allocate. Lengths that exceed the remaining input are rejected before any allocation, so a short malformed input raises CborDecodingException rather than OutOfMemoryError.
  • julc-tools. The cbor Data input of julc-tools is strict in the same way.

Map order and duplicate keys are still preserved. Encoding is unchanged.

NewConstitution carries the Constitution wrapper (#223)

Section titled “NewConstitution carries the Constitution wrapper (#223)”

GovernanceAction.NewConstitution now has the Plutus Data layout of plutus-ledger-api V3, Constr 5 [Maybe GovernanceActionId, Constitution] with Constitution = Constr 0 [Maybe ScriptHash]. JuLC encoded and read the second field as a bare Maybe ScriptHash, without the Constr 0 that the ledger builds (transConstitution in cardano-ledger Conway/TxInfo.hs). A compiled V3 script that read a NewConstitution proposal from a real script context therefore read the wrong field: constitution() gave the Constitution value where the script expected the optional hash.

The ledger API has a new record Constitution(Optional<ScriptHash> script), and the second component of NewConstitution changes from Optional<ScriptHash> constitution to Constitution constitution. Read the guardrails script hash with nc.constitution().script().

Contracts that read constitution() must be updated and recompiled. Their script bytes and hashes change. Contracts that take a GovernanceAction or ProposalProcedure as a typed parameter or datum also get new bytes and a new hash, even if they only match the NewConstitution case, because the typed-boundary check now validates the Constitution wrapper. Before, that check rejected the ledger’s NewConstitution payload and accepted the bare Maybe ScriptHash, which no ledger produces. It now does the reverse. Contracts that read proposals from the ScriptContext and only match the case compile to the same bytes as before. Off-chain code that constructs NewConstitution must pass a Constitution, and the script contexts the cardano-client-lib evaluator builds now contain the wrapper. The other six governance actions are unchanged; tests now compare each of them with hex written by hand from Haskell’s ToData.

The pinned Lean model for formal verification (CardanoLedgerApiBlaster 5dab3c43) still omits the wrapper, so its strict decoder returns none for every ledger NewConstitution payload. Formal verification now decodes proposal actions through a reviewed adapter, adapter.new-constitution.ledger-wrapper, which removes the wrapper before the pinned decoder and rejects the bare layout. Properties about NewConstitution proposals, including whenNewConstitution’s script, therefore have the ledger’s meaning. The adapter goes once the pin carries the wrapper.

Nested types shadow ledger types of the same name

Section titled “Nested types shadow ledger types of the same name”

A record or sealed interface declared inside a validator or library class now shadows a bundled ledger type with the same simple name within that class, as javac binds it (JLS 6.4.1). Before, the implicit org.julclang.ledger.* import won: a nested record Committee (or, with #223, record Constitution) resolved to the ledger type without a diagnostic, so a typed parameter or datum accepted the ledger schema instead of the declared one. Such contracts now get the schema they declare and a new hash. A type nested in another top-level class (Helper.Committee) does not capture the name, and a qualified name such as Inner.Constitution resolves to the type it names, or is reported as unknown; it no longer falls back to a ledger type with the same simple name. Contracts without such a name collision compile to the same bytes.

instanceof pattern variables may not reuse a field name (JULC0059, #207)

Section titled “instanceof pattern variables may not reuse a field name (JULC0059, #207)”

JuLC binds an instanceof pattern variable only when the pattern is the whole condition of an if statement outside a loop (#204). In every other position (a loop body, an && condition, a negated guard such as if (!(x instanceof T v)) return ...;, a ternary, a lambda, a boolean return) the variable is not bound. When a field of the class, including a @Param field, has the same name, those positions silently read or updated the field. For example, with a field q holding 40, if (s instanceof Sq q && q.s() > 1) { return q.s(); } returned 40 where Java returns 3. This behaviour dates back to the first preview.

The compiler now rejects a pattern variable that reuses the name of a field of an enclosing class (JULC0059) in every position, including the one where the variable is bound correctly. Rename the variable. switch case patterns (case Sq q ->) bind their variables in every position and are not affected. This is validation only: every program that still compiles produces the same script bytes and hashes.

Known limitation until #204, fixed in 0.1.0-pre21: a pattern variable with any name that is used outside that one position fails to compile, usually with Undefined variable. Use a switch on the sealed type, or the plain if (x instanceof T v) { ... } form outside a loop.

A new Best Practices page, Value-Oriented Contract Code, shows how to compute values in initializers, switch expressions, helper methods and list operations instead of updating variables across branches, and how to test the compiled validator. Every example is compiled and evaluated on the VM by tests in julc-examples, and a test fails if the page and the tested code drift apart.

The page records current list-operation behaviour that differs from Java:

  • compiled any and all evaluate the predicate for every element, so a predicate that fails on a later element fails the script where Java would already have returned;
  • list.find(...) returns an optional value in compiled code although its Java signature returns the element;
  • the static ListsLib.any, all, filter, map, find, foldl and zip forms compile only from source text, because ListsLib does not declare them in Java.

No compiler behaviour changes in this entry.

A source name can never resolve to a compiler-generated binder (ADR-060)

Section titled “A source name can never resolve to a compiler-generated binder (ADR-060)”

The compiler generates variables around your code for switch dispatch, loops, the validator wrapper, @Param decoding and the list and map builders. Several of those names were legal Java identifiers, so a source variable with the same name silently resolved to the compiler’s variable instead:

  • BigInteger __match_tag = ...; read inside a switch arm gave the constructor tag;
  • a @Param named datum__ compared the spent datum with itself, so any parameter value was accepted;
  • a variable named xs__, __acc_tuple or loop__forEach__0 read inside a loop saw the loop’s remaining list, accumulator tuple or recursive function;
  • a @Param named redeemer__, scriptContextData, ctxFields__ or tag__, or a pair of @Params cfg__raw and cfg, read the wrapper’s value.

Every generated name now begins with #, which no Java identifier can contain, and switch-dispatch names are also chosen away from every name a branch uses (ADR-060). The same change fixes adjacent silent miscompiles:

  • Compound assignment in loops dropped the operator: count += 1 over three items returned 1 and while (k < 3) { k += 1; } never terminated. +=, -=, *=, /= and %= on integers, and += on strings, now mean x = x op y. &=, |=, ^= and the shift operators are rejected (JULC0052), because lowering &= as && would skip a check Java always evaluates.
  • Overloaded methods: the last declaration ran for every call, so check(BigInteger) next to check(long) used the wrong body. Overloads are rejected (JULC0054) unless they compile to identical code, like the stdlib’s two integerToByteString forms.
  • Declarations with several variables, BigInteger a = x, b = y;, bound only the first, so a later b could read a field b. They are rejected (JULC0053); fields may still declare several variables.
  • Methods now have their own namespace, as in Java: a local, parameter, field or @Param may share a method’s name (BigInteger fee = fee(a); return fee(fee); failed at run time, and a @Param limit next to a method limit(...) gave the wrong decision). x.name() or x.name on a value whose type is not known used to call whatever was named name; it is now rejected (JULC0055). A static field initializer that calls a method of its class now gets an explicit error (JULC0057).
  • Fields updated in loops: a loop assignment to a static field or @Param rebinds the name only inside that method, so another method reading the field saw the original value (a helper returned 0 after count += 1 three times), and every call of the updating method started again from the initial value (a helper called twice returned 6 where Java returns 9). Such an update is now rejected (JULC0056) unless it is in an entry method (a validator entrypoint, a multi-validator handler or the compileMethod target) that no method calls, outside any lambda, and no other method reads the field. Updating a field in a helper or a library method no longer compiles; copy the field into a local accumulator. A loop-body local that shadows a field and is reassigned was threaded out of the loop as if it were the field; it is now a local. So is a for-each variable that shadows a field: reassigning it updated the field, so the field read 1 after the loop where Java reads 10.
  • Reassignment in a loop without an accumulator: a for-each loop that updates no variable declared before it cannot reassign its loop variable or a body local. This was already rejected, with “Unsupported expression: AssignExpr”; it now reports JULC0058 and suggests declaring a new local.

Migration. Programs that use none of these shapes keep byte-identical scripts and hashes at every optimization level; this was checked on 1,432 in-repo corpus rows (all levels, with and without source maps, including @Param and multi-validator programs) and the 344 external example artifacts. A recompiled script that used an affected shape changes its bytes, hash and budget, and its behaviour now matches Java: review it and redeploy if the old behaviour mattered. Deployed scripts never change. Code that is now rejected must be rewritten as the diagnostic describes. PIR and UPLC text output, such as the .uplc file from julc build and the playground pipeline view, now shows # names; this is cosmetic. Code that drives PirGenerator directly must register a method with SymbolTable.declareMethod: a method registered as a variable with SymbolTable.define is no longer callable. Diagnostic codes JULC0044–JULC0051 are reserved for the generic backend work.

Builder binders no longer capture user variables (#186)

Section titled “Builder binders no longer capture user variables (#186)”

A variable referenced inside a lambda or argument could silently resolve to an internal variable of the list, map or loop code the compiler generated around it. For example, outer.any(x -> inner.any(y -> y.equals(x))) compared each inner element with itself and returned true whenever inner was non-empty, so a validator could accept a transaction it should reject. Affected names were the builders’ internal binders: x, acc, lst, go and h for any, all, find and foldl; x_map, acc_map, x_flt and acc_flt for map and filter; the *_get, *_c, go_*, ps_*, xs_*, *__ao and *__f binders of get, contains, reverse, concat, take, drop, size, keys, values, map lookups, ListsLib.contains, MapLib.member/lookup/delete and Value.assetOf; and the statement binders _if, _forEach, _while, _nested, __t and _u. Instance and static ListsLib forms were both affected.

Each generated binder is now renamed only when a caller term actually refers to that name, so evaluation order is unchanged. Scripts without such a reference keep byte-identical output at every optimization level. Recompiling an affected script changes its bytes, hash and budget; review it and redeploy if its behaviour mattered. Deployed scripts never change. The generated names #186 did not reach, such as the loop and switch binders, are covered by ADR-060 below.

Release regression gates and profile freeze (#121)

Section titled “Release regression gates and profile freeze (#121)”

The pre17 hash-stability policy freezes existing optimization profiles, with explicit, reviewed exceptions for correctness fixes. It distinguishes script-hash changes from network execution-cost changes.

Developer-node gates now support an explicitly configured native Haskell CLI/socket as well as an existing DevKit container. New Value/Array and G1/G2 MSM regressions pin script hashes, sizes and execution budgets and check confirmed node spends. Normal builds run only the offline regressions; node tests remain opt-in. This test/documentation change does not alter compiler output or deployed scripts. The documentation build dependencies are also updated to resolve known advisories.

Decode boolean and String switch fields (#166)

Section titled “Decode boolean and String switch fields (#166)”

Switch case-pattern access such as case Sum s -> s.enabled() ? ONE : ZERO now decodes a boolean record field to native Bool. Previously the cached field remained raw Data and evaluation failed. String fields had the same missing decode. DataMatch field extraction now reuses the shared decoder used by other field-access paths rather than maintaining a separate incomplete type table (ADR-051).

This is separate from the loop/switch validation fixes. Constructor encodings, branch selection, field order and #162’s rejection of case-pattern reassignment are unchanged. Only the selected arm’s bound fields are decoded, strictly before its body; malformed Bool/String fields can now fail there even when unused. The existing decoder’s permissive Bool tag handling is unchanged; this is not a new strict Data-validation boundary.

Recompiling affected switches changes script bytes, hashes and budgets at all optimization levels, including NONE and BASELINE. Recompile and reassess affected scripts before deployment. Existing deployed scripts and ledger encodings do not change; switches without these field types retain their existing decoding.

Preserve loop state across enclosing branches (#161)

Section titled “Preserve loop state across enclosing branches (#161)”

A loop inside an if at method level or inside a switch-expression arm now preserves its accumulator updates for statements following the branch. Previously total = 0; if (condition) { for (...) { total = total.add(x); } } return total; could silently return 0. The fix reuses existing continuation lowering with a shared join lambda for loop-containing branches, including for while loops, nested branches, multiple accumulators and break. Conditions and branches keep their evaluation order; early return/yield still short-circuit. Continuation-bearing branches also rename local and instanceof pattern bindings internally to protect join arguments when a local shadows a class field updated by the other branch, and to prevent capture in the existing inline return/yield lowering. Diagnostics display the original source names.

The validation follow-up also accepts this pattern when the switch expression is inside an outer loop body. Previously the outer-loop guard conservatively rejected arm-local guarded-loop updates. It now validates the selector and leaves arm bodies to their ownership guard and nested loops’ own checks. Switch arms still cannot update enclosing variables, and conditional updates to actual loop-body locals remain unsupported. This validation-only change adds no lowering or encoding change for previously accepted programs.

Recompiled sources with loop-containing branches or affected name captures may change script bytes, hashes, size and execution budgets at all optimization levels, including NONE and BASELINE. The following code is bound once outside the branches: sequential guarded loops grow linearly instead of exponentially duplicating their tails. Join calls add execution overhead; reassess budgets as well as size. Recompile and reassess affected scripts before deployment; existing deployed scripts do not change. Public APIs, ledger encoding and the restrictions below remain unchanged.

This was a missed case in the older discarded-result path: #79 added continuations for returns and #137 extended them to yields. #157 explicitly left this case open.

Reject lost conditional loop-local updates (#155)

Section titled “Reject lost conditional loop-local updates (#155)”

The compiler now rejects assignments inside an if/else branch to a variable declared in the loop body outside that branch. Previously the update could be silently lost. This applies to for-each and while loops at every optimization level, including nested and break-aware forms. The diagnostic identifies the variable and source location, and suggests a conditional initializer, moving the declaration before the loop (resetting it each iteration if necessary), or declaring it inside the branch when its value is only needed there.

Switch-expression arms also reject updates to enclosing variables, including updates made by nested loops to either body locals or outer accumulators, with or without an enclosing if. Declare the accumulator inside the arm and yield its result instead. This conservative rule also rejects previously correct code that updated an enclosing variable but consumed the update only via yield inside the arm; move the accumulator declaration into the arm to preserve that behavior.

Reassignment of a switch case-pattern binding is also rejected (#162), even if the arm only yields the record itself. Previously field projections could read the original record after reassignment. Copy the binding to a fresh arm-local accumulator instead. Supported instanceof binding reassignment is unchanged.

The separate enclosing-if/loop miscompile is fixed by #161, described above.

This is a conservative restriction, including constant conditions and dead updates. This validation alone preserves accepted programs’ generated bytes; the separate #161 lowering fix may change them. Existing deployed scripts are unchanged. See conditional loop state for supported patterns.

Independent compiler and evaluation costs (#153)

Section titled “Independent compiler and evaluation costs (#153)”

pv11-costed now needs no compiler cost profile. Its list-to-array rule uses structural eligibility; its transformations and the default pv11-safe level are unchanged. Omitting an optional profile preserves generated script bytes, hashes and source maps.

The immutable evaluation snapshot is now named plutus-v3-pv11-costs-v1, with neutral Java constants OptimizationCostProfiles.PLUTUS_V3_PV11_COSTS_V1 (and _ID/_PARAMETER_HASH). The old ID remains accepted and the old constants are deprecated aliases to the same snapshot. The parameters and hash are unchanged. See the profile catalog for the exact upstream mapping.

Optional compiler profile settings remain accepted and validated for compatibility, but no longer appear as dependencies in compilation reports. Reports now also carry the compiler build version; target, optimization level and applied rules remain available. Benchmark reports independently retain the model actually used for evaluation. Runtime callers continue supplying cost parameters through the VM API or ProtocolParamsSupplier; no named profile is required there.

Typed BLS12-381 values and multi-scalar multiplication (ADR-047)

Section titled “Typed BLS12-381 values and multi-scalar multiplication (ADR-047)”

BLS12-381 values now have their own types: JulcG1 and JulcG2 for points, JulcMlResult for a Miller-loop result (all in org.julclang.core.types). Every Builtins.bls12_381_* method and every BlsLib method now takes and returns these types wherever it took or returned a point or a Miller-loop result as byte[]; only g1Compress/g2Compress produce bytes and only g1Uncompress/g2Uncompress consume them (messages, domain separation tags and scalars keep their byte[]/BigInteger types). A compressed byte string where a point is required, a G2 point where a G1 point is required, a point compared with == or placed in a datum, redeemer, record or list is rejected at compile time (JULC0041); a point at a validator or compileMethod boundary is JULC0042. Compress at the boundary and uncompress on the other side.

Multi-scalar multiplication is now callable from source on the PV11 target: BlsLib.g1MultiScalarMul(JulcScalars, JulcG1Points) and the G2 form take the native lists built by Builtins.scalars(...), Builtins.g1Points(...), Builtins.g2Points(...) (literal or runtime elements) or decoded from Data lists by Builtins.scalarsFromList(JulcList<BigInteger>), Builtins.g1PointsFromCompressed(JulcList<byte[]>) and the G2 form. Every scalar is validated first (512 bytes of two’s complement), the lists are zipped to the shorter one, and the empty sum is the identity. On the pinned PV11 costs one MSM call is smaller than the manual g1ScalarMul/g1Add chain from three points and cheaper in CPU from seven (about 322 million to enter plus 25 million per point against 77 million per point); nothing rewrites one into the other. An element of the wrong type in scalars(...), or a Data list of the wrong element type in a converter, is JULC0041.

Migration. A local, helper parameter or return type that named a BLS value as byte[] no longer compiles (JULC0041, at the initializer, the helper call or the return): declare it as JulcG1/JulcG2/JulcMlResult or use var. The same check covers the two branches of a conditional (b ? p : q with a G2 q where a G1 is required), declarations inside a loop body and assignments to a loop accumulator or a loop-body local; a native accumulator must be its loop’s only accumulator (a multi-accumulator loop packs its accumulators as Data). Two loop-body shapes that compiled with their update silently dropped are handled: an assignment inside a bare nested block now updates the accumulator, and an assignment in expression position or to an undeclared variable is rejected. Code that used var for BLS values compiles unchanged and keeps its bytes; the compressed encodings are still byte[]. The two bls12_381_*_multiScalarMul signatures changed from PlutusData to the typed lists (the old ones compiled but could not evaluate successfully). No program in the example corpus or the golden suites uses the BLS surface, so no existing script changes bytes or hash at any level.

Array literals and literal folding (ADR-046)

Section titled “Array literals and literal folding (ADR-046)”

JulcArray.of(a, b, ...) writes a PV11 array down. On-chain it is JulcList.of(a, b, ...).toArray(): the elements are Data-encoded as the declared element type requires (declare it: JulcArray<BigInteger> t = JulcArray.of(...)) and the list is converted with ListToArray, so get and length behave exactly as on an array converted from a list.

At pv11-safe (the default) and pv11-costed, an array whose elements are all literals (integers, byte strings, strings, booleans, nested list literals) becomes one UPLC array constant; length() on it folds to a constant and get(i) with a literal index folds to the element, decode included (JulcArray.of(1, 2, 3).get(1) is 2: 42 → 6 bytes, 1,238,594 → 16,100 CPU). A runtime index keeps the access over the embedded constant (a three-entry fee table indexed by a runtime tier: 57 → 46 bytes, 1,435,338 → 625,598 CPU on a valid tier and 809,740 CPU less on an invalid one, which fails exactly as before). The same folds apply to list.toArray() and JulcArray.fromList(list) over a JulcList.of literal. An index outside the array, literal or runtime, fails at IndexArray with the same text as before. Nothing changes at none/baseline; the optimization report records pv11.o10.array-literal-fold, and the rule can be switched off with CompilerOptions.disableOptimizationRule.

This change is additive for the example corpus and every golden suite: no program there contains an array constant or converts a list literal to an array, so those scripts keep their bytes and hashes at every level. A program of your own that already spells JulcList.of(...).toArray() or JulcArray.fromList(JulcList.of(...)) does change at pv11-safe (it gains the array constant). A native Value cannot be an array element (JULC0041, as for every Data-backed container). Spell a negative literal element as new BigInteger("-5"). var t = JulcArray.of(...) infers the element type from the elements, as javac does; elements of different types under var are rejected with JULC0012 (declare JulcArray<T>).

Native Value literals and literal folding (ADR-045)

Section titled “Native Value literals and literal folding (ADR-045)”

Builtins gains three native Value literal producers on the PV11 target: emptyValue() (a UPLC Value constant), singletonValue(policyId, tokenName, quantity) and lovelaceValue(quantity) (inserts into the empty Value, with insertCoin’s rules: a zero quantity yields the empty Value, a non-zero quantity needs keys of at most 32 bytes and a quantity in the signed 128-bit range). They replace the unValueData(mapData(mkNilPairData())) idiom for new code; the idiom keeps working and keeps its bytes. They are intrinsics rather than NativeValueLib methods so that programs which do not call them keep their bytes at every level.

At pv11-safe (the default) and pv11-costed, a call of insertCoin, lookupCoin, union, contains, scale, toData or fromData whose arguments are all literals (constants, or locals bound once to a literal) is folded at compile time into the Value, integer, boolean or Data it evaluates to, by the same code the VM runs. A requirement such as one NFT plus two ADA becomes one constant in the script (40 → 7 bytes and 883,863 → 16,100 CPU for a literal lookup); the runtime part of a check (fromData(minted), contains) stays. A literal call the builtin would reject (a 33-byte key, an overflow, a negative quantity under contains) is left as written and fails at runtime with the same text. No algebraic identity is applied and nothing changes at none/baseline. The fold only fires when the literal is not larger than the call it replaces as it stands in the script, so toData(Builtins.emptyValue()) stays a call and a literal local shared by several calls is never copied into them (the calls stay, the local keeps its one constant). The optimization report records pv11.o14.value-literal-fold, and the rule can be switched off with CompilerOptions.disableOptimizationRule.

This change is additive: no program compiled before it contains a Value literal, so existing scripts keep their bytes and hashes at every level. Spell a negative literal quantity as new BigInteger("-5") (BigInteger.valueOf(-5) compiles to a runtime subtraction).

Automatic sharing of repeated record field projections (ADR-044)

Section titled “Automatic sharing of repeated record field projections (ADR-044)”

PV11_SAFE (the default) and PV11_COSTED now share a repeated projection of the same record field of the same variable (txInfo.outputs() on a TxInfo local or parameter, b.amount() on a cast local, out.value() on a loop item) once per scope when that projection is already the first non-trivial evaluation of the scope, and share the record’s decoded fields list when two or more different fields of one variable are projected. The compiler binds the projection (or the fields list) as one strict let and reuses it at every later occurrence, including occurrences inside a loop body and inside compareTo, which evaluates its receiver twice on its own. A projection of a projection (b.inner().x() and b.inner().y()) shares the inner record first. The output for the motivating shape is byte-identical to writing BigInteger amount = b.amount(); yourself. The optimization report records pv11.o15.projection-sharing.

Nothing observable on-chain changes: the shared projection already ran first on every path, so results, traces, the failure point and the failure text are identical on Java, Truffle and Scalus for well-formed and malformed input, at every level. Budgets move, on failing paths too (a failing path that reaches only the leading site pays the binding, one that fails inside the shared unit pays a few machine steps less), so off-chain tests that pin a budget need refreshing. A path that reaches a later occurrence saves the whole projection (about 462,000 CPU for an integer field at the first position, 1,058,000 CPU for a raw field at the sixth, 279,000 CPU for the fields list); a path that reaches none, such as an untaken branch or an empty loop, pays at most one lambda, one application and one variable lookup (48,000 CPU) per shared binding. A projection is never hoisted above a trace, an error, a saturated call or a projection of another variable, and projections in exclusive branches of one conditional are left exactly as written. A validator that projects ctx.txInfo().outputs() twice drops from 429 to 380 bytes and from 11.6 million to 8.8 million CPU on the path that uses both.

Earlier safe-profile rules (Case on booleans, pairs and integers, list Case loops) already moved most pv11-safe hashes; this is the first whose trigger shape is in most validators since the safe profile became the default: any program that projects one field of one variable twice in leading position, or two fields of one variable, compiles to a different (smaller) script. Deployed scripts are unaffected; recompiling changes the script hash and therefore the script address. Tests or deployments that pin a hash need to be refreshed. NONE/BASELINE retain historical bytes.

One costed-only consequence: because the shared list projection is a variable, pv11-costed now also promotes b.items().get(0) beside b.items().get(1) to a PV11 array (ADR-043), with ADR-043’s IndexArray failure text for an out-of-range index on such sites.

Each PIR-to-PIR rule can be switched off on its own for review and measurement: new CompilerOptions().disableOptimizationRule("pv11.o15.projection-sharing") (also pv11.o8.value-sharing and pv11.o9.list-to-array); any other id fails with JULC0043. The optimization level remains the supported rollout control, and the Gradle plugin and CLI do not expose the switch.

List-to-array promotion at pv11-costed (ADR-043)

Section titled “List-to-array promotion at pv11-costed (ADR-043)”

PV11_COSTED (opt-in; julc { optimization = 'pv11-costed' }, no cost profile required) now converts a JulcList variable that its scope indexes at two or more get sites, or at a get site inside a loop body, to a PV11 array once (ListToArray) and rewrites those sites to IndexArray. Every other use of the list (for-each, size, head, passing it to a helper) is untouched, the array binding is placed at the innermost sub-term that contains every index site (so a path on which the binding is not placed, such as a branch whose sibling holds all the sites, pays nothing), and for two sites in one expression the output is byte-identical to writing list.toArray() by hand at that point. The optimization report records pv11.o9.list-to-array. PV11_SAFE (the default), BASELINE and NONE keep their bytes and hashes.

The recursive get costs about 620,000 CPU plus 683,000 CPU per index step and 60 FLAT bytes per site; the array form costs 49,000 + 24,838 CPU per element once plus 312,000 CPU per site. Two sites at indexes 0 and 1 save CPU for lists of up to 44 elements, sites at indexes 3 and 7 for up to 291, and loops multiply the saving: a WingRiders-shaped request loop with sixteen requests drops from 349.6 million to 81.9 million CPU. A path that converts but then indexes less than twice pays at most the conversion plus one binding (97,000 + 24,838·n CPU per list): an empty loop, or an untaken branch when both branches index. The compiler assumes a promoted list is indexed at least twice per evaluation; this is why the rule is confined to the costed profile.

Failure contract (costed profile only): a promoted get with an index outside 0..length-1 now fails at the IndexArray builtin instead of inside the recursive traversal. Both fail after the index is evaluated and before any other effect, so results, traces and the failure point are unchanged; only the off-chain text and the failing path’s budget (smaller) differ. Because the typed boundary does not range-check integers, a redeemer- or datum-supplied index reaches get unchecked and a validator compiled at pv11-costed itself reports IndexArray: index I out of bounds for array of size N (Scalus: … indexArray: index I out of bounds for array of length N) instead of HeadList: empty list (index equal to the length) or TailList: empty list (negative or larger). You see it wherever the costed artifact is evaluated: the Gradle plugin or annotation processor with julc.optimization=pv11-costed, julc build --optimization pv11-costed followed by julc eval, direct JulcCompiler use, and the MCP tools. The testkit’s JulcEval, MethodEvaluator and ValidatorTest compile at the default level and never show it. On-chain a failure is a failure. Tests that assert on that text under the costed profile need updating; nothing changes at the default level. MultiIndexArray remains illegal at PV11.

A JulcList variable is promoted only when the compiler can prove it holds a list on every path: a value decoded at the typed boundary, a list built by a list operation, a helper parameter that every call in the program passes such a list, or a helper result whose body returns one. A local bound to an unchecked cast such as (JulcList<T>) (Object) somePlutusData, every alias of it, a callback lambda’s list-typed parameter (which holds the raw element), and any helper parameter or result such a value can reach are never promoted, so a program that never indexes on some path keeps accepting on that path at the costed level. An earlier preview build trusted helper parameters by their declared type; review showed that a callback’s element passed into a helper could then turn acceptance into a ListToArray failure. That is fixed, and no released artifact was built at the costed level.

Automatic sharing of repeated native Value conversions (ADR-042)

Section titled “Automatic sharing of repeated native Value conversions (ADR-042)”

PV11_SAFE (the default) and PV11_COSTED now share a repeated native Value conversion of the same variable, NativeValueLib.fromData(x) or Builtins.unValueData(x), once per scope when that conversion is already the first non-trivial evaluation of the scope. The compiler binds it as one strict let and reuses the bound value at every later occurrence, including occurrences inside a loop body, which hoists a per-iteration conversion out of the loop. The output for the motivating shape is byte-identical to writing the JulcValue binding by hand. The optimization report records pv11.o8.value-sharing.

Nothing observable changes: the conversion that is shared already ran first on every path, so results, traces, the failure point and the failure text are identical on Java, Truffle and Scalus for valid, malformed and non-canonical input. A path that reaches a second occurrence saves one full conversion (about 513,000 CPU for even a one-token Value, more for larger Values); a path that reaches none, such as an untaken branch or an empty loop, pays at most one lambda, one application and one variable lookup (48,000 CPU). A conversion is never hoisted above a trace, an error, a saturated call or another partial conversion, and conversions in exclusive branches of one conditional are left exactly as written; binding JulcValue explicitly remains the recommended style and applies at every level.

Only safe-profile output of programs that convert one Data variable at least twice changes bytes and hash; no shipped example uses native Values, and ValuesLib is untouched. NONE/BASELINE retain historical bytes. ValueData sinking, adjacent conversion cancellation and Data-side (ValuesLib) sharing remain deferred (ADR-032 O8/O15).

Integer Case dispatch for sealed-interface switches (ADR-041)

Section titled “Integer Case dispatch for sealed-interface switches (ADR-041)”

PV11_SAFE (the default) and PV11_COSTED now dispatch every switch on a sealed interface with two or more constructors through one PV11 integer Case on the decoded constructor tag instead of an equalsInteger chain. Branch i runs for tag i; field decoding, branch bodies, traces and evaluation order are unchanged, and only the selected branch is evaluated. The dispatch cost is now flat instead of growing with the constructor’s position: in the ADR-041 fixtures a five-way switch selecting its last constructor saves about 710,000 CPU and 33 FLAT bytes, and a two-way switch saves 116,000 to 265,000 CPU and 12 bytes (8 bytes on the ADR-038 on-chain validator). Single-constructor switches and instanceof chains are untouched. The optimization report records pv11.o5.case-integer.

Failure contract: a constructor tag outside 0..n-1 now fails at Case selection instead of reaching the chain’s terminal error. Both fail at the same point with no branch effects and no traces; only the off-chain failure text and the failing path’s budget differ. The strict typed boundary already rejects invalid tags on datum, redeemer and nested typed fields before user logic runs, so validators observe no change. The change is observable where no boundary runs: JulcCompiler.compileMethod, and therefore the testkit’s JulcEval and MethodEvaluator, now report Case: tag T out of range for N branches (Scalus: Case index T out of bounds for N branches) for a sealed argument with an out-of-range constructor tag instead of Error term encountered; the same applies to direct-PIR consumers of compilePirToProgram and to sealed values a program casts from raw PlutusData without a typed boundary. Tests that assert on that failure text need updating. Both the Java and Truffle VMs now range-check integer Case scrutinees over the full integer domain before narrowing, so tags beyond the int range fail as the same machine error.

Recompiling an eligible validator with a safe profile changes its script bytes and hash. NONE/BASELINE retain historical bytes; deployed scripts and ledger Data encodings are unchanged. The decompiler recovers the new dispatch as the same DataMatch HIR node. ADR-041 also closes the O6 unit Case question as rejected: JuLC emits no ChooseUnit, and a census of shipped artifacts shows no typed-unit statement population worth a new PIR surface.

A yield inside an if/else branch of a switch-expression case block was silently discarded when statements followed the conditional: the block lowered as “evaluate the if, then run the rest”, so a guard such as if (cond) { yield false; } yield true; always produced true (#137). The frontend now applies the same fall-through continuation lowering that #79 introduced for early return, so a yield exits its owning switch expression and the trailing statements only run for branches that fall through. A yield inside a nested switch expression still belongs to that inner switch.

Two diagnostics accompany the fix: a case block whose paths do not all end in a yield is rejected instead of falling off the end, and a yield inside a for-each or while loop body is rejected like return already was.

This is frontend statement lowering, so recompiling a source that uses the affected shape changes its script bytes and hash under every profile, including NONE and BASELINE. Sources that do not use the shape keep their bytes. Deployed scripts and ledger Data encodings are unchanged. The shipped stdlib and examples were scanned and do not use the shape. The two Blaster controlled-mint verification fixtures do; their locked artifacts and counterexample binding are refreshed for the corrected lowering with the same property outcomes.

serialiseData compiled without a force wrapper

Section titled “serialiseData compiled without a force wrapper”

Builtins.serialiseData and ByteStringLib.serialiseData previously compiled to a forced SerialiseData builtin. SerialiseData is monomorphic and takes its Data argument directly, so the extra force made every generated program that reached the call fail at evaluation on the Java, Truffle and Scalus backends (#132). The compiler now emits the builtin without the type-instantiation force.

Recompiling a program that calls serialiseData changes its script bytes and hash under every profile; programs that do not call it keep their bytes. The CBOR serialization format, VM behavior and ledger Data encodings are unchanged, and already deployed scripts are not modified. Any execution path that reached the old forced builtin failed, so the new hash only replaces scripts that could not have succeeded on that path.

Two follow-ups guard against regression: an exhaustive comparison of all 102 DefaultFun force counts against the shared builtin metadata (PR #134), and a Java-source regression matrix for serialiseData under BASELINE and PV11_SAFE on Java and Scalus with exact CBOR and BLAKE2b-256 vectors (PR #135).

CBOR decoding now preserves Plutus Data map entry order and duplicate keys, including nested maps and Data constants read from serialized FLAT programs. Previously, the decoder could collapse {1:10,1:20} to {1:20} before evaluation. Encoding and compiler lowering are unchanged. Re-encoding affected decoded data now retains entries that older versions lost; stored scripts are not modified.

Incomplete map pairs, misplaced map breaks and impossible declared map lengths are rejected. This is a focused decoder correction, not a general strict-CBOR or resource-limits change. Converting an already deduplicated external cbor-java Map cannot recover its missing entries; use PlutusDataCborDecoder.decode when starting from bytes. See ADR-037 for design and validation scope.

PV11_SAFE (the default) and PV11_COSTED now destructure proven native pairs from strict constructor-boundary checks with a single PV11 Case. The compiler requires both tag/fields projections of the same once-bound UnConstrData result; it leaves field decoding and failure/trace order unchanged. Arbitrary pair values, aliases, map traversal and Data-encoded tuples are outside this rule. The optimization report records pv11.o4.case-pair.

Recompiling an eligible validator with a safe profile changes its script bytes and hash. NONE/BASELINE retain historical bytes; deployed scripts and ledger Data encodings are unchanged. The bounded rule has passed independent correctness review; JuLC remains experimental. compilePirToProgram also applies this rule in safe profiles, so eligible caller-supplied PIR can produce new bytes/hashes. ADR-038 extends the same rule to sealed-interface switch decomposition during UPLC lowering. This preserves the integer tag-dispatch chain and selected-field decoding, including errors in unused fields. The measured switch fixtures save 10 bytes per site compared with the previous safe output; NONE/BASELINE remain byte-identical. Direct PIR DataMatch callers also receive this safe-profile change. The switch extension passed its own independent correctness review in PR #129. The decompiler follow-up #130 recovers native pair and verified legacy constructor decomposition as explicit HIR DataMatch, preserving raw fields, ordered integer tag tests and the final fallback. Readable output uses decomposition and if/else dispatch; it does not invent Java record schemas. FLAT-erased bindings are recovered from de Bruijn indices. External exhaustive HIR visitors must handle the new DataMatch node; the compiler’s output bytes and costs are unaffected by this decompiler change.

JuLC now provides a stable construction API for exact-artifact formal verification. API version 1 uses canonical property schema 1 and supports typed composition over compiler-projected contract data, four standard Plutus purposes (spending, minting, rewarding, and certifying), transaction context, authorization, certificates, multi-asset values, governance data, and reviewed raw-data adapters.

julc verify dsl-init emits only schema 1. The unreleased E.2–E.4 milestone formats previously numbered 1 through 10 have been removed from public generation and replay rather than carried as compatibility aliases. Regenerate those experimental workspaces with the current CLI. Historical certificates remain hash-bound records of their original runs, but they are not accepted as current replay inputs. New semantic vocabulary requires a new schema rather than changing schema-1 meanings.

@RequiresSigner, @ControlledMint, and the complete @RequiresSigner + @PreservesValue + @Monotonic stateful profile now lower to the same canonical DSL IR used by explicit Java specifications. The former annotation-specific duplicate Lean security formulas have been removed. These annotations remain UPLC-neutral: they state properties and do not add checks to validator execution.

The stable API covers documented Java construction and canonical property semantics. It does not promise solver termination, complete CardanoLedgerApi coverage, general compiler correctness, or that a verified validator is safe under every unspecified property. Voting/proposing validator selection, parameter-derived authorities, arbitrary Lean in the DSL, and temporal verification are not included. The E.5 bounded temporal experiment did not meet its solver-calibration gate and was not promoted.

See the formal verification guide for annotation and DSL workflows, local/Docker backends, exact certificate scope, outcome classification, and CI guidance.

JuLC compilation now resolves one explicit, immutable compiler profile: plutus-v3-pv11-uplc-1.1.0. The profile covers the Plutus language, ledger protocol version, and UPLC version together. Existing compile entry points select this named profile by default; unknown profiles, future protocol versions, and a latest alias are rejected rather than interpreted as PV11.

CompileResult now has a public target() record component containing this provenance. Compatibility constructors preserve existing constructor call sites by assigning the documented PV11 target, but code that inspects the record shape, uses record patterns, or depends on generated record equality or string representation must account for the additional component. Compiler target plumbing and validation alone do not change generated UPLC, FLAT bytes, or script hashes.

Testkit operations that retain a CompileResult now pass its exact ledger target to the selected VM. With the Java VM, this means source-based validator and method evaluation uses explicit PV11 semantics and costs instead of the legacy language-only path, which defaults to PV10 when no protocol-aware cost model is configured. A caller may also provide an explicit evaluation target; it must match CompileResult.target() or evaluation fails before VM execution.

The Scalus adapter now implements JuLC’s explicit-target VM SPI. Scalus 1.1.0 has no certified target in JuLC, so ValidatorTest.evaluate(result, ...) with Scalus as the only provider throws UnsupportedOperationException at the backend-capability gate. This prevents a testkit rejection assertion from mistaking an unevaluated profile for a rejected script. For a Scalus compatibility cross-check, evaluate result.program() through the language-only overload. The Java VM supports both forms, although the raw Program form cannot carry compiler-target provenance. See ADR-033’s certification evidence.

The CLI, Gradle plugin, annotation processor and MCP tools accept and report the same stable profile ID. Supporting a later protocol version will add and verify a separate pinned profile; it will not silently change the PV11 default.

Scalus protocol-aware evaluation (ADR-033)

Section titled “Scalus protocol-aware evaluation (ADR-033)”

The Scalus adapter now has atomic per-language configurations, target-bound V1/V2/V3 VM construction, and one validated explicit-target pipeline. Public explicit-target calls remain fail-closed because six reason-coded upstream Scalus 1.1.0 divergences prevent V3/PV10 and V3/PV11 certification.

Cardano Client Lib continues to supply current protocol-parameter cost arrays for V1, V2, and V3. Configured Scalus language-only evaluation now passes all three arrays to MachineParams.fromCostModels with the matching language and protocol. Compared with main, this changes configured V1/V2 transaction evaluation from Scalus’s bundled mainnet defaults to the current live model. Scalus consumes the mapped live V1/V2 prices; its 1.1.0 V1/V2 adapters still reference-fill PV11-only builtin costs and ignore audited Constr/Case positions, so that compatibility behavior is not a complete ledger-parity claim. Pinned conformance vectors are test evidence only and are never substituted for runtime protocol parameters.

A non-null ExBudget is now enforced; exceeding it returns EvalResult.BudgetExhausted. Array and Value results now cross the Scalus bridge. Unconfigured language-only V3 retains Scalus 1.1.0’s PV11/E bundled default, which differs from Java/Truffle’s PV10 compatibility default. These VM changes do not modify compiled UPLC, FLAT bytes, or script hashes.

Typed validator boundaries now reject non-canonical Data before user code runs. Records and variants require exact constructor tags and arities; primitive, optional, list, map, nested, and productive recursive fields are checked eagerly. Explicit PlutusData roots remain raw.

Typed, non-record entrypoint arguments now reach validator code in their declared representation. In older compiler versions, a root declared as BigInteger, byte[], String, boolean, List, or Map could remain raw Data at runtime even though the PIR type said otherwise. Strict-boundary lowering fixes that compiler bug by decoding the root before invocation. Remove workarounds such as an explicit Builtins.unIData(redeemer), unBData, asList, or asMap when the entrypoint argument is already declared with the corresponding typed Java form. This change concerns transaction-time entrypoint arguments; deployer-applied @Param fields are a separate pipeline.

A concrete record that implements a sealed interface cannot currently be used as an independent typed datum/redeemer root or nested boundary field. Declare the sealed interface instead. JuLC now rejects the concrete form at its Java parameter because constructor lowering uses the variant’s sum tag while the record schema does not yet carry that nominal tag.

This is an intentional preview-language breaking change. Recompiling an affected validator changes its UPLC and script hash. There is no permissive mode: retain the old compiler to reproduce an old artifact. Before moving state to a new script address, decode and canonically re-encode existing datums so wrong-tag or trailing-field values accepted by a permissive-era script are not carried to the strict address.

Strict traversal has a real execution cost. In the activation measurements, a 250-element List<BigInteger> guard used approximately 502 million CPU units (about 2 million per element and about 5% of the 10-billion transaction ceiling), compared with approximately 0.9 million for the legacy no-op path. Measure production maximum-size inputs; use an explicitly raw PlutusData boundary with a reviewed manual check when full traversal is unsuitable.

Blueprint compiler identities include +boundary.strict-data-v1, and formal verification certificates record boundarySemantics: strict-data-v1. See the strict data boundary guide for the exact coverage, cost guidance, raw-data escape, and migration checklist.

Purpose-indexed multi-validator blueprints

Section titled “Purpose-indexed multi-validator blueprints”

An explicit @MultiValidator with supported SPEND, MINT, WITHDRAW, or CERTIFY entrypoints now publish one standard CIP-57 validator entry per purpose. The titles are purpose-qualified—for example Protocol.spend and Protocol.mint—while every entry retains byte-identical compiled code and the same Cardano script hash because they describe one deployed script.

Artifact consumers must migrate from the unsuffixed multi-validator title to the exact purpose-qualified entry. julc verify and julc verify init instead take the base Java title plus --purpose. Normal single-purpose titles and script bytes are unchanged. Every newly generated blueprint now records an explicit purpose on its datum, redeemer, and parameter arguments, so its JSON changes even for an ordinary single-purpose validator.

CERTIFY is emitted as CIP-57 publish, following Aiken’s mapping of the ledger certificate purpose; the JuLC source-level name remains CERTIFY. Manual dispatch remains fail-closed. Single-purpose and multi-purpose VOTE or PROPOSE validators now also fail strict blueprint generation: older previews emitted incomplete purpose-free metadata for these single-purpose validators, but the pinned CIP-57 vocabulary cannot name them truthfully. Use the blueprint opt-out to compile without metadata when needed. See the purpose-indexed blueprint guide for examples and limitations.

pv11-safe (the default) and pv11-costed now use PV11 Case List for eligible compiler-generated for-each loops. The compiler binds the raw head and tail together and keeps element decoding at its original point. Nested loops, records, accumulators, conditional break, and recursive methods retain their source behavior.

The existing NullList guard remains: it preserves failures for unchecked casts that carry a non-list value. Loops with an unconditional break and no tail use retain their prior projection form to avoid increasing script size. Map/native pair iteration, arbitrary while traversals and HOF builders are outside this rule’s scope.

none and baseline preserve their prior bytes, checked against fixtures from commit 8c9f1f63, including source-map compilation. This does not add a PV10 compiler target. Recompilation at pv11-safe can change script bytes and hashes; existing deployed scripts are unaffected. Use baseline when reproducing historical lowering, or retain the prior compiler version for exact reproduction of its pv11-safe artifacts.

The new PirTerm.ListMatch variant is an internal compiler IR extension; consumers with exhaustive switches over PIR must handle it. Java validator APIs and ledger Data encodings are unchanged. See ADR-034 and its measured evidence for scope, failure analysis, pinned budgets and hash migration. The on-chain validation adds confirmed PV11 spending transactions, direct Haskell/Java budget agreement, and malformed-input checks. This completes the bounded rule’s node evidence gate without enabling additional traversal families.

ADR-032 adds an explicit optimizer rollout boundary without adding another compiler target. The legal output target remains plutus-v3-pv11-uplc-1.1.0. After the initial opt-in review window and full semantic, benchmark, repository, and hosted-verification gates, pv11-safe is now the default and enables these reviewed rules:

  • JulcList.drop(...) lowers directly to PV11 DropList;
  • typed boolean conditionals lower to UPLC 1.1.0 Case Bool;
  • successful all-literal ExpModInteger calls fold at compile time while invalid literal calls retain their exact runtime failure.

The experimental native Value surface now uses a distinct JulcValue type. Conversion from and to ledger Data is explicit, and the compiler rejects native/Data mixing at assignments, equality, Data-backed containers/records, and external method or validator boundaries. These checks apply at every optimization level, including baseline. This type correction adds no UPLC cost by itself and does not automatically rewrite existing Data-encoded ledger Value operations.

The Scalus backend is pinned to the stable 1.1.0 release. Focused PV11 cross-checks now cover Case Bool false/true branch order and confirm that an unselected failing branch is not evaluated. Scalus remains a language-only compatibility backend in JuLC; protocol/cost provenance still belongs to the canonical target-aware evaluation path. Cross-backend budget tests therefore configure one explicit cost profile on both VMs rather than treating Scalus’s version-dependent built-in default as ledger evidence.

Measurements use the immutable plutus-v3-pv11-costs-v1 cost profile (parameter SHA-256 40ea9e0b7df77a7bd2cb7d4e4d9da040f8bee7ff0324a7cdb7e51702330e43a8). Java and Truffle produced identical results, failures, traces, and ledger budgets for these fixtures:

Fixture FLAT bytes CPU Memory
one-element drop path 162 → 109 3,886,301 → 2,311,844 17,931 → 10,864
three-condition Bool fixture 134 → 117 2,251,555 → 1,687,408 9,694 → 7,591
three literal ExpMod calls 42 → 6 3,406,498 → 16,100 3,407 → 200
aggregate validator-like accepted path 169 → 88 5,346,583 → 1,935,936 19,605 → 8,533

The aggregate fixture’s script hash changes from 3d1e9ac3561e68d3d0864705686adca6105ff5fc15f5a43e904de1f2 to 2f2ea7f79a5dd083ed51e573dc247267ae7cb978ecc615692479c594. These are exact fixture results rather than general percentage guarantees. Default recompilation now produces a new deployment artifact; it does not change an already deployed script. Select baseline explicitly when reproducing the earlier ADR-031 lowering and hash.

Raw JulcVm language-only evaluation overloads retain the deliberate PV10 compatibility default from ADR-030. Because default compiler output may now contain PV11-only Case Bool or DropList, evaluate a CompileResult through its result.target().ledgerTarget(). JuLC testkit and CLI evaluation propagate that target automatically; MCP test/evaluate and the playground do the same. The decompiler also recovers the PV11 Case Bool form as a Java conditional only when its untyped UPLC scrutinee is provably Boolean, leaving ambiguous SOP cases as switches.

Array promotion/folding, native Value algebra, BLS fusion, broader list traversal rewrites beyond #110, and general conversion sharing remain explicitly deferred (pair Case rewrites were later delivered by ADR-036/038, integer Case dispatch by ADR-041, unit Case sequencing was rejected by ADR-041, and strict-prefix native Value conversion sharing was delivered by ADR-042): the current compiler lacks the typed literal, representation, or use-analysis proof needed to preserve failures and strict evaluation. A future protocol target starts with ADR-032 rules disabled and enables each rule only after its legality and semantics are revalidated; cost-directed rules additionally need a new pinned cost profile.

JuLC’s current compiler targets the Plutus V3/PV11 feature set. This contract was verified against Plutus 1.63.0.0 (f92b7d7d82622a26caf456a6be33859f697e2cfc), as shipped by cardano-node 11.0.1.

The released PV11 Batch 6 is exactly:

Tags Builtins Specification
87 ExpModInteger CIP-109
88 DropList CIP-132
89-91 LengthOfArray, ListToArray, IndexArray CIP-138
92-93 BLS12-381 G1/G2 multi-scalar multiplication CIP-133
94-100 Native MaryEraValue operations CIP-153

Earlier JuLC previews exposed Builtins.multiIndexArray as if it were a PV11 builtin and could generate FLAT tag 101. Tag 101 is the future CIP-156 operation; it is not part of PV11, and scripts containing it are not valid for that target.

The current compiler now rejects multiIndexArray with a compile-time diagnostic. Recompile affected scripts and replace the call with repeated IndexArray operations (for typed arrays, repeated array.get(index) calls). There is no automatic bytecode migration for an already-generated tag-101 script.

The tag remains in JuLC’s AST/FLAT support and Java VM for forward-development experiments only. That experimental implementation does not make it ledger-valid for PV11. It also retains JuLC’s legacy (array, indices) argument order rather than CIP-156’s proposed indices-first signature, so it is not a conformant preview of the future builtin.