feat: add target-aware PV11 optimizations (ADR-032) - #109
Conversation
|
Milestone 6 is merged into the integration branch. |
|
CI exposed a locked-artifact migration issue rather than a compiler test failure. Rebuilding the Blaster suite with the new default changed every proof artifact hash; attempting the PV11-safe smoke proof then kept Lean compute-bound beyond ten minutes. Corrective milestone 6b now pins this legacy exact-artifact suite explicitly to |
|
Milestone 7 addresses the review findings in merge commit 16e5e35:
Validation: affected module suites, pinned optimizationEvidence benchmark, and ./gradlew build --no-daemon (217 tasks) all pass. |
Summary
Implements ADR-032 as a stacked change on the ADR-031 compiler-target branch from PR #93.
none,baseline,pv11-safe, andpv11-costedpv11-safeprofile the default while retaining explicitbaselinefor pre-ADR-032 lowering and script-byte reproductionplutus-v3-pv11-uplc-1.1.0compilation target; no new target is introducedcardano-node-11.0.1-plutus-v3-pv11optimization cost profile and provenanceDropList, O2Case Bool, and O13 literalExpModIntegerloweringpv11-costedexplicit; no cost-profile-dependent rule becomes defaultJulcValueboundary and rejects native/Data mixing through assignments, equality, Data-backed containers/records, and external boundariesCase Boollanguage-level cross-checksTarget selection answers whether generated UPLC is legal. Optimization level and cost profile answer whether a proven rewrite is enabled and profitable. Future compiler targets start with ADR-032 rules disabled and opt rules in only after legality, semantic equivalence, and target-specific cost evidence are established.
Default promotion and compatibility
pv11-safeis now the single named default for Java compilation, CLI, Gradle, annotation processing, and MCP compile/evaluate entry points. This changes only newly compiled artifacts; deployed scripts are unchanged. Selectbaselineexplicitly to reproduce ADR-031 lowering and hashes.Default compiler output may contain PV11-only
Case BoolorDropList. ADR-030 deliberately keeps Java/Truffle raw language-only overloads on the PV10 compatibility default, so JuLC-owned compiler consumers propagateCompileResult.target().ledgerTarget()through CLI, MCP, playground, testkit, examples, JRL, blueprint, and verification evaluation paths. Commands evaluating arbitrary raw UPLC retain compatibility-mode behavior.Scalus 1.1.0 now evaluates the generated
Case Boolshape with the correct false/true branch order and selected-branch-only laziness. The Scalus adapter remains language-only and fails closed on JuLC's protocol-aware ledger-target SPI; it is not claimed as a ledger-cost authority. Cross-backend raw budget tests explicitly configure the same pinned profile on both VMs instead of comparing version-dependent built-in defaults.The decompiler conservatively recovers PV11
Case Boolas a source conditional only when the untyped scrutinee is provably Boolean. Ambiguous two-branch SOP cases remain switches.The legacy exact-artifact Blaster suite is explicitly pinned to
baseline. During default-promotion review, its PV11-safe 353-byte smoke artifact remained compute-bound in Lean preprocessing beyond ten minutes, while the same suite completed in about 36 seconds on baseline. This is a proof-tool performance limitation, not a semantic mismatch. The suite remainsSMT-VALID, but it is not claimed as formal coverage of PV11-safe untilCase Boolpreprocessing is practical.Correctness and security gates
DropListuses count-before-list builtin arguments.[false, true]and differentially checks success, failure, and laziness paths; Scalus 1.1.0 now passes focused compatibility regressions.Measured evidence
Pinned profile:
cardano-node-11.0.1-plutus-v3-pv11The aggregate malformed-list path is unchanged at CPU 643,521 and memory 3,796. Every aggregate row is non-increasing in CPU and memory.
Aggregate script hashes change deterministically:
3d1e9ac3561e68d3d0864705686adca6105ff5fc15f5a43e904de1f22f2ea7f79a5dd083ed51e573dc247267ae7cb978ecc615692479c594Detailed tables, outcomes, traces, boundary cases, and deferral rationale are in
adr/evidence/and the release notes.Validation
:julc-benchmark:optimizationEvidencesuite with pinned Java/Truffle budgets and hashes./gradlew build --no-daemonafter the review-corrections milestone: 217 tasks, successfulSMT-VALID, all reviewed positive properties and negative controls establishednpm run build: 32 pages, successfulgit diff --check integration/adr-031-compiler-target...HEADMilestone history
Each coherent phase was developed on a separate milestone branch, tested and reviewed against ADR invariants, and merged with a no-fast-forward milestone merge into this integration branch. Milestone 6 promotes the evidence-backed safe profile to the default and preserves explicit baseline compatibility. Corrective milestone 6b makes the legacy Blaster baseline pin explicit after CI exposed the proof-preprocessing boundary. Milestone 7 addresses the external review: Scalus 1.1.0 compatibility, exact ExpMod bounds in compiler and VMs, comprehensive Native Value/Data isolation, corrected verification claims, and full repository revalidation.
Related: #77, #94, #95, #96, #97, #98, #99, #100, #101, #102, #103, #104, #105, #106, #107, #108.