aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/properties.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/properties.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/properties.rs')
-rw-r--r--src/federation/properties.rs11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/federation/properties.rs b/src/federation/properties.rs
index 082fcac..36724ff 100644
--- a/src/federation/properties.rs
+++ b/src/federation/properties.rs
@@ -99,15 +99,6 @@ fn pick(rng: &mut Rng, ids: &[Id]) -> Id {
}
}
-fn root_of(spec: &Spec) -> Vec<u8> {
- Checkpoint {
- at: Vec::new(),
- keeps: Vec::new(),
- version: Version::read(&spec.json()).expect("a version"),
- }
- .bytes()
-}
-
fn generate(rng: &mut Rng, kind: Kind) -> History {
let count = rng.between(3, 5);
let parties: Vec<Party> = (0..count)
@@ -116,7 +107,7 @@ fn generate(rng: &mut Rng, kind: Kind) -> History {
let adversary = count - 1;
let refs: Vec<&Party> = parties.iter().collect();
let first = Spec::first(&refs, &[("names/{party}", harness::str("{party}"))]);
- let root = root_of(&first);
+ let root = first.root();
let root_id = Id::of(&root);
let mut world: Store<Federation> = Store::new(root.clone(), Vec::new()).expect("a root");
let mut specs: BTreeMap<Id, Spec> = BTreeMap::from([(first.hash(), first)]);