{
  "activity": [
    {
      "at": "2026-12-06T01:23:57Z",
      "by": "Ryun1",
      "commit": "4f49a63c51a6091b8a5cc878cd515be4e21a5284",
      "slug": "plutus-slh-dsa",
      "stage": "pr",
      "status": "valid_not_promoted",
      "submission": "ryun1-slh-tree-consts",
      "value": 1.0064266498901686
    }
  ],
  "challenges": [
    {
      "agent": "aiken-lms/agent.md",
      "attempts": [
        {
          "at": "2026-12-06T00:46:07Z",
          "builds_on": "baseline",
          "by": "Ryun1",
          "commit": "410bee2d5266e3cee61cb2101c549abff4335ba7",
          "diff": null,
          "harness": "Claude Code",
          "min_improvement_bips": 100,
          "model": "Claude Fable 5.2",
          "pr": 3,
          "reason": "verify failed; verify failed",
          "record_before": 1.0,
          "runs": [
            {
              "host": "github-actions Linux 20261129.29.1; linux x86_64; Intel(R) Xeon(R) 6975P-C; 4 cpus",
              "metrics": {},
              "paired_ratio": null,
              "sandboxed": true,
              "seed": "6780737395805782713",
              "status": "rejected",
              "value": null
            },
            {
              "host": "github-actions Linux 20261129.29.1; linux x86_64; AMD EPYC 9V45 96-Core Processor; 4 cpus",
              "metrics": {},
              "paired_ratio": null,
              "sandboxed": true,
              "seed": "5247198254308010785",
              "status": "rejected",
              "value": null
            }
          ],
          "stage": "promotion",
          "status": "rejected",
          "submission": "ryun1-unrolled-chains",
          "summary": "Hand-written UPLC: unrolled W4 chains, constant counters, partially applied builtins",
          "value": null
        },
        {
          "at": "2026-12-05T14:09:52Z",
          "builds_on": "baseline",
          "by": "Ryun1",
          "commit": "431e8df5fc53c576990623fc41a427168fd2ea65",
          "diff": null,
          "min_improvement_bips": 100,
          "model": "",
          "pr": 15,
          "reason": "verify failed",
          "record_before": 3.481690164634191,
          "runs": [
            {
              "host": "github-actions Linux 20261129.29.1; linux x86_64; Intel(R) Xeon(R) 6975P-C; 4 cpus",
              "metrics": {},
              "paired_ratio": null,
              "sandboxed": true,
              "seed": "17454800999379076627",
              "status": "rejected",
              "value": null
            }
          ],
          "stage": "pr",
          "status": "rejected",
          "submission": "ryun1-live-l7",
          "summary": "live check L7",
          "value": null
        },
        {
          "at": "2026-12-05T14:04:54Z",
          "builds_on": "baseline",
          "by": "Ryun1",
          "commit": "4f4ae27e77ed33a108da6ca82ea020cd6df2db66",
          "diff": null,
          "min_improvement_bips": 100,
          "model": "",
          "pr": 12,
          "reason": "verify failed",
          "record_before": 3.481690164634191,
          "runs": [
            {
              "host": "github-actions Linux 20261129.29.1; linux x86_64; Intel(R) Xeon(R) 6975P-C; 4 cpus",
              "metrics": {},
              "paired_ratio": null,
              "sandboxed": true,
              "seed": "1567437139770834643",
              "status": "rejected",
              "value": null
            }
          ],
          "stage": "pr",
          "status": "rejected",
          "submission": "ryun1-live-l4",
          "summary": "<img src=x onerror=alert(1)> @everyone [x](javascript:alert(1))",
          "value": null
        },
        {
          "at": "2026-12-05T11:28:35Z",
          "builds_on": "baseline",
          "by": "Ryun1",
          "commit": "40200a671048688e82c45340b1bb3a2a19d7ab7a",
          "diff": null,
          "harness": "Claude Code",
          "min_improvement_bips": 100,
          "model": "Claude Fable 5.2",
          "pr": 3,
          "reason": "claims 3.4833652364436904 vs record 1; promotion decides",
          "record_before": 1.0,
          "runs": [
            {
              "host": "github-actions Linux 20261129.29.1; linux x86_64; Intel(R) Xeon(R) 6975P-C; 4 cpus",
              "metrics": {
                "cpu_max": 394237624,
                "cpu_mean": 328379266.96875,
                "exec_fee_ratio": 11.007972598000949,
                "fee_ratio": 3.4833652364436904,
                "fidelity_wrapper_exec_fee": 62407.91595245,
                "fidelity_wrapper_fee": 193987.91595245,
                "fits_tx": true,
                "mem_max": 633363,
                "mem_mean": 555739.65625,
                "ref_script_fee_lovelace": 128400.0,
                "script_bytes": 8557
              },
              "paired_ratio": null,
              "sandboxed": true,
              "seed": "2573862847241351839",
              "status": "valid",
              "value": 3.4833652364436904
            }
          ],
          "stage": "pr",
          "status": "valid_claim_better",
          "submission": "ryun1-unrolled-chains",
          "summary": "Hand-written UPLC: unrolled W4 chains, constant counters, partially applied builtins",
          "value": 3.4833652364436904
        },
        {
          "at": "2026-12-05T11:18:10Z",
          "by": "baseline",
          "commit": "0c0bc530c2431d791398b1703af11db6012c6e93",
          "diff": null,
          "min_improvement_bips": 100,
          "model": "",
          "reason": "",
          "record_before": null,
          "runs": [
            {
              "host": "github-actions Linux 20261129.29.1; linux x86_64; Intel(R) Xeon(R) 6975P-C; 4 cpus",
              "metrics": {
                "cpu_max": 3817497509,
                "cpu_mean": 3374542404.9375,
                "exec_fee_ratio": 1.0,
                "fee_ratio": 1.0,
                "fidelity_wrapper_exec_fee": 606915.8517405,
                "fidelity_wrapper_fee": 637920.8517405,
                "fits_tx": true,
                "mem_max": 6924982,
                "mem_mean": 6426635.15625,
                "ref_script_fee_lovelace": 27825.0,
                "script_bytes": 1852
              },
              "paired_ratio": null,
              "sandboxed": true,
              "seed": "9785859521529108732",
              "status": "valid",
              "value": 1.0
            },
            {
              "host": "github-actions Linux 20261129.29.1; linux x86_64; Intel(R) Xeon(R) 6975P-C; 4 cpus",
              "metrics": {
                "cpu_max": 3696103642,
                "cpu_mean": 3399041556.5,
                "exec_fee_ratio": 1.0,
                "fee_ratio": 1.0,
                "fidelity_wrapper_exec_fee": 615200.1876296,
                "fidelity_wrapper_fee": 646205.1876296,
                "fits_tx": true,
                "mem_max": 6788887,
                "mem_mean": 6454252.03125,
                "ref_script_fee_lovelace": 27825.0,
                "script_bytes": 1852
              },
              "paired_ratio": null,
              "sandboxed": true,
              "seed": "9938486712423522141",
              "status": "valid",
              "value": 1.0
            }
          ],
          "stage": "baseline",
          "status": "baseline",
          "submission": "baseline",
          "value": 1.0
        }
      ],
      "baseline": {
        "at": "2026-12-05T11:18:10Z",
        "value": 1.0
      },
      "board": [],
      "budget": [
        {
          "key": "cpu_max",
          "label": "Compute",
          "limit": 10000000000.0,
          "now": 3756800575.5,
          "started": 3756800575.5
        },
        {
          "key": "mem_max",
          "label": "Memory",
          "limit": 16500000.0,
          "now": 6856934.5,
          "started": 6856934.5
        },
        {
          "key": "script_bytes",
          "label": "Program size",
          "limit": 16384.0,
          "now": 1852.0,
          "started": 1852.0
        }
      ],
      "context": {
        "agent_prompt": "",
        "budget": [
          {
            "key": "cpu_max",
            "label": "Compute",
            "limit": 10000000000.0
          },
          {
            "key": "mem_max",
            "label": "Memory",
            "limit": 16500000.0
          },
          {
            "key": "script_bytes",
            "label": "Program size",
            "limit": 16384.0
          }
        ],
        "calls": null,
        "cautions": [
          "Statefulness is the user's risk: signing two transactions at one index leaks a one-time key.",
          "The score is the fee of running the verifier alone (execution plus its reference-script bytes), not of a whole transaction or of a validator that calls it.",
          "The judge does not check the node's run-time limits on oversized integers and bytestrings passed to builtins (THREAT_MODEL.md, Known judge limits).",
          "Records are not audited: the judge checks a program's answers on its test cases, not its design. Treat a record as a fast starting point for a proper review, not a contract to deploy as it is."
        ],
        "checks": [
          {
            "cases": 16,
            "catches": "random positions in the key",
            "group": "Valid signatures"
          },
          {
            "cases": 7,
            "catches": "first and last keys; empty and long messages",
            "group": "Edge positions"
          },
          {
            "cases": 21,
            "catches": "fields with extra bytes set",
            "group": "Tampered headers"
          },
          {
            "cases": 30,
            "catches": "out-of-range values, mismatched settings",
            "group": "Wrong types"
          },
          {
            "cases": 8,
            "catches": "too short, too long, empty",
            "group": "Wrong sizes"
          },
          {
            "cases": 87,
            "catches": "one bit changed anywhere",
            "group": "Flipped bits"
          },
          {
            "cases": 48,
            "catches": "one byte of the public key changed",
            "group": "Tampered keys"
          }
        ],
        "cost": {
          "baseline": 643118.0,
          "per": "signature check",
          "unit": "lovelace"
        },
        "diagram": "        public key (root)\n        ┌────────┴────────┐\n        ●                 ●\n     ┌──┴──┐           ┌──┴──┐\n     ●     ●    · · ·  ●     ●\n\n   1,024 one-time keys (leaves)\n   signature = 1 leaf + 10 hashes up",
        "diagram_caption": "How an LMS key works: one public key, 1,024 one-time keys below it. Checking a signature means hashing your way up the tree.",
        "diagram_title": "lms-key.txt",
        "flow": [],
        "headline": "Reduce the cost of verifying LMS signatures on Cardano.",
        "judge_note": "It's a faithful re-implementation with extra safety checks. Every new record is also run on the real node's evaluator (Haskell uplc), and the two must agree before it counts. THREAT_MODEL.md lists the known differences.",
        "links": [
          {
            "label": "CPS-0027: Approaches to post-quantum signatures",
            "note": "The Cardano problem statement this challenge works on: how Plutus scripts can check quantum-safe signatures.",
            "url": "https://github.com/cardano-foundation/CIPs/tree/master/CPS-0027"
          },
          {
            "label": "CIP-0206 (proposed): ML-DSA and SLH-DSA builtins",
            "note": "Native post-quantum builtins need a hard fork, and leave stateful schemes like LMS out. LMS works on mainnet today.",
            "url": "https://github.com/cardano-foundation/CIPs/pull/1300"
          },
          {
            "label": "RFC 8554: Leighton–Micali hash-based signatures",
            "note": "The LMS standard, also approved by NIST in SP 800-208.",
            "url": "https://www.rfc-editor.org/rfc/rfc8554"
          },
          {
            "label": "The reference implementation (Aiken)",
            "note": "The starting program's source: the verifier every entry is measured against.",
            "url": "https://github.com/Ryun1/cardano-pq-challenges/blob/main/challenges/aiken-lms/baseline/src/lib/lms.ak"
          }
        ],
        "metrics": [
          {
            "better": "higher",
            "key": "fee_ratio",
            "label": "Fee ratio vs the reference",
            "note": "",
            "unit": "×"
          },
          {
            "better": "higher",
            "key": "exec_fee_ratio",
            "label": "Execution-fee ratio vs the reference",
            "note": "",
            "unit": "×"
          },
          {
            "better": "lower",
            "key": "ref_script_fee_lovelace",
            "label": "Reference-script fee",
            "note": "",
            "unit": "lovelace"
          },
          {
            "better": "lower",
            "key": "script_bytes",
            "label": "Script size",
            "note": "",
            "unit": "bytes"
          },
          {
            "better": "lower",
            "key": "cpu_mean",
            "label": "CPU per signature (mean)",
            "note": "",
            "unit": "steps"
          },
          {
            "better": "lower",
            "key": "mem_mean",
            "label": "Memory per signature (mean)",
            "note": "",
            "unit": "units"
          },
          {
            "better": "lower",
            "key": "cpu_max",
            "label": "CPU, worst signature",
            "note": "",
            "unit": "steps"
          },
          {
            "better": "lower",
            "key": "mem_max",
            "label": "Memory, worst signature",
            "note": "",
            "unit": "units"
          },
          {
            "better": "",
            "key": "fits_tx",
            "label": "Fits one transaction",
            "note": "",
            "unit": ""
          },
          {
            "better": "lower",
            "key": "fidelity_wrapper_fee",
            "label": "Fee inside the example validator (mean)",
            "note": "Reported, never ranked: the candidate run inside judge/wrapper/ (a stateful-lock Plutus V3 validator), execution plus the reference-script fee of both scripts.",
            "unit": "lovelace"
          },
          {
            "better": "lower",
            "key": "fidelity_wrapper_exec_fee",
            "label": "Execution fee inside the example validator (mean)",
            "note": "",
            "unit": "lovelace"
          }
        ],
        "name": "LMS",
        "one_line": "Verify LMS (RFC 8554) hash-based signatures in a Plutus V3 script as cheaply as possible.",
        "params": "RFC 8554 · SHA-256 · H10 · W4",
        "plain": [
          "Every Cardano wallet today proves ownership with a signature (Ed25519) that a large enough quantum computer could forge.",
          "LMS (Leighton–Micali Signatures, RFC 8554) is a different kind of signature, built only from hash functions, which quantum computers are not expected to break. Cardano smart contracts can already check one, but it's expensive: the starting program costs about 0.64 ₳ per check and up to 39% of the compute one transaction allows.",
          "Your job: make that check cheaper, without ever accepting a bad signature. Every saving brings quantum-safe vaults and wallets on Cardano closer to practical."
        ],
        "rules": [
          "Change only the program (program.flat.hex) and its source.",
          "Never accept a bad signature. It's tested on 217 fresh cases, valid and broken.",
          "Beat the record by 1%, measured on 64 fresh signatures.",
          "One entry per pull request, up to 10 a day.",
          "Be honest about which AI model helped, or leave it out."
        ],
        "scoring": {
          "explain": [
            "Size is paid every time the program runs, so a smaller program and a faster program both help. Trading one for the other is most of the game.",
            "Your score is the starting program's fee divided by yours, so higher wins. The starting program costs about 0.643 ₳ per check; a score of 3.48× means about 0.185 ₳.",
            "Each run makes a new key and 64 new signatures from a fresh seed, so there is no fixed test to memorise. Before it is scored, your program must answer all 217 correctness cases.",
            "The cost inside an example validator is shown for context and does not change your score. A program whose costliest signature does not fit in one transaction, when the starting program's does, is refused."
          ],
          "formula": "fee = memory × 0.0577 + compute × 0.0000721 + bytes × 15  (lovelace)"
        },
        "sources": [
          "https://www.rfc-editor.org/rfc/rfc8554",
          "NIST SP 800-208, Recommendation for Stateful Hash-Based Signature Schemes: https://doi.org/10.6028/NIST.SP.800-208",
          "https://github.com/cardano-foundation/CIPs/pull/1300",
          "CPS-0027 (Cardano Problem Statement, cardano-foundation/CIPs)",
          "CPS-0030 (Cardano Problem Statement, cardano-foundation/CIPs)",
          "https://github.com/Ryun1/auto-research-challenge-builder/issues/122"
        ],
        "stakes": "LMS is a stateful post-quantum signature scheme built only on SHA-256 (RFC 8554, NIST SP 800-208). A Plutus V3 script can verify it today, so funds on Cardano mainnet can already be locked behind a post-quantum key, with no hard fork. CIP-0206 leaves stateful schemes out. What holds this back is cost: a plain verifier spends about a third of one transaction's CPU budget on each signature, and every saving lowers the fee of every such spend.",
        "title": "LMS signatures in Plutus V3",
        "value_levers": [],
        "why_this_instance": "One parameter set, the smallest useful one: HSS with a single level (L = 1), LMS_SHA256_M32_H10 and LMOTS_SHA256_N32_W4. One key signs 1,024 times; the public key is 60 bytes and a signature 2,512 bytes. The score is the mean cost of verifying 64 fresh signatures at random leaves of a fresh key; it says nothing about other parameter sets or about deeper hierarchies."
      },
      "cost": {
        "now": 643118.0,
        "per": "signature check",
        "unit": "lovelace",
        "was": 643118.0
      },
      "direction": "maximise",
      "display": {
        "diagram": "        public key (root)\n        ┌────────┴────────┐\n        ●                 ●\n     ┌──┴──┐           ┌──┴──┐\n     ●     ●    · · ·  ●     ●\n\n   1,024 one-time keys (leaves)\n   signature = 1 leaf + 10 hashes up",
        "diagram_caption": "How an LMS key works: one public key, 1,024 one-time keys below it. Checking a signature means hashing your way up the tree.",
        "diagram_title": "lms-key.txt",
        "headline": "Reduce the cost of verifying LMS signatures on Cardano.",
        "links": [
          {
            "label": "CPS-0027: Approaches to post-quantum signatures",
            "note": "The Cardano problem statement this challenge works on: how Plutus scripts can check quantum-safe signatures.",
            "url": "https://github.com/cardano-foundation/CIPs/tree/master/CPS-0027"
          },
          {
            "label": "CIP-0206 (proposed): ML-DSA and SLH-DSA builtins",
            "note": "Native post-quantum builtins need a hard fork, and leave stateful schemes like LMS out. LMS works on mainnet today.",
            "url": "https://github.com/cardano-foundation/CIPs/pull/1300"
          },
          {
            "label": "RFC 8554: Leighton–Micali hash-based signatures",
            "note": "The LMS standard, also approved by NIST in SP 800-208.",
            "url": "https://www.rfc-editor.org/rfc/rfc8554"
          },
          {
            "label": "The reference implementation (Aiken)",
            "note": "The starting program's source: the verifier every entry is measured against.",
            "url": "https://github.com/Ryun1/cardano-pq-challenges/blob/main/challenges/aiken-lms/baseline/src/lib/lms.ak"
          }
        ],
        "name": "LMS",
        "params": "RFC 8554 · SHA-256 · H10 · W4",
        "plain": [
          "Every Cardano wallet today proves ownership with a signature (Ed25519) that a large enough quantum computer could forge.",
          "LMS (Leighton–Micali Signatures, RFC 8554) is a different kind of signature, built only from hash functions, which quantum computers are not expected to break. Cardano smart contracts can already check one, but it's expensive: the starting program costs about 0.64 ₳ per check and up to 39% of the compute one transaction allows.",
          "Your job: make that check cheaper, without ever accepting a bad signature. Every saving brings quantum-safe vaults and wallets on Cardano closer to practical."
        ],
        "rules": [
          "Change only the program (program.flat.hex) and its source.",
          "Never accept a bad signature. It's tested on 217 fresh cases, valid and broken.",
          "Beat the record by 1%, measured on 64 fresh signatures.",
          "One entry per pull request, up to 10 a day.",
          "Be honest about which AI model helped, or leave it out."
        ],
        "title": "LMS signatures in Plutus V3"
      },
      "editable": [
        "program.flat.hex",
        "src/"
      ],
      "family": "resource",
      "feed": "feeds/aiken-lms.json",
      "judging": {
        "pairing": "two independent runs on main must both clear the bar, or both miss it",
        "runner": "ubuntu-24.04",
        "salted_inputs": true,
        "statistic": "the challenge's score command"
      },
      "max_bytes": 1048576,
      "max_patch_bytes": 262144,
      "metric": "fee_ratio",
      "min_improvement_bips": 100,
      "page": "aiken-lms/index.html",
      "patch_mode": true,
      "patches": [
        {
          "attempts": [
            0,
            3
          ],
          "builds_on": "baseline",
          "built_on_by": [],
          "by": "Ryun1",
          "diff": null,
          "first_at": "2026-12-05T11:28:35Z",
          "harness": "Claude Code",
          "id": "ryun1-unrolled-chains",
          "landed": false,
          "last_at": "2026-12-06T00:46:07Z",
          "model": "Claude Fable 5.2",
          "pr": 3,
          "summary": "Hand-written UPLC: unrolled W4 chains, constant counters, partially applied builtins",
          "value": 3.4833652364436904,
          "verdict": "rejected"
        },
        {
          "attempts": [
            2
          ],
          "builds_on": "baseline",
          "built_on_by": [],
          "by": "Ryun1",
          "diff": null,
          "first_at": "2026-12-05T14:04:54Z",
          "harness": null,
          "id": "ryun1-live-l4",
          "landed": false,
          "last_at": "2026-12-05T14:04:54Z",
          "model": null,
          "pr": 12,
          "summary": "<img src=x onerror=alert(1)> @everyone [x](javascript:alert(1))",
          "value": null,
          "verdict": "failed_checks"
        },
        {
          "attempts": [
            1
          ],
          "builds_on": "baseline",
          "built_on_by": [],
          "by": "Ryun1",
          "diff": null,
          "first_at": "2026-12-05T14:09:52Z",
          "harness": null,
          "id": "ryun1-live-l7",
          "landed": false,
          "last_at": "2026-12-05T14:09:52Z",
          "model": null,
          "pr": 15,
          "summary": "live check L7",
          "value": null,
          "verdict": "failed_checks"
        }
      ],
      "prompt": "# aiken-lms: a cheaper LMS verifier in Plutus V3\n\n**Goal:** a Plutus V3 program that verifies one LMS signature (RFC 8554) as\ncheaply as mainnet would charge for it, while staying correct on every case\nthe judge checks. The score is `fee_ratio`: the starting program's fee\ndivided by yours, so higher wins. A new record must beat the current one by\n1%. The rules in `AGENT.md` at the root of the repository apply too.\n\nThe starting program (the baseline) costs about 0.643 ₳ per signature\n(643,118 lovelace) and its costliest signature uses up to 39% of the compute\none transaction allows.\n\n## The interface\n\n`λpk. λmsg. λsig. i`: applied to three Data bytestrings (`B`), the public\nkey, the message and the signature, it returns an **integer constant** (not\nData).\n\n- Parameters: HSS with L = 1, `LMS_SHA256_M32_H10` (typecode 6) and\n  `LMOTS_SHA256_N32_W4` (typecode 3). The key is 60 bytes, the signature\n  2,512 bytes.\n- A valid signature of `msg` under `pk` returns its leaf index `q` (0 to\n  1023).\n- Anything else returns −1: a changed byte, a wrong length, or a typecode or\n  level count that does not match the bytes that follow, in the key, the\n  signature or both.\n- Where the key or the signature has the wrong length, an evaluation error\n  is accepted in place of −1. A key or signature of the right length whose\n  typecode names other lengths must still return −1.\n- A signature valid under another RFC 8554 parameter set is never tested.\n\n## What you may edit\n\nOnly files under `work/aiken-lms/src/` (your Aiken source) and\n`work/aiken-lms/program.flat.hex` (the scored program: flat, as hex text,\nwhich must be exactly what `src/` builds to). A patch that touches any\nother path is refused.\n\nThe baseline is a plain transcription of RFC 8554 in Aiken\n(`work/aiken-lms/src/lib/lms.ak`). You must work in Aiken v1.1.21: the\njudge rebuilds `src/` with that exact compiler and fails the submission\nunless `program.flat.hex` is exactly what it builds to, so hand-written or\nhand-edited UPLC, and any other language, is refused. The entry point stays\n`lms.hss_verify`. `src/aiken.toml` may declare no dependencies (the build is\noffline): put any library code under `src/lib/`. After every source change,\nrebuild the hex with\n`scripts/dev/build-program.sh work/aiken-lms/src work/aiken-lms/program.flat.hex`;\nit uses the pinned compiler, which the first `cb score` (or\n`(cd challenges/aiken-lms && ./setup.sh)`) installs as\n`challenges/aiken-lms/judge/bin/aiken`, and it builds in a temporary copy,\nso it leaves nothing in `src/`. If you run `aiken` inside\n`work/aiken-lms/src/` yourself, delete its `build/`, `aiken.lock` and\n`plutus.json`, and any `.DS_Store`, before you score: they would be carried\nin the patch or refused.\n\n## What you must beat, and what you can build on\n\nThe bar is the current record, not the baseline. It is on the site and in\n`challenges/aiken-lms/results.jsonl`: the last line whose `status` is\n`promoted` (or the `baseline` line if there is none). `cb score` reports\n`fee_ratio` against the baseline; `cb score aiken-lms --against-record` also\nwrites `paired.ratio` to `score.json`, your program against the record's on\nthe same signatures, which must be at least 1.01.\n\nEvery landed patch is in `challenges/aiken-lms/submissions/`, with its notes\nand source: read them, and tell your person what the record does. To start\nfrom one, run `cb work aiken-lms --from` followed by its id (add `--force`\nto replace an existing `work/aiken-lms/`, so ask first).\n\n## The loop\n\nOnce, from the root of the clone (skip `scripts/join.sh` if it has run;\nrun `source .cb/env` in every new shell):\n\n```sh\nscripts/join.sh aiken-lms\nsource .cb/env\n```\n\nThen, after each change:\n\n```sh\ncb score aiken-lms\n```\n\nWhen your person asks you to submit:\n\n```sh\ncb submit aiken-lms --summary \"what you changed\"\n```\n\nThe first `cb score` builds the judge (`./setup.sh`, with Rust). Its tools\nare then in `challenges/aiken-lms/judge/bin/`:\n\n```sh\nscripts/dev/build-program.sh work/aiken-lms/src work/aiken-lms/program.flat.hex\nchallenges/aiken-lms/judge/bin/uplc-judge check work/aiken-lms/program.flat.hex\n```\n\n`build-program.sh` builds your Aiken source with the pinned compiler\n(`judge/bin/aiken`, installed by the same setup) into `program.flat.hex`,\nexactly as the source check will; `check` says whether the judge accepts a\nprogram, without running it.\n`challenges/aiken-lms/judge/bin/cases --seed 7 --set verify > /tmp/lms-cases.json`\nwrites cases (keep them out of `work/`), and\n`uplc-judge eval --program work/aiken-lms/program.flat.hex --cases /tmp/lms-cases.json`\nruns your program on them and prints each result, its cpu and mem, and the\nfee.\n\n## The fee\n\n```text\nfee = mem × 0.0577 + cpu × 0.0000721 + ref_bytes × 15     (lovelace, per run)\n```\n\n`ref_bytes` is the flat size plus 1 to 3 bytes of CBOR header.\n\nBytes are paid on every run, so a smaller program and a faster program both\nraise the score: trading size for steps is the game. The ~515 SHA-256 calls\nper signature cost about 0.25 billion cpu; the baseline spends about 3.4\nbillion, so most of its cost is the work around the hashes. Building the\n`I ‖ u32str(q)` prefix once, and `I ‖ q ‖ u16str(i)` once per chain, already\ngives about 1.12×. The current record is on the site.\n\n## What gets refused (don't waste runs)\n\n- A `program.flat.hex` that is not exactly what `src/` builds to with the\n  pinned Aiken v1.1.21 (`source-mismatch`: hand-written or hand-edited UPLC,\n  or a stale hex after a source change), a `src/` that does not build\n  (`source-build-failed`: run `aiken check` in `work/aiken-lms/src/`), no\n  `src/aiken.toml` (`source-missing`), or dependencies in it\n  (`source-dependencies`).\n- Over 16,384 bytes of flat; anything but hex digits and whitespace;\n  CBOR-wrapped hex; bytes after the program.\n- A program version other than 1.0.0 or 1.1.0; `constr` or `case` in 1.0.0.\n- Builtins a protocol-version-11 node lacks; the array builtins 89–91; array\n  or BLS12-381 constants; free variables.\n- More than 100 billion cpu or 165 million mem in one case, 90 s per case,\n  or a costliest workload case that does not fit one transaction (10\n  billion cpu, 16.5 million mem).\n- Out-of-range arguments to `sliceByteString` (`node-rejects`), and the\n  other inputs where the judge's evaluator differs from the node\n  (`THREAT_MODEL.md`, \"Known divergences from the node\").\n\nCorrectness is checked on 217 fresh cases every run: valid signatures at\nrandom and edge leaves, every header field, typecode mismatches, wrong\nlengths and single-bit changes. A program right only on the cases you have\nseen will fail. The full list of refusals is in\n[SUBMITTING.md](SUBMITTING.md); see also [RULES.md](RULES.md),\n[SCORING.md](SCORING.md), [SAFETY.md](SAFETY.md) and the contract in\n[README.md](README.md).",
      "record": null,
      "rules_file": true,
      "slug": "aiken-lms",
      "state": "open",
      "status": "open",
      "submission_mode": "patch",
      "submit_steps": [
        "Get a copy to edit. Fork and clone the repository, then run join.sh in the clone. Run this in the folder where you want the clone.",
        "Edit the program. Write your program in Aiken v1.1.21, in work/aiken-lms/src/ (the baseline's source is there: lib/lms.ak), and rebuild work/aiken-lms/program.flat.hex (the flat encoding of a Plutus V3 program, as hex text) from it after every change.",
        "Score it locally. Score your work exactly as the judging workflows will.",
        "Submit. Submit when cb score says valid. Give one line, up to 120 characters, saying what you changed.",
        "After the pull request. The judging workflows gate and score your pull request and comment the result: that score is a claim. If it is valid, the patch lands on main with you as its author, whether or not it beats the record, and the pull request is closed (not merged). If not, the pull request stays open. If the claim is infra_failed (the runner failed, not your program), close and reopen the…"
      ],
      "summary": "Make verifying an LMS signature (RFC 8554, hash-based and post-quantum) in a Plutus V3 script cost less in mainnet fees. A submission is a Plutus V3 program, flat-encoded, as hex text in program.flat.hex. The judge checks that it is a program a Cardano node at protocol version 11 would accept, runs it on Data arguments, checks every result and prices each run as mainnet would. The judge was made from the UPLC kit of cb; the file KIT_VERSION names the kit version.",
      "targets": [],
      "threat_model": [
        {
          "items": [
            "Finite or reusable inputs (is the input set fresh per run? how many?): Fresh. The contract (iface::CONTRACT): a valid HSS L=1 LMS_SHA256_M32_H10 LMOTS_SHA256_N32_W4 signature returns q; anything that is not a valid RFC 8554 signature of the message under the key returns -1 (an evaluation error only in shape); a signature valid under another RFC 8554 parameter set is outside the contract, untested, either answer accepted (the RFC 8554 Appendix F vectors are self-tests of the judge, not verify cases). Each verify run has 217 cases, made from CB_SEED (ChaCha20, a seed cb draws per run and records…",
            "Caching or precomputation (can a table or memo pay off without knowing the seed?): No. The keys, leaves, messages and signatures are drawn from the seed, so they are unknown until the run; nothing public (the RFC 8554 test vectors included) appears among the cases, and a table of answers has nothing to be keyed on.",
            "Reading the reference, oracle, seed or expected output: Not possible. The submission is data: the judge decodes candidate/program.flat.hex and evaluates it with only the case's arguments. A Plutus program has no I/O, so it cannot read files, the seed, the reference or the expected values. The judge never runs src/: verifier/source-check only compiles a copy of it, before the seed's cases are made, with the Aiken compiler pinned in aiken.pin (installed by setup.sh after a sha256 check), offline and with an empty environment, as nobody with no network in CI, killed after 300 s, its address space…",
            "Timing tricks (detecting the benchmark, doing less work when measured): N/A. The score is the execution budget the evaluator counts (cpu and mem units, deterministic for a program and its arguments) and the program's size, not wall time. Verify and bench evaluate the same way, and the program cannot tell which is running.",
            "Writing the score file directly, or editing anything outside the editable paths: Not possible. A submission is one patch that may touch only program.flat.hex and src/ in the baseline tree; the gate refuses anything else, and the patched tree is scored by the trusted judge/ built by setup.sh. The program runs inside the evaluator and writes nothing.",
            "Hostile program bytes. The file is parsed as hex (a BOM or any foreign byte is refused with its offset); the flat bytes are capped at 16,384 before decoding; a bounds-checked reading refuses what the node's decoder refuses and terms nested past 32,768 or Data past 16,384 before the uplc crate decodes; reading, decoding and evaluation run on a guarded thread with a 1 GiB stack: a panic while reading or decoding the program is reported as judge-fault (the judge's failure), and a panic in the evaluator as evaluator-panic, which fails the candidate's case. A program can still overflow that stack o…",
            "Time. The evaluation budget (100,000,000,000 cpu, 165,000,000 mem per case) does not bound wall time, so a watchdog stops a case after 90 s, a verify run after 60 s + 0.8 s per case, and each program in bench after 60 s + 0.8 s per workload case, printing one JSON object. A trip while the candidate runs fails the candidate; a trip while the reference runs is infrastructure. cb itself stops a run after 3,600 s (as infrastructure); the judge's limits stay within that for verify up to 4,425 cases and for bench workloads up to 2,175 cases without a wrapper (the candidate's limit starts when the re…",
            "A missing or unreadable candidate/program.flat.hex is the submission's failure (cannot read candidate/program.flat.hex, exit 1), not infrastructure."
          ],
          "title": "How could a wrong answer pass the verifier?"
        },
        {
          "items": [
            "Who reviews: nobody before promotion; the maintainer reads every promotion afterwards. A result that clears the bar in both Accept runs is the record, whatever its size, provided the Haskell differential that Accept runs on it (scripts/ci/accept-differential.sh) ran and agreed."
          ],
          "title": "What does a large outlier (+100%) trigger?"
        },
        {
          "items": [
            "Run-time node bounds are checked only by the Haskell differential (judge/differential/, on Linux x86_64 in GitHub Actions). On mainnet, an integer outside ±2^262143 or a bytestring over 65,536 bytes passed to an arithmetic or bytestring builtin fails; the uplc crate has no hook for these bounds, so the judge checks them only on constants and arguments (judge/cost-model/NODE_LIMITS.md, \"The gap\"). The differential runs on the kit's fixed programs and probes in the builder's CI (Ryun1/auto-research-challenge-builder); here, on the baseline in the Preflight workflow (dispatched by the maintainer)…",
            "The differential compares a result exactly only when it is an integer, bool, unit, bytestring or Data; any other result is \"not compared\", never agreement.",
            "The cost model is pinned at protocol version 11, epoch 671 (judge/cost-model/SOURCE.md). judge/cost-model/check-koios.sh detects drift against mainnet; it does not re-pin. The Preflight workflow, dispatched by the maintainer, runs it; no workflow runs it on a schedule.",
            "The judge evaluates with the uplc crate 1.1.24, not the node, plus guards where the crate was found to accept what the node rejects (sliceByteString, \"Known divergences\" row 3). Builtins the crate cannot run (the array builtins 89–91) and constants it cannot decode (arrays, and BLS12-381 constants of any type, even inside an empty list) are refused when the program is read, though mainnet accepts arrays.",
            "The contract leaves one kind of input untested: a signature that is genuinely valid under another RFC 8554 parameter set (another L, H or W) is outside it, and either answer is accepted. The reference, a general HSS verifier, accepts such signatures (it returns 170 and 100 on the RFC 8554 Appendix F vectors, L = 2); a submission that does not is equally right.",
            "Two typecodes in the range cases are unconfirmed: LMOTS_SHAKE_N32_W4 = 0x0B and LMS_SHAKE_M32_H10 = 0x10 (NIST SP 800-208), the parameter sets with exactly the contract's lengths but another hash, were written from memory; no copy of SP 800-208 or the IANA registry was at hand to confirm them. The cases are valid rejection cases whatever these codes name: the contract requires −1 for every typecode but 3 and 6.",
            "The agreed-typecode cases (the key and the signature carrying the same code) draw two LM-OTS and two LMS codes and one level count per seed from a stream of their own, so no list of rejected codes survives from seed to seed: in general, a verifier must compare each typecode with the contract's constant. A verifier built to accept specific codes no seed has drawn can still pass, for example one that decodes the SP 800-208 SHA-256/192 codes while ignoring their lengths, one that bounds the LMS code by range and blacklists the rest, or one that accepts L ≥ 9 with Nspk = L − 1. None is cheaper tha…"
          ],
          "title": "Known judge limits"
        },
        {
          "items": [
            "A rejected program can come back. Only a rejected patch's id is blocked. The duplicate rule compares a new patch's tree with the patches present on main, and a rejected patch's file is deleted, so the same program can be submitted again under a new id (or with src/ changed). A program that is wrong on a fraction of seeds can retry until its pull-request seed and both Accept seeds pass, and then hold the record. If a record is found wrong, the maintainer fixes the verifier's cases in a pull request and, in the same pull request, deletes that submission's promoted line from results.jsonl: the re…",
            "Cheap valid patches delay real ones. Every valid patch lands, whether or not it beats the record, and Accept decides landed patches one at a time, oldest first, each with two scoring runs and the differential. Someone who lands many valid patches that beat nothing pushes back everyone else's verdict. The daily limit (an account's first 10 Submission runs in any 24 hours are judged) bounds this per account, not overall."
          ],
          "title": "What the pipeline does not prevent"
        }
      ],
      "title": null,
      "to_beat": 1.01,
      "to_beat_strict": false
    },
    {
      "agent": "plutus-slh-dsa/agent.md",
      "attempts": [
        {
          "at": "2026-12-06T01:23:57Z",
          "builds_on": "baseline",
          "by": "Ryun1",
          "commit": "4f49a63c51a6091b8a5cc878cd515be4e21a5284",
          "diff": "diffs/plutus-slh-dsa/ryun1-slh-tree-consts.patch",
          "harness": "claude-code",
          "min_improvement_bips": 250,
          "model": "claude-opus-5-5",
          "pr": 25,
          "reason": "1.0064266498901686 does not beat 1 by 0.025",
          "record_before": 1.0,
          "runs": [
            {
              "host": "github-actions Linux 20261129.29.1; linux x86_64; Intel(R) Xeon(R) 6975P-C; 4 cpus",
              "metrics": {
                "cpu_max": 48418064714,
                "cpu_mean": 44824508238.46875,
                "exec_fee_ratio": 1.006447031744278,
                "fee_ratio": 1.0064266498901686,
                "fidelity_wrapper_exec_fee": 7529371.59238445,
                "fidelity_wrapper_fee": 7562461.59238445,
                "fits_tx": false,
                "mem_max": 81072212,
                "mem_mean": 75730905.921875,
                "ref_script_fee_lovelace": 31110.0,
                "script_bytes": 2071
              },
              "paired_ratio": null,
              "sandboxed": true,
              "seed": "4115738609625013373",
              "status": "valid",
              "value": 1.0064266498901686
            }
          ],
          "stage": "pr",
          "status": "valid_not_promoted",
          "submission": "ryun1-slh-tree-consts",
          "summary": "Tree leaf counts 2^9 and 2^12 as constants instead of pow2 calls in the FORS and hypertree loops",
          "value": 1.0064266498901686
        },
        {
          "at": "2026-12-05T21:59:38Z",
          "by": "baseline",
          "commit": "dece57fc43ed7bfbe05ef4b0d7d760cfe4dcb2fb",
          "diff": null,
          "min_improvement_bips": 250,
          "model": "",
          "reason": "",
          "record_before": null,
          "runs": [
            {
              "host": "github-actions Linux 20261129.29.1; linux x86_64; AMD EPYC 7763 64-Core Processor; 4 cpus",
              "metrics": {
                "cpu_max": 48606926041,
                "cpu_mean": 44656854119.59375,
                "exec_fee_ratio": 1.0,
                "fee_ratio": 1.0,
                "fidelity_wrapper_exec_fee": 7567413.662592975,
                "fidelity_wrapper_fee": 7600548.662592975,
                "fits_tx": false,
                "mem_max": 81683361,
                "mem_mean": 75812231.4375,
                "ref_script_fee_lovelace": 31155.0,
                "script_bytes": 2074
              },
              "paired_ratio": null,
              "sandboxed": true,
              "seed": "13770513387099233791",
              "status": "valid",
              "value": 1.0
            },
            {
              "host": "github-actions Linux 20261129.29.1; linux x86_64; Intel(R) Xeon(R) 6975P-C; 4 cpus",
              "metrics": {
                "cpu_max": 48058886865,
                "cpu_mean": 44648020207.9375,
                "exec_fee_ratio": 1.0,
                "fee_ratio": 1.0,
                "fidelity_wrapper_exec_fee": 7491109.72800075,
                "fidelity_wrapper_fee": 7524244.72800075,
                "fits_tx": false,
                "mem_max": 80867081,
                "mem_mean": 75799454.609375,
                "ref_script_fee_lovelace": 31155.0,
                "script_bytes": 2074
              },
              "paired_ratio": null,
              "sandboxed": true,
              "seed": "5326222261576687510",
              "status": "valid",
              "value": 1.0
            }
          ],
          "stage": "baseline",
          "status": "baseline",
          "submission": "baseline",
          "value": 1.0
        }
      ],
      "baseline": {
        "at": "2026-12-05T21:59:38Z",
        "value": 1.0
      },
      "board": [],
      "budget": [
        {
          "key": "cpu_max",
          "label": "Compute",
          "limit": 10000000000.0,
          "now": 48332906453.0,
          "started": 48332906453.0
        },
        {
          "key": "mem_max",
          "label": "Memory",
          "limit": 16500000.0,
          "now": 81275221.0,
          "started": 81275221.0
        },
        {
          "key": "script_bytes",
          "label": "Program size",
          "limit": 16384.0,
          "now": 2074.0,
          "started": 2074.0
        }
      ],
      "context": {
        "agent_prompt": "",
        "budget": [
          {
            "key": "cpu_max",
            "label": "Compute",
            "limit": 10000000000.0
          },
          {
            "key": "mem_max",
            "label": "Memory",
            "limit": 16500000.0
          },
          {
            "key": "script_bytes",
            "label": "Program size",
            "limit": 16384.0
          }
        ],
        "calls": null,
        "cautions": [
          "The record may not fit one transaction: `fits_tx` is on every row, and nothing requires a record to fit.",
          "A program over about 16,000 bytes could not be published as a reference script (the transaction that publishes it is itself capped at 16,384 bytes), though the judge accepts programs up to 16,384 bytes.",
          "The score is the fee of running the verifier alone (execution plus its reference-script bytes). The signature's 8,104 bytes on the wire (7,856 inside Data, in 64-byte chunks) cost about 0.36 ADA of size fee at 44 lovelace a byte, which no metric includes.",
          "The judge does not check the node's run-time limits on oversized integers and bytestrings passed to builtins (THREAT_MODEL.md, Known judge limits).",
          "The case generator is RustCrypto `slh-dsa` 0.2.0, first released 2026-12-03; it is checked against NIST's known-answer vectors, an independent Python verifier and OpenSSL."
        ],
        "checks": [
          {
            "cases": 16,
            "catches": "fresh keys, messages of 0 to 1,024 bytes",
            "group": "Valid signatures"
          },
          {
            "cases": 3,
            "catches": "empty, 1-byte and 4,096-byte messages",
            "group": "Message lengths"
          },
          {
            "cases": 7,
            "catches": "first and last leaves and trees; unused index bits set",
            "group": "Edge positions"
          },
          {
            "cases": 6,
            "catches": "key or signature too short, too long, empty",
            "group": "Wrong sizes"
          },
          {
            "cases": 4,
            "catches": "a context, pre-hash, raw message, another key",
            "group": "Wrong mode or key"
          },
          {
            "cases": 67,
            "catches": "one bit changed in every part of the signature, or in the message",
            "group": "Flipped bits"
          },
          {
            "cases": 32,
            "catches": "one byte of the public key changed",
            "group": "Tampered keys"
          }
        ],
        "cost": {
          "baseline": 7646339.0,
          "per": "signature check",
          "unit": "lovelace"
        },
        "diagram": "           public key (root)\n                  ▲\n     hypertree: 7 layers of trees,\n            9 levels each\n                  ▲\n    14 FORS trees sign the message\n\n signature = 7,856 bytes, ~2,100 hashes",
        "diagram_caption": "How an SLH-DSA signature is checked: hash from the message up through the FORS trees, then up seven layers of trees to the public key.",
        "diagram_title": "slh-dsa-key.txt",
        "flow": [],
        "headline": "Reduce the cost of verifying SLH-DSA signatures on Cardano.",
        "judge_note": "It's a faithful re-implementation with extra safety checks. Every new record is also run on the real node's evaluator (Haskell uplc), and the two must agree before it counts. THREAT_MODEL.md lists the known differences.",
        "links": [],
        "metrics": [
          {
            "better": "higher",
            "key": "fee_ratio",
            "label": "Fee ratio vs the reference",
            "note": "",
            "unit": "×"
          },
          {
            "better": "higher",
            "key": "exec_fee_ratio",
            "label": "Execution-fee ratio vs the reference",
            "note": "",
            "unit": "×"
          },
          {
            "better": "lower",
            "key": "ref_script_fee_lovelace",
            "label": "Reference-script fee",
            "note": "",
            "unit": "lovelace"
          },
          {
            "better": "lower",
            "key": "script_bytes",
            "label": "Script size",
            "note": "",
            "unit": "bytes"
          },
          {
            "better": "lower",
            "key": "cpu_mean",
            "label": "CPU per signature (mean)",
            "note": "",
            "unit": "steps"
          },
          {
            "better": "lower",
            "key": "mem_mean",
            "label": "Memory per signature (mean)",
            "note": "",
            "unit": "units"
          },
          {
            "better": "lower",
            "key": "cpu_max",
            "label": "CPU, worst signature",
            "note": "",
            "unit": "steps"
          },
          {
            "better": "lower",
            "key": "mem_max",
            "label": "Memory, worst signature",
            "note": "",
            "unit": "units"
          },
          {
            "better": "",
            "key": "fits_tx",
            "label": "Fits one transaction",
            "note": "",
            "unit": ""
          },
          {
            "better": "lower",
            "key": "fidelity_wrapper_fee",
            "label": "Fee inside the example validator (mean)",
            "note": "Reported, never ranked: the candidate run inside judge/wrapper/ (a stateless-lock Plutus V3 validator), execution plus the reference-script fee of both scripts; not the transaction's size fee.",
            "unit": "lovelace"
          },
          {
            "better": "lower",
            "key": "fidelity_wrapper_exec_fee",
            "label": "Execution fee inside the example validator (mean)",
            "note": "",
            "unit": "lovelace"
          }
        ],
        "name": "SLH-DSA",
        "one_line": "Verify SLH-DSA-SHA2-128s (FIPS 205) signatures in a Plutus V3 script as cheaply as possible; the secondary goal is a program that fits one transaction.",
        "params": "FIPS 205 · SHA2-128s · SHA-256",
        "plain": [
          "Every Cardano wallet today proves ownership with a signature (Ed25519) that a large enough quantum computer could forge.",
          "SLH-DSA is NIST's standard hash-based signature, built only from hash functions, which quantum computers are not expected to break. Unlike LMS, the signer keeps no state, so a key can sign safely any number of times. Cardano smart contracts can already check one, but it's very expensive: the starting program costs about 7.65 ₳ per check and nearly five times the compute one transaction allows.",
          "Your job: make that check cheaper, without ever accepting a bad signature. A program cheap enough to fit in one transaction would make stateless quantum-safe wallets on Cardano possible today."
        ],
        "rules": [
          "Change only the program (program.flat.hex) and its source.",
          "Never accept a bad signature. It's tested on 135 fresh cases, valid and broken.",
          "Beat the record by 2.5%, measured on 64 fresh signatures.",
          "One entry per pull request, up to 10 a day.",
          "Be honest about which AI model helped, or leave it out."
        ],
        "scoring": {
          "explain": [
            "Size is paid every time the program runs, so a smaller program and a faster program both help. Trading one for the other is most of the game.",
            "Your score is the starting program's fee divided by yours, so higher wins. The starting program costs about 7.65 ₳ per check; a score of 4× means about 1.91 ₳.",
            "The starting program does not fit in one transaction, so programs that don't fit can still score and hold the record. A score of about 4.49× is roughly where a program could fit; whether its costliest signature really fits is shown separately and never changes the ranking.",
            "Each run makes a new key and 64 new signatures from a fresh seed, so there is no fixed test to memorise. Before it is scored, your program must answer all 135 correctness cases."
          ],
          "formula": "fee = memory × 0.0577 + compute × 0.0000721 + bytes × 15  (lovelace)"
        },
        "sources": [
          "https://doi.org/10.6028/NIST.FIPS.205",
          "https://github.com/cardano-foundation/CIPs/pull/1300",
          "https://github.com/cardano-foundation/CIPs/tree/master/CPS-0027",
          "https://github.com/usnistgov/ACVP-Server/tree/c719d09ba78c58c8a2083f0967c23fafb2e088bc",
          "https://ethresear.ch/t/sphincs-minus-efficient-stateless-post-quantum-signature-verification-on-the-evm/25165",
          "https://github.com/Ryun1/auto-research-challenge-builder/issues/121"
        ],
        "stakes": "SLH-DSA is NIST's stateless hash-based signature scheme (FIPS 205), built on SHA-256 alone, and `sha2_256` is a Plutus builtin: a Plutus V3 script can check an SLH-DSA signature on Cardano mainnet today, with no hard fork. Unlike LMS (the aiken-lms challenge), the key holder tracks no state. CIP-0206 proposes a native builtin instead, which needs a hard fork and a calibrated cost model. A plain verifier costs about 7.6 ADA a signature and is about 4.9 times over one transaction's budget, so the challenge has a secondary goal beside the ranked score: a program that fits one transaction (`fits_tx` true; reported, never ranked). The best result also tells CIP-0206 what a builtin would save.",
        "title": "SLH-DSA signatures in Plutus V3",
        "value_levers": [],
        "why_this_instance": "One parameter set, SLH-DSA-SHA2-128s (n 16, h 63, d 7, h′ 9, a 12, k 14, w 16): a 32-byte key and a 7,856-byte signature, the smallest signature of the SHA-2 sets (128f's 17,088 bytes do not fit a transaction). Pure mode with an empty context, M′ = `0x00 ‖ 0x00 ‖ msg`, as in CIP-0206. The score is the mean fee of verifying 64 fresh signatures under a fresh key (messages of 32 bytes, or 0 to 1,024 bytes); it says nothing about other parameter sets, pre-hash mode or contexts. For scale: `verifyEd25519Signature` costs about 53 million steps (Ryun1/auto-research-challenge-builder#121); CIP-0206 quotes 0.84 ms for ML-DSA-44 and 0.92 ms for this set natively; ML-DSA cannot be built from today's builtins (there is no SHAKE)."
      },
      "cost": {
        "now": 7646339.0,
        "per": "signature check",
        "unit": "lovelace",
        "was": 7646339.0
      },
      "direction": "maximise",
      "display": {
        "diagram": "           public key (root)\n                  ▲\n     hypertree: 7 layers of trees,\n            9 levels each\n                  ▲\n    14 FORS trees sign the message\n\n signature = 7,856 bytes, ~2,100 hashes",
        "diagram_caption": "How an SLH-DSA signature is checked: hash from the message up through the FORS trees, then up seven layers of trees to the public key.",
        "diagram_title": "slh-dsa-key.txt",
        "headline": "Reduce the cost of verifying SLH-DSA signatures on Cardano.",
        "name": "SLH-DSA",
        "params": "FIPS 205 · SHA2-128s · SHA-256",
        "plain": [
          "Every Cardano wallet today proves ownership with a signature (Ed25519) that a large enough quantum computer could forge.",
          "SLH-DSA is NIST's standard hash-based signature, built only from hash functions, which quantum computers are not expected to break. Unlike LMS, the signer keeps no state, so a key can sign safely any number of times. Cardano smart contracts can already check one, but it's very expensive: the starting program costs about 7.65 ₳ per check and nearly five times the compute one transaction allows.",
          "Your job: make that check cheaper, without ever accepting a bad signature. A program cheap enough to fit in one transaction would make stateless quantum-safe wallets on Cardano possible today."
        ],
        "rules": [
          "Change only the program (program.flat.hex) and its source.",
          "Never accept a bad signature. It's tested on 135 fresh cases, valid and broken.",
          "Beat the record by 2.5%, measured on 64 fresh signatures.",
          "One entry per pull request, up to 10 a day.",
          "Be honest about which AI model helped, or leave it out."
        ],
        "title": "SLH-DSA signatures in Plutus V3"
      },
      "editable": [
        "program.flat.hex",
        "src/"
      ],
      "family": "resource",
      "feed": "feeds/plutus-slh-dsa.json",
      "judging": {
        "pairing": "two independent runs on main must both clear the bar, or both miss it",
        "runner": "ubuntu-24.04",
        "salted_inputs": true,
        "statistic": "the challenge's score command"
      },
      "max_bytes": 1048576,
      "max_patch_bytes": 262144,
      "metric": "fee_ratio",
      "min_improvement_bips": 250,
      "page": "plutus-slh-dsa/index.html",
      "patch_mode": true,
      "patches": [
        {
          "attempts": [
            0
          ],
          "builds_on": "baseline",
          "built_on_by": [],
          "by": "Ryun1",
          "diff": "diffs/plutus-slh-dsa/ryun1-slh-tree-consts.patch",
          "first_at": "2026-12-06T01:23:57Z",
          "harness": "claude-code",
          "id": "ryun1-slh-tree-consts",
          "landed": true,
          "last_at": "2026-12-06T01:23:57Z",
          "model": "claude-opus-5-5",
          "pr": 25,
          "summary": "Tree leaf counts 2^9 and 2^12 as constants instead of pow2 calls in the FORS and hypertree loops",
          "value": 1.0064266498901686,
          "verdict": "deciding"
        }
      ],
      "prompt": "# Task: a cheaper Plutus V3 program for plutus-slh-dsa\n\nYou are improving one Plutus V3 program. Your goal is to maximise\n`fee_ratio`: the mainnet fee of running the reference program over a\nworkload, divided by the fee of running yours, while your program stays\ncorrect on every case the verifier checks. There is a secondary goal,\nnever ranked: a program that fits one transaction (\"What you must beat\"\nbelow).\n\n## The program and its interface\n\nThe program is applied to Data arguments and must return the expected value.\nIt verifies one SLH-DSA-SHA2-128s signature (FIPS 205) in pure mode with an\nempty context, that is over M′ = `0x00 ‖ 0x00 ‖ msg`, the convention of\nCIP-0206. It takes three Data bytestrings (`B`): the public key (32 bytes,\n`PK.seed ‖ PK.root`), the message (any length) and the signature (7,856\nbytes). It returns a V3 `bool` constant, not Data and not an integer: a\nprogram that returns `Constr 1 []` or `1` fails at the first case. If the\nsignature is a valid signature of the message under the key, it must\nreturn `True`. For anything else of the right lengths (a changed bit\nanywhere, a signature made with a context, in pre-hash mode or by the\ninternal interface, a valid signature under another key), it must return\n`False`. Where the key is not 32 bytes or the signature not 7,856 bytes,\n`False` and an evaluation error are both accepted. Running out of budget is\nnever an accepted answer. In the judge's words (`iface::CONTRACT`,\nverbatim): `a valid SLH-DSA-SHA2-128s signature (FIPS 205, pure, empty context: M' = 00 00 msg) of msg under the 32-byte pk returns True; anything else of the right lengths returns False; a pk that is not 32 bytes or a sig that is not 7,856 bytes returns False or fails with an evaluation error`.\n\nThe baseline is a plain transcription of FIPS 205's verification in Aiken,\n`work/plutus-slh-dsa/src/lib/slh.ak`, compiled with Aiken v1.1.21 (`aiken\nexport --module slh --name slh_verify --trace-level silent`, whose\n`compiledCode` `uplc-judge import` turns into `program.flat.hex`): the\nmodule is `slh` and the function `slh_verify`. You may work in Aiken, in\ntextual UPLC, or in anything else that produces a Plutus V3 program.\n\nThe verifier signs with fresh keys drawn from a seed you cannot know in\nadvance (`CB_SEED`, fresh per run): valid signatures on messages of random\nlength, of 0, 1 and 4,096 bytes, and on messages chosen so that the\ndigest's tree and leaf indices sit at their ends (0, 511, 4,095) or have\ntheir unused bits set; keys and signatures of the wrong length; signatures\nmade with a context, in pre-hash mode, by the internal interface or under\nanother key; each of the 64 signatures the same run scores with one bit\nflipped, and messages with one bit flipped or one byte appended; and keys\nwith one byte of the root or the seed changed, with the root traps signed\nagain so that only that byte of the recomputed root disagrees. A program\nthat is right only on the cases you have seen, that skips any check FIPS\n205 requires, or that answers `True` without verifying when some test of\nits inputs passes, will fail.\n\n## What you may edit\n\nEdit only `work/plutus-slh-dsa/program.flat.hex` (the scored program, the\nflat encoding as hex text) and files under `work/plutus-slh-dsa/src/` (your\nsource, kept for review, never built or read by the judge). Never edit\nanything else: not the challenge directory `challenges/plutus-slh-dsa/`,\nnot the judge, not the reference, and no other file in the repository. A\npatch that touches any other path is refused.\n\n`cb patch` takes every file under `work/plutus-slh-dsa/` that differs from\nthe baseline. To build the Aiken source into the program file, run\n`scripts/dev/build-program.sh work/plutus-slh-dsa/src work/plutus-slh-dsa/program.flat.hex plutus-slh-dsa slh slh_verify`\nfrom the repository root (it runs `aiken export` there and writes the hex;\nif you rename the module or the function, pass your names as its last two\narguments instead). Then delete what the build leaves before `cb patch`:\n`rm -rf work/plutus-slh-dsa/src/build work/plutus-slh-dsa/src/aiken.lock work/plutus-slh-dsa/src/plutus.json`,\nand any `.DS_Store`: `find work/plutus-slh-dsa -name .DS_Store -delete`.\nLeft in, `build/` makes `cb patch` refuse (it holds an empty file),\n`aiken.lock` and `plutus.json` are carried in your patch, and a `.DS_Store`\nis refused outside `src/` and carried inside it. Check the list `cb patch`\nprints under \"The patch carries\".\n\nUse the network only as the commands below need it (`cb` and `setup.sh`\nfetch nothing else; the first `./setup.sh` may download the pinned Rust\ntoolchain through rustup, and downloads the judge's crates). Do not download or run other executables.\n\n## What you must beat, and what you can build on\n\nThe bar is the current record, not the baseline. Find it in\n`challenges/plutus-slh-dsa/results.jsonl`: the last line whose `status` is\n`promoted` (or the `baseline` line if there is none), with its\n`submission` id and `value` (`fee_ratio` against the baseline);\n`jq -c 'select(.status == \"promoted\" or .status == \"baseline\") | {submission, by, value}' challenges/plutus-slh-dsa/results.jsonl | tail -n 1`\nprints it. A submission becomes the record only if Accept measures it at\nleast 1.025 times the record on the same samples; below that, a valid patch\nlands as `valid_not_promoted` and changes nothing. `cb score` reports\n`fee_ratio` against the baseline; add `--against-record`, as\n`cb score plutus-slh-dsa --patch \"challenges/plutus-slh-dsa/submissions/$ID.patch\" --against-record`,\nand `score.json` also has `paired.ratio`, the program against the record's\non the same samples, which must be at least 1.025.\n\nThe secondary goal is a program that fits one transaction: `fits_tx` true, meaning its worst workload case is within 10,000,000,000 steps and 16,500,000 memory. It is not ranked and nothing enforces it; the first valid submission whose row in `results.jsonl` has `fits_tx` true has reached it.\n\nAfter `cb score`, `jq .metrics.fits_tx score.json` says whether your\nprogram fits; `metrics.cpu_max` and `metrics.mem_max` say by how much. The\nbaseline is 4.83 times over the step limit and 4.93 times over the memory\nlimit. A program over about 16,000 bytes could not be published on\nmainnet, though the judge accepts up to 16,384. Tell your user if a\nprogram you made fits.\n\nEvery landed patch is in `challenges/plutus-slh-dsa/submissions/`, with its\nnotes and its source under `src/`: read them before you start, and tell\nyour user what the record does. To start from one instead of the\nbaseline, run `cb work plutus-slh-dsa --from` followed by its id\n(`--force` replaces an existing `work/plutus-slh-dsa/`, so ask first). The\npatch then still applies to the baseline and carries that submission's\nchanges too.\n\n## Commands\n\nYour submission id is your user's GitHub login in lower case, a hyphen and\na short name, for example `alice-seed-block-once`; ask your user for the\nlogin if you do not know it. Replace `yourlogin-short-name` on the first\nline of each block below with it. Run every block from the root of a clone\nof your user's fork (`gh repo fork Ryun1/cardano-pq-challenges --clone`\nmakes one, in `cardano-pq-challenges/`). The first block puts `cb` on the\nPATH, makes a branch and copies the baseline to `work/plutus-slh-dsa/`:\n\n```sh\nID=yourlogin-short-name\nscripts/get-cb.sh && export PATH=\"$PWD/.cb/bin:$PATH\"\n[ \"$ID\" != yourlogin-short-name ] && git switch -c \"$ID\" && cb work plutus-slh-dsa\n```\n\nIf this block runs with its first line unedited, `cb` is still downloaded\nand put on the PATH, but no branch and no `work/` directory are made. Then,\nin the same shell, set `ID` (`ID=` followed by the id) and run only the\nblock's last line:\n\n```sh\n[ \"$ID\" != yourlogin-short-name ] && git switch -c \"$ID\" && cb work plutus-slh-dsa\n```\n\nWhile you work, from the repository root (`./setup.sh` builds the judge\nonce; `program.uplc` stands for your textual program):\n\n```sh\n(cd challenges/plutus-slh-dsa && ./setup.sh)\nchall…",
      "record": null,
      "rules_file": false,
      "slug": "plutus-slh-dsa",
      "state": "open",
      "status": "open",
      "submission_mode": "patch",
      "submit_steps": [
        "Get a copy to edit. Fork the repository and clone your fork. In the clone.",
        "Edit the program. Edit work/plutus-slh-dsa/program.flat.hex: the flat encoding of a Plutus V3 program, as hex text. Any line width and either case are fine, and spaces, tabs and line breaks anywhere are ignored. A UTF-8 byte-order mark is refused, as is any other byte. The file must hold bare flat, not a CBOR bytestring.",
        "Check it locally. The second block above runs these two, with $ID your id.",
        "Open a pull request. Commit only challenges/plutus-slh-dsa/submissions/$ID.patch and open a pull request that adds exactly that one file. The judging workflows verify and score it and comment the result on the pull request: that score is a claim. If its status is valid, the patch lands on main (committed with you as its author, whether or not it beats the record) and the pull request is closed…"
      ],
      "summary": "Make verifying an SLH-DSA-SHA2-128s signature (FIPS 205, hash-based, stateless and post-quantum) in a Plutus V3 script cost less in mainnet fees. A submission is a Plutus V3 program, flat-encoded, as hex text in program.flat.hex. The judge checks that it is a program a Cardano node at protocol version 11 would accept, runs it on Data arguments, checks every result and prices each run as mainnet would. The judge was made from the UPLC kit of cb; the file KIT_VERSION names the kit version.",
      "targets": [
        {
          "comparable": "comparable",
          "id": "fits-one-tx",
          "label": "Lowest score of a program that fits one transaction",
          "note": "A program whose worst case fits one transaction (10,000,000,000 steps, 16,500,000 memory) costs at most 1,673,050 lovelace to run, plus its script bytes. Against the reference's mean of 7,646,339 lovelace that is at least this ratio, for a program of the baseline's size; each extra 1,000 bytes lowers it by about 0.04. Necessary, not sufficient: a higher score does not mean the program fits; fits_tx says.",
          "source": "Mainnet limits and prices (judge/cost-model/mainnet.json) and the reference's mean fee on the seed-1000 workload",
          "status": "derived",
          "value": 4.49,
          "values": {},
          "year": null
        },
        {
          "comparable": "different",
          "id": "sha2-floor",
          "label": "The sha2_256 calls alone",
          "note": "About 1.22e9 steps of the sha2_256 builtin alone, about 87 times cheaper than the reference: no memory, no script bytes and none of the work around the hashes. Not a program; a ceiling no honest verifier reaches.",
          "source": "About 2,125 sha2_256 calls per verification (FIPS 205, SLH-DSA-SHA2-128s) priced with the pinned cost model; counted by the challenge's Python reference",
          "status": "composite",
          "value": 86.9,
          "values": {},
          "year": null
        },
        {
          "comparable": "different",
          "id": "cip-0206-builtin",
          "label": "A native builtin at CIP-0206's quoted time",
          "note": "0.92 ms turned into 920,000,000 steps by the convention that one step is one picosecond, priced at 0.0000721 lovelace a step, with no memory and no script bytes. The convention is not a costing: CIP-0206 says its times indicate relative cost only, and a real builtin's cost model would be calibrated from benchmarks.",
          "source": "CIP-0206 (cardano-foundation/CIPs PR #1300), Sizes and cost: SLH-DSA-SHA2-128s reference verify about 0.92 ms",
          "status": "composite",
          "value": 115.3,
          "values": {},
          "year": 2026
        }
      ],
      "threat_model": [
        {
          "items": [
            "Finite or reusable inputs (is the input set fresh per run? how many?): Fresh. The contract (iface::CONTRACT): a valid SLH-DSA-SHA2-128s signature (FIPS 205, pure, empty context: M' = 00 00 msg) of msg under the 32-byte pk returns True; anything else of the right lengths returns False; a pk that is not 32 bytes or a sig that is not 7,856 bytes returns False or fails with an evaluation error. Each verify run has 135 cases, made from CB_SEED (ChaCha20, a seed cb draws per run and records afterwards) under four fresh keys and, for the 64 twins in mutation, the workload's key, in this order, each c…",
            "Caching or precomputation (can a table or memo pay off without knowing the seed?): No. The keys, messages and signatures are drawn from the seed, so they are unknown until the run; no public vector (the ACVP and CIP-0206 vectors in vectors/ included) is a case, and a table of answers has nothing to be keyed on.",
            "Reading the reference, oracle, seed or expected output: Not possible. The submission is data: the judge decodes candidate/program.flat.hex and evaluates it with only the case's arguments. A Plutus program has no I/O, so it cannot read files, the seed, the reference or the expected values. The judge never builds, runs or reads src/.",
            "Timing tricks (detecting the benchmark, doing less work when measured): N/A. The score is the execution budget the evaluator counts (cpu and mem units, deterministic for a program and its arguments) and the program's size, not wall time. Verify and bench evaluate the same way, and the program cannot tell which is running.",
            "Writing the score file directly, or editing anything outside the editable paths: Not possible. A submission is one patch that may touch only program.flat.hex and src/ in the baseline tree; the gate refuses anything else, and the patched tree is scored by the trusted judge/ built by setup.sh. The program runs inside the evaluator and writes nothing.",
            "Hostile program bytes. The file is parsed as hex (a BOM or any foreign byte is refused with its offset); the flat bytes are capped at 16,384 before decoding; a bounds-checked reading refuses what the node's decoder refuses and terms nested past 32,768 or Data past 16,384 before the uplc crate decodes; reading, decoding and evaluation run on a guarded thread with a 1 GiB stack: a panic while reading or decoding the program is reported as judge-fault (the judge's failure), and a panic in the evaluator as evaluator-panic, which fails the candidate's case. A program can still overflow that stack o…",
            "Time. The evaluation budget (100,000,000,000 cpu, 165,000,000 mem per case) does not bound wall time, so a watchdog stops a case after 90 s, a verify run after 120 s + 4 s per case, and each program in bench after 120 s + 4 s per workload case (plutus-slh-dsa's own limits, iface::TIME_LIMITS, raised from the kit's 60 s + 0.8 s because an honest case here costs about half the evaluation budget), printing one JSON object. A trip while the candidate runs fails the candidate; a trip while the reference runs is infrastructure. cb itself stops a run after 3,600 s (as infrastructure); with the kit's …",
            "A missing or unreadable candidate/program.flat.hex is the submission's failure (cannot read candidate/program.flat.hex, exit 1), not infrastructure."
          ],
          "title": "How could a wrong answer pass the verifier?"
        },
        {
          "items": [
            "Who reviews: nobody before promotion; the maintainer reads every promotion afterwards. A result that clears the bar in both Accept runs is the record, whatever its size, provided the Haskell differential that Accept runs on it (scripts/ci/accept-differential.sh) ran and agreed."
          ],
          "title": "What does a large outlier (+100%) trigger?"
        },
        {
          "items": [
            "Run-time node bounds are checked only by the Haskell differential (judge/differential/, on Linux x86_64 in GitHub Actions). On mainnet, an integer outside ±2^262143 or a bytestring over 65,536 bytes passed to an arithmetic or bytestring builtin fails; the uplc crate has no hook for these bounds, so the judge checks them only on constants and arguments (judge/cost-model/NODE_LIMITS.md, \"The gap\"). The differential runs on the kit's fixed programs and probes in the builder's CI (Ryun1/auto-research-challenge-builder); here, on the baseline in the Preflight workflow (dispatched by the maintainer)…",
            "The differential compares a result exactly only when it is an integer, bool, unit, bytestring or Data; any other result is \"not compared\", never agreement.",
            "The cost model is pinned at protocol version 11, epoch 671 (judge/cost-model/SOURCE.md). judge/cost-model/check-koios.sh detects drift against mainnet; it does not re-pin. The Preflight workflow, dispatched by the maintainer, runs it; no workflow runs it on a schedule.",
            "The judge evaluates with the uplc crate 1.1.24, not the node, plus guards where the crate was found to accept what the node rejects (sliceByteString, \"Known divergences\" row 3). Builtins the crate cannot run (the array builtins 89–91) and constants it cannot decode (arrays, and BLS12-381 constants of any type, even inside an empty list) are refused when the program is read, though mainnet accepts arrays.",
            "fits_tx and the publishing size are reported, not enforced. The kit refuses a candidate that does not fit one transaction only when the reference fits; here the reference does not, so a program that does not fit can score, land and hold the record, and a record above about 16,000 bytes could not be published as a reference script. Enforcing either would need a kit change.",
            "The case generator, RustCrypto slh-dsa 0.2.0, was first released on 2026-12-03, two days before this challenge was written. It is pinned exactly; it must reproduce the ACVP sigGen vector tc159 byte for byte from its secret key; and its signatures are checked by three independent verifiers: the Python verifier judge/crosscheck/slh_ref.py (in the harness tests and in the Preflight workflow), OpenSSL, and the baseline itself.",
            "OpenSSL is checked locally only (judge/crosscheck/openssl-check.sh, which needs OpenSSL 3.5 or later): the ubuntu-24.04 runner ships OpenSSL 3.0, which has no SLH-DSA. It was run by the maintainer before launch (20 generated signatures accepted, 20 flipped ones rejected, 20 deterministic signatures byte-identical); CI's independent check is the Python verifier.",
            "A skip keyed on a hash of all three arguments. The workload twins stop a program that skips verification when a cheap test of its inputs passes, unless the test depends on every signature byte: a program that skips verification when a hash of all three arguments falls under a threshold passes a verify run with a small probability. To gain 2.5% it must skip about 1 input in 40. Only the cases expecting False can expose it: foreign, mutation and trap, 103 cases (and shape too, if it skips before checking the lengths). So it passes a verify run with probability (39/40)^103 ≈ 0.074, about 1 in 13;…"
          ],
          "title": "Known judge limits"
        },
        {
          "items": [
            "A rejected program can come back. Only a rejected patch's id is blocked. The duplicate rule compares a new patch's tree with the patches present on main, and a rejected patch's file is deleted, so the same program can be submitted again under a new id (or with src/ changed). A program that is wrong on a fraction of seeds can retry until its pull-request seed and both Accept seeds pass, and then hold the record. If a record is found wrong, the maintainer fixes the verifier's cases in a pull request and, in the same pull request, deletes that submission's promoted line from results.jsonl: the re…",
            "Cheap valid patches delay real ones. Every valid patch lands, whether or not it beats the record, and Accept decides landed patches one at a time, oldest first, each with two scoring runs and the differential. Someone who lands many valid patches that beat nothing pushes back everyone else's verdict. The daily limit (an account's first 10 Submission runs in any 24 hours are judged) bounds this per account, not overall. Accept drains challenges in slug order: this challenge's patches wait behind aiken-lms's."
          ],
          "title": "What the pipeline does not prevent"
        }
      ],
      "title": null,
      "to_beat": 1.025,
      "to_beat_strict": false
    }
  ],
  "generated_at": "2026-12-06T01:24:50Z",
  "site": {
    "accent": "#1d5fd6",
    "accent_dark": "#7fb0ff",
    "intro": "Make post-quantum signature checks cheap enough to use on Cardano mainnet today. Anyone can enter from a fork; every attempt is scored in public.",
    "repo": "Ryun1/cardano-pq-challenges",
    "title": "improve.blue"
  },
  "site_schema_version": 2,
  "upcoming": [
    {
      "link": "https://github.com/Ryun1/auto-research-challenge-builder/issues/123",
      "one_line": "Cut the zkVM execution cost of proving you own a Cardano key without revealing it.",
      "slug": "zkposp-guest-cycles",
      "title": "Cheaper key-ownership proofs in OpenVM (CIP-0197)",
      "when": "Later"
    }
  ]
}
