CMP-0.3 — Deterministic work-unit identity and attempt separation¶
Status: SPECIFICATION INCREMENT, not a deployed ID registry, implementation, or executable cross-language qualification. Authority: frozen V1 architecture, CMP-0 overview, CMP-0.2 canonical job schema. The roadmap assigns work-unit identity to CMP-0.3; the overview's older CMP-0.2 — Deterministic work-unit identity heading is a numbering error. CMP-0.4 owns signed execution manifests. No new fixed predeploy, additional custody authority, or consensus dependency is created here.
1. Immutable work plan¶
A canonical job has one accepted, immutable manifest commitment and one accepted partition plan. Before any execution, bind jobId (bytes32), the manifest commitment (bytes32), partitionSchemeId (bytes32), partitionSchemeVersion (uint32, nonzero), partitionPlanHash (bytes32), partitionCount (uint32, 1..policy maximum), and replicationFactor (uint32, 1..policy maximum). partitionPlanHash commits to a versioned deterministic description of how the immutable input is split, partition ordering, input-slice commitments, output aggregation and any per-partition verification requirements; it does not contain private input bytes. Each partition index is zero-based, < partitionCount; each replica index is zero-based, < replicationFactor. Multiplication of the two counts must be checked without overflow, within a versioned per-job work-unit limit, and already accounted for by the accepted total spend and funding cap; replication is not an unquoted multiplier. A partition plan or manifest change after acceptance requires an explicitly authorized new request/match/job rather than silently reusing a job ID. Independent replicas of a partition share its input commitment but differ in replica index and must satisfy the bound independent-provider policy where required.
jobId MUST be canonical and collision-resistant under the job registry's own scoped identity policy; this document does not redefine the CMP-0.2 job-creation ID. The verifying registry MUST resolve the exact accepted job and derive manifest/plan/counts from its authoritative state. Caller-supplied copies are compared with that state rather than treated as an alternative authority. No worker, scheduler, timestamp, transport URL, or execution attempt may change the underlying unit identity.
2. V1 typed unit-ID encoding¶
For CMP work-unit schema version 1, define UNIT_DOMAIN_V1 = keccak256(utf8("420Integrated.ComputeMarket.WorkUnit.v1")). Define unitId = keccak256(abi.encode(UNIT_DOMAIN_V1, uint256(chainId), uint32(schemaVersion), bytes32(jobId), bytes32(manifestHash), bytes32(partitionSchemeId), uint32(partitionSchemeVersion), bytes32(partitionPlanHash), uint32(partitionCount), uint32(replicationFactor), uint32(partitionIndex), uint32(replicaIndex))) with schemaVersion = 1. All values use Solidity ABI standard (NOT packed) encoding: each static argument occupies one 32-byte word in the displayed order; integers are unsigned, big-endian and left-zero-padded to 32 bytes; bytes32 is used verbatim. The domain constant is the 32-byte Keccak-256 digest of the exact case-sensitive ASCII/UTF-8 string above, with no terminator. chainId is the EVM chain ID recorded for the job, not an RPC connection hint. Reject zero chain ID, zero job/manifest/scheme/plan hashes, schema or scheme versions not explicitly supported, invalid indexes/counts and an accepted record whose chain does not match the verifying chain. Job identity, chain, schema, manifest and partition plan are frozen for the accepted job. Do not substitute SHA3-256 for Ethereum Keccak-256, abi.encodePacked, JSON serialization, decimal string joining, local timestamps, or a scheduler/worker nonce.
An implementation MUST use the recorded immutable plan and unitId derivation for all receipts, verification, challenges and settlement; a submitted arbitrary unit ID is checked against the derivation. Changing any encoded field produces a different domain input and must never silently transfer an existing settlement entitlement to the new identity. Collision resistance is a cryptographic assumption, not a proof of injectivity of the 256-bit hash across all possible inputs.
3. Retry / attempt ID (not a new payable unit)¶
A unit may have multiple attempts, each with a unique canonical uint64 attemptNonce allocated monotonically by the authorized attempt registry for that unitId (starting at 1; no zero, reuse or wraparound). Define ATTEMPT_DOMAIN_V1 = keccak256(utf8("420Integrated.ComputeMarket.WorkAttempt.v1")) and attemptId = keccak256(abi.encode(ATTEMPT_DOMAIN_V1, uint256(chainId), uint32(schemaVersion), bytes32(unitId), uint64(attemptNonce))) for schema version 1. Bind every execution receipt to both unitId and attemptId; verify that attempt belongs to the same canonical unit and authorized provider/resource assignment and that the attempt's manifest equals the accepted job manifest. Failed, timed-out or challenged attempts remain auditable and cannot be erased by retry. Provider changes, if permitted, require a separately authorized reassignment of the attempt, without mutating unit ID or accepted economics.
Retries must not create new units or additional settlement slots. Mark paid eligibility on the canonical (jobId, unitId, replicaIndex) entitlement (unit ID already commits replica index), enforce at-most-once finalization and idempotent replays of the same accepted result, and reject a second or conflicting payout even if it bears a new attempt ID or a different receipt ID. A rejected attempt never becomes payable merely because it is the latest attempt. Replica payments are independently bounded by the accepted replication plan and aggregate requester maximum. The policy must state whether a successful replica can be superseded by later verified evidence and how disputes hold rather than duplicate payment; CMP-0.7+ finalizes transition and settlement details.
4. Boundaries and exceptional cases¶
A replacement scheduler recomputes the same IDs from accepted immutable state; it cannot choose indexes outside the plan, create a larger replication count, or grant extra funding. Worker identity belongs to the signed attempt/receipt, not the canonical unit hash. Off-chain partition payloads and private datasets remain off-chain; only commitments and authorized access policy references are public. Deterministic identity does not assert deterministic computation or output correctness: those depend on the bound verification profile and receipt evidence. Expired/cancelled/failed jobs cannot open fresh paid attempts except under an explicitly specified and authorized dispute/recovery transition; they cannot regain spending authority. Provider suspension blocks new assignment but does not silently confiscate already-earned entitlements. Do not use AI or Resource Protocol receipt/session IDs as aliases for a CMP unit ID.
5. Executable qualification gate and reproducible vectors¶
Before Solidity/SDK deployment, check in a canonical fixture file containing: complete typed input values; each domain constant hex; the 32-byte ABI words in order; complete ABI-encoded hex; expected Keccak unitId; accepted attempt nonces and expected attemptId; and a fixture-generation script with pinned dependencies. Independently derive and compare those vectors in Solidity Foundry and a second implementation (Go or TypeScript) with exact byte equality, not a shared hard-coded expected hash and not two wrappers invoking the same library. This document does not invent or claim executed hash vectors or implemented contract tests. The CI gate must execute both implementations on the same versioned fixtures.
Required positive cases: same immutable inputs produce the same unit ID across clients and schedulers; partition/replica order independent of scheduling; different valid partitions and replicas produce distinct IDs in the test domain; retries generate distinct attempts attached to the same unit; deterministic reconstruction after node restart. Required negative cases: altered chain ID, job ID, manifest, plan hash, scheme/version, partition/replication count, partition/replica index, domain or schema version; zero and out-of-range counts/indexes; count multiplication/maximum budget overflow; malformed ABI/endianness, SHA3 versus Keccak and packed encoding; unknown/unaccepted job, post-acceptance plan mutation, unauthorized attempt allocation, duplicate nonce, overflow, receipt attempt/unit mismatch, reassignment without authority, retry double-pay and cross-chain replay. Fuzz bounds/uniqueness and property-test at-most-once settlement under concurrent or reordered receipts; fail closed for unknown versions. Map these to frozen CMP-INV-001–030 before CMP-0 closeout.
6. Completion classification¶
CMP-0.3 design specified: canonical version-1 unit/attempt input types, encoding/domain, bounds, and economic anti-duplication rules. Not completed: executable pinned vectors, independent cross-language implementation/fixtures, real registries and ABI, end-to-end matching/execution/verification/settlement, contract/application qualification, deployment and production readiness. CMP-0.4 next specifies canonical signed manifests; this phase must not be represented as runnable compute infrastructure. Remain in draft PR #367 until subsequent gates are met and requalify its exact head after each change.