Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
}
],
"submission": {
"date": "2026-07-08T07:23:46Z",
"date": "2026-07-08T14:36:30Z",
"source_available": true,
"source_repository": "https://github.com/Unisay/plinth-cape-submissions",
"source_commit_hash": "f9ef6bdf4ed08ec16039600903d8af7e6c22046b",
"implementation_notes": "Linear vesting validator written in `do`-notation on `Plinth.Validator`, a zero-cost early-termination monad, together with the zero-cost typed decoding DSL `Plinth.Decoder.Named` (`V.do`/`N.do` via `QualifiedDo`; `IxDecoder`/`FieldAt` Peano-indexed cursor; `Plinth.Encoded` compare-without-decode). Re-optimised for CAPE metrics schema 2.0.0, whose aggregates cover only the happy-path (accept) measurements. This round's structural change decodes the `VestingDatum` on the partial-unlock path in a single 7-field region. total_fee 173470 to 59048 lovelace (-66.0%); promoted to the default artifact for this line, with the previous plain implementation retained as Plinth_1.65.0.0_Unisay_plain. Source: lib/LinearVesting.hs (+ `lib/Plinth/Validator.hs`, `lib/Plinth/Decoder/Named.hs`, `lib/Plinth/Decoder/Named/ScriptContext.hs`, `lib/Plinth/Encoded.hs`) in plinth-cape-submissions @ f9ef6bdf4ed08ec16039600903d8af7e6c22046b (branch main)."
"source_commit_hash": "d078652f03d31ed728c1fb63f1d9f8824218494c",
"implementation_notes": "Linear vesting validator written in `do`-notation on `Plinth.Validator`, a zero-cost early-termination monad, together with the zero-cost typed decoding DSL `Plinth.Decoder.Named` (`V.do`/`N.do` via `QualifiedDo`; `IxDecoder`/`FieldAt` Peano-indexed cursor; `Plinth.Encoded` compare-without-decode). This round reads the vesting-token quantity with a bytestring-keyed map lookup (`lookupBytesE`, comparing the unwrapped `CurrencySymbol`/`TokenName` keys with `equalsByteString`) rather than comparing whole `Value` keys with `equalsData`, and re-sweeps the inliner budget for the new shape. total_fee 59048 to 58343 lovelace (-1.2%, CAPE changPV measurement). The previous plain implementation stays as Plinth_1.65.0.0_Unisay_plain. Source: lib/LinearVesting.hs (+ `lib/Plinth/Validator.hs`, `lib/Plinth/Decoder/Named.hs`, `lib/Plinth/Decoder/Named/ScriptContext.hs`, `lib/Plinth/Encoded.hs`) in plinth-cape-submissions @ d078652f03d31ed728c1fb63f1d9f8824218494c (branch main)."
}
}
83 changes: 41 additions & 42 deletions submissions/linear_vesting/Plinth_1.65.0.0_Unisay/metrics.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"evaluations": [
{
"cpu_units": 45618536,
"cpu_units": 41747914,
"description": "PartialUnlock at time=11 with 900 tokens remaining should succeed (first installment unlocked)",
"execution_result": "success",
"included_in_aggregates": true,
"memory_units": 109284,
"memory_units": 110676,
"name": "partial_unlock_first_installment"
},
{
"cpu_units": 45618536,
"cpu_units": 41747914,
"description": "PartialUnlock at time=50 with 500 tokens remaining should succeed (half vested)",
"execution_result": "success",
"included_in_aggregates": true,
"memory_units": 109284,
"memory_units": 110676,
"name": "partial_unlock_mid_vesting"
},
{
"cpu_units": 45618536,
"cpu_units": 41747914,
"description": "PartialUnlock at time=91 with 100 tokens remaining should succeed (9 installments unlocked)",
"execution_result": "success",
"included_in_aggregates": true,
"memory_units": 109284,
"memory_units": 110676,
"name": "partial_unlock_near_end"
},
{
"cpu_units": 45618536,
"cpu_units": 41747914,
"description": "PartialUnlock at time=25 with 800 tokens remaining should succeed (between installment boundaries)",
"execution_result": "success",
"included_in_aggregates": true,
"memory_units": 109284,
"memory_units": 110676,
"name": "partial_unlock_between_installments"
},
{
Expand Down Expand Up @@ -129,35 +129,35 @@
"name": "partial_unlock_at_first_unlock"
},
{
"cpu_units": 30136315,
"cpu_units": 28125146,
"description": "PartialUnlock with 0 tokens remaining in output should fail (must use FullUnlock instead)",
"execution_result": "success",
"included_in_aggregates": false,
"memory_units": 63997,
"memory_units": 64125,
"name": "partial_unlock_zero_remaining"
},
{
"cpu_units": 38456586,
"cpu_units": 34393964,
"description": "PartialUnlock with output tokens equal to input (1000) should fail (no tokens actually withdrawn)",
"execution_result": "success",
"included_in_aggregates": false,
"memory_units": 84600,
"memory_units": 84792,
"name": "partial_unlock_not_decreasing"
},
{
"cpu_units": 38584968,
"cpu_units": 34522346,
"description": "PartialUnlock at time=11 with 800 tokens remaining should fail (expected minimum 900)",
"execution_result": "success",
"included_in_aggregates": false,
"memory_units": 84602,
"memory_units": 84794,
"name": "partial_unlock_wrong_remaining_too_low"
},
{
"cpu_units": 38584968,
"cpu_units": 34522346,
"description": "PartialUnlock at time=11 with 950 tokens remaining should fail (must withdraw at least 1 installment)",
"execution_result": "success",
"included_in_aggregates": false,
"memory_units": 84602,
"memory_units": 84794,
"name": "partial_unlock_wrong_remaining_too_high"
},
{
Expand All @@ -177,11 +177,11 @@
"name": "partial_unlock_datum_missing"
},
{
"cpu_units": 47603065,
"cpu_units": 43540443,
"description": "PartialUnlock with two script inputs should fail (double satisfaction attack)",
"execution_result": "success",
"included_in_aggregates": false,
"memory_units": 105604,
"memory_units": 105796,
"name": "partial_unlock_double_satisfaction"
},
{
Expand Down Expand Up @@ -237,43 +237,42 @@
"evaluator": "PlutusTx.Eval-1.45.0.0"
},
"measurements": {
"block_cpu_budget_pct": 0.11404634,
"block_memory_budget_pct": 0.17626451612903227,
"block_cpu_budget_pct": 0.10436978499999999,
"block_memory_budget_pct": 0.17850967741935483,
"cpu_units": {
"maximum": 45618536,
"median": 45618536,
"maximum": 41747914,
"median": 41747914,
"minimum": 12449469,
"sum": 207373082
"sum": 191890594
},
"excluded": {
"count": 23,
"cpu_units": {
"maximum": 47603065,
"sum": 359534681
"maximum": 43540443,
"sum": 341273024
},
"memory_units": {
"maximum": 105604,
"sum": 794967
"maximum": 105796,
"sum": 795863
}
},
"execution_fee_lovelace": 44183,
"execution_fee_lovelace": 43388,
"memory_units": {
"maximum": 109284,
"median": 109284,
"maximum": 110676,
"median": 110676,
"minimum": 34731,
"sum": 506598
"sum": 512166
},
"reference_script_fee_lovelace": 14865,
"script_size_bytes": 991,
"scripts_per_block": 567,
"scripts_per_tx": 128,
"term_size": 979,
"total_fee_lovelace": 59048,
"tx_cpu_budget_pct": 0.45618536,
"tx_memory_budget_pct": 0.7806
"reference_script_fee_lovelace": 14955,
"script_size_bytes": 997,
"scripts_per_block": 560,
"scripts_per_tx": 126,
"term_size": 985,
"total_fee_lovelace": 58343,
"tx_cpu_budget_pct": 0.41747913999999997,
"tx_memory_budget_pct": 0.7905428571428572
},
"scenario": "linear_vesting",
"timestamp": "2026-07-08T07:23:47Z",
"version": "2.0.0",
"notes": "Generated using UPLC-CAPE measure tool"
"timestamp": "2026-07-08T14:37:18Z",
"version": "2.0.0"
}
18 changes: 12 additions & 6 deletions submissions/linear_vesting/Plinth_1.65.0.0_Unisay/source/README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
# linear_vesting Plinth 1.65.0.0 source
# linear_vesting Plinth 1.65.0.0 (monadic) source

**Repository**: <https://github.com/Unisay/plinth-cape-submissions>

**Branch**: `main`

**Commit**: `f9ef6bdf4ed08ec16039600903d8af7e6c22046b`
**Commit**: `d078652f03d31ed728c1fb63f1d9f8824218494c`

**Path**: `lib/LinearVesting.hs` (+ `lib/Plinth/Validator.hs`, `lib/Plinth/Decoder/Named.hs`, `lib/Plinth/Decoder/Named/ScriptContext.hs`, `lib/Plinth/Encoded.hs`)

Linear vesting validator written in `do`-notation on `Plinth.Validator`, a zero-cost early-termination monad, together with the zero-cost typed decoding DSL `Plinth.Decoder.Named` (`V.do`/`N.do` via `QualifiedDo`; `IxDecoder`/`FieldAt` Peano-indexed cursor; `Plinth.Encoded` compare-without-decode). Re-optimised for CAPE metrics schema 2.0.0 (happy-path aggregates only): This round's structural change decodes the `VestingDatum` on the partial-unlock path in a single 7-field region. total_fee 173470 to 59048 lovelace (-66.0%), promoted to the default for this line.
The monadic linear vesting validator; see the submission `metadata.json` for the latest decoder change. This is the default artifact for the mainnet 1.65.0.0 line.

## Reproducing the compilation

```bash
git clone https://github.com/Unisay/plinth-cape-submissions
cd plinth-cape-submissions
git checkout f9ef6bdf4ed08ec16039600903d8af7e6c22046b
git checkout d078652f03d31ed728c1fb63f1d9f8824218494c
```

`CAPE_REPO` must point at the sibling UPLC-CAPE checkout (build aborts if unset); set it in `.envrc.local` (gitignored). Then:
`CAPE_REPO` must point at the sibling UPLC-CAPE checkout; the build aborts if the variable is unset. The recommended place is `.envrc.local` (gitignored), e.g.:

```sh
export CAPE_REPO="$HOME/src/UPLC-CAPE"
```

Then enter the dev shell and run the generator:

```bash
nix develop
cabal run plinth-submissions
Comment thread
Unisay marked this conversation as resolved.
```

The generator writes `$CAPE_REPO/submissions/linear_vesting/Plinth_1.65.0.0_Unisay/linear_vesting.uplc` (monadic is the default on `main`; the previous plain implementation is retained as `Plinth_1.65.0.0_Unisay_plain`).
The produced UPLC writes to `$CAPE_REPO/submissions/linear_vesting/Plinth_1.65.0.0_Unisay/linear_vesting.uplc` and matches the UPLC in this submission.
Loading
Loading