aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/properties.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/federation/properties.rs')
-rw-r--r--src/federation/properties.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/federation/properties.rs b/src/federation/properties.rs
index 2b824f0..dce0984 100644
--- a/src/federation/properties.rs
+++ b/src/federation/properties.rs
@@ -108,7 +108,7 @@ fn generate(rng: &mut Rng, kind: Kind) -> History {
}
/// A history of `kind`, its first version following `revision`, or, where none is given,
-/// the base revision or one with merge events alike.
+/// the base revision or the newest alike.
pub(super) fn generate_at(rng: &mut Rng, kind: Kind, revision: Option<Revision>) -> History {
let count = rng.between(3, 5);
let parties: Vec<Party> = (0..count)
@@ -117,13 +117,18 @@ pub(super) fn generate_at(rng: &mut Rng, kind: Kind, revision: Option<Revision>)
let adversary = count - 1;
let refs: Vec<&Party> = parties.iter().collect();
let mut first = Spec::first(&refs, &[("names/{party}", harness::str("{party}"))]);
- // Half the federations begin at a revision with merge events, which nodes then sign.
- let merging = rng.chance(0.5);
- first.revision = revision.unwrap_or(if merging {
- Feature::MergeEvents.revision()
+ // Half the federations begin at the newest revision: with merge events, which nodes
+ // then sign, and a name, which versions change.
+ let newest = rng.chance(0.5);
+ first.revision = revision.unwrap_or(if newest {
+ Revision::newest()
} else {
Revision::default()
});
+ let naming = first.revision.has(Feature::FederationName);
+ if naming {
+ first.name = Some("f".to_owned());
+ }
let root = first.root();
let root_id = Id::of(&root);
let mut world: Store<Federation> = Store::new(root.clone(), Vec::new()).expect("a root");
@@ -204,6 +209,8 @@ pub(super) fn generate_at(rng: &mut Rng, kind: Kind, revision: Option<Revision>)
let head = *deps.iter().find(|dep| **dep != root_id).expect("one");
next.checkpoint = Some(vec![head]);
deps = vec![head];
+ } else if naming && rng.chance(0.3) {
+ next.name = Some(format!("f{step}"));
} else {
next.rules
.push((format!("names/x{step}"), harness::str(&party.name)));