aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/harness.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-16 22:56:25 +0000
committertv <tv@krebsco.de>2026-11-17 00:09:47 +0100
commitce8ccdc68f5b0cc52b380177665ee07505c5bfb5 (patch)
tree339772ea691185c0d9d30c2927d83ab0e07623c3 /src/federation/harness.rs
parent9b20645df80363d922b25b8f2c0a531d060ff36f (diff)
federation: the tests' harness builds a federation's root
`Spec::root`: the root whose first version a spec spells out, built in one place for the tests of the attacks, of the store read from a document, and the properties.
Diffstat (limited to 'src/federation/harness.rs')
-rw-r--r--src/federation/harness.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/federation/harness.rs b/src/federation/harness.rs
index 80328dd..42ee870 100644
--- a/src/federation/harness.rs
+++ b/src/federation/harness.rs
@@ -248,4 +248,14 @@ impl Spec {
pub(crate) fn hash(&self) -> Id {
Id::of(&self.json().bytes())
}
+
+ /// The root of a federation whose first version this is.
+ pub(crate) fn root(&self) -> Vec<u8> {
+ event::Checkpoint {
+ at: Vec::new(),
+ keeps: Vec::new(),
+ version: super::version::Version::read(&self.json()).expect("a version"),
+ }
+ .bytes()
+ }
}