chadtmiller.com/group-host
atmosphere group host
Records are served with their proof by com.atproto.sync.getRecord
MergedThis adds com.atproto.sync.getRecord. It returns a CAR rooted at the signed head commit. The CAR holds the tree's covering proof, plus the record block when the record exists. It reuses Tree::covering_proof, which the firehose already uses. Errors go through did_of, so unknown repos give RepoNotFound and deactivated groups give RepoDeactivated, as getRepo does. The route shares the sync-repo limit. The change file, api.md and limits.md all changed with it. The test checks the commit signature, walks the proof down to the record, and checks absence for keys before, between and after the records. I read the diff and did not run it.
I found nothing that must change. Two minor notes:
record_proofreadshead, the paths and the record in separate store calls. A write between them could mix commits. Only a fresh read would pay for that, so it's fine unless the store reads aren't in one transaction.- The new
limits.mdsentence runs long on one line, which is cosmetic.
8 passed, 1 skipped
What changes
The host answers
com.atproto.sync.getRecord(did,collection,rkey) as a PDS does: anapplication/vnd.ipld.carrooted at the group's current signed commit, holding that commit, the tree's nodes covering the key (its path and its neighbours', the MST's covering proof, as the reference PDS sends), and the record's block when it is there. A record not there gets the same nodes, proving it absent. A repo not here isRepoNotFound, a group switched offRepoDeactivated, a missing parameterInvalidRequest, asgetRepoanswers. It spends from the samesync-repolimit asgetRepo.Why
Apps read a record an account just wrote with
getRecord; grain-serve'srefreshRecordsfailed on a group with "its PDS answered 501 Not Implemented", so what a group wrote through an app showed only once the relays brought it. The proof is built from the tree the host already builds forgetRepoand the firehose's commits (Tree::covering_proof), so no new primitive was needed.How it was checked
proves_a_record_or_its_absence_from_the_signed_commitintests/repos.rs, over a tree of 200 records and several layers: the commit verifies against the group's signing key (Commit::verified), the record's CID is reached down the path from the commit's MST root, as grain reads a proof, and matchesrepo.getRecord's; keys before, between and after the records are proved absent; an unknown repo, a missing parameter and a deactivated group are refused by name.Shortcomings
The host still routes no
com.atproto.sync.getBlocksorcom.atproto.sync.getRepoStatus(nor the deprecatedgetCheckoutandgetHead), which the reference PDS serves.