Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

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/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.
**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) (copied into [`verification/`](verification/)) 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

Expand Down Expand Up @@ -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/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.
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) (a copy is in [`verification/`](verification/)) 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 docs/verification-handoff.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Handoff for formal verification

The formal verification of v1.1.0 (source revision `57b3f02`) lives in [difflabai/formalver PR #32](https://github.com/difflabai/formalver/pull/32); this repository holds no proofs itself. The implementation intentionally focuses on small Rust APIs, tests, synthetic execution and static UIs.
The formal verification of v1.1.0 (source revision `57b3f02`) lives in [difflabai/formalver PR #32](https://github.com/difflabai/formalver/pull/32). A verbatim copy is in [`verification/`](../verification/); it is not yet wired into this repository's CI (see [`verification/README.md`](../verification/README.md)). The implementation intentionally focuses on small Rust APIs, tests, synthetic execution and static UIs.

Start with `crates/core/src/lib.rs` and `docs/spec.md`. The default pool-core build has **zero dependencies**, no unsafe code, no NEAR imports, and no external I/O. Optional serde/borsh are serialization only. `cargo test -p pool-core --no-default-features` exercises the proof-facing configuration.

Expand Down
64 changes: 64 additions & 0 deletions verification/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Formal verification (copied from formalver)

This directory is a verbatim copy of the shared-pool-controls verification from
[difflabai/formalver](https://github.com/difflabai/formalver), taken at commit `da343e2`
(formalver PR #32, which is stacked on PR #31 at `651852b`). It verifies contract **v1.1.0**, this
repository's commit `57b3f02`. No file under `crates/` has changed between `57b3f02` and `7c11f88`,
the `main` this branch starts from, so the verified code is the code on `main`.

The formalver CI run on `da343e2` is green:
[run 43642798201](https://github.com/difflabai/formalver/actions/runs/43642798201) (18 jobs passed;
the 4 dispatch-only jobs were skipped).

## What is here

| Path | Contents |
|---|---|
| `tla/` | TLA+ models (with the executor model) and TLC configurations |
| `lean/` | Lean proofs |
| `prolog/` | Prolog model and checks |
| `kani/` | Kani harnesses; `kani/local/` is the fingerprinted local record of the 48 large harnesses, and `kani/local/not-run.tsv` lists the 27 large mutants with no Kani result at v1.1.0 |
| `conformance/` | 216 conformance traces and their replay |
| `near-tests/`, `sandbox/` | NEAR unit tests and sandbox tests |
| `status.toml`, `strategy.md` | Claims, findings and the verification strategy |
| `tools/` | The formalver scripts these layers and the CI workflow call |
| `ci/shared-pool.yml` | formalver's CI workflow, kept here **inactive** (it is not under `.github/workflows/`) |

## Not wired up yet

The files are unchanged from formalver, so their paths still assume formalver's layout:

| formalver path | Path in this repository |
|---|---|
| `projects/shared-pool/source-mirror/` (a submodule pinned at `57b3f02`) | the repository root |
| `projects/shared-pool/` | `verification/` |
| `tools/` | `verification/tools/` |
| `.github/workflows/shared-pool.yml` | `verification/ci/shared-pool.yml` |

Nothing here runs in this repository's CI yet, and the root Cargo workspace does not include these

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Update repository-facing verification links for the local copy. Adding the local verification tree without updating the repository-facing documentation leaves readers directed only to formalver PR #32. In particular, docs/verification-handoff.md still states that this repository holds no proofs itself, which is now false. Add the root README/docs link updates to the PR or explicitly list them as a follow-up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 03b57d7. The root README.md (both formalver links) and docs/verification-handoff.md now also point to verification/. The handoff no longer says this repository holds no proofs; it says the copy is not yet wired into CI.

crates. Follow-ups to make it run here:

1. Rewrite the paths above (90 of the copied files refer to `source-mirror`), unless follow-up 2
restores formalver's layout.
2. Keep the Kani record valid. `tools/scripts/check-kani-record.py` (lines 95-104) fingerprints
paths under `projects/shared-pool/`, including the `source-mirror` gitlink, so the record does not
match at `verification/`, and a path rewrite would not fix that. There are two ways to keep it:
- Restore formalver's layout: `projects/shared-pool/`, with `source-mirror` as a submodule of this
repository pinned at `57b3f02`. A trial extraction in that layout kept the record's fingerprint.
- Re-run the 48 large harnesses. The current record took about 7 hours on a 64 GB Mac.

Either way, replace the submodule pin check (`tools/scripts/check-pin.sh`). Inside this repository,
any change to the contract makes the record stale.
3. Check the verification crates' toolchains against the root `rust-toolchain.toml`. The crates
(`kani`, `conformance`, `near-tests`, `sandbox` with `sandbox/relay`) already declare their own
`[workspace]`, so the root workspace leaves them alone.
4. Move `ci/shared-pool.yml` into `.github/workflows/`, limited by `paths:` filters (a full run takes
about 48 minutes), and set `vars.CI_RUNNER` / `vars.KANI_RUNNER` if self-hosted runners are used.

## History

The root `README.md` and `docs/verification-handoff.md` point here as well as to formalver.
The commit history, review threads and CI runs stay in formalver: PR #31 (v1.0.0 verification) and
PR #32 (v1.1.0 re-verification). The v1.0.0 findings, their fixes in this repository's PR #4, and the
regression evidence (fails on v1.0.0, passes on v1.1.0) are recorded in `status.toml` and
`strategy.md`.
Loading
Loading