From bc321ec05b49b5cf6cf30609c886e5f74ec15ca8 Mon Sep 17 00:00:00 2001 From: Gabe Hamilton Date: Fri, 30 Oct 2026 14:24:27 -0600 Subject: [PATCH 1/3] Add a requirements spec-approval page beside the full packet review. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing packet walk moves to ui/spec-approvals-full. ui/spec-approvals now signs each of R1–R6 and D1–D17, with the properties that discharge it, and counts requests from agent1 rather than spec-agent. --- README.md | 3 +- scripts/near/README.md | 4 +- scripts/near/spec_packet.py | 11 +- scripts/near/submit-spec-packet.sh | 11 +- ui/approvals/ARCHITECTURE.md | 2 +- ui/approvals/README.md | 3 +- ui/approvals/index.html | 2 +- ui/shared/approval-kit.js | 3 +- ui/shared/base.css | 2 +- .../app.js => shared/spec-app.js} | 133 +- ui/{spec-approvals => shared}/spec-kit.js | 3 +- ui/{spec-approvals => shared}/spec.css | 29 +- ui/spec-approvals-full/README.md | 122 + ui/spec-approvals-full/index.html | 101 + .../packets/near-approval.json | 0 .../packets/near-approval.src.json | 0 ui/spec-approvals-full/tools/build-packet.py | 171 + .../tools/check-hashes.sh | 17 +- ui/spec-approvals/README.md | 109 +- ui/spec-approvals/index.html | 21 +- ui/spec-approvals/packets/requirements.json | 4812 +++++++++++++++++ .../packets/requirements.src.json | 26 + ui/spec-approvals/tools/build-packet.py | 285 +- 23 files changed, 5688 insertions(+), 182 deletions(-) rename ui/{spec-approvals/app.js => shared/spec-app.js} (86%) rename ui/{spec-approvals => shared}/spec-kit.js (97%) rename ui/{spec-approvals => shared}/spec.css (76%) create mode 100644 ui/spec-approvals-full/README.md create mode 100644 ui/spec-approvals-full/index.html rename ui/{spec-approvals => spec-approvals-full}/packets/near-approval.json (100%) rename ui/{spec-approvals => spec-approvals-full}/packets/near-approval.src.json (100%) create mode 100755 ui/spec-approvals-full/tools/build-packet.py rename ui/{spec-approvals => spec-approvals-full}/tools/check-hashes.sh (84%) create mode 100644 ui/spec-approvals/packets/requirements.json create mode 100644 ui/spec-approvals/packets/requirements.src.json diff --git a/README.md b/README.md index 374ecf6..6911761 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ A NEAR contract that records an agent's request to act and an approver's decisio - Contract: [`contracts/approval`](contracts/approval/README.md) - Operations: [`scripts/near`](scripts/near/README.md) - Approver page: [`ui/approvals`](ui/approvals/README.md) -- Spec review page: [`ui/spec-approvals`](ui/spec-approvals/README.md) +- Spec review, one signature per requirement (R1–R6, D1–D17): [`ui/spec-approvals`](ui/spec-approvals/README.md) +- Spec review, full packet: [`ui/spec-approvals-full`](ui/spec-approvals-full/README.md) The testnet demonstration is [`approvals.difflabai.testnet`](https://testnet.nearblocks.io/address/approvals.difflabai.testnet), owned by `difflabai.testnet`. It can still be redeployed. Set `NEAR_ACCOUNT_ID` to point the scripts at it, or at your own account. `APPROVAL_CONTRACT_ID` defaults to `approvals.`. diff --git a/scripts/near/README.md b/scripts/near/README.md index c02836c..1e1aa1d 100644 --- a/scripts/near/README.md +++ b/scripts/near/README.md @@ -133,7 +133,7 @@ seconds). | `request-action.sh ` | Signs `request_action` with the agent's stored key, else `APPROVAL_AGENT_*` from `.env` when it names this account (or `--key-file PATH`), after checking the key may call `request_action` and is registered; prints the request id. `--action-file PATH` (`-` for stdin) reads the action byte for byte; an action starting with `-` goes after `--`. | | `approve.sh ` | Signs `approve` with the approver's stored key, else `APPROVAL_APPROVER_*` from `.env` (or `--key-file PATH`); prints the proof. Checks first that the key may call `approve` and is registered, that the request is pending, that the action matches exactly, and that the agent isn't the approver's own account (`--skip-checks` sends anyway). The action can come from `--action-file PATH`, or, after reviewing it, from `--action-from-request`. | | `reject.sh ` | Signs `reject` with the stored key, else `APPROVAL_APPROVER_*` from `.env` (or `--key-file PATH`); prints the rejection. Refuses before sending when the key may not call `reject` (e.g. an approve-only key). | -| `submit-spec-packet.sh [--packet PATH] [--item ID]... [--setup-agent] [--dry-run] [--yes]` | Files each item of a spec review packet (default `ui/spec-approvals/packets/near-approval.json`) as one request for review in [`ui/spec-approvals/`](../../ui/spec-approvals/README.md). Each action names the item and the SHA-256 of its text (`spec_packet.py`). Idempotent: items that already have a pending, approved or rejected request are skipped, and only items with void requests are filed again. The agent (`--agent`, else `APPROVAL_AGENT_ACCOUNT_ID`, else `spec-agent`) signs as `request-action.sh` does: `--key-file`, its stored key, or `APPROVAL_AGENT_*` from `.env`. `--setup-agent` creates and registers the stored key with `new-principal.sh` if it is missing. | +| `submit-spec-packet.sh [--packet PATH] [--item ID]... [--setup-agent] [--dry-run] [--yes]` | Files each item of a spec review packet (default `ui/spec-approvals-full/packets/near-approval.json`) as one request for review in [`ui/spec-approvals-full/`](../../ui/spec-approvals-full/README.md). Pass `--packet ui/spec-approvals/packets/requirements.json` to file one request per requirement (R1–R6, D1–D17), reviewed in [`ui/spec-approvals/`](../../ui/spec-approvals/README.md). Each action names the item and the SHA-256 of its text (`spec_packet.py`). Idempotent: items that already have a pending, approved or rejected request are skipped, and only items with void requests are filed again. The agent (`--agent`, else `APPROVAL_AGENT_ACCOUNT_ID`, else `spec-agent`) signs as `request-action.sh` does: `--key-file`, its stored key, or `APPROVAL_AGENT_*` from `.env`. `--setup-agent` creates and registers the stored key with `new-principal.sh` if it is missing. | | `smoke-test.sh [--cleanup]` | End-to-end check: ensures `smoke-agent` and `smoke-approver` principals, requests, approves and rejects, and asserts `get_approval`, `get_request` and `get_rejection`. `--cleanup` revokes their keys and deletes both accounts. | | `transfer.sh [--yes]` | Sends NEAR from `NEAR_ACCOUNT_ID`, e.g. to top up the contract's storage balance. | | `faucet-fund.sh [] [--rounds N]` | Testnet only: tops up an existing account (default `NEAR_ACCOUNT_ID`) with 10 NEAR per round from the testnet faucet, which only funds new accounts: each round has the faucet create a throwaway `tf-faucet-….testnet` account and then deletes it with the receiver as beneficiary. Needs no `NEAR_PRIVATE_KEY`. If a deletion fails, the throwaway key is kept and `--recover KEYFILE` finishes the round. Uses `NEAR_FAUCET_URL` (default `https://helper.testnet.near.org/account`; near-cli's own default host fails TLS). | @@ -286,7 +286,7 @@ agent or approver holds. A real approver should not use a key from this repo's credentials dir: generate it elsewhere, register it with `add-approver.sh`, and sign with `approve.sh --action-file action.txt --key-file ~/keys/reviewer.json`. -To sign from a browser wallet instead, open [`ui/approvals/`](../../ui/approvals/README.md) (or [`ui/spec-approvals/`](../../ui/spec-approvals/README.md) for a spec review packet) +To sign from a browser wallet instead, open [`ui/approvals/`](../../ui/approvals/README.md) (or [`ui/spec-approvals/`](../../ui/spec-approvals/README.md) for the 23 requirements, or [`ui/spec-approvals-full/`](../../ui/spec-approvals-full/README.md) for the full spec packet) and register the wallet's public key with `add-approver.sh … --force` (a full-access key; the page cannot select a different key than the one the wallet connects with). diff --git a/scripts/near/spec_packet.py b/scripts/near/spec_packet.py index a149fcf..5eae15e 100755 --- a/scripts/near/spec_packet.py +++ b/scripts/near/spec_packet.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 """Spec review packets on the approval contract: one request per packet item. -Each item of a packet manifest (ui/spec-approvals/packets/*.json, built by -ui/spec-approvals/tools/build-packet.py) becomes one `request_action`. The -action names the packet, the item and the SHA-256 of the item's canonical -payload, so an approval on chain binds to the exact text the reviewer read. -ui/spec-approvals/spec-kit.js computes the same payload, hash and action; +Each item of a packet manifest (ui/spec-approvals/packets/*.json or +ui/spec-approvals-full/packets/*.json, built by the tools/build-packet.py +next to it) becomes one `request_action`. The action names the packet, the +item and the SHA-256 of the item's canonical payload, so an approval on +chain binds to the exact text the reviewer read. +ui/shared/spec-kit.js computes the same payload, hash and action; `check` prints them so the two can be compared. Canonical payload of item X (UTF-8 JSON, object keys sorted at every level, diff --git a/scripts/near/submit-spec-packet.sh b/scripts/near/submit-spec-packet.sh index 3525554..351d8d4 100755 --- a/scripts/near/submit-spec-packet.sh +++ b/scripts/near/submit-spec-packet.sh @@ -4,7 +4,7 @@ # # File each item of a spec review packet as one request on the approval # contract (APPROVAL_CONTRACT_ID, from NEAR_ACCOUNT_ID), for a reviewer to approve or -# reject in ui/spec-approvals/. Each action names the packet, the item and the +# reject in ui/spec-approvals/ or ui/spec-approvals-full/. Each action names the packet, the item and the # SHA-256 of the item's canonical text (scripts/near/spec_packet.py), so the # approval on chain binds to exactly what the reviewer read. # @@ -30,7 +30,7 @@ # Prints one line per filed request, "", on stdout. # # Options: -# --packet PATH manifest (default ui/spec-approvals/packets/near-approval.json) +# --packet PATH manifest (default ui/spec-approvals-full/packets/near-approval.json) # --item ID only this item (repeatable) # --agent NAME agent account (overrides APPROVAL_AGENT_ACCOUNT_ID) # --key-file PATH sign with this key file @@ -48,7 +48,7 @@ done # shellcheck source=SCRIPTDIR/lib.sh . "$(cd "$(dirname "$NEAR_SELF")" && pwd -P)/lib.sh" -PACKET="$REPO_ROOT/ui/spec-approvals/packets/near-approval.json" +PACKET="$REPO_ROOT/ui/spec-approvals-full/packets/near-approval.json" ITEMS=() AGENT_ARG="" KEY_FILE="" SETUP=0 DRY=0 while [ $# -gt 0 ]; do case $1 in @@ -152,4 +152,7 @@ for id in "${TODO[@]}"; do ok "item $id is request $rid" printf '%s\t%s\n' "$id" "$rid" done -info "review them in ui/spec-approvals/?agent=$AGENT (see its README for how to run it)" +# The page that loads this packet is the ui/* directory that contains it. +packet_dir=$(cd "$(dirname "$PACKET")" && pwd -P) +ui_name=$(basename "$(dirname "$packet_dir")") +info "review them in ui/${ui_name}/?agent=$AGENT (see its README for how to run it)" diff --git a/ui/approvals/ARCHITECTURE.md b/ui/approvals/ARCHITECTURE.md index 2cd3165..b95a98f 100644 --- a/ui/approvals/ARCHITECTURE.md +++ b/ui/approvals/ARCHITECTURE.md @@ -10,7 +10,7 @@ submits is the one the approver's wallet signs. `index.html` is the application. Contract reads, the wallet connector, signing and the text-safety helpers live in `../shared/approval-kit.js`, and the base styles in `../shared/base.css`. Both are shared with -`../spec-approvals/`. No build, no framework, no backend. Views +`../spec-approvals/` and `../spec-approvals-full/`. No build, no framework, no backend. Views are `fetch` calls to a NEAR JSON-RPC at `finality: final`. Signing uses [NEAR Connect](https://docs.near.org/tools/near-connect) (`@hot-labs/near-connect` 0.11.4), loaded from a pinned URL with diff --git a/ui/approvals/README.md b/ui/approvals/README.md index cc5e8ee..796e48d 100644 --- a/ui/approvals/README.md +++ b/ui/approvals/README.md @@ -12,7 +12,8 @@ cd ui && python3 -m http.server 8080 Open . Serve `ui/`, not this directory: the page loads `../shared/` (code shared with -[`../spec-approvals/`](../spec-approvals/README.md)). Use HTTP on localhost, +[`../spec-approvals/`](../spec-approvals/README.md) and +[`../spec-approvals-full/`](../spec-approvals-full/README.md)). Use HTTP on localhost, not `file://`: wallet extensions and the clipboard do not reliably work from a file URL. No install and no build. diff --git a/ui/approvals/index.html b/ui/approvals/index.html index 76ee706..7a0379c 100644 --- a/ui/approvals/index.html +++ b/ui/approvals/index.html @@ -153,7 +153,7 @@

(function () { "use strict"; - // Shared with ui/spec-approvals: ../shared/approval-kit.js. + // Shared with ui/spec-approvals and ui/spec-approvals-full: ../shared/approval-kit.js. var K = window.ApprovalKit; var DEFAULT_CONTRACT = K.DEFAULT_CONTRACT; var DEFAULT_HASH = K.DEFAULT_HASH; diff --git a/ui/shared/approval-kit.js b/ui/shared/approval-kit.js index cfb1708..af66bb6 100644 --- a/ui/shared/approval-kit.js +++ b/ui/shared/approval-kit.js @@ -1,5 +1,6 @@ /* - * Shared pieces of the approval contract UIs (ui/approvals, ui/spec-approvals). + * Shared pieces of the approval contract UIs (ui/approvals, ui/spec-approvals, + * ui/spec-approvals-full). * A classic script: it defines window.ApprovalKit and nothing else. No build, * no dependencies. The wallet connector (NEAR Connect) is loaded by each page * with its own pinned + + + + + diff --git a/ui/spec-approvals/packets/near-approval.json b/ui/spec-approvals-full/packets/near-approval.json similarity index 100% rename from ui/spec-approvals/packets/near-approval.json rename to ui/spec-approvals-full/packets/near-approval.json diff --git a/ui/spec-approvals/packets/near-approval.src.json b/ui/spec-approvals-full/packets/near-approval.src.json similarity index 100% rename from ui/spec-approvals/packets/near-approval.src.json rename to ui/spec-approvals-full/packets/near-approval.src.json diff --git a/ui/spec-approvals-full/tools/build-packet.py b/ui/spec-approvals-full/tools/build-packet.py new file mode 100755 index 0000000..9c36c11 --- /dev/null +++ b/ui/spec-approvals-full/tools/build-packet.py @@ -0,0 +1,171 @@ +#!/usr/bin/env python3 +"""Build a spec review packet manifest from its source file. + +Usage: + ui/spec-approvals-full/tools/build-packet.py --formalver PATH --trust-framework PATH \ + [--src ui/spec-approvals-full/packets/near-approval.src.json] [--out ...near-approval.json] + +Every file is read with `git show :` at the commit the source +file pins, so the working tree's checkout does not matter. For each reading +entry the manifest records the file's sha256 and, when the entry names +`from` / `to` (exclusive) / `through` (inclusive) regexes, the 1-based line +range they select. Properties, assumptions and findings are copied from +formalver's status.toml and strategy.md at the pinned commit. + +Standard library only (Python 3.11+ for tomllib). +""" +import argparse +import hashlib +import json +import os +import re +import subprocess +import sys + +try: + import tomllib +except ImportError: # pragma: no cover + sys.exit("build-packet.py needs Python 3.11+ (tomllib)") + +HERE = os.path.dirname(os.path.abspath(__file__)) +DEFAULT_SRC = os.path.join(HERE, "..", "packets", "near-approval.src.json") + + +def git_show(repo_dir, commit, path): + try: + return subprocess.run(["git", "-C", repo_dir, "show", "%s:%s" % (commit, path)], + check=True, capture_output=True).stdout + except subprocess.CalledProcessError as e: + sys.exit("git show %s:%s in %s failed: %s" % (commit, path, repo_dir, e.stderr.decode().strip())) + + +def line_range(text, entry, where): + lines = text.split("\n") + start = None + for i, line in enumerate(lines): + if re.search(entry["from"], line): + start = i + break + if start is None: + sys.exit("%s: no line matches from=%r" % (where, entry["from"])) + end_pat = entry.get("through") or entry.get("to") + if end_pat is None: + return start + 1, len(lines) + for j in range(start + 1, len(lines)): + if re.search(end_pat, lines[j]): + return start + 1, (j + 1 if "through" in entry else j) + sys.exit("%s: no line after %d matches %r" % (where, start + 1, end_pat)) + + +def findings_table(strategy): + """Rows of the '### Open' findings table: {id: {finding, resolution}}.""" + out = {} + m = re.search(r"^### Open\n(.*?)^---", strategy, re.S | re.M) + if not m: + sys.exit("strategy.md: no '### Open' findings section") + for row in m.group(1).splitlines(): + cells = [c.strip() for c in row.strip().strip("|").split(" | ")] + if len(cells) >= 3 and re.fullmatch(r"F-\d+", cells[0]): + out[cells[0]] = {"finding": cells[1], "resolution": cells[2]} + return out + + +def main(): + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument("--formalver", required=True, help="a clone of difflabai/formalver") + ap.add_argument("--trust-framework", required=True, help="a clone of difflabai/trust-framework") + ap.add_argument("--src", default=DEFAULT_SRC) + ap.add_argument("--out") + a = ap.parse_args() + out_path = a.out or re.sub(r"\.src\.json$", ".json", a.src) + with open(a.src, encoding="utf-8") as f: + src = json.load(f) + + packet = src["packet"] + clones = {"formalver": a.formalver, "trust-framework": a.trust_framework} + + def show(source, path): + s = packet["sources"][source] + full = (s["root"] + "/" + path) if s["root"] else path + return full, git_show(clones[source], s["commit"], full) + + fv = packet["sources"]["formalver"] + status = tomllib.loads(show("formalver", "status.toml")[1].decode("utf-8")) + strategy = show("formalver", "strategy.md")[1].decode("utf-8") + + properties = {} + for module, m in status["modules"].items(): + for pid, p in m["properties"].items(): + properties[pid] = { + "module": module, + "layer": p.get("layer", ""), + "evidence": p.get("evidence", ""), + "status": p.get("status", ""), + "description": p.get("description", ""), + "assumptions": p.get("assumptions", []), + } + assumptions = {k: {"statement": v.get("statement", ""), "level": v.get("level", ""), + "status": v.get("status", ""), "checked_by": v.get("checked_by", [])} + for k, v in status["assumptions"].items()} + findings = findings_table(strategy) + + items = [] + for it in src["items"]: + item = {k: v for k, v in it.items() if k not in ("read", "properties", "assumptions", "findings")} + reads = [] + for r in it["read"]: + full, data = show(r["source"], r["path"]) + entry = {"source": r["source"], "path": full, "label": r["label"], + "sha256": hashlib.sha256(data).hexdigest()} + if "from" in r: + entry["lines"] = list(line_range(data.decode("utf-8"), r, "%s %s" % (it["id"], full))) + reads.append(entry) + item["read"] = reads + + sel = it.get("properties") + if sel == "*": + pids = list(properties) + elif isinstance(sel, dict) and "ids" in sel: + pids = sel["ids"] + elif isinstance(sel, dict): + (key, val), = sel.items() + pids = [p for p, v in properties.items() if v[key] == val] + else: + pids = [] + missing = [p for p in pids if p not in properties] + if missing: + sys.exit("%s: unknown properties %s" % (it["id"], missing)) + item["properties"] = pids + + asel = it.get("assumptions", []) + item["assumptions"] = list(assumptions) if asel == "*" else asel + missing = [x for x in item["assumptions"] if x not in assumptions] + if missing: + sys.exit("%s: unknown assumptions %s" % (it["id"], missing)) + + item["findings"] = it.get("findings", []) + missing = [x for x in item["findings"] if x not in findings] + if missing: + sys.exit("%s: unknown findings %s" % (it["id"], missing)) + items.append(item) + + ids = [i["id"] for i in items] + if len(set(ids)) != len(ids): + sys.exit("duplicate item ids") + manifest = { + "format": "spec-packet/1", + "packet": packet, + "items": items, + "properties": properties, + "assumptions": assumptions, + "findings": findings, + } + with open(out_path, "w", encoding="utf-8") as f: + json.dump(manifest, f, indent=1, ensure_ascii=False) + f.write("\n") + sys.stderr.write("wrote %s: %d items, %d properties, %d assumptions, %d findings (formalver %s)\n" + % (out_path, len(items), len(properties), len(assumptions), len(findings), fv["commit"][:7])) + + +if __name__ == "__main__": + main() diff --git a/ui/spec-approvals/tools/check-hashes.sh b/ui/spec-approvals-full/tools/check-hashes.sh similarity index 84% rename from ui/spec-approvals/tools/check-hashes.sh rename to ui/spec-approvals-full/tools/check-hashes.sh index b01071a..9f8c579 100755 --- a/ui/spec-approvals/tools/check-hashes.sh +++ b/ui/spec-approvals-full/tools/check-hashes.sh @@ -1,10 +1,11 @@ #!/usr/bin/env bash -# Usage: ui/spec-approvals/tools/check-hashes.sh [MANIFEST...] +# Usage: ui/spec-approvals-full/tools/check-hashes.sh [MANIFEST...] # # Check that scripts/near/spec_packet.py (which files the requests) and -# ui/spec-approvals/spec-kit.js (which the page uses to match them) compute +# ui/shared/spec-kit.js (which the pages use to match them) compute # the same hash and action for every item: on the given manifests (default: -# every packets/*.json) and on a generated manifest full of awkward strings +# every packets/*.json here and in ui/spec-approvals) and on a generated +# manifest full of awkward strings # (quotes, backslashes, control characters, non-ASCII, astral characters, # U+2028); and that spec_packet.py refuses numbers and keys the browser # would hash differently. Needs python3 and node (18+). @@ -12,6 +13,7 @@ set -euo pipefail HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P) UI=$(cd "$HERE/.." && pwd -P) ROOT=$(cd "$UI/../.." && pwd -P) +SPEC_KIT="$ROOT/ui/shared/spec-kit.js" TMP=$(mktemp -d) trap 'rm -rf "$TMP"' EXIT @@ -44,12 +46,17 @@ for (const it of m.items) { } JS -if [ $# -eq 0 ]; then set -- "$UI"/packets/*.json; fi +if [ $# -eq 0 ]; then + set -- "$UI"/packets/*.json + if compgen -G "$ROOT/ui/spec-approvals/packets/*.json" >/dev/null; then + set -- "$@" "$ROOT"/ui/spec-approvals/packets/*.json + fi +fi fail=0 for f in "$@" "$TMP/awkward.json"; do case $f in *.src.json) continue ;; esac python3 "$ROOT/scripts/near/spec_packet.py" check "$f" >"$TMP/py.txt" - node "$TMP/check.mjs" "$UI/spec-kit.js" "$f" >"$TMP/js.txt" + node "$TMP/check.mjs" "$SPEC_KIT" "$f" >"$TMP/js.txt" if diff -u "$TMP/py.txt" "$TMP/js.txt" >&2; then echo "ok: $(basename "$f"): $(wc -l <"$TMP/py.txt" | tr -d ' ') items agree" >&2 else diff --git a/ui/spec-approvals/README.md b/ui/spec-approvals/README.md index 2f2fc74..636de43 100644 --- a/ui/spec-approvals/README.md +++ b/ui/spec-approvals/README.md @@ -1,16 +1,24 @@ # Spec approval UI -A page for a spec reviewer. It walks a spec review packet item by item and -signs `approve` or `reject` on the approval contract for each one. For each -item it shows: +A page for a spec reviewer. It walks the 23 requirements (R1–R6, D1–D17) +one sentence at a time and signs `approve` or `reject` on the approval +contract for each one. The full packet review is +[`../spec-approvals-full/`](../spec-approvals-full/README.md). Both pages +share `../shared/spec-app.js`. -- what to read, with links to the exact file and lines at the pinned commits; -- what to check; -- the properties, assumptions and findings the item covers. +For each requirement it shows: -The packet for the NEAR approval contract is -[`packets/near-approval.json`](packets/near-approval.json). It is built from -formalver's spec review packet, `status.toml` and `strategy.md`. +- the sentence from `requirement/2` in `approval_req.pl`, which is what you sign; +- the properties `traceability.pl` says discharge that sentence; +- what to check before approving. + +The property text under a sentence is the proof obligation. You are signing +the sentence, and that those properties are the right discharge, not the +proof obligation as if it were the requirement. + +The packet is [`packets/requirements.json`](packets/requirements.json). It +is built from formalver's `approval_req.pl`, `traceability.pl`, `status.toml` +and `strategy.md` at the same commits as the full packet. ## Run @@ -24,28 +32,29 @@ this directory: the page loads `../shared/`. Use HTTP on localhost, not | Param | Default | |---|---| -| `packet` | `near-approval`, which loads `packets/near-approval.json` | -| `item` | the first item. Opens that item. | -| `agent` | `spec-agent.` for `approvals.`. Only requests filed by this account count. | +| `packet` | `requirements`, which loads `packets/requirements.json` | +| `item` | the first requirement. Opens that requirement. | +| `agent` | `agent1.` for `approvals.` (`data-agent`). A short name is expanded the same way. Only requests filed by this account count. | | `contract`, `network`, `rpc`, `code_hash` | as in [`../approvals/`](../approvals/README.md) | +The same agent can file this packet and the full packet. The page matches a +request by the action text, which names this packet id, so the two reviews +do not collide. + ## Flow -1. The owner files the packet, one request per item: +1. The owner files the packet, one request per requirement: ```bash - scripts/near/submit-spec-packet.sh --dry-run # plan; sends nothing - scripts/near/submit-spec-packet.sh # files as the .env agent (APPROVAL_AGENT_*) - scripts/near/submit-spec-packet.sh --setup-agent # or, with no agent in .env: creates spec-agent. + scripts/near/submit-spec-packet.sh --packet ui/spec-approvals/packets/requirements.json --dry-run + scripts/near/submit-spec-packet.sh --packet ui/spec-approvals/packets/requirements.json + scripts/near/submit-spec-packet.sh --packet ui/spec-approvals/packets/requirements.json --item D5 ``` The script reads its credentials from `.env`, like every script in - `scripts/near/` (see [its README](../../scripts/near/README.md)). The - agent is `APPROVAL_AGENT_ACCOUNT_ID` when `.env` has one (set by - `principal-env.sh`, signing with `APPROVAL_AGENT_PRIVATE_KEY`), else - `spec-agent.`. Open the page with `?agent=` - if it is not `spec-agent`. The script is idempotent: re-running it files - only the items that are missing. + `scripts/near/` (see [its README](../../scripts/near/README.md)). It is + idempotent: re-running it files only the requirements that are missing. + Open the page with `?agent=` if the agent is not `agent1`. 2. The owner registers the reviewer's wallet key as an approver: @@ -56,15 +65,16 @@ this directory: the page loads `../shared/`. Use HTTP on localhost, not `--force` is needed because a browser wallet signs with a full-access key. The reviewer's account must not be the agent account. -3. The reviewer opens the page and connects their wallet. For each item they - read the linked material, tick each reading and check line, and then - either approve or reject it. Approve stays disabled until every line is - ticked. Reject needs a note first. Ticks and notes are kept in the - browser (localStorage), keyed by the item's hash. +3. The reviewer opens the page and connects their wallet. For each + requirement they read the sentence and the properties that discharge it, + tick each reading and check line, and then either approve or reject it. + Approve stays disabled until every line is ticked. Reject needs a note + first. Ticks and notes are kept in the browser (localStorage), keyed by + the requirement's hash. -4. **Export review** downloads a JSON record of the review: each item's - hash, request id, status, who decided it, and the reviewer's note. The - record goes with the PR that sets `[review] spec_reviewer` in formalver. +4. **Export review** downloads a JSON record of the review: each + requirement's hash, request id, status, who decided it, and the + reviewer's note. ## What an approval binds to @@ -72,39 +82,34 @@ Each request's action is five lines: ```text spec-review/1 -packet: near-approval 2026-10-20 -item: D1 -title: Verus spec machine and lemma statements -sha256: 363f5cba… +packet: requirements 2026-10-30 +item: D5 +title: Separation of duties: an approver cannot approve or reject a request made by an agent key bound to the same account +sha256: … ``` -The hash covers the item's canonical JSON, together with its properties, -assumptions and findings, the packet header and the source commits. Each -reading entry also carries the sha256 of its file at the pinned commit. The -format is defined in -[`scripts/near/spec_packet.py`](../../scripts/near/spec_packet.py), and -[`spec-kit.js`](spec-kit.js) computes the same value. +The hash covers the sentence, the properties named as its discharge (their +status.toml records), the assumptions and findings those records name, the +packet header and the source commits. Each reading entry also carries the +sha256 of its file at the pinned commit. The format is the same as the full +packet, defined in +[`scripts/near/spec_packet.py`](../../scripts/near/spec_packet.py). +[`../shared/spec-kit.js`](../shared/spec-kit.js) computes the same value. The page recomputes each hash from the packet file it loaded and matches requests by exact action. If the file served to the browser differs from the one that was filed, no request matches it and nothing can be approved. -Requests filed for an earlier text of an item (same packet and item, a -different hash) are listed as outdated. The page offers to reject them. The -contract has no way to withdraw a request. - -## Rebuilding a packet +## Rebuilding the packet ```bash ui/spec-approvals/tools/build-packet.py --formalver ~/src/formalver --trust-framework . -ui/spec-approvals/tools/check-hashes.sh # Python and JS agree on every hash +ui/spec-approvals-full/tools/check-hashes.sh # Python and JS agree on every hash ``` -`packets/near-approval.src.json` holds the items and pins the commits. -Every file is read with `git show :`, so the clones only need -those commits fetched. A new review round needs a new `packet.version`. -Changing an item's text changes its hash, so any request filed for the old -text shows up as outdated. +`packets/requirements.src.json` pins the commits. A new review round needs +a new `packet.version`. Changing a sentence or its discharge changes its +hash, so any request filed for the old text shows up as outdated. ## What the page will not do @@ -113,4 +118,4 @@ not sign while the contract's `code_hash` differs from the expected one, or for a request filed by the connected account. It will not approve a request whose action differs from the packet text it loaded. Signing goes through the same pinned NEAR Connect script as `../approvals/`, using the -shared code in `../shared/approval-kit.js`. +shared code in `../shared/approval-kit.js` and `../shared/spec-app.js`. diff --git a/ui/spec-approvals/index.html b/ui/spec-approvals/index.html index 2915b84..f9dfdb0 100644 --- a/ui/spec-approvals/index.html +++ b/ui/spec-approvals/index.html @@ -4,14 +4,14 @@ - - Spec review + + Spec review · requirements - + - +
-

Spec review

+

Approval requirements

Loading the packet…

About this review @@ -41,12 +41,13 @@

Spec review

-
@@ -85,7 +86,7 @@

-

Items are filed with scripts/near/submit-spec-packet.sh. The owner registers your wallet's public key with scripts/near/add-approver.sh. See README.md. The request list is at the approver page.

+

Items are filed with scripts/near/submit-spec-packet.sh --packet ui/spec-approvals/packets/requirements.json. The owner registers your wallet's public key with scripts/near/add-approver.sh. See README.md. The full packet review is at spec-approvals-full. The request list is at the approver page.

@@ -94,7 +95,7 @@

integrity="sha384-6eNPlV+Bf92wTtH7ZfZE8sZPdohJ84VDXuVVegFjBvJsGWE6BXTT1he2jKjalJ9L" crossorigin="anonymous"> - - + + diff --git a/ui/spec-approvals/packets/requirements.json b/ui/spec-approvals/packets/requirements.json new file mode 100644 index 0000000..4fa21e1 --- /dev/null +++ b/ui/spec-approvals/packets/requirements.json @@ -0,0 +1,4812 @@ +{ + "format": "spec-packet/1", + "packet": { + "id": "requirements", + "version": "2026-10-30", + "title": "approval requirements", + "summary": "Approve or reject each requirement (R1–R6, D1–D17), one signature per sentence. You certify that the sentence says what the contract is meant to do, and that the properties listed under it are the right discharge. The property text is the proof obligation; you are not signing that text as the requirement.", + "qualifies": "A named human who did not write approval-core. Claude sessions wrote most of the specs and harnesses, so a review by Claude does not count.", + "why_a_day": [ + "The 23 sentences are requirement/2 in prolog/requirements/approval_req.pl. That file was written from strategy.md (the Target, sections 1–4 and 5.12) and the contract README, not from the Rust. The Prolog step machine was then written from these sentences.", + "Each item signs one sentence and the properties traceability.pl says discharge it. Several properties share one sentence. A low-level statement such as the add_principal post-state is a proof obligation under a sentence, not a sentence of its own.", + "The full packet (ui/spec-approvals-full) is a separate review. Signing a requirement here does not sign that packet." + ], + "sources": { + "formalver": { + "repo": "difflabai/formalver", + "commit": "f3c64714853649374342e8833c687444b3a057e4", + "root": "projects/near-approval" + }, + "trust-framework": { + "repo": "difflabai/trust-framework", + "commit": "18f57cb218f391d59d14f9db68dd2dd6951d71fb", + "root": "" + } + } + }, + "items": [ + { + "id": "R1", + "title": "An agent requests an action with its own registered agent key (request_action)", + "minutes": 8, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "An agent requests an action with its own registered agent key (request_action).", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 47, + 47 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 26, + 26 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "TX-3", + "TX-4", + "TR-1", + "SH-1", + "RT-KEY" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-STRLEN", + "ASM-SIGNER", + "ASM-PRED" + ], + "findings": [] + }, + { + "id": "R2", + "title": "A successful request emits the NEP-297 event approval_requested", + "minutes": 5, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "A successful request emits the NEP-297 event approval_requested.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 48, + 48 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 27, + 27 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "SH-4", + "SH-6", + "C-4", + "RT-TRACE" + ], + "assumptions": [ + "ASM-ATOMIC", + "ASM-COMPILE", + "ASM-SDK" + ], + "findings": [] + }, + { + "id": "R3", + "title": "An approver approves a request with its own registered approver key (approve)", + "minutes": 8, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "An approver approves a request with its own registered approver key (approve).", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 49, + 49 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 28, + 28 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "TX-3", + "TX-5", + "INV-5", + "INV-6", + "TR-1", + "RT-KEY", + "RT-RELAY" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-SIGNER", + "ASM-PRED" + ], + "findings": [] + }, + { + "id": "R4", + "title": "A successful approval emits the NEP-297 event action_approved", + "minutes": 5, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "A successful approval emits the NEP-297 event action_approved.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 50, + 50 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 29, + 29 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "SH-5", + "SH-6", + "C-4", + "RT-TRACE" + ], + "assumptions": [ + "ASM-COMPILE", + "ASM-SDK" + ], + "findings": [] + }, + { + "id": "R5", + "title": "The approval proof for a specific request is publicly readable (get_approval(request_id)) and equals the recorded proof", + "minutes": 8, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "The approval proof for a specific request is publicly readable (get_approval(request_id)) and equals the recorded proof.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 51, + 51 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 30, + 30 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "RD-1", + "RD-5", + "HIST-5", + "SH-7", + "SH-8", + "VER-1" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-FINAL", + "ASM-ATOMIC" + ], + "findings": [] + }, + { + "id": "R6", + "title": "All approvals are publicly readable as a paged log in approval order (get_approvals(from_index, limit)); the documented client loop yields every proof...", + "minutes": 8, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "All approvals are publicly readable as a paged log in approval order (get_approvals(from_index, limit)); the documented client loop yields every proof exactly once.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 52, + 52 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 31, + 31 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "RD-2", + "RD-3", + "RD-4", + "RD-5", + "SH-7", + "RES-3", + "VER-5" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-IDENT", + "ASM-LIMITS" + ], + "findings": [] + }, + { + "id": "D1", + "title": "Identity is the signing key: a call is accepted only if signer_account_pk is registered for the method's role and bound to signer_account_id", + "minutes": 12, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "Identity is the signing key: a call is accepted only if signer_account_pk is registered for the method's role and bound to signer_account_id.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment.", + "Each related finding is acceptable with the resolution given." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 54, + 54 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 33, + 33 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "TX-3", + "INV-8", + "RT-KEY", + "RT-RELAY", + "RT-SELFACCT", + "RT-METATX", + "RT-FCKEY", + "DEP-1", + "VER-8" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-SIGNER", + "ASM-PRED", + "ASM-META", + "ASM-FCKEY", + "ASM-DEPLOY", + "ASM-OWNER" + ], + "findings": [ + "F-9" + ] + }, + { + "id": "D2", + "title": "No relaying: predecessor_account_id must equal signer_account_id (the caller is the signer)", + "minutes": 12, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "No relaying: predecessor_account_id must equal signer_account_id (the caller is the signer).", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment.", + "Each related finding is acceptable with the resolution given." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 55, + 55 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 34, + 34 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "TX-3", + "INV-8", + "RT-KEY", + "RT-RELAY", + "RT-SELFACCT", + "RT-METATX", + "RT-FCKEY", + "DEP-1", + "VER-8" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-SIGNER", + "ASM-PRED", + "ASM-META", + "ASM-FCKEY", + "ASM-DEPLOY", + "ASM-OWNER" + ], + "findings": [ + "F-9" + ] + }, + { + "id": "D3", + "title": "The owner, fixed at init, manages keys: add_agent, add_approver and revoke_key are owner-only; owner checks use the predecessor", + "minutes": 8, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "The owner, fixed at init, manages keys: add_agent, add_approver and revoke_key are owner-only; owner checks use the predecessor.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 56, + 56 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 35, + 35 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "TX-1", + "TX-2", + "TX-6", + "HIST-6", + "HIST-7", + "SH-1" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-IDENT", + "ASM-MODEL" + ], + "findings": [] + }, + { + "id": "D4", + "title": "Each key is registered at most once at a time, with exactly one role (agent or approver), bound to exactly one account", + "minutes": 5, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "Each key is registered at most once at a time, with exactly one role (agent or approver), bound to exactly one account.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 57, + 57 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 36, + 36 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "INV-0", + "INV-6", + "C-1" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "findings": [] + }, + { + "id": "D5", + "title": "Separation of duties: an approver cannot approve or reject a request made by an agent key bound to the same account", + "minutes": 5, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "Separation of duties: an approver cannot approve or reject a request made by an agent key bound to the same account.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 58, + 58 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 37, + 37 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "INV-5" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "findings": [] + }, + { + "id": "D6", + "title": "A request is decided (approved or rejected) at most once; decided requests are never modified", + "minutes": 8, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "A request is decided (approved or rejected) at most once; decided requests are never modified.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 59, + 59 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 1 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 38, + 38 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 2 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 58, + 58 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 3 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 70, + 70 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "TX-5", + "HIST-2", + "TR-2", + "TLA-SAFE", + "TLA-IND", + "LEAN-IND", + "LEAN-STEP", + "LEAN-TR" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-IDENT", + "ASM-TLA-SCOPE", + "ASM-LEAN-TLA" + ], + "findings": [] + }, + { + "id": "D7", + "title": "Durable revocation: revoke_key removes a key immediately and records when, against that registration; requests pending under the revoked registration become...", + "minutes": 12, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "Durable revocation: revoke_key removes a key immediately and records when, against that registration; requests pending under the revoked registration become void and stay void even if the key is registered again; proofs report later revocations of either key.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment.", + "Each related finding is acceptable with the resolution given." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 60, + 60 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 1 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 39, + 39 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 2 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 56, + 56 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 3 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 59, + 59 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 4 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 71, + 71 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "TR-3", + "HIST-8", + "INV-8", + "LEM-4", + "RD-7", + "INV-11", + "INV-12", + "INV-14", + "INV-15", + "INV-16", + "HIST-10", + "TR-7", + "RD-8", + "TLA-SAFE", + "TLA-IND", + "LEAN-IND", + "LEAN-STEP", + "LEAN-TR" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-IDENT", + "ASM-TLA-SCOPE", + "ASM-LEAN-TLA" + ], + "findings": [ + "F-14" + ] + }, + { + "id": "D8", + "title": "Append-only paged log: requests and proofs are never changed or removed; request ids are dense; the approval log is append-only in approval order; pages are...", + "minutes": 12, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "Append-only paged log: requests and proofs are never changed or removed; request ids are dense; the approval log is append-only in approval order; pages are clamped to 100 (default 50); clients page until an empty page.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 61, + 61 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 1 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 40, + 40 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 2 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 72, + 72 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "INV-1", + "INV-3", + "INV-4", + "INV-7", + "LEM-1", + "LEM-2", + "HIST-3", + "HIST-4", + "RD-2", + "RD-4", + "LEAN-IND", + "LEAN-STEP" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-LEAN-TLA" + ], + "findings": [] + }, + { + "id": "D9", + "title": "Bounded storage: an action is 1 to 2048 bytes; an agent key holds at most 16 pending requests; approving or rejecting frees a slot; every accepted request...", + "minutes": 12, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "Bounded storage: an action is 1 to 2048 bytes; an agent key holds at most 16 pending requests; approving or rejecting frees a slot; every accepted request stays approvable within runtime log limits.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment.", + "Each related finding is acceptable with the resolution given." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 62, + 62 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 1 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 41, + 41 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 2 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 60, + 60 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 3 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 73, + 73 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 4 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 75, + 75 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "INV-2", + "INV-9", + "ROB-3", + "TR-6", + "RES-1", + "RES-2", + "SH-13", + "TLA-LIVE-1", + "TLA-LIVE-2", + "LEAN-IND", + "LEAN-LIVE" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-STRLEN", + "ASM-IDENT", + "ASM-STAKE", + "ASM-LIMITS", + "ASM-TLA-SCOPE", + "ASM-LEAN-TLA" + ], + "findings": [ + "F-4", + "F-17" + ] + }, + { + "id": "D10", + "title": "An approval commits to content: approve(request_id, action) fails unless action equals the stored action", + "minutes": 5, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "An approval commits to content: approve(request_id, action) fails unless action equals the stored action.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 63, + 63 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 42, + 42 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "TX-5", + "TR-1" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-SIGNER", + "ASM-PRED" + ], + "findings": [] + }, + { + "id": "D11", + "title": "No upgrade, ownership transfer, expiry or M-of-N threshold", + "minutes": 5, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "No upgrade, ownership transfer, expiry or M-of-N threshold.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 66, + 66 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 44, + 44 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "SH-11", + "SH-12", + "C-1", + "C-6" + ], + "assumptions": [ + "ASM-SDK" + ], + "findings": [] + }, + { + "id": "D12", + "title": "Atomic, bounded execution: a call the core rejects writes nothing and emits nothing; every guard runs before any write; the core never panics; each mutator...", + "minutes": 12, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "Atomic, bounded execution: a call the core rejects writes nothing and emits nothing; every guard runs before any write; the core never panics; each mutator does bounded work.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment.", + "Each related finding is acceptable with the resolution given." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 67, + 67 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 1 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 45, + 45 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 2 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 78, + 78 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "TX-0", + "ROB-1", + "ROB-2", + "ROB-4", + "ST-1", + "ST-2", + "ST-3", + "ST-4", + "ST-5", + "ST-6", + "ST-7", + "ST-8", + "SH-2", + "SH-3", + "RD-6", + "LEM-3", + "LEAN-DELTA", + "LINK", + "LEAN-COVER", + "LEAN-FRAME", + "LEAN-REN", + "K-LINK-T" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-IDENT", + "ASM-MODEL", + "ASM-SDK", + "ASM-LEAN-TLA", + "ASM-NU" + ], + "findings": [ + "F-6", + "F-7" + ] + }, + { + "id": "D13", + "title": "Timestamps (block height and ns) are recorded on requests and decisions and are ordered along the log", + "minutes": 5, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "Timestamps (block height and ns) are recorded on requests and decisions and are ordered along the log.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 68, + 68 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 46, + 46 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "INV-10", + "TR-4", + "RT-TIME" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-TIME" + ], + "findings": [] + }, + { + "id": "D14", + "title": "The deployed artifact is the reproducible build of the verified source, locked at deploy", + "minutes": 8, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "The deployed artifact is the reproducible build of the verified source, locked at deploy.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 69, + 69 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 47, + 47 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "RT-CODEHASH", + "RT-RESET", + "RT-TRACE", + "DEP-1", + "VER-2", + "VER-3", + "VER-6" + ], + "assumptions": [ + "ASM-DEPLOY", + "ASM-COMPILE", + "ASM-CODE", + "ASM-SDK", + "ASM-OWNER" + ], + "findings": [] + }, + { + "id": "D15", + "title": "Verification hygiene: specs are independent of the code (ASM-SPEC) and tools are sound and checked by canaries and mutants (ASM-TOOLS)", + "minutes": 12, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "Verification hygiene: specs are independent of the code (ASM-SPEC) and tools are sound and checked by canaries and mutants (ASM-TOOLS).", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 70, + 70 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 1 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 48, + 48 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 2 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 62, + 62 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 3 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 66, + 66 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge row 4 in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 76, + 76 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "TR-5", + "MC-1", + "MC-2", + "C-2", + "C-3", + "C-5", + "C-6", + "C-7", + "C-8", + "C-9", + "C-10", + "TLA-WIT", + "REF-1", + "REF-2", + "REF-3", + "REF-4", + "REF-5", + "C-2t", + "MC-3", + "CUT-1", + "CUT-2", + "U-1", + "LEAN-GUARD", + "LEAN-WIT", + "REF-5L", + "MC-4" + ], + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-LEAN-TLA" + ], + "findings": [] + }, + { + "id": "D16", + "title": "Verifier and executor discipline: proofs are read at finality from the expected contract, events are hints, executors deduplicate and bound age", + "minutes": 8, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "Verifier and executor discipline: proofs are read at finality from the expected contract, events are hints, executors deduplicate and bound age.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment.", + "Each related finding is acceptable with the resolution given." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 71, + 71 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 49, + 49 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "VER-1", + "VER-4", + "VER-5", + "VER-7", + "VER-8" + ], + "assumptions": [ + "ASM-FINAL", + "ASM-ATOMIC", + "ASM-OWNER", + "ASM-FCKEY", + "ASM-PRED" + ], + "findings": [ + "F-9" + ] + }, + { + "id": "D17", + "title": "An Approver key of another account (not the agent's account) may reject a pending request; rejection is terminal, frees the agent key's pending slot, emits...", + "minutes": 12, + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": "An Approver key of another account (not the agent's account) may reject a pending request; rejection is terminal, frees the agent key's pending slot, emits action_rejected, and a rejected request is never approvable.", + "check": [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + "Each assumption the discharge rests on is acceptable for this deployment." + ], + "read": [ + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/approval_req.pl", + "label": "Requirement sentence", + "sha256": "addd05696451f7697234746b4226faeb5dd1d05e364567fc77c39c5210427416", + "lines": [ + 73, + 73 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/prolog/requirements/traceability.pl", + "label": "Discharge in traceability.pl", + "sha256": "5135628b7185ee8d0c8d3422fc96b7f05109512204ea3d565035da99d81cfcd4", + "lines": [ + 54, + 54 + ] + } + ], + "see": [ + { + "source": "trust-framework", + "path": "contracts/approval/README.md", + "label": "Contract README", + "sha256": "bca19d675be6ff2e22ab60d130c238b4ea39fdcef3953806e8914bbbadcd6db6" + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "What the requirements establish (§1)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 63, + 109 + ] + }, + { + "source": "formalver", + "path": "projects/near-approval/strategy.md", + "label": "Traceability table (§5.12)", + "sha256": "2b9dbe5b1d7e31d9a6ec14313eb29f2ddf8aeb3deff614d0c990822a4ef9ac9c", + "lines": [ + 526, + 554 + ] + } + ], + "properties": [ + "TX-7", + "HIST-9", + "INV-13", + "INV-5", + "INV-6", + "TR-2", + "RD-7", + "TLA-LIVE-2", + "SH-6" + ], + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-IDENT", + "ASM-TLA-SCOPE" + ], + "findings": [] + } + ], + "properties": { + "TX-3": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "authenticate: Ok <=> predecessor = signer and key registered to signer with role; errors IndirectCall, UnknownKey, WrongRole, KeyAccountMismatch; read-only", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: authenticate ensures auth_spec; kani: h_step_request, h_step_approve, h_step_reject", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TX-4": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "request_action: exact result, error order (auth, EmptyAction, ActionTooLong, TooManyPending, LogFull), appended request recording the caller's registration id, caller key pend+1", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-STRLEN" + ], + "harness": "verus: request_action ensures refines(request_spec); kani: h_step_request, h_raw_request", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TR-1": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Provenance: every proof has a prior successful request by a registered agent key and a successful approval restating the action by a registered approver key of a different account, with the agent registration continuous in between; the proof's registration ids are the registrations in force at request and approval", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-SIGNER", + "ASM-PRED" + ], + "harness": "verus: lemma_tr1 (runs from init), lemma_reg_stays; kani: h_init, h_step_*, h_bmc_from_init", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "SH-1": { + "module": "contract_shell", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "Env mapping (caller, now) with pairwise-distinct context values; add_agent/add_approver pass the right role; all three owner methods pass the predecessor (DAO owner works, relayed owner signature fails)", + "assumptions": [], + "harness": "near-tests/tests/shell.rs sh1_env_mapping; store_diff.rs", + "cross": [ + "review" + ], + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "RT-KEY": { + "module": "runtime_assumptions", + "layer": "sandbox", + "evidence": "test", + "status": "in-progress", + "description": "FC key of account a arrives as signer = predecessor = a with signer_pk = key; unregistered and cross-account keys rejected", + "assumptions": [ + "ASM-SIGNER" + ], + "harness": "sandbox/tests/runtime.rs::rt_key", + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "SH-4": { + "module": "contract_shell", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "approval_requested: exactly one NEP-297 line with RequestView(r), status pending; emitted only after Ok", + "assumptions": [ + "ASM-ATOMIC" + ], + "harness": "near-tests/tests/shell.rs sh4_approval_requested_is_one_exact_line; store_diff.rs", + "cross": [ + "review", + "difftest" + ], + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "SH-6": { + "module": "contract_shell", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "Each change method logs exactly its one event (key_added, key_revoked with voided_pending, approval_requested, action_approved, action_rejected = returned RejectionView); new, views and failed calls log nothing", + "assumptions": [], + "harness": "near-tests/tests/shell.rs sh6_each_change_method_logs_exactly_its_event_and_nothing_else_logs; store_diff.rs", + "cross": [ + "difftest" + ], + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "C-4": { + "module": "requirements", + "layer": "prolog", + "evidence": "check", + "status": "verified", + "description": "Each event from exactly one method; authority/proof-changing ops emit an event or carry accepted_risk (admin ops emit key_added / key_revoked since 3426c92)", + "assumptions": [], + "depends_on": [ + "contract/src/lib.rs", + "README.md" + ] + }, + "RT-TRACE": { + "module": "runtime_assumptions", + "layer": "sandbox", + "evidence": "test", + "status": "in-progress", + "description": "Prolog traces + 200 random sequences replayed on the reproducible wasm equal spec.rs: results, exact messages, logs, views", + "assumptions": [ + "ASM-COMPILE", + "ASM-SDK" + ], + "harness": "sandbox/tests/trace.rs::rt_trace", + "depends_on": [ + "core/src/lib.rs", + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "TX-5": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "approve: exact result, error order (auth, RequestNotFound, AlreadyApproved, AlreadyRejected, AgentRevoked, ActionMismatch, SelfApproval, LogFull), approval recorded with the approver's registration id, log appended, agent key pend-1, proof = approval(s', i)", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: approve ensures refines(approve_spec); kani: h_step_approve", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-5": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Separation of duties: approver account != agent account, on every approval and rejection", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv_req), lemma_full_inv; kani: h_init, h_step_*", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-6": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Approver key != agent key on every approval and rejection", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv_req), lemma_full_inv; kani: h_init, h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "RT-RELAY": { + "module": "runtime_assumptions", + "layer": "sandbox", + "evidence": "test", + "status": "in-progress", + "description": "Calls through a third-party relay contract fail IndirectCall", + "assumptions": [ + "ASM-PRED" + ], + "harness": "sandbox/tests/runtime.rs::rt_relay", + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "SH-5": { + "module": "contract_shell", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "action_approved: exactly one line; data = return value = get_approval(i) at approval (revocation fields null); later get_approval differs only in agent_key_revoked_at / approver_key_revoked_at", + "assumptions": [], + "harness": "near-tests/tests/shell.rs sh5_action_approved_equals_return_value_and_get_approval_forever; store_diff.rs", + "cross": [ + "difftest" + ], + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "RD-1": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "approval(s,i) = Some(proof(R[i])) iff approved; None for pending, void or unknown", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: approval ensures approval_spec, lemma_rd1; kani: h_read", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "RD-5": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Per-request and paged views agree; proof findable by request_id or approval_index", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: lemma_rd2; kani: h_read", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "HIST-5": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Proof stability: a published proof never changes", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: hist, lemma_hist; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "SH-7": { + "module": "contract_shell", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "View mapping: get_approval(s) with proof_revocations, get_approvals defaults (0, 50); get_request None past #R else every field of R[i] plus request_status; get_rejection; get_revocation = V(g); get_principal None if unregistered else account, role, registration_id, pending; get_owner; counts", + "assumptions": [], + "harness": "near-tests/tests/shell.rs sh7_*; store_diff.rs check_views every step", + "cross": [ + "difftest" + ], + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "SH-8": { + "module": "contract_shell", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "JSON shape: README field names of every view and event payload (incl. revocation fields, RejectionView, KeyView, KeyRevokedView, BlockTimeView), U64 strings for *_ns, numbers for ids and heights, {} or null fields give defaults, whole-args null fails (wasm wrappers: sandbox), lossless conversions", + "assumptions": [], + "harness": "near-tests/tests/shell.rs sh8_json_shape (argument half: sandbox, M6)", + "cross": [ + "sandbox" + ], + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "VER-1": { + "module": "deployment", + "layer": "prolog", + "evidence": "check", + "status": "in-progress", + "description": "Accept proofs only from get_approval at final, or action_approved logs of successful receipts with executor_id = C in final blocks", + "assumptions": [ + "ASM-FINAL", + "ASM-ATOMIC" + ], + "harness": "prolog/tests/test_verifier_rules.pl; sandbox/tests/runtime.rs::rt_spoof", + "cross": [ + "sandbox" + ], + "depends_on": [ + "README.md" + ] + }, + "RD-2": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Exact page: approvals(f,l) = proofs of L[f..min(f saturating_add min(l,100), #L)], no drops", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: approvals ensures approvals_spec, lemma_rd2; kani: h_read", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "RD-3": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Page arithmetic over any u64 (from, limit, count): no overflow; reads only approval_count, approved_request_id(j) in the page and request(id) for returned ids; no writes", + "assumptions": [ + "ASM-TOOLS", + "ASM-IDENT" + ], + "harness": "h_page_arith, h_page_arith_empty", + "cross": [ + "verus" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "RD-4": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Client loop (stop on empty page or from >= count) enumerates the log exactly once, in order", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: lemma_rd4; plain: plain::client_enum", + "cross": [ + "plain", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "RES-3": { + "module": "contract_shell", + "layer": "sandbox", + "evidence": "test", + "status": "in-progress", + "description": "get_approvals(0,100) over 100 max-size proofs stays under view gas and 4 MiB return; measured about 1.30 MB (1,299,658-1,299,659 B) and about 88.3-88.4 TGas as a transaction (near-sandbox 2.13.4)", + "assumptions": [ + "ASM-LIMITS" + ], + "harness": "sandbox/tests/shell.rs::res3_full_page_of_max_proofs", + "depends_on": [ + "core/src/lib.rs", + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "VER-5": { + "module": "deployment", + "layer": "prolog", + "evidence": "check", + "status": "in-progress", + "description": "Enumerate with the RD-4 loop at one block_id", + "assumptions": [], + "harness": "prolog/tests/test_verifier_rules.pl", + "depends_on": [ + "README.md" + ] + }, + "INV-8": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Registration provenance: R[i].ak = k and i >= P(k).active_from => R[i].aa = P(k).account, role Agent and R[i].agent_registration_id = P(k).registration_id", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv_kr), lemma_full_inv; kani: h_step_*", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "RT-SELFACCT": { + "module": "runtime_assumptions", + "layer": "sandbox", + "evidence": "test", + "status": "in-progress", + "description": "A contract on the signer's own account calling C succeeds (documents F-9)", + "assumptions": [ + "ASM-PRED" + ], + "harness": "sandbox/tests/runtime.rs::rt_selfacct", + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "RT-METATX": { + "module": "runtime_assumptions", + "layer": "sandbox", + "evidence": "test", + "status": "in-progress", + "description": "NEP-366 delegate action outcome recorded: IndirectCall on C for both an agent function-call key and a full-access agent key (results/RT-METATX.json)", + "assumptions": [ + "ASM-META" + ], + "harness": "sandbox/tests/runtime.rs::rt_metatx", + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "RT-FCKEY": { + "module": "runtime_assumptions", + "layer": "sandbox", + "evidence": "test", + "status": "in-progress", + "description": "Agent FC key scoped to request_action cannot call approve or add_agent: InvalidAccessKeyError(MethodNameMismatch), not a contract panic", + "assumptions": [ + "ASM-FCKEY" + ], + "harness": "sandbox/tests/runtime.rs::rt_fckey", + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "DEP-1": { + "module": "deployment", + "layer": "deploy-check", + "evidence": "check", + "status": "in-progress", + "description": "Code hash = reproducible build, not a global contract referenced by account id; locked at deploy (deploy + new + full-access key deletion in one tx); owner is multisig/DAO; registered keys (rebuilt from an indexer) are FC keys scoped to C ([request_action]; [approve] or [approve, reject]) with finite allowance; balance buffer. Demonstrated on near-sandbox only: no testnet deployment", + "assumptions": [ + "ASM-DEPLOY", + "ASM-OWNER" + ], + "harness": "deploy-checks/check_deployment.py; sandbox/tests/deploy.rs::dep1_check_deployment_in_sandbox", + "depends_on": [ + "README.md", + "contract/src/lib.rs" + ] + }, + "VER-8": { + "module": "deployment", + "layer": "deploy-check", + "evidence": "check", + "status": "in-progress", + "description": "Per proof: archival view_access_key for the agent key at the request block and the approver key at the approval block both show a function-call permission with receiver C and the DEP-1 method names (closes F-9)", + "assumptions": [ + "ASM-FCKEY", + "ASM-PRED" + ], + "harness": "deploy-checks/check_deployment.py; prolog/tests/test_verifier_rules.pl; sandbox/tests/deploy.rs::dep1_check_deployment_in_sandbox", + "cross": [ + "prolog" + ], + "depends_on": [ + "README.md" + ] + }, + "TX-1": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "add_principal: Ok(principal) <=> caller = owner, key unregistered and G != MAXU; errors NotOwner, KeyAlreadyRegistered, LogFull; P' = P[k -> (acct, role, G, #R, 0)], G' = G + 1", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: add_principal ensures refines(add_spec); kani: h_step_add, h_raw_add", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TX-2": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "revoke_key: Ok(P(k)) <=> caller = owner and key registered; errors NotOwner, KeyNotRegistered; P' = P minus k, V' = V[P(k).reg -> t]", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: revoke_key ensures refines(revoke_spec); kani: h_step_revoke", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TX-6": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Owner never changes; owner checks compare the caller account passed by the shell (predecessor: SH-1)", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "h_step_*", + "cross": [ + "review", + "verus" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "HIST-6": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Registry discipline: owner fixed; P changes only by owner Add/Revoke or the pending field on request/approve/reject", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: hist, lemma_hist; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "HIST-7": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Owner operations never change requests or the log, and reject never changes the log, from any state", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "h_raw_add, h_raw_revoke, h_raw_reject", + "cross": [ + "verus" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-0": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Registry is a function: one registration and role per key (MemStore has no duplicate keys)", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (principals is a Map; MemStore wf distinct_keys); kani: h_store_laws_mem_law_insert, h_store_laws_mem_law_remove, h_store_laws_arr, h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "C-1": { + "module": "requirements", + "layer": "prolog", + "evidence": "check", + "status": "verified", + "description": "Authority matrix: one authority per change method; owner/agent/approver method sets disjoint; no key can both request and approve", + "assumptions": [], + "depends_on": [ + "README.md" + ] + }, + "HIST-2": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Decisions immutable once recorded: approvals and rejections", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: hist (grows), lemma_hist, lemma_run_grows; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TR-2": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Each request decided (approved or rejected) at most once in any trace", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: lemma_tr2; kani: h_step_approve, h_step_reject, h_bmc_from_init", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TLA-SAFE": { + "module": "tla_model", + "layer": "tla", + "evidence": "model-check", + "status": "in-progress", + "description": "TLC: Inv (INV-3..9, INV-11..16, LEM-1/2, TR-1 provenance, RidLive, Approvable) in every reachable state and StepProperty (HIST-1/2/3/7/8/9/10, TR-2, TR-3) on every step, any interleaving of all calls by all parties", + "assumptions": [ + "ASM-IDENT", + "ASM-TLA-SCOPE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "MC_Safety", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TLA-IND": { + "module": "tla_model", + "layer": "tla", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Apalache: Init => Inv, and Inv /\\ Next => Inv' /\\ StepProps from any state with <= 3 requests, integers unbounded, MaxPending scaled to 2: Inv and the step properties hold at every depth", + "assumptions": [ + "ASM-IDENT", + "ASM-TLA-SCOPE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "MC_Apalache", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEAN-IND": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-proof", + "status": "in-progress", + "description": "Lean: Init => Inv and Inv /\\ Next => Inv' (TypeOK, INV-2..9, INV-11..16, INV-5r, LEM-1/2, TR-1 provenance, RidLive, Approvable) for states of every size, every MaxPending, any key, account and payload types; so Inv holds in every reachable state. TLA-IND without its bound of 3", + "assumptions": [ + "ASM-LEAN-TLA", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "inv_init, inv_next, reach_inv", + "cross": [ + "tla" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEAN-STEP": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-proof", + "status": "in-progress", + "description": "Lean: every call from an Inv state, successful or not, satisfies StepProps (HIST-1/2/3/7/8/9/10), at every size", + "assumptions": [ + "ASM-LEAN-TLA", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "stepProps_next, stepProps_step", + "cross": [ + "tla" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEAN-TR": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-proof", + "status": "in-progress", + "description": "Lean: over every run of any length from a reachable state, a decision is final (TR-2), Void is terminal across revoke and re-add (TR-3), request content, the log prefix, the registration counter and the revocation set only grow; every decided request has TR-1 provenance", + "assumptions": [ + "ASM-LEAN-TLA", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "tr1_provenance, tr2_decision_final, tr3_void_terminal, hist1_run, hist3_run, hist10_run", + "cross": [ + "tla" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TR-3": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Durable revocation: a request whose agent registration is revoked while pending is never approved, even after re-registration", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: lemma_tr3, witness_trace; kani: h_step_*, h_bmc_from_init_witness", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "HIST-8": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Void is terminal", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: hist, lemma_hist, lemma_run_void; kani: h_step_*", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEM-4": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Under INV-8, liveness reduces to active_from <= id; role/account checks are redundant (F-14, the 2 equivalent mutants)", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: lemma_live_reduces; kani: h_read", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "RD-7": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "request_status = Approved / Rejected / Pending (live) / Void; None for unknown ids", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: request_status ensures, lemma_rd7; kani: h_read", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-11": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Live registration ids are issued (< G), pairwise distinct and not revoked", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv), lemma_full_inv; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-12": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Revoked registration ids are issued (< G) and each is revoked once (insert_revocation's write-once law holds)", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv), lemma_full_inv; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-14": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Recorded registration ids (request agent, approver, rejecter) are issued (< G)", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv_req), lemma_full_inv; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-15": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Registration accounting: #P + #V = G, so with INV-11/12 every issued registration is exactly one of live or revoked", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv, lemma_full_inv; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-16": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Registration binding: a live registration id recorded on a request or decision belongs to the key, account and role it was recorded with", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv_kr), lemma_full_inv; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "HIST-10": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Registrations and revocations: G grows by 1 exactly on a successful Add, V gains one entry exactly on a successful Revoke, and a recorded revocation never changes", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: hist, lemma_hist; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TR-7": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Revocation record: V lists exactly the successful Revokes, in order, each with the registration id it removed (as issued, fresh, by Add) and its time", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: lemma_tr7 (runs from init); kani: h_init, h_step_*, h_bmc_from_init", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "RD-8": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "proof_revocations(proof) = (V(agent registration), V(approver registration)); under Inv each is None exactly when that registration is still the key's current one", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: proof_revocations ensures, lemma_rd8; kani: h_read", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-1": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Dense request ids: R[i].id = i", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv, lemma_full_inv; kani: h_step_*", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-3": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Log -> request: L[j] < #R and R[L[j]] approved with index j", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv_log), lemma_full_inv; kani: h_step_*", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-4": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Request -> log: approved R[i] has index < #L and L[index] = i", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv_req), lemma_full_inv; kani: h_step_*", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-7": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Registration bound: P(k).active_from <= #R", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv_key), lemma_full_inv; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEM-1": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Approval log has no duplicates", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: lemma_log_distinct; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEM-2": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "#L = number of approved requests <= #R", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv, lemma_log_room; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "HIST-3": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Approval log append-only", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: hist (grows), lemma_hist, lemma_run_grows; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "HIST-4": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "#R grows by 1 exactly on a successful request, #L by 1 exactly on a successful approval; otherwise unchanged", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: hist, lemma_hist; kani: h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-2": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Stored actions are 1..=2048 bytes", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-STRLEN" + ], + "harness": "verus: full_inv (inv_req), lemma_full_inv; kani: h_step_*", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-9": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Pending count: P(k).pending equals undecided (neither approved nor rejected) requests of k under its registration, <= 16 (0 for approvers); the cap bound is stepped in h_raw_request", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv_key), lemma_full_inv, lemma_approver_pending; kani: h_step_*, h_raw_request", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "ROB-3": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Action length boundaries in bytes: 0, 1 (a space), 2048, 2049 and a multi-byte 2050", + "assumptions": [ + "ASM-TOOLS", + "ASM-IDENT" + ], + "harness": "h_action_len", + "cross": [ + "plain" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TR-6": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Agent storage bound as a potential: Phi = sum over agent keys of (16 - pending) >= 0 drops by 1 per successful request and rises only on a successful approval or rejection or agent Add", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: lemma_tr6 (per key); kani: h_step_*, h_raw_request", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "RES-1": { + "module": "contract_shell", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "Storage growth per op (add, revoke, request, approve, reject) computed from the Borsh layout and equal to VMLogic's metering at the worst case; measured on-chain (sandbox); 16 x B_req = 0.364 NEAR per agent key without an approver (ed25519/secp256k1; ML-DSA-65 keys are refused, SH-13)", + "assumptions": [ + "ASM-STAKE" + ], + "harness": "near-tests/tests/shell.rs res1_storage_growth_bounds", + "cross": [ + "sandbox" + ], + "depends_on": [ + "core/src/lib.rs", + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "RES-2": { + "module": "contract_shell", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "Worst-case approval_requested, action_approved and action_rejected lines (2048 escaped control bytes, 64-char accounts, ed25519/secp256k1 keys, max u64s) fit 16384 B: 13197 B (F-4). ML-DSA-65 keys, which would reach 18256 B on both sides (F-17), cannot be registered (SH-13)", + "assumptions": [ + "ASM-LIMITS" + ], + "harness": "near-tests/tests/shell.rs res2_worst_case_event_lines_fit_16384_bytes, f17_mldsa65_keys_are_refused", + "cross": [ + "sandbox" + ], + "depends_on": [ + "core/src/lib.rs", + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "SH-13": { + "module": "contract_shell", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "add_agent and add_approver refuse ML-DSA-65 keys (F-17): after the owner check (non-owners get NotOwner) and before the core's guards (LogFull), with exactly UNSUPPORTED_KEY_TYPE and no log; so every registered key is ed25519 or secp256k1, the key types RES-1 and RES-2 bound", + "assumptions": [ + "ASM-LIMITS" + ], + "harness": "near-tests/tests/shell.rs f17_mldsa65_keys_are_refused; sandbox/tests/shell.rs sh13_mldsa65_key_refused", + "cross": [ + "sandbox" + ], + "depends_on": [ + "contract/src/lib.rs" + ] + }, + "TLA-LIVE-1": { + "module": "tla_model", + "layer": "tla", + "evidence": "model-check", + "status": "in-progress", + "description": "Under weak fairness of approvers, a request whose eligible approver eventually always exists never stays pending (ends approved, rejected or void); fails without fairness (non-vacuity). MC_Liveness_SF: under strong fairness an eligible approver infinitely often is enough (TLA-LIVE-1s)", + "assumptions": [ + "ASM-IDENT", + "ASM-TLA-SCOPE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "MC_Liveness", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TLA-LIVE-2": { + "module": "tla_model", + "layer": "tla", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Approvable: every Approver key of another account can approve or reject a pending request (no accepted request is stuck in the core)", + "assumptions": [ + "ASM-IDENT", + "ASM-TLA-SCOPE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "MC_Apalache, MC_Safety", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEAN-LIVE": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-proof", + "status": "in-progress", + "description": "Lean: TLA-LIVE-1 for every behaviour at every size (any key, account and payload types, any MaxPending, any number of requests and registrations, any step relation, so both Next and MC_Liveness's BNext); TLA-LIVE-1s under strong fairness; a concrete unfair behaviour violates Live1 and a fair one satisfies its premise. TLA-LIVE-1 without TLC's bounds", + "assumptions": [ + "ASM-LEAN-TLA", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "live1, live1_sf, live1_of_live1Inf, unfair_violates, fair_witness (Liveness.lean, LivenessWitness.lean)", + "cross": [ + "tla" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "SH-11": { + "module": "contract_shell", + "layer": "wasm-check", + "evidence": "check", + "status": "in-progress", + "description": "Function exports exactly the 16 #[near] methods + contract_source_metadata + __contract_abi (embedded by cargo-near); the only non-function export is memory; no Store, upgrade or owner-transfer export", + "assumptions": [ + "ASM-SDK" + ], + "harness": "tools/scripts/wasm-surface.sh vs wasm-surface.expected (cargo near build non-reproducible-wasm)", + "cross": [ + "sandbox" + ], + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "SH-12": { + "module": "contract_shell", + "layer": "wasm-check", + "evidence": "check", + "status": "in-progress", + "description": "No promise_*, deploy, delete, add-key, global-contract or transfer imports (exact import set in wasm-surface.expected); only ST-5 storage keys written", + "assumptions": [], + "harness": "tools/scripts/wasm-surface.sh (forbidden-import check, exact import set); store_diff.rs (storage keys)", + "cross": [ + "review", + "difftest" + ], + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "C-6": { + "module": "requirements", + "layer": "prolog", + "evidence": "check", + "status": "in-progress", + "description": "Generated API surface equals the requirements API table: #[near] wasm exports = method/3 names, other exports only near-sdk's (contract_source_metadata, __contract_abi), ABI kind and modifiers match each method's kind and authority", + "assumptions": [], + "harness": "consistency.pl c_check('C-6') over extracted/api_facts.pl (tools/scripts/wasm-surface.sh)", + "cross": [ + "wasm-check" + ], + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "TX-0": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Atomic failure: Err => state unchanged; no Store mutator on failure except remove_principal of an absent key (F-6, no-op)", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: refines (every mutator's ensures); kani: h_step_*, h_raw_*", + "cross": [ + "kani", + "plain" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "ROB-1": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "No panics, overflows or OOB indexing for any arguments and any MemStore within the bounds (beyond: ASM-MODEL), including non-Inv states", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS" + ], + "harness": "h_raw_*", + "cross": [ + "verus" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "ROB-2": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "LogFull guards: count = MAXU with all earlier guards passing => Err(LogFull), no writes, before the shell's += 1 (which would panic under overflow-checks); approve's case needs a non-Inv state", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS" + ], + "harness": "h_proto_request, h_proto_approve", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "ROB-4": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Bounded work: <= 4 Store reads and <= 3 writes per mutator; approvals <= 2*min(l,100)+1 reads", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS" + ], + "harness": "h_count_*, h_page_arith", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "ST-1": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Store laws for MemStore and Sparse (map/sequence semantics; removing an absent key is a no-op)", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS" + ], + "harness": "h_store_laws_mem_law_*, h_store_laws_sparse, h_store_laws_sparse_reg, h_store_laws_arr", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "ST-2": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Store protocol: exact mutator call sequence per op; makes contract-store differences from MemStore unreachable", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "h_proto_*, h_refine_*", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "ST-3": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Sparse (transliteration of the contract Store impl) refines ArrStore under Kani (h_refine_*) and MemStore in plain mode; ST-1 laws tie ArrStore and MemStore to the same observations", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS" + ], + "harness": "h_refine_*", + "depends_on": [ + "core/src/lib.rs", + "contract/src/lib.rs" + ] + }, + "ST-4": { + "module": "contract_store", + "layer": "difftest", + "evidence": "test", + "status": "in-progress", + "description": "Real ApprovalContract store (public methods, mocked runtime) refines MemStore over 10k x 50 random ops, persisted and reloaded every step: equal results and alpha after every step", + "assumptions": [ + "ASM-STORE", + "ASM-SDK" + ], + "harness": "near-tests/tests/store_diff.rs store_refines_memstore_with_reload_every_step", + "depends_on": [ + "core/src/lib.rs", + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "ST-5": { + "module": "contract_store", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "Storage prefixes p/r/a/v pairwise distinct, prefix-free and distinct from STATE; after every random step the keys are exactly STATE and prefix ++ borsh(key) for the entries alpha lists", + "assumptions": [ + "ASM-STORE" + ], + "harness": "near-tests/tests/shell.rs st5_prefixes_distinct_and_state_roundtrips; store_diff.rs (exact key set every step)", + "cross": [ + "review", + "difftest" + ], + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "ST-6": { + "module": "contract_store", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "Golden Borsh bytes (key, value) for STATE and one entry of each map: ed25519 and secp256k1 principals; pending, approved, rejected requests; log entry; revocation. Layout changes flagged storage-breaking", + "assumptions": [ + "ASM-STORE" + ], + "harness": "near-tests/tests/shell.rs st6_golden_borsh_bytes (tests/golden/layout.txt)", + "depends_on": [ + "core/src/lib.rs", + "core/Cargo.toml", + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "ST-7": { + "module": "contract_store", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "Identity equality: == on near-sdk AccountId and PublicKey equals Borsh-byte equality, is reflexive and symmetric, and survives clone and a Borsh round trip (edge identities and 200k random pairs); the checked half of ASM-IDENT", + "assumptions": [], + "harness": "near-tests/tests/ident.rs", + "depends_on": [ + "Cargo.lock" + ] + }, + "ST-8": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Store protocol at any store size (K-ORACLE): on a Sparse holding the step's footprint at any keys and positions, with every field and counter free, approve and reject return exactly expect() and make exactly the protocol() calls, with accounts from 8 values (ST-8W, src::Wide: every footprint maps injectively); add, revoke and request read no request, so h_proto_* already covers them at every size", + "assumptions": [ + "ASM-IDENT", + "ASM-TOOLS" + ], + "harness": "h_oracle_approve, h_oracle_reject (with h_proto_add/revoke/request)", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "SH-2": { + "module": "contract_shell", + "layer": "difftest", + "evidence": "test", + "status": "in-progress", + "description": "Exactly one core transition per change call and no other writes", + "assumptions": [], + "harness": "near-tests/tests/store_diff.rs (alpha and the exact storage key set after every call)", + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "SH-3": { + "module": "contract_shell", + "layer": "unit", + "evidence": "test", + "status": "in-progress", + "description": "Core Err(e) panics with exactly e.as_str() (catch_unwind; payload HostError(GuestPanic { panic_msg })) and logs nothing; all 17 errors incl. the three LogFull guards", + "assumptions": [], + "harness": "near-tests/tests/shell.rs sh3_*; store_diff.rs", + "cross": [ + "sandbox", + "difftest" + ], + "depends_on": [ + "core/src/lib.rs", + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "RD-6": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Core reads are pure (Window store panics on writes); every get_* takes &self", + "assumptions": [ + "ASM-TOOLS", + "ASM-IDENT" + ], + "harness": "h_page_arith, h_page_arith_empty", + "cross": [ + "review" + ], + "depends_on": [ + "core/src/lib.rs", + "contract/src/lib.rs" + ] + }, + "LEM-3": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "An unapproved request exists => #L < #R <= MAXU, so approve's LogFull is unreachable (F-7)", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: lemma_log_room; kani: h_step_approve", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEAN-DELTA": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-proof", + "status": "in-progress", + "description": "Lean: on every concrete store of every size whose request ids equal their positions and whose counters are below u64::MAX, the transcribed expect error is the model's err and running the transcribed protocol calls lands on the model's step, up to map equality of principals and set equality of revocations", + "assumptions": [ + "ASM-LEAN-TLA", + "ASM-TOOLS" + ], + "harness": "delta_refines (Delta.lean)", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LINK": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-check", + "status": "in-progress", + "description": "ghost::expect / ghost::protocol (Rust) equal the Lean cstep on the representative view of every class (14,310 views, Lean's allCls.map rep exactly, as a set); the real core on a Sparse holding each view agrees too", + "assumptions": [ + "ASM-NU", + "ASM-TOOLS" + ], + "harness": "run-lean.sh link (kani link::link_cases, approval-lean link)", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEAN-COVER": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-proof", + "status": "in-progress", + "description": "Lean: for every footprint view of every concrete store (any identity types, any Nat counters, request at i has id i and a pay action), cls v is in allCls and cstep v op = (sub v op).out (cstep (rep (cls v op))): every view steps like its LINK representative, transported back", + "assumptions": [ + "ASM-NU", + "ASM-TOOLS" + ], + "harness": "Ident.cover, Ident.cls_mem, Ident.wfv_of_store (Ident.lean)", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEAN-FRAME": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-proof", + "status": "in-progress", + "description": "Lean: cstep depends only on the footprint (owner, call key's principal, request at the id, its key's principal, decision ids, counters): stores agreeing there step the same", + "assumptions": [ + "ASM-TOOLS" + ], + "harness": "Ident.frame (Ident.lean)", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEAN-REN": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-proof", + "status": "in-progress", + "description": "Lean: cstep commutes with renaming accounts, keys and payloads, for any renaming injective on the footprint", + "assumptions": [ + "ASM-TOOLS" + ], + "harness": "Ident.rename (Ident.lean)", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "K-LINK-T": { + "module": "lean_model", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Rust side of LEAN-COVER: on a symbolic footprint view (any u8 accounts and keys, free u64/u32 counters and times), ghost::expect / ghost::protocol on the view equal the transported result of the same functions on its representative", + "assumptions": [ + "ASM-NU", + "ASM-TOOLS" + ], + "harness": "h_link_t_add, h_link_t_revoke, h_link_t_request(_empty, _long), h_link_t_approve_part_{err,c0,c1_ids,c1_act_v,c1_act_s,c1_appr,c1_rej,c2,c3}, plain h_link_t (keeps_action_all), h_link_t_approve(_empty, _long), h_link_t_reject", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-10": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Time order (non-decreasing time inputs): approved_at and rejected_at >= requested_at component-wise", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-TIME" + ], + "harness": "verus: inv10, lemma_timed; kani: h_init, h_step_*", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "TR-4": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Approval times non-decreasing along the log", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC", + "ASM-TIME" + ], + "harness": "verus: tr4, lemma_timed; kani: h_step_approve", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "RT-TIME": { + "module": "runtime_assumptions", + "layer": "sandbox", + "evidence": "test", + "status": "in-progress", + "description": "Stored request/approval/rejection times equal the block their receipt ran in; heights strictly increase and timestamps never decrease across receipts on C", + "assumptions": [ + "ASM-TIME" + ], + "harness": "sandbox/tests/runtime.rs::rt_time", + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "RT-CODEHASH": { + "module": "runtime_assumptions", + "layer": "sandbox", + "evidence": "check", + "status": "in-progress", + "description": "Wasm under test is the reproducible build; record sha256 (hex) and NEAR code_hash (base58)", + "assumptions": [ + "ASM-DEPLOY", + "ASM-COMPILE" + ], + "harness": "sandbox/tests/runtime.rs::rt_codehash", + "depends_on": [ + "Cargo.toml", + "Cargo.lock", + "contract/Cargo.toml", + "core/Cargo.toml", + "core/src/lib.rs", + "contract/src/lib.rs" + ] + }, + "RT-RESET": { + "module": "runtime_assumptions", + "layer": "sandbox", + "evidence": "test", + "status": "in-progress", + "description": "Delete + recreate C resets counters; VER-3 detects it (VER-6 only heuristically)", + "assumptions": [ + "ASM-CODE" + ], + "harness": "sandbox/tests/deploy.rs::rt_reset", + "depends_on": [ + "contract/src/lib.rs", + "Cargo.lock" + ] + }, + "VER-2": { + "module": "deployment", + "layer": "deploy-check", + "evidence": "check", + "status": "in-progress", + "description": "code_hash(C) = expected at the proof's block (archival) and now", + "assumptions": [ + "ASM-CODE" + ], + "harness": "deploy-checks/check_deployment.py; sandbox/tests/deploy.rs::dep1_check_deployment_in_sandbox", + "cross": [ + "prolog" + ], + "depends_on": [ + "README.md" + ] + }, + "VER-3": { + "module": "deployment", + "layer": "deploy-check", + "evidence": "check", + "status": "in-progress", + "description": "No full-access key on C since b0, or an indexer scan finds no DeployContract/UseGlobalContract/AddKey/DeleteAccount", + "assumptions": [ + "ASM-CODE" + ], + "harness": "deploy-checks/check_deployment.py; sandbox/tests/deploy.rs::dep1_check_deployment_in_sandbox", + "cross": [ + "prolog", + "sandbox" + ], + "depends_on": [ + "README.md" + ] + }, + "VER-6": { + "module": "deployment", + "layer": "prolog", + "evidence": "check", + "status": "in-progress", + "description": "Counter decrease or code-hash change invalidates cached proofs", + "assumptions": [], + "harness": "prolog/tests/test_verifier_rules.pl; sandbox/tests/deploy.rs::rt_reset", + "depends_on": [ + "README.md" + ] + }, + "TR-5": { + "module": "core_state_machine", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Non-vacuity: approved, rejected and void states reachable; every error reachable (approve LogFull only from a non-Inv Sparse state, h_proto_approve); request LogFull only at #R = MAXU", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "h_step_*, h_raw_request, h_action_len, h_proto_request, h_proto_approve, h_bmc_from_init", + "cross": [ + "verus", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "MC-1": { + "module": "requirements", + "layer": "prolog", + "evidence": "model-check", + "status": "verified-with-assumptions", + "description": "Bounded model check of reference step/4 at depth 6 with real constants: no INV, separation-of-duties, double-approval, pending-count or revival violation; reaches approved and void states and every error except both LogFull and TooManyPending; MC-1s (max_pending=2, max_u=2) also reaches TooManyPending and request LogFull; state counts >= mc1_state_floor", + "assumptions": [ + "ASM-SPEC" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "MC-2": { + "module": "requirements", + "layer": "prolog", + "evidence": "test", + "status": "in-progress", + "description": "Generated traces replayed on the real core, on spec.rs and (RT-TRACE) on the wasm; all agree", + "assumptions": [ + "ASM-SPEC" + ], + "cross": [ + "plain", + "sandbox" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "C-2": { + "module": "requirements", + "layer": "prolog", + "evidence": "check", + "status": "verified", + "description": "Guard table: every ApprovalError produced by >=1 guard; specified precedence equals generated code_precedence/2", + "assumptions": [], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "C-3": { + "module": "requirements", + "layer": "prolog", + "evidence": "check", + "status": "verified", + "description": "Error messages pairwise distinct and substring-free", + "assumptions": [], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "C-5": { + "module": "requirements", + "layer": "prolog", + "evidence": "check", + "status": "verified", + "description": "Generated constants equal requirement constants; DEFAULT_PAGE_SIZE <= MAX_PAGE_SIZE; MAX_PENDING_PER_KEY >= 1; MAX_ACTION_LEN within RES-2 bound", + "assumptions": [], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "C-7": { + "module": "requirements", + "layer": "prolog", + "evidence": "check", + "status": "verified", + "description": "Traceability both ways: every requirement has >=1 property; every property traces to a requirement or threat", + "assumptions": [], + "depends_on": [ + "README.md" + ] + }, + "C-8": { + "module": "requirements", + "layer": "prolog", + "evidence": "check", + "status": "verified", + "description": "Every threat has mitigated_by or accepted_risk", + "assumptions": [] + }, + "C-9": { + "module": "requirements", + "layer": "prolog", + "evidence": "check", + "status": "verified", + "description": "Property and assumption IDs in status.toml equal those in traceability.pl", + "assumptions": [] + }, + "C-10": { + "module": "requirements", + "layer": "prolog", + "evidence": "check", + "status": "verified", + "description": "Warn when a verified* property depends on an assumption with level below high whose check has not passed", + "assumptions": [] + }, + "TLA-WIT": { + "module": "tla_model", + "layer": "tla", + "evidence": "model-check", + "status": "in-progress", + "description": "Non-vacuity: approved, rejected, void, revival-attempt and pending-cap states are reachable in TLC; IndInit holds full states with approved, rejected and void requests and a revocation", + "assumptions": [ + "ASM-TOOLS" + ], + "harness": "MC_Safety, MC_Apalache", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "REF-1": { + "module": "tla_model", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Guard exactness (A1): the core's error equals the TLA+ error operator on alpha(pre); Ok exactly when the TLA+ action is enabled", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS" + ], + "harness": "h_ref_*", + "cross": [ + "plain" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "REF-2": { + "module": "tla_model", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Effect exactness (A2): on Ok, alpha(post) is the TLA+ action's post-state", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS" + ], + "harness": "h_ref_*", + "cross": [ + "plain" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "REF-3": { + "module": "tla_model", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Rejected calls stutter (A3): on Err, alpha(post) = alpha(pre)", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS" + ], + "harness": "h_ref_*", + "cross": [ + "plain" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "REF-4": { + "module": "tla_model", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Time irrelevance (A7): tla.rs reads no BlockTime, so REF-1/2 hold for every block time; payload classes (A5) via h_ref_toolong", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS" + ], + "harness": "h_ref_*", + "cross": [ + "review" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "REF-5": { + "module": "tla_model", + "layer": "plain", + "evidence": "test", + "status": "in-progress", + "description": "Trace validation: 60 x 80-call core traces equal tla.rs on every step, and TLC accepts each as a behaviour of ApprovalCore.tla (>= 5 revival attempts, >= 20 rejections and revocations)", + "assumptions": [ + "ASM-TOOLS" + ], + "harness": "trace::tests::ref5_traces, TraceCheck", + "cross": [ + "tla" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "C-2t": { + "module": "requirements", + "layer": "prolog", + "evidence": "check", + "status": "verified", + "description": "Guard table across models: TLA+ GuardOrder = guard/4 order = code_precedence/2", + "assumptions": [], + "cross": [ + "tla" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "MC-3": { + "module": "requirements", + "layer": "prolog", + "evidence": "model-check", + "status": "verified-with-assumptions", + "description": "Graph equivalence: Prolog step/4 and TLC export the full labelled reachable graph of one small universe; state and edge sets are equal", + "assumptions": [ + "ASM-SPEC", + "ASM-TOOLS" + ], + "cross": [ + "tla" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "CUT-1": { + "module": "tla_model", + "layer": "kani", + "evidence": "bounded-proof", + "status": "in-progress", + "description": "Footprint (kani/CUTOFF.md): each call reads and writes at most the keys, request positions, log slots and revocation records of its row; tracking is transparent", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL", + "ASM-TOOLS" + ], + "harness": "h_cut_*", + "cross": [ + "plain" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "CUT-2": { + "module": "tla_model", + "layer": "review", + "evidence": "review", + "status": "in-progress", + "description": "Cutoff: given CUT-1, harness state bounds (CAP_P, CAP_R, CAP_V) are sufficient for REF-1..3 at every size, except E1 (pending at MAXP) and E2 (counters at u64::MAX), which raw and Sparse harnesses cover, including request/approve LogFull (h_proto_request, h_proto_approve)", + "assumptions": [ + "ASM-IDENT", + "ASM-MODEL" + ], + "harness": "kani/CUTOFF.md", + "cross": [ + "kani" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "U-1": { + "module": "tla_model", + "layer": "review", + "evidence": "review", + "status": "in-progress", + "description": "Every loop in every harness's goto program has a bound derived from a constant, and no reachable loop needs more than its harness unwind", + "assumptions": [ + "ASM-TOOLS" + ], + "harness": "tools/scripts/kani-loops.py", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEAN-GUARD": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-proof", + "status": "in-progress", + "description": "Lean: each error operator returns the first failing guard of a list whose codes are TLA+'s GuardOrder (equal to tla_facts.pl, C-2t); LogFull is never returned (A6)", + "assumptions": [ + "ASM-LEAN-TLA", + "ASM-TOOLS" + ], + "harness": "err_eq_firstFail, guards_order, err_mem_guardOrder, err_ne_logFull; run-lean.sh guards", + "cross": [ + "tla", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "LEAN-WIT": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-proof", + "status": "in-progress", + "description": "Non-vacuity: reachable states with an approved, a rejected, a void and a revoked-re-added-still-void request and a key at the pending cap, checked by evaluation", + "assumptions": [ + "ASM-TOOLS" + ], + "harness": "Witness.lean", + "depends_on": [ + "core/src/lib.rs" + ] + }, + "REF-5L": { + "module": "lean_model", + "layer": "plain", + "evidence": "test", + "status": "in-progress", + "description": "The real core's MC-2 traces (2000 x 120 calls) replayed on the Lean machine: every result and post-store equal", + "assumptions": [ + "ASM-TOOLS" + ], + "harness": "run-lean.sh replay (approval-lean replay)", + "cross": [ + "lean" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "MC-4": { + "module": "lean_model", + "layer": "lean", + "evidence": "model-check", + "status": "verified-with-assumptions", + "description": "Graph equivalence: the Lean machine and TLC export the full labelled reachable graph of the MC_Graph universe; stores, rejected calls and edges are equal (with MC-3: Prolog = TLC = Lean)", + "assumptions": [ + "ASM-TOOLS" + ], + "harness": "run-lean.sh graph (approval-lean graph, mc3.py)", + "cross": [ + "tla" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "VER-4": { + "module": "deployment", + "layer": "prolog", + "evidence": "check", + "status": "in-progress", + "description": "Check action and both accounts against expectations; approver against the verifier's own allowlist", + "assumptions": [ + "ASM-OWNER" + ], + "harness": "prolog/tests/test_verifier_rules.pl", + "depends_on": [ + "README.md" + ] + }, + "VER-7": { + "module": "deployment", + "layer": "prolog", + "evidence": "check", + "status": "in-progress", + "description": "Executors deduplicate on (C, request_id) and enforce a maximum approval age", + "assumptions": [], + "harness": "prolog/tests/test_verifier_rules.pl", + "depends_on": [ + "README.md" + ] + }, + "TX-7": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "reject: exact result, error order (auth, RequestNotFound, AlreadyApproved, AlreadyRejected, AgentRevoked, SelfApproval), rejection recorded with the approver's registration id, agent key pend-1, log unchanged; Ok(R'[i])", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: reject ensures refines(reject_spec); kani: h_step_reject, h_raw_reject", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "HIST-9": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "Rejected is terminal", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: hist, lemma_hist; kani: h_step_*", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + }, + "INV-13": { + "module": "core_state_machine", + "layer": "verus", + "evidence": "proof", + "status": "in-progress", + "description": "At most one decision per request: never both approved and rejected", + "assumptions": [ + "ASM-DERIVE", + "ASM-IDTYPE", + "ASM-STORE", + "ASM-TOOLS", + "ASM-SPEC" + ], + "harness": "verus: full_inv (inv_req), lemma_full_inv; kani: h_step_*", + "cross": [ + "kani", + "prolog" + ], + "depends_on": [ + "core/src/lib.rs" + ] + } + }, + "assumptions": { + "ASM-DERIVE": { + "statement": "(M5 only) #[derive(Clone)] clones field-wise and #[derive(PartialEq)] on Role compares variants; the twin declares these for the core's data types (verus/TRUSTED.toml), which stay outside verus! so their derives are untouched", + "level": "high", + "status": "unverified", + "checked_by": [] + }, + "ASM-IDTYPE": { + "statement": "(M5 only) On near_sdk::AccountId and near_sdk::PublicKey, == is structural equality and clone returns an equal value (the eq_laws / clone_laws hypotheses every Verus core function requires); the equivalence half of ASM-IDENT without its parametricity half", + "level": "high", + "status": "in-progress", + "checked_by": [ + "ST-7" + ] + }, + "ASM-STORE": { + "statement": "store::LookupMap is a map keyed prefix ++ borsh(key); writes flushed when the contract struct drops after state_write. For M5 path A: the contract crate's Store impl meets the Store trait's Verus contract (verified for MemStore; tested, not proved, for the NEAR store)", + "level": "med", + "status": "in-progress", + "checked_by": [ + "ST-4", + "ST-5", + "ST-6" + ] + }, + "ASM-TOOLS": { + "statement": "Kani (unwinding assertions on), Verus+Z3, scryer-prolog, TLC, Apalache and the Lean 4 kernel are sound at the pinned versions", + "level": "n/a", + "status": "unverified", + "checked_by": [] + }, + "ASM-SPEC": { + "statement": "spec.rs, the Verus specs and the Prolog requirements state the intended behaviour; signed off by a human who did not write approval-core", + "level": "n/a", + "status": "unverified", + "checked_by": [ + "C-7", + "MC-2" + ] + }, + "ASM-STRLEN": { + "statement": "(M5 only) String::len is the UTF-8 byte length; is_empty <=> len == 0", + "level": "high", + "status": "unverified", + "checked_by": [] + }, + "ASM-SIGNER": { + "statement": "signer_account_pk() is the key whose signature over the originating tx was verified, an access key of signer_account_id(); signatures unforgeable", + "level": "high", + "status": "in-progress", + "checked_by": [ + "RT-KEY" + ] + }, + "ASM-PRED": { + "statement": "predecessor_account_id() is unforgeable; equals the signer for the first receipt and when code on the signer's own account calls (F-9)", + "level": "high", + "status": "in-progress", + "checked_by": [ + "RT-RELAY", + "RT-SELFACCT" + ] + }, + "ASM-ATOMIC": { + "statement": "Atomicity is per receipt: panic, out-of-gas or LackBalanceForState reverts all writes, including earlier actions batched in the same receipt; logs of a failed receipt may remain", + "level": "med", + "status": "in-progress", + "checked_by": [ + "RT-REVERT", + "RT-BATCH" + ] + }, + "ASM-COMPILE": { + "statement": "rustc/LLVM/wasm-opt preserve core semantics host -> wasm32; overflow-checks on in release; the only on-chain usize use is action.len() > MAX_ACTION_LEN; cfg(feature=\"borsh\") gates only use/derive", + "level": "n/a", + "status": "in-progress", + "checked_by": [ + "RT-CODEHASH", + "RT-TRACE" + ] + }, + "ASM-SDK": { + "statement": "#[init] panics if state exists; #[private] requires predecessor = current account; non-payable change methods reject deposits; &self never writes; only #[near] impl methods exported; PanicOnDefault blocks default init", + "level": "high", + "status": "in-progress", + "checked_by": [ + "SH-9", + "SH-10", + "SH-11" + ] + }, + "ASM-FINAL": { + "statement": "State at finality 'final' is never reverted", + "level": "high", + "status": "unverified", + "checked_by": [] + }, + "ASM-IDENT": { + "statement": "PartialEq on AccountId/PublicKey is an equivalence matching Borsh-byte equality; the core uses A/K only via Clone and PartialEq (parametricity: a footprint maps injectively into the harness identities, ST-8W); harnesses use opaque newtypes so a new trait bound breaks the build. Which views LINK covers is no longer part of it (LEAN-COVER, K-LINK-T)", + "level": "high", + "status": "in-progress", + "checked_by": [ + "ST-7", + "ST-8" + ] + }, + "ASM-LIMITS": { + "statement": "max_total_log_length 16384 B; 100 logs; 4 MiB return data; 300 TGas per call; view gas cap per node", + "level": "med", + "status": "in-progress", + "checked_by": [ + "RES-2", + "RES-3" + ] + }, + "ASM-META": { + "statement": "NEP-366 (and NEP-518 eth-implicit) inner receipts carry the relayer as signer, so relayed calls fail IndirectCall", + "level": "med", + "status": "in-progress", + "checked_by": [ + "RT-METATX" + ] + }, + "ASM-FCKEY": { + "statement": "Function-call keys restrict receiver and methods, cannot attach deposits, have an allowance, and cannot add keys", + "level": "high", + "status": "in-progress", + "checked_by": [ + "RT-FCKEY" + ] + }, + "ASM-DEPLOY": { + "statement": "The deployed code is the reproducible build of the pin, locked at deploy", + "level": "policy", + "status": "in-progress", + "checked_by": [ + "DEP-1", + "VER-2", + "VER-3" + ] + }, + "ASM-OWNER": { + "statement": "The owner registers keys honestly (it could otherwise register two accounts it controls)", + "level": "policy", + "status": "unverified", + "checked_by": [ + "DEP-1", + "VER-4" + ] + }, + "ASM-MODEL": { + "statement": "Kani-layer properties only: a core step on a state larger than the Kani bound behaves like one within it (strategy section 6.3). Properties on the verus layer (M5 path A) are proved on the real core at every size and do not rely on it", + "level": "med", + "status": "in-progress", + "checked_by": [ + "MC-2", + "ST-8", + "LINK", + "LEAN-DELTA", + "LEAN-COVER", + "K-LINK-T" + ] + }, + "ASM-TLA-SCOPE": { + "statement": "TLA+ model bounds (strategy section 17.3): behaviours with more requests, keys or accounts than TLC and Apalache explore add no new violations. Accounts and keys are covered by ASM-IDENT parametricity; the request bound is a small-scope assumption. It backs no every-size claim: LEAN-IND, LEAN-STEP and LEAN-TR prove the safety properties and LEAN-LIVE proves TLA-LIVE-1/1s at every size (strategy sections 18.3, 18.7). It remains only as the scope of the TLC and Apalache rows themselves", + "level": "med", + "status": "unverified", + "checked_by": [ + "TLA-IND", + "REF-5", + "LEAN-IND", + "LEAN-LIVE" + ] + }, + "ASM-LEAN-TLA": { + "statement": "The Lean machine (lean/ApprovalLean/Machine.lean, Props.lean) transcribes ApprovalCore.tla and ApprovalProps.tla, and Liveness.lean transcribes MC_Liveness.tla with TLA+'s temporal operators over behaviours Nat -> State (strategy sections 18, 18.7)", + "level": "high", + "status": "unverified", + "checked_by": [ + "MC-4", + "REF-5L" + ] + }, + "ASM-STAKE": { + "statement": "Account must hold storage_usage * 1e19 yocto; ~40 B overhead per record", + "level": "med", + "status": "in-progress", + "checked_by": [ + "RES-1" + ] + }, + "ASM-NU": { + "statement": "The Rust (kani/src/norm.rs) and Lean (lean/ApprovalLean/Ident.lean) transcriptions of LINK's class, representative and transport functions agree (strategy section 18.6.1)", + "level": "high", + "status": "in-progress", + "checked_by": [ + "LINK" + ] + }, + "ASM-TIME": { + "statement": "block_height and block_timestamp never decrease across receipts on one account", + "level": "med", + "status": "in-progress", + "checked_by": [ + "RT-TIME" + ] + }, + "ASM-CODE": { + "statement": "Code changes only via DeployContract or UseGlobalContract on C (both need a full-access key on C), or via DeployGlobalContract by the owner of a NEP-591 global contract C references by account id; DeleteAccount erases state and a recreated account starts empty", + "level": "med", + "status": "in-progress", + "checked_by": [ + "RT-RESET", + "DEP-1" + ] + } + }, + "findings": { + "F-9": { + "finding": "`predecessor == signer` also admits code deployed on the signer's own account.", + "resolution": "DEP-1 requires registered keys to be function-call keys with receiver `C`. RT-SELFACCT." + }, + "F-14": { + "finding": "Two equivalent mutants. In `live_agent_registration`, dropping the role check or the account check survives all tests: under INV-8 both are implied by `active_from ≤ id`. They are kept as defence in depth.", + "resolution": "LEM-4 proves the redundancy, so the equivalence is established and not merely assumed." + }, + "F-4": { + "finding": "`MAX_ACTION_LEN` is coupled to the 16 KiB log limit. The worst-case `action_approved` line is about 13.0 KB (2048 control bytes escaped to `\\u00XX`, 64-char accounts, secp256k1 keys, max `u64`s). The limit breaks above about 2.6 KB. Upstream has a doc comment but no test.", + "resolution": "RES-2 unit test (OQ-4)" + }, + "F-17": { + "finding": "near-sdk-core 4.2.3 (in the lockfile) accepts **ML-DSA-65** public keys (1952 bytes; nearcore 2.13, protocol 85). With ML-DSA-65 keys on both sides, the worst-case `action_approved` line is 18256 B, over the 16384 B limit: the core accepts the request, and that approver key can never approve it (the call fails with `TotalLogLengthExceeded`). One ML-DSA-65 key on either side still fits (≤ 15775 B), so another approver with a shorter key can. Storage per request also grows (`B_req` 4160 B; 16 pending = 0.666 NEAR). The README's worst case assumes secp256k1.", + "resolution": "**Fixed upstream** in trust-framework PR #19 (pin `081a3a6`, 2026-10-17): `add_agent`/`add_approver` refuse ML-DSA-65 keys after the owner check. Checked by SH-13 (`f17_mldsa65_keys_are_refused`). Supporting them later needs a shorter event or a lower action limit (README)." + }, + "F-6": { + "finding": "`revoke_key` calls `remove_principal` before knowing the key exists. The core's \"no writes on `Err`\" holds only because removing an absent key is a no-op (L-REMOVE-ABSENT). On-chain the call panics before any flush, so nothing is written.", + "resolution": "ST-2 records it. Optionally reorder upstream (OQ-5)." + }, + "F-7": { + "finding": "`approve`'s `LogFull` branch is unreachable under `Inv`: a pending request implies `#L < #R ≤ MAXU`.", + "resolution": "Kept as defence in depth. LEM-3." + } + } +} diff --git a/ui/spec-approvals/packets/requirements.src.json b/ui/spec-approvals/packets/requirements.src.json new file mode 100644 index 0000000..1e41744 --- /dev/null +++ b/ui/spec-approvals/packets/requirements.src.json @@ -0,0 +1,26 @@ +{ + "packet": { + "id": "requirements", + "version": "2026-10-30", + "title": "approval requirements", + "summary": "Approve or reject each requirement (R1–R6, D1–D17), one signature per sentence. You certify that the sentence says what the contract is meant to do, and that the properties listed under it are the right discharge. The property text is the proof obligation; you are not signing that text as the requirement.", + "qualifies": "A named human who did not write approval-core. Claude sessions wrote most of the specs and harnesses, so a review by Claude does not count.", + "why_a_day": [ + "The 23 sentences are requirement/2 in prolog/requirements/approval_req.pl. That file was written from strategy.md (the Target, sections 1–4 and 5.12) and the contract README, not from the Rust. The Prolog step machine was then written from these sentences.", + "Each item signs one sentence and the properties traceability.pl says discharge it. Several properties share one sentence. A low-level statement such as the add_principal post-state is a proof obligation under a sentence, not a sentence of its own.", + "The full packet (ui/spec-approvals-full) is a separate review. Signing a requirement here does not sign that packet." + ], + "sources": { + "formalver": { + "repo": "difflabai/formalver", + "commit": "f3c64714853649374342e8833c687444b3a057e4", + "root": "projects/near-approval" + }, + "trust-framework": { + "repo": "difflabai/trust-framework", + "commit": "18f57cb218f391d59d14f9db68dd2dd6951d71fb", + "root": "" + } + } + } +} diff --git a/ui/spec-approvals/tools/build-packet.py b/ui/spec-approvals/tools/build-packet.py index 8486895..d0d0239 100755 --- a/ui/spec-approvals/tools/build-packet.py +++ b/ui/spec-approvals/tools/build-packet.py @@ -1,16 +1,14 @@ #!/usr/bin/env python3 -"""Build a spec review packet manifest from its source file. +"""Build a spec review packet with one item per requirement/2 sentence. Usage: ui/spec-approvals/tools/build-packet.py --formalver PATH --trust-framework PATH \ - [--src ui/spec-approvals/packets/near-approval.src.json] [--out ...near-approval.json] + [--src ui/spec-approvals/packets/requirements.src.json] [--out ...] -Every file is read with `git show :` at the commit the source -file pins, so the working tree's checkout does not matter. For each reading -entry the manifest records the file's sha256 and, when the entry names -`from` / `to` (exclusive) / `through` (inclusive) regexes, the 1-based line -range they select. Properties, assumptions and findings are copied from -formalver's status.toml and strategy.md at the pinned commit. +The source file pins the commits. Every file is read with +`git show :`, so the working tree does not matter. The items +are R1–R6 and D1–D17 from prolog/requirements/approval_req.pl. Each item +carries the properties traceability.pl says discharge that sentence. Standard library only (Python 3.11+ for tomllib). """ @@ -28,7 +26,12 @@ sys.exit("build-packet.py needs Python 3.11+ (tomllib)") HERE = os.path.dirname(os.path.abspath(__file__)) -DEFAULT_SRC = os.path.join(HERE, "..", "packets", "near-approval.src.json") +DEFAULT_SRC = os.path.join(HERE, "..", "packets", "requirements.src.json") +TITLE_RE = re.compile(r"^[ -~]{1,160}$") +FINDING_RE = re.compile(r"F-\d+") +REQ_RE = re.compile(r"""^requirement\('([A-Z][A-Z0-9]*)',\s*"(.*)"\)\.\s*$""") +TRACE_RE = re.compile(r"""^trace_row\('([A-Z][A-Z0-9]*)',\s*\[(.*)\]\)\.\s*$""") +EXPECTED = ["R%d" % i for i in range(1, 7)] + ["D%d" % i for i in range(1, 18)] def git_show(repo_dir, commit, path): @@ -39,24 +42,6 @@ def git_show(repo_dir, commit, path): sys.exit("git show %s:%s in %s failed: %s" % (commit, path, repo_dir, e.stderr.decode().strip())) -def line_range(text, entry, where): - lines = text.split("\n") - start = None - for i, line in enumerate(lines): - if re.search(entry["from"], line): - start = i - break - if start is None: - sys.exit("%s: no line matches from=%r" % (where, entry["from"])) - end_pat = entry.get("through") or entry.get("to") - if end_pat is None: - return start + 1, len(lines) - for j in range(start + 1, len(lines)): - if re.search(end_pat, lines[j]): - return start + 1, (j + 1 if "through" in entry else j) - sys.exit("%s: no line after %d matches %r" % (where, start + 1, end_pat)) - - def findings_table(strategy): """Rows of the '### Open' findings table: {id: {finding, resolution}}.""" out = {} @@ -70,6 +55,52 @@ def findings_table(strategy): return out +def heading_span(lines, start_pat, end_pat, where): + """1-based inclusive line range from a heading up to, but not including, the next.""" + start = end = None + for i, line in enumerate(lines): + if start is None and re.match(start_pat, line): + start = i + elif start is not None and re.match(end_pat, line): + end = i + break + if start is None or end is None: + sys.exit("strategy.md: %s" % where) + return start + 1, end + + +def title_for(rid, sentence): + text = " ".join(sentence.split()).rstrip(".") + if len(text) > 160: + cut = text[:157] + space = cut.rfind(" ") + if space > 40: + cut = cut[:space] + text = cut.rstrip(" ,:;-") + "..." + if not TITLE_RE.fullmatch(text): + sys.exit("%s: title is not 1-160 printable ASCII: %r" % (rid, text)) + return text + + +def minutes_for(n_properties): + if n_properties > 8: + return 12 + if n_properties > 4: + return 8 + return 5 + + +def mentioned_findings(*texts, known): + """Open findings named in the texts, in order. A mention of a closed id is not a finding to accept.""" + ids = [] + for text in texts: + for fid in FINDING_RE.findall(text or ""): + if fid in ids or fid not in known: + continue + ids.append(fid) + return ids + + def main(): ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) ap.add_argument("--formalver", required=True, help="a clone of difflabai/formalver") @@ -81,90 +112,174 @@ def main(): with open(a.src, encoding="utf-8") as f: src = json.load(f) - packet = src["packet"] + packet = dict(src["packet"]) clones = {"formalver": a.formalver, "trust-framework": a.trust_framework} + shown = {} def show(source, path): - s = packet["sources"][source] - full = (s["root"] + "/" + path) if s["root"] else path - return full, git_show(clones[source], s["commit"], full) + key = (source, path) + if key not in shown: + s = packet["sources"][source] + full = (s["root"] + "/" + path) if s["root"] else path + shown[key] = (full, git_show(clones[source], s["commit"], full)) + return shown[key] + + def file_entry(source, path, label, start, end): + full, data = show(source, path) + entry = {"source": source, "path": full, "label": label, + "sha256": hashlib.sha256(data).hexdigest()} + if start is not None: + entry["lines"] = [start, end] + return entry - fv = packet["sources"]["formalver"] status = tomllib.loads(show("formalver", "status.toml")[1].decode("utf-8")) - strategy = show("formalver", "strategy.md")[1].decode("utf-8") + strategy_text = show("formalver", "strategy.md")[1].decode("utf-8") + req_lines = show("formalver", "prolog/requirements/approval_req.pl")[1].decode("utf-8").split("\n") + trace_lines = show("formalver", "prolog/requirements/traceability.pl")[1].decode("utf-8").split("\n") + strategy_lines = strategy_text.split("\n") + + requirements = {} + for i, line in enumerate(req_lines): + m = REQ_RE.match(line) + if not m: + if line.startswith("requirement("): + sys.exit("approval_req.pl:%d: requirement fact is not a single quoted line" % (i + 1)) + continue + rid, sentence = m.group(1), m.group(2) + if rid in requirements: + sys.exit("approval_req.pl: duplicate requirement %s" % rid) + requirements[rid] = {"sentence": sentence, "line": i + 1} + got = list(requirements) + if got != EXPECTED: + missing = [r for r in EXPECTED if r not in requirements] + extra = [r for r in got if r not in EXPECTED] + sys.exit("approval_req.pl: want %s; missing %s; extra %s" % (EXPECTED, missing, extra)) + + discharge = {rid: [] for rid in EXPECTED} + trace_hits = {rid: [] for rid in EXPECTED} + for i, line in enumerate(trace_lines): + m = TRACE_RE.match(line) + if not m: + if line.startswith("trace_row("): + sys.exit("traceability.pl:%d: trace_row is not a single line" % (i + 1)) + continue + rid, body = m.group(1), m.group(2) + if rid not in discharge: + sys.exit("traceability.pl:%d: trace_row for unknown requirement %s" % (i + 1, rid)) + trace_hits[rid].append(i + 1) + for pid in re.findall(r"'([^']+)'", body): + if pid not in discharge[rid]: + discharge[rid].append(pid) + empty = [rid for rid in EXPECTED if not discharge[rid]] + if empty: + sys.exit("traceability.pl: no discharge for %s" % empty) properties = {} - for module, m in status["modules"].items(): - for pid, p in m["properties"].items(): - properties[pid] = { + for module, mod in status["modules"].items(): + for pid, p in (mod.get("properties") or {}).items(): + if pid in properties: + sys.exit("status.toml: property %s is in more than one module" % pid) + rec = { "module": module, "layer": p.get("layer", ""), "evidence": p.get("evidence", ""), "status": p.get("status", ""), "description": p.get("description", ""), - "assumptions": p.get("assumptions", []), + "assumptions": list(p.get("assumptions") or []), } + if p.get("harness"): + rec["harness"] = p["harness"] + if p.get("cross"): + rec["cross"] = list(p["cross"]) + if p.get("depends_on"): + rec["depends_on"] = list(p["depends_on"]) + properties[pid] = rec + missing = sorted({pid for ids in discharge.values() for pid in ids if pid not in properties}) + if missing: + sys.exit("traceability.pl names properties not in status.toml: %s" % missing) + assumptions = {k: {"statement": v.get("statement", ""), "level": v.get("level", ""), "status": v.get("status", ""), "checked_by": v.get("checked_by", [])} for k, v in status["assumptions"].items()} - findings = findings_table(strategy) + findings = findings_table(strategy_text) + goals = heading_span(strategy_lines, r"^## 1\. ", r"^## 2\. ", "no section 1 before section 2") + catalogue = heading_span(strategy_lines, r"^### 5\.12 ", r"^## 6\. ", "no section 5.12 before section 6") items = [] - for it in src["items"]: - item = {k: v for k, v in it.items() if k not in ("read", "properties", "assumptions", "findings")} - reads = [] - for r in it["read"]: - full, data = show(r["source"], r["path"]) - entry = {"source": r["source"], "path": full, "label": r["label"], - "sha256": hashlib.sha256(data).hexdigest()} - if "from" in r: - entry["lines"] = list(line_range(data.decode("utf-8"), r, "%s %s" % (it["id"], full))) - reads.append(entry) - item["read"] = reads - - sel = it.get("properties") - if sel == "*": - pids = list(properties) - elif isinstance(sel, dict) and "ids" in sel: - pids = sel["ids"] - elif isinstance(sel, dict): - (key, val), = sel.items() - pids = [p for p, v in properties.items() if v[key] == val] - else: - pids = [] - missing = [p for p in pids if p not in properties] - if missing: - sys.exit("%s: unknown properties %s" % (it["id"], missing)) - item["properties"] = pids - - asel = it.get("assumptions", []) - item["assumptions"] = list(assumptions) if asel == "*" else asel - missing = [x for x in item["assumptions"] if x not in assumptions] - if missing: - sys.exit("%s: unknown assumptions %s" % (it["id"], missing)) - - item["findings"] = it.get("findings", []) - missing = [x for x in item["findings"] if x not in findings] - if missing: - sys.exit("%s: unknown findings %s" % (it["id"], missing)) - items.append(item) - - ids = [i["id"] for i in items] - if len(set(ids)) != len(ids): - sys.exit("duplicate item ids") + used_properties = [] + used_assumptions = [] + used_findings = [] + for rid in EXPECTED: + sentence = requirements[rid]["sentence"] + pids = discharge[rid] + asms = [] + for pid in pids: + for asm in properties[pid]["assumptions"]: + if asm not in assumptions: + sys.exit("%s: property %s names unknown assumption %s" % (rid, pid, asm)) + if asm not in asms: + asms.append(asm) + finding_ids = mentioned_findings( + sentence, *(properties[pid]["description"] for pid in pids), + known=findings) + checks = [ + "The sentence says what the contract is meant to do.", + "It neither over-claims nor under-claims against the contract README.", + "The properties listed are the right discharge: nothing the sentence promises is missing, and none is the wrong check.", + ] + if asms: + checks.append("Each assumption the discharge rests on is acceptable for this deployment.") + if finding_ids: + checks.append("Each related finding is acceptable with the resolution given.") + reads = [ + file_entry("formalver", "prolog/requirements/approval_req.pl", + "Requirement sentence", requirements[rid]["line"], requirements[rid]["line"]), + ] + for n, line_no in enumerate(trace_hits[rid], 1): + label = "Discharge in traceability.pl" if len(trace_hits[rid]) == 1 else "Discharge row %d in traceability.pl" % n + reads.append(file_entry("formalver", "prolog/requirements/traceability.pl", label, line_no, line_no)) + see = [ + file_entry("trust-framework", "contracts/approval/README.md", "Contract README", None, None), + file_entry("formalver", "strategy.md", "What the requirements establish (§1)", goals[0], goals[1]), + file_entry("formalver", "strategy.md", "Traceability table (§5.12)", catalogue[0], catalogue[1]), + ] + items.append({ + "id": rid, + "title": title_for(rid, sentence), + "minutes": minutes_for(len(pids)), + "summary": "Sign this sentence, and that the properties below are what discharges it. You are not signing the property text as the requirement.", + "statement": sentence, + "check": checks, + "read": reads, + "see": see, + "properties": pids, + "assumptions": asms, + "findings": finding_ids, + }) + for pid in pids: + if pid not in used_properties: + used_properties.append(pid) + for asm in asms: + if asm not in used_assumptions: + used_assumptions.append(asm) + for fid in finding_ids: + if fid not in used_findings: + used_findings.append(fid) + manifest = { "format": "spec-packet/1", "packet": packet, "items": items, - "properties": properties, - "assumptions": assumptions, - "findings": findings, + "properties": {pid: properties[pid] for pid in used_properties}, + "assumptions": {k: assumptions[k] for k in used_assumptions}, + "findings": {k: findings[k] for k in used_findings}, } with open(out_path, "w", encoding="utf-8") as f: json.dump(manifest, f, indent=1, ensure_ascii=False) f.write("\n") - sys.stderr.write("wrote %s: %d items, %d properties, %d assumptions, %d findings (formalver %s)\n" - % (out_path, len(items), len(properties), len(assumptions), len(findings), fv["commit"][:7])) + fv = packet["sources"]["formalver"] + sys.stderr.write("wrote %s: %d requirements, %d properties, %d assumptions, %d findings (formalver %s)\n" + % (out_path, len(items), len(used_properties), len(used_assumptions), len(used_findings), fv["commit"][:7])) if __name__ == "__main__": From 8b22cc13cb0f731ae0e223348d366d815349960f Mon Sep 17 00:00:00 2001 From: Gabe Hamilton Date: Mon, 2 Nov 2026 12:42:35 -0700 Subject: [PATCH 2/3] Accept approver1 when the wallet does not name its signing key. The review pages expect approver1 to sign. If the connected account has a registered approver key, that is enough to enable approve, because browser wallets often omit the public key. --- ui/approvals/index.html | 2 +- ui/shared/approval-kit.js | 108 ++++++++++++++++++++++-------- ui/shared/spec-app.js | 57 +++++++++++++--- ui/spec-approvals-full/README.md | 4 +- ui/spec-approvals-full/index.html | 16 +++-- ui/spec-approvals/README.md | 4 +- ui/spec-approvals/index.html | 16 +++-- 7 files changed, 154 insertions(+), 53 deletions(-) diff --git a/ui/approvals/index.html b/ui/approvals/index.html index 7a0379c..62f9c47 100644 --- a/ui/approvals/index.html +++ b/ui/approvals/index.html @@ -148,7 +148,7 @@

src="https://cdn.jsdelivr.net/gh/azbang/near-connect@de0f08af1e07c19fe5f80070383231d16ef924f6/cdn/hot-connect.iife.js" integrity="sha384-6eNPlV+Bf92wTtH7ZfZE8sZPdohJ84VDXuVVegFjBvJsGWE6BXTT1he2jKjalJ9L" crossorigin="anonymous"> - + - - - + + + diff --git a/ui/spec-approvals/README.md b/ui/spec-approvals/README.md index 636de43..c0178c5 100644 --- a/ui/spec-approvals/README.md +++ b/ui/spec-approvals/README.md @@ -35,6 +35,7 @@ this directory: the page loads `../shared/`. Use HTTP on localhost, not | `packet` | `requirements`, which loads `packets/requirements.json` | | `item` | the first requirement. Opens that requirement. | | `agent` | `agent1.` for `approvals.` (`data-agent`). A short name is expanded the same way. Only requests filed by this account count. | +| `approver` | `approver1.` (`data-approver`). Only this account may sign. | | `contract`, `network`, `rpc`, `code_hash` | as in [`../approvals/`](../approvals/README.md) | The same agent can file this packet and the full packet. The page matches a @@ -65,7 +66,8 @@ do not collide. `--force` is needed because a browser wallet signs with a full-access key. The reviewer's account must not be the agent account. -3. The reviewer opens the page and connects their wallet. For each +3. The reviewer opens the page and connects `approver1.` + (`approver1.difflabai.testnet` on the testnet demonstration). For each requirement they read the sentence and the properties that discharge it, tick each reading and check line, and then either approve or reject it. Approve stays disabled until every line is ticked. Reject needs a note diff --git a/ui/spec-approvals/index.html b/ui/spec-approvals/index.html index f9dfdb0..db324b2 100644 --- a/ui/spec-approvals/index.html +++ b/ui/spec-approvals/index.html @@ -6,10 +6,11 @@ Spec review · requirements - - + + + - +

Approval requirements

Loading the packet…

@@ -24,6 +25,7 @@

Approval requirements

Code
Checking…
Owner
Checking…
Filed by
+
Approver
@@ -72,6 +74,8 @@

+ + @@ -94,8 +98,8 @@

src="https://cdn.jsdelivr.net/gh/azbang/near-connect@de0f08af1e07c19fe5f80070383231d16ef924f6/cdn/hot-connect.iife.js" integrity="sha384-6eNPlV+Bf92wTtH7ZfZE8sZPdohJ84VDXuVVegFjBvJsGWE6BXTT1he2jKjalJ9L" crossorigin="anonymous"> - - - + + + From cbb1ea8e008745b04ffef42826b271ffdfd79642 Mon Sep 17 00:00:00 2001 From: Gabe Hamilton Date: Mon, 2 Nov 2026 12:48:22 -0700 Subject: [PATCH 3/3] File spec packets as agent1 when no agent is configured. That matches the account both review pages scan, so the documented submit command no longer files requests the page treats as unfiled. --- scripts/near/README.md | 2 +- scripts/near/submit-spec-packet.sh | 4 ++-- ui/spec-approvals-full/README.md | 7 ++++--- ui/spec-approvals/README.md | 4 +++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/near/README.md b/scripts/near/README.md index 1e1aa1d..3621e35 100644 --- a/scripts/near/README.md +++ b/scripts/near/README.md @@ -133,7 +133,7 @@ seconds). | `request-action.sh ` | Signs `request_action` with the agent's stored key, else `APPROVAL_AGENT_*` from `.env` when it names this account (or `--key-file PATH`), after checking the key may call `request_action` and is registered; prints the request id. `--action-file PATH` (`-` for stdin) reads the action byte for byte; an action starting with `-` goes after `--`. | | `approve.sh ` | Signs `approve` with the approver's stored key, else `APPROVAL_APPROVER_*` from `.env` (or `--key-file PATH`); prints the proof. Checks first that the key may call `approve` and is registered, that the request is pending, that the action matches exactly, and that the agent isn't the approver's own account (`--skip-checks` sends anyway). The action can come from `--action-file PATH`, or, after reviewing it, from `--action-from-request`. | | `reject.sh ` | Signs `reject` with the stored key, else `APPROVAL_APPROVER_*` from `.env` (or `--key-file PATH`); prints the rejection. Refuses before sending when the key may not call `reject` (e.g. an approve-only key). | -| `submit-spec-packet.sh [--packet PATH] [--item ID]... [--setup-agent] [--dry-run] [--yes]` | Files each item of a spec review packet (default `ui/spec-approvals-full/packets/near-approval.json`) as one request for review in [`ui/spec-approvals-full/`](../../ui/spec-approvals-full/README.md). Pass `--packet ui/spec-approvals/packets/requirements.json` to file one request per requirement (R1–R6, D1–D17), reviewed in [`ui/spec-approvals/`](../../ui/spec-approvals/README.md). Each action names the item and the SHA-256 of its text (`spec_packet.py`). Idempotent: items that already have a pending, approved or rejected request are skipped, and only items with void requests are filed again. The agent (`--agent`, else `APPROVAL_AGENT_ACCOUNT_ID`, else `spec-agent`) signs as `request-action.sh` does: `--key-file`, its stored key, or `APPROVAL_AGENT_*` from `.env`. `--setup-agent` creates and registers the stored key with `new-principal.sh` if it is missing. | +| `submit-spec-packet.sh [--packet PATH] [--item ID]... [--setup-agent] [--dry-run] [--yes]` | Files each item of a spec review packet (default `ui/spec-approvals-full/packets/near-approval.json`) as one request for review in [`ui/spec-approvals-full/`](../../ui/spec-approvals-full/README.md). Pass `--packet ui/spec-approvals/packets/requirements.json` to file one request per requirement (R1–R6, D1–D17), reviewed in [`ui/spec-approvals/`](../../ui/spec-approvals/README.md). Each action names the item and the SHA-256 of its text (`spec_packet.py`). Idempotent: items that already have a pending, approved or rejected request are skipped, and only items with void requests are filed again. The agent (`--agent`, else `APPROVAL_AGENT_ACCOUNT_ID`, else `agent1`) signs as `request-action.sh` does: `--key-file`, its stored key, or `APPROVAL_AGENT_*` from `.env`. `--setup-agent` creates and registers the stored key with `new-principal.sh` if it is missing. | | `smoke-test.sh [--cleanup]` | End-to-end check: ensures `smoke-agent` and `smoke-approver` principals, requests, approves and rejects, and asserts `get_approval`, `get_request` and `get_rejection`. `--cleanup` revokes their keys and deletes both accounts. | | `transfer.sh [--yes]` | Sends NEAR from `NEAR_ACCOUNT_ID`, e.g. to top up the contract's storage balance. | | `faucet-fund.sh [] [--rounds N]` | Testnet only: tops up an existing account (default `NEAR_ACCOUNT_ID`) with 10 NEAR per round from the testnet faucet, which only funds new accounts: each round has the faucet create a throwaway `tf-faucet-….testnet` account and then deletes it with the receiver as beneficiary. Needs no `NEAR_PRIVATE_KEY`. If a deletion fails, the throwaway key is kept and `--recover KEYFILE` finishes the round. Uses `NEAR_FAUCET_URL` (default `https://helper.testnet.near.org/account`; near-cli's own default host fails TLS). | diff --git a/scripts/near/submit-spec-packet.sh b/scripts/near/submit-spec-packet.sh index 351d8d4..c1a9d3d 100755 --- a/scripts/near/submit-spec-packet.sh +++ b/scripts/near/submit-spec-packet.sh @@ -15,7 +15,7 @@ # them (the contract has no cancel), so the reviewer should reject them. # # Credentials come from .env (ENV_FILE), like every script here. The agent -# is --agent, else APPROVAL_AGENT_ACCOUNT_ID, else spec-agent (a short name +# is --agent, else APPROVAL_AGENT_ACCOUNT_ID, else agent1 (a short name # means .). It signs the way request-action.sh does: # --key-file PATH, else the stored key # //.agent.json, else APPROVAL_AGENT_* @@ -89,7 +89,7 @@ case $PACKET in /*) ;; *) PACKET="$PWD/$PACKET" ;; esac near_load_config SPY() { "$NEAR_PYTHON" -I -X utf8 "$NEAR_SCRIPTS_DIR/spec_packet.py" "$@"; } SPY check "$PACKET" >/dev/null || die "invalid packet manifest $PACKET" -AGENT=$(principal_account "${AGENT_ARG:-${APPROVAL_AGENT_ACCOUNT_ID:-spec-agent}}") +AGENT=$(principal_account "${AGENT_ARG:-${APPROVAL_AGENT_ACCOUNT_ID:-agent1}}") near_require_contract # Every request on the contract (get_request per id; there is no index). diff --git a/ui/spec-approvals-full/README.md b/ui/spec-approvals-full/README.md index 44748a7..cef96df 100644 --- a/ui/spec-approvals-full/README.md +++ b/ui/spec-approvals-full/README.md @@ -42,15 +42,16 @@ this directory: the page loads `../shared/`. Use HTTP on localhost, not ```bash scripts/near/submit-spec-packet.sh --dry-run # plan; sends nothing scripts/near/submit-spec-packet.sh # files as the .env agent (APPROVAL_AGENT_*) - scripts/near/submit-spec-packet.sh --setup-agent # or, with no agent in .env: creates spec-agent. + scripts/near/submit-spec-packet.sh --setup-agent # or, with no agent in .env: creates agent1. ``` The script reads its credentials from `.env`, like every script in `scripts/near/` (see [its README](../../scripts/near/README.md)). The agent is `APPROVAL_AGENT_ACCOUNT_ID` when `.env` has one (set by `principal-env.sh`, signing with `APPROVAL_AGENT_PRIVATE_KEY`), else - `spec-agent.`. The page counts requests from - `agent1.` unless you open it with `?agent=`. + `agent1.`. That is the same account the page counts + (`data-agent`). Open it with `?agent=` only if you filed + as someone else. The script is idempotent: re-running it files only the items that are missing. diff --git a/ui/spec-approvals/README.md b/ui/spec-approvals/README.md index c0178c5..4dfb108 100644 --- a/ui/spec-approvals/README.md +++ b/ui/spec-approvals/README.md @@ -55,7 +55,9 @@ do not collide. The script reads its credentials from `.env`, like every script in `scripts/near/` (see [its README](../../scripts/near/README.md)). It is idempotent: re-running it files only the requirements that are missing. - Open the page with `?agent=` if the agent is not `agent1`. + With no `--agent` and no `APPROVAL_AGENT_ACCOUNT_ID`, it files as + `agent1.`, the account this page counts. Open the page + with `?agent=` only if you filed as someone else. 2. The owner registers the reviewer's wallet key as an approver: