From 96a733e1ccbf6dab2d69f263d655e487ac54c20d Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 20 Nov 2026 01:28:41 +0000 Subject: federation: revision 2, the federation's name A version may give its federation a name (`name`, spelled as a party's), under a revision that has names: `federation-name`, revision 2. The first version's is in the root, so a rehearsal named otherwise is another federation, though its parties, keys, nodes and rules are the same; a later version changes the name as anything else, which changes what the federation is called, not which it is. A version giving a name under an earlier revision is none. What a version does says so, in words: it names the federation, renames it, or drops its name. Half the generated histories begin at the newest revision now, their versions naming the federation anew now and then; those of the revisions before are generated as they were. --- src/federation/properties.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/federation/properties.rs') 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) -> History { let count = rng.between(3, 5); let parties: Vec = (0..count) @@ -117,13 +117,18 @@ pub(super) fn generate_at(rng: &mut Rng, kind: Kind, revision: Option) 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 = 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) 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))); -- cgit v1.3.1