Skip to content

Commit 2b8f825

Browse files
committed
feat(prism): emit ExecutionProof in work-unit result payload (M3 prism-proof)
Add src/prism_challenge/proof.py: ExecutionProof v1 envelope (schema-compatible with the base worker plane), canonical manifest hashing (sha256 over json.dumps(manifest, sort_keys=True, indent=2) == the exact on-disk bytes of prism_run_manifest.v2.json), tier computation from injected provider env (tier 0 default; tier 1 needs BOTH image digest AND pod metadata; tier 2 only with a non-null attestation payload), and an sr25519 worker signature over the pinned message sha256(f'{manifest_sha256}:{unit_id}') (identical to the base agent, VAL-AGENT-008/VAL-PRISM-006). Wire emission into the validator finalization path: the dispatch result payload carries exactly one signed proof at successful finalization, gated on a new prism worker_plane config block (enabled by default OFF -> legacy behavior). Proof construction reads only the manifest + a fixed non-secret provider env allowlist and never the held-out split config or LLM keys (VAL-PRISM-008). Fulfills VAL-PRISM-001/002/003/004/005/006/008.
1 parent 5e0387f commit 2b8f825

7 files changed

Lines changed: 1104 additions & 7 deletions

File tree

src/prism_challenge/config.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,43 @@
33
from pathlib import Path
44
from typing import Literal
55

6-
from pydantic import AliasChoices, Field
6+
from pydantic import AliasChoices, BaseModel, Field
77
from pydantic_settings import SettingsConfigDict
88

99
from .sdk.config import ChallengeSettings
1010

1111

12+
class WorkerPlaneConfig(BaseModel):
13+
"""Prism worker-plane feature block (architecture.md 3.4/3.5).
14+
15+
OFF by default: with ``enabled`` false prism behaves exactly as before the compute plane (no
16+
ExecutionProof emission, no admission gate, legacy audit-free finalization). Env overrides use
17+
the nested delimiter, e.g. ``PRISM_WORKER_PLANE__ENABLED=true``.
18+
"""
19+
20+
enabled: bool = False
21+
admission_requires_worker: bool = False
22+
audit_rate_tier0: float = Field(default=0.10, ge=0.0, le=1.0)
23+
audit_rate_tier1: float = Field(default=0.05, ge=0.0, le=1.0)
24+
audit_rate_tier2: float = Field(default=0.02, ge=0.0, le=1.0)
25+
# sr25519 signing key (URI ``//Name`` / mnemonic / seed) for the worker that emits
26+
# ExecutionProofs. This is the worker's OWN key, injected by the worker agent -- NEVER a
27+
# master-side secret. Unset -> prism emits no signed proof (the base worker plane may still
28+
# stamp a tier-0 proof from the manifest hash).
29+
signing_key: str | None = Field(default=None, repr=False)
30+
31+
1232
class PrismSettings(ChallengeSettings):
1333
model_config = SettingsConfigDict(
14-
env_prefix="PRISM_", env_file=".env", extra="ignore", populate_by_name=True
34+
env_prefix="PRISM_",
35+
env_file=".env",
36+
extra="ignore",
37+
populate_by_name=True,
38+
env_nested_delimiter="__",
1539
)
1640

41+
worker_plane: WorkerPlaneConfig = Field(default_factory=WorkerPlaneConfig)
42+
1743
database_url: str = Field(
1844
default="sqlite+aiosqlite:////data/prism.sqlite3",
1945
validation_alias=AliasChoices("PRISM_DATABASE_URL", "CHALLENGE_DATABASE_URL"),

0 commit comments

Comments
 (0)