CMP-0.7 — Authorized job lifecycle and transitions¶
Status: PROTOCOL SPECIFICATION ONLY. This document introduces no runnable job registry, transition engine, worker, Vault transaction, executable lifecycle tests or deployed ComputeMarket component. Authority: frozen ComputeMarket V1 architecture, CMP-0 overview, CMP-0.2 job schema, CMP-0.3 work-unit identity, CMP-0.4 manifest authorization, CMP-0.5 provider/node/resource identity, and CMP-0.6 offers/requests/matching. CMP-0.7 refines the frozen state vocabulary; it cannot add a consensus dependency, grant a scheduler custody, create a fixed Genesis predeploy or override accepted economic terms.
1. Single canonical state and immutable bindings¶
A job has one authoritative ComputeJobRegistry420 lifecycle record keyed by its distinct, nonzero jobId. The accepted request owns requester/payer, funding authorization, manifest and maximum spend; the accepted match owns provider/resource, beneficiary, resource and pricing/verification/SLA commitments; the approved Vault adapter owns custody and obligations. Refer to those canonical records, with integrity-checked snapshot commitments, rather than creating second independently editable job fields. CREATED may precede funding, matching, provider selection or beneficiary binding. ACCEPTED freezes accepted match, manifest/work plan, provider, resource, beneficiary, pricing/verification policy and maximum payable obligation. A late registry, endpoint, signer, pricing or scheduler revision cannot mutate that snapshot. Per-unit retries have distinct CMP-0.3 attemptId and share a single unit entitlement.
The only normal canonical path is CREATED -> FUNDED -> MATCHED -> ACCEPTED -> RUNNING -> RESULT_COMMITTED -> VERIFIED -> SETTLED. Exceptional canonical states are CANCELLED, EXPIRED, FAILED, DISPUTED, REFUNDED. QUEUED, ASSIGNED, SUBMITTED, VERIFYING are noncanonical off-chain observations; REJECTED, SLASHED and PAUSED are outcomes or operational flags, not additional job states. An off-chain scheduler neither sets a canonical state nor fabricates verification, receipt, refund or settlement evidence. Only guarded, named transitions below may mutate state; generic setStatus, administrator overrides or silent reopening are prohibited.
2. Common transition guard, actor and event requirements¶
Each state-changing action checks (chainId, registry/codehash, jobId, expectedCurrentState, expectedRevision, object-scoped capability, actor, nonce or unique action key, expiry/deadline, authoritative referenced records) against the current canonical state inside the same atomic transaction. Reject zero/foreign job ID, stale revision, unsupported policy or verifier version, expired/revoked grant, replay, unauthorized signer, emergency-disabled new work, mismatched manifest/request/match/provider/resource, or terminal spending. A scoped provider key can attest to its own execution; it does not inherit request.fund, job.verify, vault.release, governance, bridge, validator or arbitrary-wallet rights. A verifier's policy-bound approval does not grant it authority to select a payout address. Accepted payer refund and provider beneficiary identities are derived from canonical records, never caller-supplied alternatives.
A successful action increments the job revision exactly once and emits a versioned JobTransition(jobId, previousState, nextState, previousRevision, nextRevision, actionId, actor, authorizationReference, evidenceCommitment, effectiveAt) plus specific funding/matching/attempt/verification/accounting event references where appropriate. Events are evidence of canonical writes, not a substitute for storage and Vault accounting. An identical duplicate action is either explicitly idempotent against the same stored action key with no new side effects, or fails without state/funds/nonce changes; a conflicting duplicate always fails. Avoid doing external calls before the authoritative transition guards and non-reentrant reservation/entitlement accounting.
3. Normal path: authorized transition matrix¶
| Transition | Actor/capability | Mandatory preconditions, effects and evidence |
|---|---|---|
Create -> CREATED |
requester or request.create delegate, scoped to request; canonical registry validates |
Fresh distinct job/request association; currently authorized manifest/request commitment, nonzero ID, policy and deadline. No inferred match/provider/beneficiary and no custody or work permission created. JobCreated binds immutable request reference. |
CREATED -> FUNDED |
requester or specifically capped request.fund delegate through approved Vault adapter |
Prove actual payer-bound native-$420 Vault deposit/reserve or funded obligation for that job, recognized custody route, sufficient authorized amount, replay-safe obligation ID and refundable remainder. Atomic reference to Vault custody and budget; FUNDED is invalid if merely an escrow flag or ledger promise. JobFunded references Vault funding evidence. |
FUNDED -> MATCHED |
authorized requester-side match acceptance and provider-side offer authorization through canonical match registry | CMP-0.6 compatibility, revisions, live eligible concrete resource, capacity reservation and bounded aggregate quote; accepted matchId references the same funded request/job. No scheduler-admin override or double matching. JobMatched binds the one canonical match and its revision. |
MATCHED -> ACCEPTED |
provider or object-scoped match.accept delegate, with requester selection/manifest authorization already valid |
The exact canonical match and request are rechecked, CMP-0.4 signed manifest and nonce evidence valid, CMP-0.5 eligible ancestry and accepted resource profile, reservation and funded maximum still effective; resource, beneficiary, work-plan and economics become immutable. Acknowledgment commits acceptance timestamp and deadline; a fresh manifest or unfunded expansion cannot be substituted. JobAccepted references authorization and locked snapshot. |
ACCEPTED -> RUNNING |
accepted provider-bound worker with scoped attempt.assign/start authority |
Paid work is prohibited until actual Vault reserve, accepted quote, immutable manifest and verified executable policy, live authorized resource/endpoint, unique authorized attempt and execution deadline all pass. Atomic attempt reservation records unit/attempt, provider/node/resource and assigned capacity. Duplicate starts cannot reserve twice or create an extra unit entitlement. JobRunning/AttemptStarted reference assigned work. |
RUNNING -> RESULT_COMMITTED |
accepted provider/worker with receipt.submit scope |
Every payable work unit has admissible attempt and domain-bound signed receipt/evidence references satisfying CMP-0.3/0.4/0.5, required partition/replica coverage or an explicitly preaccepted partial-result policy, bounded meter/charge and output commitment. No raw private output on-chain; signature alone does not prove correctness. JobResultCommitted binds result set/receipt root and accepted policy. |
RESULT_COMMITTED -> VERIFIED |
independent policy-authorized verifier via bound versioned verification profile | Verify immutable accepted manifest, all required receipt/evidence references and correctness policy; enforce challenge window, distinct unit entitlements, replica thresholds and payable amount <= reserved/authorized ceiling. An invalid result does not become VERIFIED via a provider signature, scheduler assertion or admin override; route failed evidence through the defined failure/dispute path. JobVerified commits verifier decision, evidence root and exact provisional earned entitlement. |
VERIFIED -> SETTLED |
narrowly scoped settlement.execute adapter after verified entitlement and dispute/finality gates |
Enforce final unchallenged or resolved verification, one-time job/unit/receipt entitlement, exact accepted provider-derived beneficiary, bound payer reference, paid <= verified earned <= accepted aggregate maximum <= funded reserve, and deterministic unused-value accounting. Transfer or make claimable only using authorized Vault primitives, never generic wallet access. Atomically mark disbursement/claim and release capacity exactly once. JobSettled references authentic Vault movement and settlement ID; a bookkeeping-only cancelObligation is not payer refund. |
Atomicity clarification: CMP-0.6 may validate and tentatively reserve capacity and payer funding during match acceptance; this lifecycle orders the canonical job-state transitions and requires matching to link to an already funded job. If match and job binding occur in separate calls, preserve tentative holds under a finite expiry and release them on rejection/timeout with no executable entitlement. Any offered combined transaction must emit distinct canonical transitions in the frozen order, revert all writes together, and never expose a partially funded/accepted/runnable job. MATCHED is not proof of provider acceptance; ACCEPTED is not proof that execution occurred.
4. Exceptional states, cancellation, expiry, failure and refund¶
CANCELLED applies when an authorized requester cancels before a policy-defined irrevocable execution commitment or when an explicitly preaccepted cancellation policy permits later cancellation with bounded, objectively proven earned work. Validate requester ownership, cancellation window, absence of conflicting verified/settled/disputed entitlements and snapshot revision. A provider cannot cancel a payer's request merely by disabling an endpoint. After ACCEPTED/RUNNING, cancellation cannot erase valid signed receipts, verification rights or preaccepted partial-entitlement rules. Mark cancellation once; release unused capacity exactly once and route the balance to the payer-bound refund procedure; no cancellation action itself transfers funds to an arbitrary address.
EXPIRED is entered only by an authenticated permissionless deadline-trigger (or narrowly scoped automation) that proves the bound request/offer/acceptance/attempt deadline has passed, with a recorded expiresAt and state-specific grace/challenge rule. A scheduler's wall clock or an endpoint cache is insufficient. Expiry of an unaccepted request/offer stops new commitments; expiry after receipt commitment cannot preempt an already valid verifier/challenge/settlement entitlement. Replaying a timeout cannot release the same reservation twice or resurrect a job.
FAILED records an objective policy-defined nonperformance, invalid verification outcome or exhausted bounded recovery deadline with authenticated evidence and appeal window; never infer failure from an arbitrary admin label, single failed replica or subjective output preference. Failed verification must produce no provider payout unless an explicitly preaccepted, objectively computable partial-entitlement policy proves independent completed work and its upper bound. Failure cannot silently slash stake; CMP-0.10 specifies objective slash/dispute authorization.
DISPUTED is a nonterminal review state reached through an authorized and timely requester/provider/challenger action bearing policy-bound evidence. Record the challenged prior canonical state, accepted terms, evidence, escrowed/earned amounts, challenge deadline and appeal status without mutating the original accepted match. Freeze only the contested releases and new paid attempts; preserve uncontested balances and verified earnings under the accepted policy. Resolution must be performed by a specifically authorized dispute resolver under the versioned policy, with auditable evidence and bounded appeal. Resolution may return to its stored lawful pre-dispute path (RUNNING, RESULT_COMMITTED, VERIFIED) only if that path's original guards and deadlines still hold, or continue to FAILED/CANCELLED/EXPIRED/REFUNDED as allowed by the frozen architecture. Do not claim DISPUTED is terminal or use it to bypass funding, matching, acceptance, verification or a terminal-state rule. Reopen only a previously nonterminal state in a verifiable dispute resolution, never SETTLED, REFUNDED or other terminal accounting.
REFUNDED requires actual payer-bound Vault withdrawal/transfer or a payer-claimable refund whose ownership and amount are recorded by the authorized Vault adapter, as prescribed by accepted refund policy. A prior CANCELLED/EXPIRED/FAILED or resolved DISPUTED disposition may initiate refund; REFUNDED is terminal for future execution/spend. The Vault's cancelObligation only returns an obligation amount to internal free balance: it neither transfers funds to the payer wallet nor proves an external refund. Partial earnings and refunds must be partitioned once with earned + refundable + pending/disputed + explicit fees <= total funded and no duplicated accounting. For a successfully SETTLED job, the unused amount follows the bound payer-claim/refund path without reopening the job or minting another provider entitlement; a separate refund accounting record does not reclassify SETTLED to REFUNDED.
SETTLED, REFUNDED, and finalized CANCELLED/EXPIRED/FAILED dispositions with no unresolved entitlement are terminal for job execution; any allowed post-disposition claim or audit is an accounting action and not a state reopening. Emergency suspension may prohibit new creates/matches/starts or unsafe verifier routes but cannot redirect funds, fabricate outcomes, confiscate verified claims or alter accepted match economics.
5. Work-unit progression, ordering, and bounded retries¶
Store canonical per-unit and per-attempt records separately from the job state. The job becomes RUNNING on a valid first start; the job cannot become RESULT_COMMITTED until required unit results or an authorized partial-result termination policy are recorded. Each unitId has at most one payable entitlement across distinct attempt nonces and any allowed equivalent worker reassignment. A late or duplicate receipt cannot regress state, reset cumulative metering, consume a second unit payment, extend a deadline or increase maximum spend. Concurrency checks lock the expected job revision and unit entitlement/reservation keys; parallel start, cancel, expire, dispute, verifier and settlement calls must have deterministic single-winner accounting. If all attempts fail before valid result, route to bounded retry or policy-defined FAILED/EXPIRED, not VERIFIED by default.
6. Executable qualification matrix and ownership¶
Proposed code ownership: ComputeJobRegistry420.sol enforces the named guarded transitions and immutable accepted snapshot; ComputeAuthorization420.sol checks scoped actors; the offer/request/match registries own terms/selection; the signed-manifest verifier owns request-bound authorizer validation; receipt and verification components own correctness/evidence; ComputeSettlement420.sol with the authorized Vault adapter owns transfers, refunds and one-time entitlement. These are architecture paths, not claims of existing source or deployment. No new fixed Genesis address; publication requires deployment, code-hash verification and authorized registry activation.
Positive executable cases (once code exists): create an unmatched CREATED job; fund with real payer-bound Vault reserve; atomically match and accept one active concrete provider/resource; start at most the accepted partition/replica plan; submit admissible signed receipts; verify with selected profile; settle once to frozen beneficiary; separately prove real unused-funds payer claim/refund; cancel an unmatched funded job and verify refund; expire a stale accepted job without confiscating earned work; dispute an in-flight result, resolve with evidence and resume only the lawful nonterminal path. Include state/revision/action/evidence event reconstruction and explicit actual Vault balance proofs.
Negative cases: unauthorized actor or expired capability, direct skipped transition, generic setter, CREATED without match receiving a beneficiary, FUNDED without actual Vault custody, match/manifest/revision/resource mismatch, quote > cap, unreserved capacity, terminal reopen, stale request/provider endpoint, scheduler-forged action, double attempt/unit entitlement, forged or replayed receipt, invalid verifier or failed correctness treated as VERIFIED, early settlement, overpayment, beneficiary redirect, duplicate refund/cancel/timeout, cancelObligation misreported as wallet refund, dispute as terminal, unbounded appeal, slashing without objective evidence, raced match/start/cancel/expiry/settlement, privacy breach or consensus dependence. Each failure must leave canonical revision, balances, accepted snapshot, unit entitlement, resource reservation and authorization nonce unchanged unless a separately permitted idempotent audit event is specified. Pin a transition-table test ID to CMP-INV-001–030, especially 006–020, 024–029, in Foundry and independent client/worker integration tests. Run actual contract/application checks once implemented and exact-head repository CI for this documentation increment; green documentation/Go/Geth workflows alone do not demonstrate any executable CMP job lifecycle.
Completion boundary: The actor/capability/precondition/event matrix, normal and exceptional V1 transitions, job-versus-attempt separation, frozen economics, nonterminal dispute, terminality and Vault refund boundaries are specified only. No functional job-state machine, production custody, receipt verification, settlement or end-to-end paid execution is introduced or verified. Keep PR #367 draft/unmerged until remaining CMP-0 implementation, test, current-main reconciliation and exact-head qualification gates pass. CMP-0.8 specifies Vault funding, settlement and payer refunds next.