interplane.Get Omega
Read in your language

synapse

A component of the AienOS ecosystem.

Brought by drakestapleton

branch main Branches Tags History

synapse / docs / E0_IDENTITY_DOCUMENT.md

84 lines · 7097 bytes Raw Blame History Source

E0: Repository Identity Document

ADR 0003 section 9 step E0 (issue aien-spark/synapse#26). Section 5.5 "Trust root": delegates and threshold live in a Synapse identity document that mirrors the Radicle refs/rad/id delegates and threshold; changing it, including registering executors and the server's own machine key, needs the current threshold.

Code: crates/synapse-radicle/src/identity.rs. Tests: crates/synapse-radicle/tests/e0_identity_document.rs. Evidence: evidence/e0-identity-document/.

1. What the document holds

FieldMeaningConsumed by
repo_idThe repository the document governsevery check
revision0 for genesis, each edit adds exactly 1chaining
prevDigest of the document this one replaces; zero for genesis (and only for genesis)chaining
thresholdDistinct delegate signatures an edit of this document needs, 1 to the delegate countE2 (promotion quorum), M2 (erasure quorum) through verify_quorum
delegatesEd25519 keys allowed to sign edits; strictly ascending, at most 256, at least 1same
executorsRegistered executor machine keys; strictly ascending, at most 4096E1 (executor_registered_at, admit_executor_receipt)
server_keyThe server's machine key, which signs derivation attestationsB5 (server_key_at)

Every key must decode to an Ed25519 point that is not of small order. All refusals use existing RefusalCode variants; no new code was added.

2. Rules

3. Byte layout (record version 1, principle P5)

All integers little-endian, all lengths and counts fixed-width and checked against their caps and against the remaining bytes before anything is allocated. Every decode refusal is RadicleIdentityInvalid; a truncated record, trailing bytes, a wrong tag, or a wrong version are each refused.

Document:

FieldBytes
tag SYNAPSE_IDENTITY_DOCUMENT_V1\029
version (1)u16
repo_id length, then UTF-8 bytes (at most 4096)u32 + n
revisionu64
prev32
thresholdu32
delegate count, then each keyu32 + 32 each
executor count, then each keyu32 + 32 each
server_key32

Digest: SHA-256 over SYNAPSE_IDENTITY_DOCUMENT_DIGEST_V1\0, the record length as u64, and the record.

Signed bytes (domain separated): SYNAPSE_IDENTITY_EDIT_SIGN_V1\0 followed by the 32-byte digest. Because the digest covers repo_id, revision, and prev, a signature cannot be replayed onto another repository, another revision, or a fork.

Edit:

FieldBytes
tag SYNAPSE_IDENTITY_EDIT_V1\025
version (1)u16
document length, then the document recordu32 + n
signature count (at most 256), then each 32-byte key and 64-byte signatureu32 + 96 each

4. Acceptance

Acceptance (ADR 0003 section 9, row 6)TestResult
An edit signed by fewer than the threshold is refusede0_edit_signed_by_fewer_than_threshold_is_refused (1 of threshold 2; the same delegate twice; no signature; a key the edit would add; a forged delegate signature)pass
An edit signed by the threshold appliese0_edit_signed_by_threshold_applies (2 of 3 applies, raises the threshold to 3, rotates the server key; the next edit then needs 3)pass
A removed executor's later receipts are refusede0_removed_executor_later_receipts_are_refused (real signed EvidenceReceipts; removal at WalSeq 10; refused at 10 and 11, still admitted on replay at 5; unregistered key, pre-genesis, forged receipt refused)pass
Radicle conformance stays 11 of 11synapse-bench child --kind conformance with the live Radicle repository, before (main 91733a3) and after11 of 11 both; case results identical

Supporting tests: e0_edits_chain_and_cannot_be_replayed_or_reordered, e0_genesis_needs_its_own_threshold_and_a_valid_document, e0_binary_format_round_trips_and_refuses_malformed_bytes.

Red then green: evidence/e0-identity-document/red-green/red.txt (all 6 tests fail on their assertions against a fail-open stub that accepts every edit and receipt and changes nothing) and green.txt (all 6 pass).

Radicle conformance reproduction: write {"suites":["radicle"],"work_dir":"<tmp>","radicle_repo":"<radicle storage repo>"} to a spec file and run synapse-bench child --kind conformance --spec <spec> --result <out>. Raw results: evidence/e0-identity-document/radicle-conformance/.

5. Performance

E0 is not a hot-path step. No figure is reported, so no bound is needed.

6. Limits and disclosures