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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ All notable changes to this project are listed here. The format follows
This release fixes the findings of an outside verification of v1.0.0. They are
described in [docs/verification-findings.md](docs/verification-findings.md).
The formal results there (TLA+, Lean, Prolog, conformance traces) apply to
v1.0.0. v1.1.0 has not been formally re-verified. Its fixes are covered by
unit tests, seeded random tests and the sandbox suite.
v1.0.0. The v1.1.0 fixes are covered by unit tests, seeded random tests, the
sandbox suite and the [v1.1.0 verification](https://github.com/difflabai/formalver/pull/32)
(source revision `57b3f02`).

### Fixed

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@

Agents submit an owner-defined recipe and exact integer quantity. The core checks caller authority, freshness, prerequisites, resource bounds and `V(after) <= V(before)`, then atomically reserves the commitment. The execution adapter accepts calls only from the lock. Unknown outcomes retain reservations.

**Status:** implemented prototype with Rust tests and NEAR sandbox integration tests. Not independently audited or deployed to a public network. This is v1.1.0. [Formal verification](https://github.com/difflabai/formalver/pull/31) of v1.0.0 includes completed Lean model proofs and TLA+ checks; Rust-core Kani verification is pending. v1.1.0 fixes the settlement/liveness and other findings that verification reported ([findings](docs/verification-findings.md), [changelog](CHANGELOG.md)). The fixes are tested but not formally re-verified. Credits, GPU jobs, physical delivery, and financial positions are synthetic. The risk coefficients are illustrative, not a production portfolio model.
**Status:** implemented prototype with Rust tests and NEAR sandbox integration tests. Not independently audited or deployed to a public network. This is v1.1.0. [Formal verification](https://github.com/difflabai/formalver/pull/32) of v1.1.0 (source revision `57b3f02`) covers Lean model proofs, TLA+ checks, Kani on the Rust core, and conformance traces. Verification found settlement/liveness and other findings in v1.0.0; v1.1.0 fixes them ([findings](docs/verification-findings.md), [changelog](CHANGELOG.md)). Credits, GPU jobs, physical delivery, and financial positions are synthetic. The risk coefficients are illustrative, not a production portfolio model.

## Hackathon review path

Submission details, category, team, and the matching formal verification are in [`nearhackathon.md`](nearhackathon.md).

Track: **AI Security & Defense**. The deliverable is an open-source contract that ecosystem teams can adapt and deploy for shared compute, delivery capacity, inventory, worker funding, and risk budgets. The explorer demonstrates those applications. See the [judge walkthrough](docs/judges-guide.md) for a 90-second demo script and a claim-to-evidence map.

Start the lab below, then click **Begin docking sequence**. Atlas reserves 4 MW and Lyra 2 MW. Vega asks for 4 MW: **WAIT TO DOCK**. The station has 12 MW per window, but 4 MW is protected for life support; docking cannot exceed 8 MW. The denied request leaves 6 MW booked. Click **Request Vega docking in window 02** to submit a fresh request against the second window. The animation reflects Rust decisions, not a JavaScript policy implementation. The original GPU scenario remains available as a separate example of an energy-only denial.
Start the lab below, then click **Watch an example: docking**. Atlas reserves 4 MW and Lyra 2 MW. Vega asks for 4 MW: **WAIT TO DOCK**. The station has 12 MW per window, but 4 MW is protected for life support; docking cannot exceed 8 MW. The denied request leaves 6 MW booked. Click **Request Vega docking in window 02** to submit a fresh request against the second window. The animation reflects Rust decisions, not a JavaScript policy implementation. The original GPU scenario remains available as a separate example of an energy-only denial.

## Run the interactive lab

Expand Down Expand Up @@ -74,7 +74,7 @@ python3 scripts/smoke.py # local HTTP demo; start server first
| [`ui`](ui) | Static scenario lab and live NEAR console |
| [`scenarios`](scenarios) | Generated configurations and reproducible decision traces |

One pool per deployment; immutable recipes, principals and policy. At most 32 metrics, 32 recipes and 64 potential terms. The pool keeps a window of the 256 most recent commitments. A new commitment prunes the oldest one if it is completed or cancelled; while the oldest is still open, submit fails `Full`, even if every other commitment has ended. The actor or owner can cancel the oldest while it is reserved; once dispatched, it closes only when its executor reports. So an executor that never reports can hold submit at `Full`. The synthetic executor forgets a job once the newest id the lock vouched for (by an `execute` that created a job, or by accepting a confirmation or `finish`) is 256 or more past its id; the lock has pruned that record by then. Honest use holds at most 256 jobs plus confirmations in flight, under a cap of 512. Confirmations the lock refuses (operator errors) keep their jobs, a typo of a far id for good; at least 256 of them above its newest id (more if fewer jobs sit at or below it) fill the cap and stop further confirmations, and if executions then keep failing that can hold submit at `Full` the same way ([API](docs/api.md#executor-protocol)). Ids keep counting, and a pruned id is `NotFound`; the event log keeps pruned records. Replay protection is the version, not retention. Prerequisites count completed units over the pool's whole life. Fixed limits bound computation and storage. The owner funds storage. The window replaces v1.0.0's 256 lifetime commitments (finding F-3); it is tested, not formally verified.
One pool per deployment; immutable recipes, principals and policy. At most 32 metrics, 32 recipes and 64 potential terms. The pool keeps a window of the 256 most recent commitments. A new commitment prunes the oldest one if it is completed or cancelled; while the oldest is still open, submit fails `Full`, even if every other commitment has ended. The actor or owner can cancel the oldest while it is reserved; once dispatched, it closes only when its executor reports. So an executor that never reports can hold submit at `Full`. The synthetic executor forgets a job once the newest id the lock vouched for (by an `execute` that created a job, or by accepting a confirmation or `finish`) is 256 or more past its id; the lock has pruned that record by then. Honest use holds at most 256 jobs plus confirmations in flight, under a cap of 512. Confirmations the lock refuses (operator errors) keep their jobs, a typo of a far id for good; at least 256 of them above its newest id (more if fewer jobs sit at or below it) fill the cap and stop further confirmations, and if executions then keep failing that can hold submit at `Full` the same way ([API](docs/api.md#executor-protocol)). Ids keep counting, and a pruned id is `NotFound`; the event log keeps pruned records. Replay protection is the version, not retention. Prerequisites count completed units over the pool's whole life. Fixed limits bound computation and storage. The owner funds storage. The window replaces v1.0.0's 256 lifetime commitments (finding F-3); it is covered by tests and the v1.1.0 verification.

Read the [API](docs/api.md), [state-machine specification](docs/spec.md), [updated implementation plan](docs/implementation-plan.md), [verification handoff](docs/verification-handoff.md), [verification findings](docs/verification-findings.md), and [changelog](CHANGELOG.md).

Expand All @@ -89,4 +89,4 @@ Read the [API](docs/api.md), [state-machine specification](docs/spec.md), [updat
- The adapter boundary is real in the sandbox. Real brokers, cloud providers or warehouses would need enforceable integrations with no alternate credentials/path around the gate.
- The prototype uses no real escrow token. Hiring credits are accounting fixtures, not NEAR balances.

The architecture follows [`difflabai/trust-framework`](https://github.com/difflabai/trust-framework/tree/249f932d84b91fbc6f82abd0668cac6c0503fc42/contracts/approval): a pure core and thin wrapper. Its proofs do **not** apply to this code. Dedicated [shared-pool formal verification](https://github.com/difflabai/formalver/pull/31) targets v1.0.0, with the contract source pinned at `a4bb5c3`: Lean proofs cover the model transcription, TLA+ checks a bounded model, and conformance traces connect the models to the Rust core. Kani verification and refinement work remain pending. It reported high-severity settlement/liveness findings F-1 and F-2 (with F-2b), and lower-severity findings F-3 to F-6 and NT-F1 to NT-F4. v1.1.0 fixes all of them, F-4 only for a recipe whose actor is its executor (by the repository owner's decision, the owner may be a recipe's executor); see [docs/verification-findings.md](docs/verification-findings.md). Those formal results apply to v1.0.0. v1.1.0 changes admission, record retention and the version limit, and has not been re-verified. Changes to the contract or policy require review against the proof assumptions.
The architecture follows [`difflabai/trust-framework`](https://github.com/difflabai/trust-framework/tree/249f932d84b91fbc6f82abd0668cac6c0503fc42/contracts/approval): a pure core and thin wrapper. Its proofs do **not** apply to this code. Dedicated [shared-pool formal verification](https://github.com/difflabai/formalver/pull/32) targets v1.1.0, with the contract source pinned at `57b3f02`: Lean proofs cover the model transcription, TLA+ checks a bounded model, Kani checks the Rust core, and conformance traces connect the models to the Rust core. Verification of v1.0.0 (pinned at `a4bb5c3`) reported high-severity settlement/liveness findings F-1 and F-2 (with F-2b), and lower-severity findings F-3 to F-6 and NT-F1 to NT-F4. v1.1.0 fixes all of them, F-4 only for a recipe whose actor is its executor (by the repository owner's decision, the owner may be a recipe's executor); see [docs/verification-findings.md](docs/verification-findings.md). The v1.1.0 verification checks those fixes. Changes to the contract or policy require review against the proof assumptions.
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Security and scope

This is an unaudited, not-formally-verified prototype. Do not treat synthetic credits or risk coefficients as a live financial system.
This is an unaudited prototype. Its v1.1.0 source (`57b3f02`) has been through [multi-level formal verification](https://github.com/difflabai/formalver/pull/32); the proofs have stated scopes and assumptions. Do not treat synthetic credits or risk coefficients as a live financial system.

Trust assumptions: immutable configuration is honestly designed; registered executor/operator truthfully reports execution; the owner truthfully reports observed values; NEAR runtime/SDK behavior is correct; the deployment account's upgrade authority is controlled. The lock cannot stop external actions using bypass credentials.

Expand Down
8 changes: 4 additions & 4 deletions docs/judges-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The contribution is checking combined consequences, including pending commitment
## A 90-second presentation

1. **Arrival (15 seconds):** Three independent ships share a station's power. Life support always retains 4 of the 12 MW available in each docking window.
2. **The conflict (25 seconds):** Click **Begin docking sequence**. Atlas reserves 4 MW, then Lyra 2 MW. Vega's 4 MW request is rejected: **WAIT TO DOCK**. The illustration changes from blue power routes to an amber holding marker. The reserved power remains 6 MW.
2. **The conflict (25 seconds):** Click **Watch an example: docking**. Atlas reserves 4 MW, then Lyra 2 MW. Vega's 4 MW request is rejected: **WAIT TO DOCK**. The illustration changes from blue power routes to an amber holding marker. The reserved power remains 6 MW.
3. **A new decision (15 seconds):** Click **Request Vega docking in window 02**. A new request reserves 4 MW in a separate allocation period. Waiting does not create an authorization or silently queue a transaction. Dispatch is a separate lifecycle step.
4. **The real product (35 seconds):** This is an MIT-licensed Rust / NEAR contract the ecosystem can adapt and deploy. Show the same gate in compute or agent hiring, then the contract, evidence, and verification scope. Explain that the station is a synthetic example; its power values are policy fixtures, not telemetry.

Expand All @@ -23,7 +23,7 @@ From the repository root, with the Rust toolchain installed:
cargo run -p pool-demo -- serve
```

Open `http://127.0.0.1:8080/` and click **Begin docking sequence**. It resets the station and runs three decisions, pausing briefly between them unless reduced motion is enabled. Expect **WAIT TO DOCK**, 6 / 8 MW docking power, and the protected 4 MW life-support allocation. The explorer records **Bounds**, prospective score 20 → 44, while the committed score stays 20.
Open `http://127.0.0.1:8080/` and click **Watch an example: docking**. It resets the station and runs three decisions, pausing briefly between them unless reduced motion is enabled. Expect **WAIT TO DOCK**, 6 / 8 MW docking power, and the protected 4 MW life-support allocation. The explorer records **Bounds**, prospective score 20 → 44, while the committed score stays 20.

Continue to submit Vega's new window-02 request. Expect 4 / 8 MW reserved in window 02, score 20 → 4, and a blue admitted route. Continue once more for Lyra's remaining 2 MW: window 02 reaches 6 MW and the score reaches zero. These are separate allocation periods, not simultaneous use of twice the station's capacity.

Expand Down Expand Up @@ -53,11 +53,11 @@ Not implemented: public-network deployment, live LLM agents, real escrow/payment

## Formal verification

[Formal verification PR #31](https://github.com/difflabai/formalver/pull/31) targets v1.0.0, with contract source pinned at `a4bb5c3`. It reports completed Lean model proofs, bounded TLA+ safety checks, Prolog requirements checks, and conformance traces against the Rust core and NEAR shell. These are substantive verification results, with distinct scopes; they are not a completed proof of every deployed Rust/Wasm behavior.
[Formal verification PR #32](https://github.com/difflabai/formalver/pull/32) targets v1.1.0, with contract source pinned at `57b3f02`. It covers Lean model proofs, bounded TLA+ safety checks, Prolog requirements checks, Kani on the Rust core, and conformance traces against the Rust core and NEAR shell. These are substantive verification results, with distinct scopes; they are not a completed proof of every deployed Rust/Wasm behavior.

The new station fixture is not part of that pinned verification revision; it has a dedicated Rust regression test.

The PR is a draft labeled **In-Progress**. Kani verification of the real Rust core and refinement obligations remain pending. It reported high-severity settlement/liveness findings F-1 and F-2 and several lower-severity findings. v1.1.0 fixes all of them (F-4 only for a recipe whose actor is its executor; by the repository owner's decision, the owner may be a recipe's executor), which changes admission, record retention and the version limit ([findings](verification-findings.md), [changelog](../CHANGELOG.md)). The fixes are tested but not formally re-verified. Present the findings and fixes alongside the proofs, and inspect the PR's current status before making a deployment claim. Modifying the contract or its policy requires reviewing the proof assumptions and rerunning applicable checks.
Verification of v1.0.0 (pinned at `a4bb5c3`, [PR #31](https://github.com/difflabai/formalver/pull/31)) reported high-severity settlement/liveness findings F-1 and F-2 and several lower-severity findings. v1.1.0 fixes all of them (F-4 only for a recipe whose actor is its executor; by the repository owner's decision, the owner may be a recipe's executor), which changes admission, record retention and the version limit ([findings](verification-findings.md), [changelog](../CHANGELOG.md)). The v1.1.0 verification checks those fixes. Present the findings and fixes alongside the proofs, and inspect the PR's current status before making a deployment claim. Modifying the contract or its policy requires reviewing the proof assumptions and rerunning applicable checks.

## Presentation rationale and official sources

Expand Down
2 changes: 1 addition & 1 deletion docs/spec.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Core specification

This document describes v1.1.0 of the implemented prototype. It is not a claim of completed formal verification. An outside verification checked v1.0.0; v1.1.0 fixes its findings and has not been re-verified ([verification findings](verification-findings.md), [changelog](../CHANGELOG.md)).
This document describes v1.1.0 of the implemented prototype. An outside verification checked v1.0.0 and found issues; v1.1.0 fixes them and is covered by a [formal verification](https://github.com/difflabai/formalver/pull/32) of source revision `57b3f02`. Its proofs have stated scopes and assumptions ([verification findings](verification-findings.md), [changelog](../CHANGELOG.md)).

## State and identity

Expand Down
Loading
Loading