# Vault escrow lifecycle

> Find the next status of an escrow in the PrismPM Vault from the step applied to it. Then locking, release and refund can be replayed.

Inspired by afflom/aistudio-experiment (https://github.com/afflom/aistudio-experiment). A PrismPM model and runtime studio that simulates a verifiable digital-asset escrow and settlement vault. Pattern: State machine, OMG UML 2.5.1 behavioral state machine. To write one of your own, follow How to build a state machine app (../../guides/state-machine/index.md). The prompt below is data, quoted from the example.

**Figure: The Vault escrow lifecycle state machine.** Each box is a state and each arrow a step a rule can take. A run starts at none and stops at released or refunded. Dashed arrows go back to an earlier state.

| From | Link | To |
| --- | --- | --- |
| none | REQ-003 | active |
| none | REQ-004 | none |
| active | otherwise | active |
| active | REQ-005 | released |
| active | REQ-006 | refunded |
| released | REQ-001 | released |
| refunded | REQ-002 | refunded |

Verified by prismpm verify in the pinned SDK. Fingerprint: 62b13899d216f4827a57f87919c1ccc9bccd174766473397865180c6943a0921. Acceptance vectors: 55. Claims: 8.

## The prompt

```json
{
  "schema": "prism/prompt/1",
  "goal": "Find the next status of an escrow in the PrismPM Vault from the step applied to it. Then locking, release and refund can be replayed.",
  "pattern": "stateMachine",
  "machine": {
    "state": "state",
    "initial": "none",
    "final": [
      "released",
      "refunded"
    ]
  },
  "repository": "afflom/aistudio-experiment",
  "license": "Apache-2.0",
  "app": {
    "name": "vault-escrow-lifecycle",
    "title": "Vault escrow lifecycle",
    "purpose": "Decide the next status of one escrow agreement from its status, the operation, the depositor funds, the preimage and the epochs.",
    "fields": [
      {
        "name": "state",
        "kind": "choice",
        "values": [
          "none",
          "active",
          "released",
          "refunded"
        ],
        "means": "the escrow status now; none means it has not been locked"
      },
      {
        "name": "event",
        "kind": "choice",
        "values": [
          "lock",
          "release",
          "refund"
        ],
        "means": "the Vault operation applied: LockEscrow, ReleaseEscrow or RefundEscrow"
      },
      {
        "name": "funds",
        "kind": "choice",
        "values": [
          "sufficient",
          "insufficient"
        ],
        "means": "whether the depositor balance covers a positive amount"
      },
      {
        "name": "preimage",
        "kind": "choice",
        "values": [
          "given",
          "empty"
        ],
        "means": "whether a condition preimage is supplied with a release"
      },
      {
        "name": "epoch",
        "kind": "number",
        "means": "the current ledger epoch"
      },
      {
        "name": "timeout",
        "kind": "number",
        "means": "the epoch at which the escrow expires"
      }
    ],
    "outcomes": [
      "none",
      "active",
      "released",
      "refunded"
    ],
    "meanings": {
      "none": "no escrow is locked and no funds are held",
      "active": "the amount is locked and counted in totalEscrowLocked",
      "released": "the amount went to the beneficiary; the escrow is settled",
      "refunded": "the amount went back to the depositor after timeout; the escrow is settled"
    },
    "rules": [
      {
        "when": [
          {
            "field": "state",
            "op": "is",
            "value": "released"
          }
        ],
        "then": "released",
        "why": "src/model/engine.ts: an escrow whose status is not active answers already released"
      },
      {
        "when": [
          {
            "field": "state",
            "op": "is",
            "value": "refunded"
          }
        ],
        "then": "refunded",
        "why": "src/model/engine.ts: an escrow whose status is not active answers already refunded"
      },
      {
        "when": [
          {
            "field": "state",
            "op": "is",
            "value": "none"
          },
          {
            "field": "event",
            "op": "is",
            "value": "lock"
          },
          {
            "field": "funds",
            "op": "is",
            "value": "sufficient"
          }
        ],
        "then": "active",
        "why": "src/model/engine.ts LockEscrow: a positive amount within the depositor balance is locked as active"
      },
      {
        "when": [
          {
            "field": "state",
            "op": "is",
            "value": "none"
          }
        ],
        "then": "none",
        "why": "src/model/engine.ts: release and refund answer escrow-not-found; a lock without funds answers insufficient-funds or invalid-amount"
      },
      {
        "when": [
          {
            "field": "state",
            "op": "is",
            "value": "active"
          },
          {
            "field": "event",
            "op": "is",
            "value": "release"
          },
          {
            "field": "preimage",
            "op": "is",
            "value": "given"
          }
        ],
        "then": "released",
        "why": "src/model/engine.ts ReleaseEscrow: conditionMatch holds for any non-empty preimage"
      },
      {
        "when": [
          {
            "field": "state",
            "op": "is",
            "value": "active"
          },
          {
            "field": "event",
            "op": "is",
            "value": "refund"
          },
          {
            "field": "epoch",
            "op": ">=",
            "value": {
              "field": "timeout"
            }
          }
        ],
        "then": "refunded",
        "why": "src/model/engine.ts RefundEscrow: currentEpoch below timeoutEpoch answers escrow-not-expired"
      }
    ],
    "otherwise": "active",
    "otherwiseWhy": "an empty preimage is a condition mismatch, an early refund is escrow-not-expired, and a lock creates a separate escrow",
    "properties": [
      {
        "kind": "never",
        "when": [
          {
            "field": "state",
            "op": "is",
            "value": "active"
          },
          {
            "field": "event",
            "op": "is",
            "value": "refund"
          },
          {
            "field": "epoch",
            "op": "<",
            "value": {
              "field": "timeout"
            }
          }
        ],
        "then": "refunded",
        "why": "src/model/engine.ts: refund is unavailable until timeout"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "state",
            "op": "is",
            "value": "active"
          },
          {
            "field": "event",
            "op": "is",
            "value": "release"
          },
          {
            "field": "preimage",
            "op": "is",
            "value": "empty"
          }
        ],
        "then": "released",
        "why": "src/model/engine.ts: an empty preimage does not satisfy the condition hash"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "state",
            "op": "is",
            "value": "none"
          },
          {
            "field": "funds",
            "op": "is",
            "value": "insufficient"
          }
        ],
        "then": "active",
        "why": "src/model/vaultSource.ts balanceNonNegativity: no lock exceeds the balance"
      }
    ],
    "examples": [
      {
        "request": "none lock sufficient empty 104 112",
        "response": "active"
      },
      {
        "request": "active release sufficient given 105 110",
        "response": "released"
      },
      {
        "request": "active refund sufficient empty 105 110",
        "response": "active"
      },
      {
        "request": "active refund sufficient empty 110 110",
        "response": "refunded"
      },
      {
        "request": "released refund sufficient empty 120 110",
        "response": "released"
      },
      {
        "request": "none lock insufficient empty 104 112",
        "response": "none"
      },
      {
        "request": "active release insufficient empty 105 110",
        "response": "active"
      }
    ]
  },
  "stakeholders": [
    {
      "name": "Depositor",
      "text": "Locks funds for a beneficiary and needs them back after timeout, and never twice.",
      "concerns": [
        "Correct answers",
        "Settled once"
      ]
    },
    {
      "name": "Beneficiary",
      "text": "Receives the escrow on release and needs a refund impossible before the timeout epoch.",
      "concerns": [
        "Proved guarantees"
      ]
    }
  ],
  "concerns": [
    {
      "name": "Settled once",
      "text": "A released or refunded escrow is never released or refunded again.",
      "model": "quality"
    }
  ],
  "components": [
    {
      "name": "PrismPM Model and Runtime Studio",
      "text": "The Vite studio that runs the Vault engine, the simulated build pipeline and the proof verifier in the browser.",
      "kind": "staticSite"
    },
    {
      "name": "PrismPM toolchain",
      "text": "The prismpm check, lexlean build, codegen and holo compose stages the studio simulates for the Vault model.",
      "kind": "cliAdapter"
    }
  ],
  "threats": [
    {
      "name": "Any preimage releases",
      "text": "A caller releases an escrow with any non-empty preimage, since the engine does not compare it with the condition hash.",
      "stride": "spoofing",
      "asset": "request",
      "likelihood": "high",
      "impact": "critical",
      "accepted": "This mirrors src/model/engine.ts as it is: conditionMatch holds for any non-empty preimage. The studio is a simulation, and a real hash check belongs to the LexLean Vault source it models."
    },
    {
      "name": "Early refund",
      "text": "A depositor refunds an active escrow before its timeout epoch.",
      "stride": "tampering",
      "asset": "answer",
      "likelihood": "medium",
      "impact": "major",
      "control": {
        "name": "Timeout guard",
        "text": "Refund leaves active only at or after the timeout epoch.",
        "evidence": [
          {
            "kind": "proof",
            "reference": "VaultEscrowLifecycleProofs::inv001Holds"
          },
          {
            "kind": "review",
            "reference": "src/model/engine.ts RefundEscrow"
          }
        ]
      }
    },
    {
      "name": "Double settlement",
      "text": "A settled escrow is released or refunded again, paying its amount twice.",
      "stride": "tampering",
      "asset": "answer",
      "likelihood": "medium",
      "impact": "critical",
      "control": {
        "name": "Final states",
        "text": "Released and refunded are final and never left; the builder derives and proves both invariants from machine.final.",
        "evidence": [
          {
            "kind": "proof",
            "reference": "VaultEscrowLifecycleProofs::inv004Holds"
          },
          {
            "kind": "proof",
            "reference": "VaultEscrowLifecycleProofs::inv005Holds"
          }
        ]
      }
    }
  ],
  "quality": [
    {
      "characteristic": "Functional suitability",
      "subcharacteristic": "Functional correctness",
      "requirement": "No refund before timeout",
      "text": "An active escrow is refunded only when the epoch has reached its timeout.",
      "measure": "Early refunds",
      "measureText": "Requests with epoch below timeout that refund an active escrow.",
      "threshold": 0
    },
    {
      "characteristic": "Reliability",
      "subcharacteristic": "Faultlessness",
      "requirement": "Settled escrows stay settled",
      "text": "No event moves a released or refunded escrow to another status.",
      "measure": "Transitions out of a final state",
      "measureText": "Requests in a final state that answer a different state.",
      "threshold": 0
    }
  ],
  "journeys": [
    {
      "stakeholder": "Depositor",
      "steps": [
        "REQ-003",
        "otherwise",
        "REQ-006",
        "INV-005"
      ]
    },
    {
      "stakeholder": "Beneficiary",
      "steps": [
        "REQ-003",
        "REQ-005",
        "INV-001",
        "INV-004"
      ]
    }
  ],
  "axioms": {}
}
```

## Claims

- VE-01: The app never answers refunded when state is active and event is refund and epoch is below timeout
- VE-02: The app never answers released when state is active and event is release and preimage is empty
- VE-03: The app never answers active when state is none and funds is insufficient
- VE-04: The app always answers released when state is released
- VE-05: The app always answers refunded when state is refunded
- VE-06: The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references
- VE-07: The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared
- VE-08: Every compliance obligation is numbered in order and names its evidence

## Pattern

State machine: OMG UML 2.5.1 behavioral state machine. The answer is the next state, given the current state and an event. This is a UML state machine written as one pure function. The state travels in the request, so the app keeps nothing between requests. The builder proves what holds over every run.

| Pattern | Standard | Answers |
| --- | --- | --- |
| State machine | OMG UML 2.5.1 behavioral state machine | none, active, released, refunded |

**Figure: Rules for each answer.** Each bar counts the rules that give one answer. When no rule matches, the answer is active.

|  | rules |
| --- | --- |
| none | 1 |
| active | 1 |
| released | 2 |
| refunded | 2 |

## Behavior

A request is state, event, funds, preimage, epoch, timeout, separated by spaces. The first rule that matches decides. If none matches, the answer is active. A request over 160 bytes, or in any other form, is answered invalid.

| Rule | When | Answer | Why |
| --- | --- | --- | --- |
| REQ-001 | state is released | released | src/model/engine.ts: an escrow whose status is not active answers already released |
| REQ-002 | state is refunded | refunded | src/model/engine.ts: an escrow whose status is not active answers already refunded |
| REQ-003 | state is none and event is lock and funds is sufficient | active | src/model/engine.ts LockEscrow: a positive amount within the depositor balance is locked as active |
| REQ-004 | state is none | none | src/model/engine.ts: release and refund answer escrow-not-found; a lock without funds answers insufficient-funds or invalid-amount |
| REQ-005 | state is active and event is release and preimage is given | released | src/model/engine.ts ReleaseEscrow: conditionMatch holds for any non-empty preimage |
| REQ-006 | state is active and event is refund and epoch is at least timeout | refunded | src/model/engine.ts RefundEscrow: currentEpoch below timeoutEpoch answers escrow-not-expired |
| otherwise | no rule matches | active | an empty preimage is a condition mismatch, an early refund is escrow-not-expired, and a lock creates a separate escrow |

## State machine

The state is state, and the answer is the next state. A run feeds each answer back in as the next state, starting from none (OMG UML 2.5.1, clause 14). All 432 requests of the spec's sample were stepped to find the states a run can reach. The invariants are INV-004, INV-005. Each holds for one step, so by induction it holds over every run.

| State | Kind | Meaning |
| --- | --- | --- |
| none | initial, reachable | no escrow is locked and no funds are held |
| active | reachable | the amount is locked and counted in totalEscrowLocked |
| released | final, reachable | the amount went to the beneficiary; the escrow is settled |
| refunded | final, reachable | the amount went back to the depositor after timeout; the escrow is settled |

## Transitions

Every step a reachable state can take, and the rule that takes it.

| From | To | By |
| --- | --- | --- |
| none | active | REQ-003 |
| none | none | REQ-004 |
| active | active | otherwise |
| active | released | REQ-005 |
| active | refunded | REQ-006 |
| released | released | REQ-001 |
| refunded | refunded | REQ-002 |

## Properties Lean proves

Each property is a theorem about the same definitions the app is built from. It is proved for every request, not only the tested ones.

| Property | Statement | Theorem | Why |
| --- | --- | --- | --- |
| INV-001 | It never answers refunded when state is active and event is refund and epoch is below timeout. | VaultEscrowLifecycleProofs::inv001Holds | src/model/engine.ts: refund is unavailable until timeout |
| INV-002 | It never answers released when state is active and event is release and preimage is empty. | VaultEscrowLifecycleProofs::inv002Holds | src/model/engine.ts: an empty preimage does not satisfy the condition hash |
| INV-003 | It never answers active when state is none and funds is insufficient. | VaultEscrowLifecycleProofs::inv003Holds | src/model/vaultSource.ts balanceNonNegativity: no lock exceeds the balance |
| INV-004 | It always answers released when state is released. | VaultEscrowLifecycleProofs::inv004Holds | released is a final state (UML 2.5.1 FinalState): a run that reaches it stays there |
| INV-005 | It always answers refunded when state is refunded. | VaultEscrowLifecycleProofs::inv005Holds | refunded is a final state (UML 2.5.1 FinalState): a run that reaches it stays there |

## Architecture

Stakeholders and the concerns each one views the app through (ISO/IEC/IEEE 42010).

| Stakeholder | Who they are | Concerns |
| --- | --- | --- |
| Beneficiary | Receives the escrow on release and needs a refund impossible before the timeout epoch. | Proved guarantees |
| Depositor | Locks funds for a beneficiary and needs them back after timeout, and never twice. | Correct answers, Settled once |
| Verifier | Anyone who loads the holo, checks its fingerprint and replays its acceptance vectors before trusting an answer. | Integrity of the published app, Refused malformed requests, Proved guarantees |

## Concerns

What the stakeholders care about, and the model each is viewed in.

| Concern | What it means | Model |
| --- | --- | --- |
| Correct answers | Every well-formed request is answered by the first rule that matches it, or active when none does, as the spec states. | quality |
| Integrity of the published app | What a visitor runs is the holo the build verified, with its fingerprint and signed provenance beside it. | security |
| Proved guarantees | Each of the 5 properties of the spec holds for every request, proved by the Lean kernel. | quality |
| Refused malformed requests | A request that is not the 6 fields in order, or is longer than 160 bytes, is answered invalid and never guessed. | security |
| Settled once | A released or refunded escrow is never released or refunded again. | quality |

## Components

8 components and 11 edges between them.

| Component | Kind | What it is |
| --- | --- | --- |
| Browser | externalSystem | The visitor's web browser, which loads the page and runs the Vault escrow lifecycle guest. |
| GitHub Pages | externalSystem | Serves the page and the holo from the repository Pages workflow. |
| Prism build | cliAdapter | prismpm verify in the SDK image prismpm.lock pins: it checks every theorem, builds the guest and replays every vector. |
| PrismPM Model and Runtime Studio | staticSite | The Vite studio that runs the Vault engine, the simulated build pipeline and the proof verifier in the browser. |
| PrismPM toolchain | cliAdapter | The prismpm check, lexlean build, codegen and holo compose stages the studio simulates for the Vault model. |
| Source repository | externalSystem | The repository that holds the prompt, the model and its gate. |
| Vault escrow lifecycle guest | service | The Core-Wasm guest built from the model: it answers one request of at most 160 bytes with one answer of at most 64. |
| Vault escrow lifecycle page | staticSite | The page the template publishes: the holo, its fingerprint, its provenance and its acceptance vectors. |

## Design views

The SDK checks each view against the system model and draws it as OPL and PlantUML.

| View | Diagram | Viewpoint |
| --- | --- | --- |
| Deciding a Vault escrow lifecycle request | opmObjectProcess | Depositor: Correct answers |
| Components of Vault escrow lifecycle | umlComponent | Verifier: Integrity of the published app |
| Answering a Vault escrow lifecycle request | umlSequence | Depositor: Correct answers |
| States of the Vault escrow lifecycle guest | umlStateMachine | Verifier: Refused malformed requests |
| The Vault escrow lifecycle state machine | umlStateMachine | Depositor: Correct answers |

## Features and journeys

13 features. Each names the definitions that do the work and the tests that accept it. Each stakeholder has one journey.

| Feature | Calls | Accepted by |
| --- | --- | --- |
| When state is released, the answer is released. | VaultEscrowLifecycle::rule1, VaultEscrowLifecycle::judge | VaultEscrowLifecycle::application |
| When state is refunded, the answer is refunded. | VaultEscrowLifecycle::rule2, VaultEscrowLifecycle::judge | VaultEscrowLifecycle::application |
| When state is none and event is lock and funds is sufficient, the answer is active. | VaultEscrowLifecycle::rule3, VaultEscrowLifecycle::judge | VaultEscrowLifecycle::application |
| When state is none, the answer is none. | VaultEscrowLifecycle::rule4, VaultEscrowLifecycle::judge | VaultEscrowLifecycle::application |
| When state is active and event is release and preimage is given, the answer is released. | VaultEscrowLifecycle::rule5, VaultEscrowLifecycle::judge | VaultEscrowLifecycle::application |
| When state is active and event is refund and epoch is at least timeout, the answer is refunded. | VaultEscrowLifecycle::rule6, VaultEscrowLifecycle::judge | VaultEscrowLifecycle::application |
| When no rule matches, the answer is active. | VaultEscrowLifecycle::judge | VaultEscrowLifecycle::application |
| A request that is not state, event, funds, preimage, epoch, timeout in order, separated by single spaces, or is over 160 bytes, is answered invalid. | VaultEscrowLifecycle::dispatch, VaultEscrowLifecycle::decodeField1 | VaultEscrowLifecycle::application |
| It never answers refunded when state is active and event is refund and epoch is below timeout. | VaultEscrowLifecycle::judge | VaultEscrowLifecycleProofs::inv001Holds |
| It never answers released when state is active and event is release and preimage is empty. | VaultEscrowLifecycle::judge | VaultEscrowLifecycleProofs::inv002Holds |
| It never answers active when state is none and funds is insufficient. | VaultEscrowLifecycle::judge | VaultEscrowLifecycleProofs::inv003Holds |
| It always answers released when state is released. | VaultEscrowLifecycle::judge | VaultEscrowLifecycleProofs::inv004Holds |
| It always answers refunded when state is refunded. | VaultEscrowLifecycle::judge | VaultEscrowLifecycleProofs::inv005Holds |

## Journeys

The ordered features each stakeholder takes.

| Stakeholder | Steps |
| --- | --- |
| Beneficiary | REQ-003 → REQ-005 → INV-001 → INV-004 |
| Depositor | REQ-003 → otherwise → REQ-006 → INV-005 |
| Verifier | refuse → INV-001 → INV-002 → INV-003 → INV-004 → INV-005 |

## Security and threat model

14 threats against 4 assets. Each has a STRIDE category, and either a control with evidence or a risk that is accepted on purpose.

| Threat | STRIDE | Asset | Risk | Answered by |
| --- | --- | --- | --- | --- |
| Answer that breaks INV-001 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-001: proof VaultEscrowLifecycleProofs::inv001Holds |
| Answer that breaks INV-002 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-002: proof VaultEscrowLifecycleProofs::inv002Holds |
| Answer that breaks INV-003 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-003: proof VaultEscrowLifecycleProofs::inv003Holds |
| Answer that breaks INV-004 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-004: proof VaultEscrowLifecycleProofs::inv004Holds |
| Answer that breaks INV-005 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-005: proof VaultEscrowLifecycleProofs::inv005Holds |
| Any preimage releases | spoofing | Request bytes | high likelihood, critical impact | accepted: This mirrors src/model/engine.ts as it is: conditionMatch holds for any non-empty preimage. The studio is a simulation, and a real hash check belongs to the LexLean Vault source it models. |
| Double settlement | tampering | Answer | medium likelihood, critical impact | Final states: proof VaultEscrowLifecycleProofs::inv004Holds; proof VaultEscrowLifecycleProofs::inv005Holds |
| Early refund | tampering | Answer | medium likelihood, major impact | Timeout guard: proof VaultEscrowLifecycleProofs::inv001Holds; review src/model/engine.ts RefundEscrow |
| Granted capability | informationDisclosure | Answer | low likelihood, major impact | No capability granted: gate prism-code check refuses an ungranted guest import |
| Malformed request | tampering | Request bytes | high likelihood, major impact | Strict decoder: gate malformed-request acceptance vectors, replayed in the compiled guest by prismpm verify |
| Oversized request | denialOfService | Request bytes | medium likelihood, minor impact | Bounded request: gate acceptance vectors at the request bound, one byte over it, and at the guest allocation bound, replayed by prismpm verify |
| Substituted holo | spoofing | Published holo | low likelihood, critical impact | Fingerprint and provenance: gate actions/attest-build-provenance in the pages workflow; gate prism-code check of the holo identities in the page |
| Substituted host | spoofing | Published holo | low likelihood, critical impact | accepted: A page cannot defend against its own host. The holo carries signed build provenance a visitor can check, and the app can be rebuilt from its prompt. |
| Tampered model | tampering | Model source | low likelihood, major impact | Regenerated from the prompt: gate prismpm verify in the SDK image prismpm.lock pins; review app/prompt.json |

## Quality

ISO/IEC 25010:2023 requirements. Each has a measure and a threshold that a theorem pins.

| Requirement | Characteristic | Measure | Threshold |
| --- | --- | --- | --- |
| Bounded allocation: The guest allocates at most 320 bytes for one request. | Performance efficiency: Resource utilization | Guest allocation bytes | 320 |
| Bounded request: A request over 160 bytes is refused before any field is read. | Performance efficiency: Time behaviour | Request bytes read | 160 |
| Every property proved: All 5 properties are theorems the Lean kernel checks. | Security: Integrity | Unproved properties | 0 |
| Every request answered: Every request gets an answer: a rule, active otherwise, or invalid. | Functional suitability: Functional completeness | Unanswered requests | 0 |
| Every vector replays: All 55 acceptance vectors replay in the compiled guest, the shortest 0 bytes long. | Reliability: Faultlessness | Failed vectors | 0 |
| Examples answered as stated: Every one of the 7 examples of the spec is answered as it states. | Functional suitability: Functional correctness | Example mismatches | 0 |
| No refund before timeout: An active escrow is refunded only when the epoch has reached its timeout. | Functional suitability: Functional correctness | Early refunds | 0 |
| Settled escrows stay settled: No event moves a released or refunded escrow to another status. | Reliability: Faultlessness | Transitions out of a final state | 0 |

## Compliance

One obligation per standard, each naming its evidence.

| Standard | Subject | Evidence |
| --- | --- | --- |
| ISO/IEC/IEEE 42010:2022 | Architecture description | Architecture::architectureDescriptionHolds |
| ISO/PAS 19450:2015 and OMG UML 2.5.1 | Design views | Design::viewOpmDecide, Design::viewUmlComponents, Design::viewUmlRequest, Design::viewUmlStates, Design::viewUmlMachine |
| ISO/IEC 25010:2023 | Product quality | Quality::qualityModelHolds |
| ISO/IEC 27034-1:2011 and ISO/IEC 27005:2022 | Application security and risk | Security::controlSet |
| OMG UML 2.5.1 behavioral state machine | State machine | VaultEscrowLifecycle::judge, VaultEscrowLifecycleProofs::inv004Holds, VaultEscrowLifecycleProofs::inv005Holds |
| OpenSpec | Requirements | VaultEscrowLifecycle::application |
| SPDX Apache-2.0 | Licensing | VaultEscrowLifecycle::application |

## Rendered design views

Written by the SDK from the design records when it verified the app.

### design/Design.viewOpmDecide.opl

```
View: Design::viewOpmDecide
Title: Deciding a Vault escrow lifecycle request
Viewpoint: Architecture::viewpointDepositorCorrectAnswers
Notation: ISO/PAS 19450:2015 OPM, Prism OPL profile

componentBrowser is an object.
componentVaultEscrowLifecycleGuest is an object.
componentVaultEscrowLifecycleGuest can be stateDeciding or stateIdle.
processDecide is a process.
processEncodeAnswer is a process.
processJudge is a process.
processParseRequest is a process.
componentVaultEscrowLifecycleGuest handles processDecide.
processParseRequest requires componentBrowser.
processEncodeAnswer affects componentBrowser.
processJudge invokes processEncodeAnswer.
processParseRequest invokes processJudge.
processDecide zooms into processParseRequest, processJudge, and processEncodeAnswer, in that sequence.

```

### design/Design.viewUmlComponents.puml

```
@startuml
' UML 2.5.1 component diagram
' view: Design::viewUmlComponents
' viewpoint: Architecture::viewpointVerifierIntegrityOfThePublishedApp
title Components of Vault escrow lifecycle
component "componentBrowser" as c0
component "componentGitHubPages" as c1
component "componentPrismBuild" as c2
component "componentPrismPMModelAndRuntimeStudio" as c3
component "componentPrismPMToolchain" as c4
component "componentSourceRepository" as c5
component "componentVaultEscrowLifecycleGuest" as c6
component "componentVaultEscrowLifecyclePage" as c7
c0 --> c6 : edgeBrowserToVaultEscrowLifecycleGuest
c1 --> c0 : edgeGitHubPagesToBrowser
c2 --> c6 : edgePrismBuildToVaultEscrowLifecycleGuest
c2 --> c7 : edgePrismBuildToVaultEscrowLifecyclePage
c3 --> c6 : edgePrismPMModelAndRuntimeStudioToVaultEscrowLifecycleGuest
c4 --> c6 : edgePrismPMToolchainToVaultEscrowLifecycleGuest
c5 --> c2 : edgeSourceRepositoryToPrismBuild
c6 --> c0 : edgeVaultEscrowLifecycleGuestToBrowser
c6 --> c3 : edgeVaultEscrowLifecycleGuestToPrismPMModelAndRuntimeStudio
c6 --> c4 : edgeVaultEscrowLifecycleGuestToPrismPMToolchain
c7 --> c1 : edgeVaultEscrowLifecyclePageToGitHubPages
@enduml

```

### design/Design.viewUmlMachine.puml

```
@startuml
' UML 2.5.1 state machine diagram
' view: Design::viewUmlMachine
' viewpoint: Architecture::viewpointDepositorCorrectAnswers
title The Vault escrow lifecycle state machine
state "stateMachineActive" as s0
state "stateMachineNone" as s1
state "stateMachineRefunded" as s2
state "stateMachineReleased" as s3
[*] --> s1
s1 --> s0 : processRule3
s1 --> s1 : processRule4
s0 --> s0 : processOtherwise
s0 --> s3 : processRule5
s0 --> s2 : processRule6
s3 --> s3 : processRule1
s2 --> s2 : processRule2
@enduml

```

### design/Design.viewUmlRequest.puml

```
@startuml
' UML 2.5.1 sequence diagram
' view: Design::viewUmlRequest
' viewpoint: Architecture::viewpointDepositorCorrectAnswers
title Answering a Vault escrow lifecycle request
participant "componentBrowser" as p0
participant "componentVaultEscrowLifecycleGuest" as p1
p0 -> p1 : processDecide
p1 --> p0 : processDecide
@enduml

```

### design/Design.viewUmlStates.puml

```
@startuml
' UML 2.5.1 state machine diagram
' view: Design::viewUmlStates
' viewpoint: Architecture::viewpointVerifierRefusedMalformedRequests
title States of the Vault escrow lifecycle guest
state "stateAnsweredActive" as s0
state "stateAnsweredNone" as s1
state "stateAnsweredRefunded" as s2
state "stateAnsweredReleased" as s3
state "stateDeciding" as s4
state "stateIdle" as s5
state "stateRefused" as s6
[*] --> s5
s5 --> s4 : processParseRequest
s5 --> s6 : processParseRequest
s4 --> s3 : processRule1
s4 --> s2 : processRule2
s4 --> s0 : processRule3
s4 --> s1 : processRule4
s4 --> s3 : processRule5
s4 --> s2 : processRule6
s4 --> s0 : processOtherwise
s1 --> s5 : processEncodeAnswer
s0 --> s5 : processEncodeAnswer
s3 --> s5 : processEncodeAnswer
s2 --> s5 : processEncodeAnswer
s6 --> s5 : processEncodeAnswer
@enduml

```

## Prism source

Every file the builder wrote, laid out as a repository created from UOR-Foundation/template; the download prism-vault-escrow-lifecycle.zip has them all.

- app/src/Architecture.lex.tex (399 lines)
- app/src/Compliance.lex.tex (56 lines)
- app/src/Design.lex.tex (710 lines)
- app/src/Features.lex.tex (158 lines)
- app/src/Quality.lex.tex (368 lines)
- app/src/Security.lex.tex (635 lines)
- app/src/VaultEscrowLifecycle.lex.tex (306 lines)
- app/src/VaultEscrowLifecycleProofs.lex.tex (234 lines)
- app/lexlean.toml (43 lines)
- app/prompt.json (413 lines)
- model/ids.toml (71 lines)
- features/suites/vault\_escrow\_lifecycle.feature (50 lines)
- crates/conformance/tests/vault\_escrow\_lifecycle.rs (142 lines)
- site/app.json (125 lines)
- openspec/specs/vault-escrow-lifecycle/spec.md (209 lines)
