Expand description
The shared tier (charter rule 9, ADR 0017).
A shared store is a directory of content-addressed, signed entry files that teams and CI share (a local path, an NFS mount, a synced folder). Nothing in it is trusted because of where it is: an entry is used only if it carries a valid ed25519 signature from a key the reader trusts, and the signature binds everything the reader relies on.
Layout. <store>/v2/<platform>/<solver binary sha256>/<k0k1>/<key>,
so entries are scoped by solver binary and platform class (ADR 0010,
item 6). The path is only a lookup hint: every field it encodes is also
in the signed header and checked there.
Entry file. One JSON header line, then the exact reply bytes, like
the local disk tier. The header holds the v2 key, the reply’s SHA-256,
the command, the mode, the solver identity (name, version, binary
SHA-256, platform), the effort (ADR 0009), the format version, the
publication time, the signer’s key id and the signature. The signature
covers a length-prefixed encoding of every one of those fields (see
Header::signed_bytes), never the JSON text, so no JSON
canonicalization is involved.
Keys. SecretKey and PublicKey are stored as one line of
text: sail-ed25519-secret-v1 <hex> and sail-ed25519-public-v1 <hex>.
A key id is the first 16 hex digits of the SHA-256 of the public key.
Readers trust the public keys in <cache root>/trust/*.pub
(TrustedKeys::load_dir).
Structs§
- Header
- The header line of a shared entry file.
- Public
Key - An ed25519 public key that verifies shared entries.
- Publish
Options - What
publishexports. - Publish
Report - What
publishdid. - Secret
Key - An ed25519 signing key. Its bytes are wiped when it is dropped, and
Debugnever prints them. - Shared
Store - A shared store: a directory reachable as a path.
- Solver
- The identity of the solver an entry was produced by: the fields of
sail_key::SolverIdentity, with the binary hash as hex. - Trusted
Keys - Public keys whose signatures a reader accepts.
- Verified
- A shared entry that passed every check.
Enums§
- Rejection
- Why a shared entry was not used. Every rejection is a miss.
Constants§
- FORMAT
- The
formatfield of every shared entry header. - MAX_
ENTRY_ BYTES - Largest shared entry file read, in bytes. Larger files are rejected without being read.
- MODE_
DEFAULT - The only mode shared entries exist for today. Opt-in modes have keys of their own (charter rule 8) and would need their own trust decision.
- PINNED_
SOLVER - The provenance of replies the local daemon recorded from the pinned
solver: the only ones
publishexports. - PROVENANCE_
PREFIX - Prefix of the provenance of every local entry copied from the shared tier. Such entries are never published again.
- SHARED_
VERSION - Version of the shared entry format. It is signed, so an entry can never be read under another version’s rules.
Functions§
- add_
trusted - Trusts
keyfor the cache atroot: writes<root>/trust/<id>.pubatomically, and returns its path. - publish
- Exports
disk’s entries tostore, signed withsecret. - sign_
entry - Builds a signed shared entry file for
reply, the reply ofcommandunderkey, produced bysolver. - trust_
dir - The trust directory of a cache root:
<root>/trust. - verify_
entry - Checks a shared entry file’s contents for
key, in this order: the header parses and has this format and version; it nameskey; its signer is trusted and the signature verifies over every header field; the reply hashes to the signed hash; the signed solver islocal’s (name, version and binary), onlocal’s platform class; the mode is default; and the reply has the shape its command requires. - verify_
entry_ ref - Applies every check of
verify_entrywhile borrowing the reply bytes. Servers can validate a large upload without allocating a second reply buffer.