2026-07-03 09:24:13 +00:00
|
|
|
from pacta.attestation import load_attestation, validate_attestation
|
|
|
|
|
from pacta.claims import build_claim_card
|
|
|
|
|
from pacta.config import RepoConfig
|
2026-07-03 11:03:58 +00:00
|
|
|
from pacta.signing import generate_ed25519_keypair, sign_attestation
|
2026-07-03 09:24:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def _repo():
|
|
|
|
|
return RepoConfig(
|
|
|
|
|
name="dalek-ed25519-verified",
|
|
|
|
|
url="https://github.com/saymrwulf/dalek-ed25519-verified.git",
|
|
|
|
|
kind="ed25519",
|
|
|
|
|
verified_backend="serial/u64",
|
|
|
|
|
certificates=["CurveFieldProofs.fieldImplementation", "CurveFieldProofs.edwardsImplementation"],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_trusted_attestation_can_drive_r3_claim(tmp_path):
|
|
|
|
|
raw = load_attestation("examples/dalek-ed25519.attestation.yaml")
|
2026-07-03 11:03:58 +00:00
|
|
|
result = validate_attestation(
|
|
|
|
|
raw,
|
|
|
|
|
_repo(),
|
|
|
|
|
path="examples/dalek-ed25519.attestation.yaml",
|
|
|
|
|
trusted_provider="example-proof-checker.invalid",
|
|
|
|
|
allow_unsigned=True,
|
|
|
|
|
)
|
2026-07-03 09:24:13 +00:00
|
|
|
card = build_claim_card(_repo(), tmp_path, attestation=result)
|
|
|
|
|
assert result.accepted
|
|
|
|
|
assert card["risk"]["level"] == "R3"
|
Estate sync: boundary-axiom vocabulary + the four-tier apex reality (R4)
The verified corpus completed its phase 2 on 2026-07-06: every ed25519
fork now carries FOUR button-enforced apex tiers up to the full lift
(accept <=> decompress(R) = [k](-A)+[s]B as points), the complete scalar
layer, and the constructive encoding/decoding chain. pacta was calibrated
to the pre-apex corpus and - worse - had no vocabulary for
boundary-audited certificates: its axiom audit knew only "clean = exactly
the three standard axioms", so the apex tiers would have scored dirty.
New vocabulary:
- Profile.certificate_axioms: per-certificate ALLOWED axiom sets;
expected_axioms_for(cert) resolves each certificate's own boundary.
- RepoConfig.apex_boundary: a simple per-fork key (dalek-wrappers /
hash3 / anza) expanded by the ed25519 profile into the exact
per-tier allowed sets. AUTHORITY NOTE in profiles/ed25519.py: each
repo's check.sh Phase 3b is the enforcement point; if the button and
this table disagree, the button wins.
- run_axiom_audit compares each certificate against ITS allowed set;
deviation in EITHER direction (extra axiom or missing boundary
axiom) is dirty.
New risk reality:
- R4 is now reachable: full four-tier apex + constructive chain +
scalar arithmetic, all proven with cones pinned to their documented
boundaries. R4 always carries explicit residual blockers (SHA-512
oracle, hypothesis-parametric wire parses, translation faithfulness,
no side-channel/build assurance - those gate R5).
- R3 unchanged (arithmetic pair) and now explains exactly which apex
certificates are missing for R4.
Attestation trust model hardened:
- The provider is trusted for its OBSERVATION, never its VERDICT:
axiom_status is re-derived locally from observed_axioms against the
agent's own boundary policy. A provider that labels a dirty cone
"clean" gains nothing; "proven" with no observed axioms is
"unverifiable".
- Partial attestations degrade instead of being rejected: uncovered
certificates stay unproven and the score caps accordingly (an
arithmetic-only attestation still authorizes an R3 library capsule,
never a wallet).
Also: scripts/mini_pytest.py - a dependency-free test runner (tmp_path,
raises, monkeypatch, capsys) for hosts without pytest; examples
regenerated FROM the tool (dalek/anza fixtures now R4, 16 certs; new
full four-tier attestation example); tests updated + new
tests/test_boundaries.py (lying-provider, missing-boundary-axiom,
partial-coverage cases). 40/40 tests green.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 08:04:43 +00:00
|
|
|
assert "trusted third-party provider" in card["risk"]["rationale"]
|
2026-07-03 09:24:13 +00:00
|
|
|
assert card["evidence"]["evidence_mode"] == "third_party_attestation"
|
|
|
|
|
assert any("Third-party proof-checking" in item for item in card["trusted_base"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_untrusted_attestation_scores_r0(tmp_path):
|
|
|
|
|
raw = load_attestation("examples/dalek-ed25519.attestation.yaml")
|
|
|
|
|
result = validate_attestation(raw, _repo(), path="examples/dalek-ed25519.attestation.yaml")
|
|
|
|
|
card = build_claim_card(_repo(), tmp_path, attestation=result)
|
|
|
|
|
assert not result.accepted
|
|
|
|
|
assert card["risk"]["level"] == "R0"
|
2026-07-03 11:03:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_signed_attestation_requires_public_key(tmp_path):
|
|
|
|
|
private_key = tmp_path / "provider.key"
|
|
|
|
|
public_key = tmp_path / "provider.pub"
|
|
|
|
|
generate_ed25519_keypair(private_key, public_key)
|
|
|
|
|
raw = load_attestation("examples/dalek-ed25519.attestation.yaml")
|
|
|
|
|
raw["provider"] = "signed-test-provider"
|
|
|
|
|
raw["signature"] = {}
|
|
|
|
|
signed = sign_attestation(raw, private_key, public_key)
|
|
|
|
|
result = validate_attestation(signed, _repo(), trusted_provider="signed-test-provider")
|
|
|
|
|
card = build_claim_card(_repo(), tmp_path, attestation=result)
|
|
|
|
|
assert not result.accepted
|
|
|
|
|
assert card["risk"]["level"] == "R0"
|
|
|
|
|
assert any("attestation-public-key" in item for item in result.diagnostics)
|