Skip to content

Decouple Plinth Submissions from UPLC-CAPE Core Repository #147

@Unisay

Description

@Unisay

Problem Statement

UPLC-CAPE currently includes both the measurement infrastructure (CEK machine for UPLC evaluation) and the Plinth submission generation code (PlutusTx compilation). This creates an unnecessary coupling between two concerns that have different versioning requirements:

  1. CEK Machine (Evaluation): Must match the Plutus version used by the latest cardano-node release (currently 1.45.0)
  2. PlutusTx Plugin (Compilation): Can use any Plutus version that targets a compatible Plutus Core version (1.1.0)

The Problem: Both currently depend on Plutus 1.45.0, preventing us from demonstrating newer PlutusTx compiler optimizations that were released after 1.45.0.

Why CEK version must match cardano-node: The measurement tool must evaluate UPLC with the same semantics and cost model as the actual Cardano blockchain to ensure benchmark results are accurate and representative.

Why PlutusTx compilation version can be independent: As long as the compiler targets Plutus Core 1.1.0 (which the CEK machine can evaluate), the compilation can use any PlutusTx version. Newer compiler versions may include optimizations that produce more efficient UPLC code while maintaining the same semantics.

Proposed Solution

Move Plinth submission generation to an external repository Unisay/plinth-cape-submissions, following the existing pattern used by Scalus and Plutarch submissions.

Benefits:

  • ✅ PlutusTx compiler can be upgraded independently from CEK evaluator
  • ✅ Demonstrate newer compiler optimizations (post-1.45.0) in Plinth submissions
  • ✅ Cleaner separation of concerns (evaluation vs compilation)
  • ✅ Reduced dependencies in UPLC-CAPE core repository
  • ✅ Faster build times (no Agda compilation needed for UPLC-CAPE)
  • ✅ Consistent pattern across all compiler submissions (all external)

Architecture:

  • UPLC-CAPE (this repo): Contains only evaluation infrastructure (measure tool with CEK machine) and submission artifacts (.uplc files, metadata)
  • plinth-cape-submissions (new external repo): Contains Plinth source code, compilation logic, and build system with independent Plutus version

Affected Submissions

5 existing Plinth submissions will be migrated:

  1. submissions/ecd/Plinth_1.45.0.0_Unisay/
  2. submissions/factorial_naive_recursion/Plinth_1.45.0.0_Unisay/
  3. submissions/two_party_escrow/Plinth_1.45.0.0_Unisay/
  4. submissions/fibonacci/Plinth_1.45.0.0_Unisay_tailrec/
  5. submissions/fibonacci_naive_recursion/Plinth_1.45.0.0_Unisay/

Implementation Tasks

Phase 1: External Repository Setup

  • Create new repository Unisay/plinth-cape-submissions
  • Set up Nix development environment with Plutus dependencies
  • Port validator source code from UPLC-CAPE lib/ modules (Fibonacci, Factorial, Ecd, TwoPartyEscrow, etc.)
  • Create executable(s) for generating submission UPLC files
  • Add README with build instructions and reproduction steps
  • Set up CI/CD for automated testing

Phase 2: UPLC-CAPE Migration

  • Remove plinth-submissions-app/ directory and cabal component
  • Remove validator modules from lib/ (Fibonacci, Factorial, Ecd, TwoPartyEscrow, FibonacciIterative, Cape.Fixture)
  • Remove PlutusTx-specific dependencies from cabal file (keep only CEK evaluator deps: plutus-core, plutus-ledger-api for types)
  • Update each Plinth submission's source/README.md with external repo references (repo URL, commit hash, file path, reproduction steps)
  • Update metadata.json files if needed

Phase 3: Build System Cleanup

  • Remove plinth-submissions executable from flake.nix
  • Clean up cabal.project if needed
  • Update nix shell to remove compilation-specific dependencies (keep only evaluation deps)
  • Verify measure tool still works correctly with all submissions

Phase 4: Documentation Updates

  • Update main README.md to remove Plinth compilation references
  • Update CONTRIBUTING.md submission guidelines
  • Update CLAUDE.md to reflect new architecture
  • Create ADR documenting the architectural decision and rationale
  • Update any CI/CD workflows that reference Plinth compilation

Migration Path for Existing Submissions

Each Plinth submission will:

  • Keep in UPLC-CAPE: .uplc file, metadata.json, metrics.json, README.md
  • Create: source/README.md pointing to external repository with:
    • Repository URL
    • Specific commit hash
    • File path within repository
    • Reproduction steps

This follows the existing pattern used by Scalus and Plutarch submissions.

References

Existing external submission examples:

  • Scalus pattern: submissions/factorial/Scalus_0.12.1_Unisay/source/README.md
  • Plutarch pattern: submissions/factorial/Plutarch_1.11.0_SeungheonOh_exbudget/source/README.md

Current Plinth (before migration):

  • submissions/factorial_naive_recursion/Plinth_1.45.0.0_Unisay/source/README.md

Critical files in UPLC-CAPE:

  • cape.cabal:16-30 - Common Plutus dependencies
  • cape.cabal:129-145 - Plinth-submissions executable definition
  • plinth-submissions-app/Main.hs - Current compilation logic
  • lib/Fibonacci.hs, lib/Factorial.hs, lib/Ecd.hs, lib/TwoPartyEscrow.hs - Validator source code
  • flake.nix:24-30 - Plutus input pinning

Success Criteria

  • UPLC-CAPE can evaluate Plinth submissions without PlutusTx compilation dependencies
  • External repo can generate submissions with newer PlutusTx versions (>1.45.0)
  • All existing Plinth submissions still pass cape submission verify
  • Documentation accurately reflects new architecture
  • Build times improved due to removed compilation dependencies
  • Pattern consistent with other external compiler submissions (Scalus, Plutarch)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions