aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/party.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-19 13:34:24 +0000
committertv <tv@krebsco.de>2026-11-19 14:39:54 +0100
commit9164ebfe9a4014cbbaaaff90c5a1d722e39457fd (patch)
tree9a45156bd4919054939d12c97a19672e92e07b98 /src/federation/party.rs
parent7a5aeb02024ddff71ba60f40913555cd21a633ad (diff)
federation: which nodes know a revision, in counts and before a `true`
`GET /events/counts` says, of each node a party lists, what it said it speaks and knows (`knows`, by node ID): the wire versions, the oldest and the newest, and the newest revision of the federation it knows, by number and ID and as people read it, its number null where this continuum doesn't know it; null where it said nothing, a build from before SPEAKS or one the node didn't hear from; the node's own as it is. So the nodes still to upgrade before a revision passes show, every party's, where before a party's operators could check only their own. A party's client, backing a proposal that moves to another revision, warns of every node of any party not known to know it, a line a party naming each and what it said: once it passes, those stop at it till upgraded. `next` warns alike, of the revision it moves to, or of the later one it suggests. A warning, not a refusal: what a node heard is no proof, and a node not heard from may well be upgraded.
Diffstat (limited to 'src/federation/party.rs')
-rw-r--r--src/federation/party.rs42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/federation/party.rs b/src/federation/party.rs
index a12dc7f..2c8dc4b 100644
--- a/src/federation/party.rs
+++ b/src/federation/party.rs
@@ -314,7 +314,15 @@ pub(crate) async fn main() -> Result<()> {
moves to it, once every party's nodes run a continuum that knows it",
current.revision
);
+ warn_unready(&node.counts().await?, later);
}
+ } else if let Some(revision) = next["revision"]
+ .as_str()
+ .and_then(Id::from_hex)
+ .and_then(|id| Revision::of(&id))
+ && revision != current.revision
+ {
+ warn_unready(&node.counts().await?, revision);
}
println!("{}", serde_json::to_string_pretty(&next)?);
return Ok(());
@@ -755,18 +763,21 @@ async fn vote(
})) if hash == proposal => version,
_ => bail!("the node's {proposing} isn't the proposal it names"),
};
- // A later revision: the node knows it, or it stops at the version once it passes.
+ // A later revision: the node knows it, or it stops at the version once it passes; and
+ // so does every other node not known to know it.
if yes
&& let Ok(version) = Version::read(&proposed)
&& version.revision != current.revision
- && !node.revisions().await?.contains(&version.revision.id())
{
- bail!(
- "{proposal} moves to {}, which the node doesn't know: once it passed, a node that \
- doesn't stops at it, and votes nothing till upgraded; upgrade this node and every \
- other of the party to a continuum that knows it, then back it",
- version.revision
- );
+ if !node.revisions().await?.contains(&version.revision.id()) {
+ bail!(
+ "{proposal} moves to {}, which the node doesn't know: once it passed, a node \
+ that doesn't stops at it, and votes nothing till upgraded; upgrade this node \
+ and every other of the party to a continuum that knows it, then back it",
+ version.revision
+ );
+ }
+ warn_unready(&counts, version.revision);
}
// The votes on its party's earlier proposals it backed, for the nays among them.
let mut nays = Vec::new();
@@ -816,6 +827,21 @@ async fn vote(
node.put(&cast).await
}
+/// Warns of the nodes not known to know `revision`, by `counts` (`client::unready`).
+fn warn_unready(counts: &JsonValue, revision: Revision) {
+ let behind = client::unready(counts, revision);
+ if behind.is_empty() {
+ return;
+ }
+ eprintln!(
+ "Warning: these nodes aren't known to know {revision}, as far as the node heard from \
+ them; once a version of it passes, each stops at it till upgraded:"
+ );
+ for line in behind {
+ eprintln!(" {line}");
+ }
+}
+
/// Signs again what a move refused: of the latest event it signed at each place, its key
/// set and its node list, those the node refuses as not above its checkpoint's heads, or
/// as built on one it refuses.