diff options
| author | tv <tv@krebsco.de> | 2026-11-19 03:52:49 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-19 05:11:45 +0100 |
| commit | 6c6f978189eafa15add0df865f713dc946dfc5cb (patch) | |
| tree | 2b4c556ba96820aa6fd13c22d96cd5fe5af9e091 /src/federation/properties.rs | |
| parent | 54bcc0e4ee8e1e6a29e0e01369c2ba95b27abce8 (diff) | |
federation: merge events, the first revision
What builds on many heads merges them, but only an event a party writes: in a quiet
federation, heads beside each other stay so, and past 64 no event is above them all.
Revision 1 (`merge-events`) adds merge events: `{"merge": true}`, signed with a node's
own key, the `key` its Ed25519 key, for the party whose node list names it. One counts for
nothing, and only gathers what it builds on into the history of what builds on it. Under
the base revision, signed by a node its party doesn't list, or by a party's key, it is
refused; the model alike. Generated federations begin at either revision, and their nodes
merge.
A node voting by itself backs no version changing the revision, on any version neither:
its party's operators vote on that one, once their nodes run a continuum that knows it.
`federation.md` lists the revisions, says what a merge event is, and row 71 is tested
(`federation_attack_71`).
Diffstat (limited to 'src/federation/properties.rs')
| -rw-r--r-- | src/federation/properties.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/federation/properties.rs b/src/federation/properties.rs index 02c7799..214bb27 100644 --- a/src/federation/properties.rs +++ b/src/federation/properties.rs @@ -1,7 +1,7 @@ //! The federation's properties over generated histories (`docs/federation-tests.md`, //! Properties): three to five parties write, change their key sets and node lists, propose //! versions and checkpoints, vote, and write the versions that pass, each on what it last -//! caught up with; an adversary signs with its keys or stolen ones whatever it likes. The +//! caught up with, and their nodes merge; an adversary signs with its keys or stolen ones whatever it likes. The //! store is checked against the model, which reads every history anew, against itself in //! other orders, and read from a document against itself given the events alone. A //! failing history is cut down, events taken out with what builds on them for as long as @@ -17,6 +17,7 @@ use super::harness::{self, Party, Spec}; use super::held::Holding; use super::jcs::Json; use super::model::{Model, Verdict}; +use super::revision::Feature; use super::store::memory::{Offered, Refusal, Store}; use super::store::{Fold, Id}; use super::version::Version; @@ -109,7 +110,11 @@ fn generate(rng: &mut Rng, kind: Kind) -> History { .collect(); let adversary = count - 1; let refs: Vec<&Party> = parties.iter().collect(); - let first = Spec::first(&refs, &[("names/{party}", harness::str("{party}"))]); + 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. + if rng.chance(0.5) { + first.revision = Feature::MergeEvents.revision(); + } let root = first.root(); let root_id = Id::of(&root); let mut world: Store<Federation> = Store::new(root.clone(), Vec::new()).expect("a root"); @@ -146,7 +151,10 @@ fn generate(rng: &mut Rng, kind: Kind) -> History { .filter(|(id, ..)| known[w].contains(id)) .collect(); let roll = rng.below(100); - let event = if roll < 35 || (roll >= 60 && mine.is_empty()) { + let event = if roll < 4 { + // A node merges, its party's or not. + harness::merge(&party.name, rng.below(10) as u8, &deps) + } else if roll < 35 || (roll >= 60 && mine.is_empty()) { let path = format!("home/{}/k{}", party.name, rng.below(3)); writer.write(&deps, &path, harness::str(&step.to_string())) } else if roll < 43 { |
