aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/events.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-24 18:58:32 +0000
committertv <tv@krebsco.de>2026-11-24 18:58:32 +0000
commitfb54044c688e0252b4af54a057151b9c4d4ccf98 (patch)
tree10e2566a2302ed11e4ec6d96a52e0afde7ad4582 /src/api/events.rs
parentc105463a8f4d080c28f39fa07d170e47e8d1eb8e (diff)
federation: no true on a checkpoint at heads no version may name
A version event is refused where the heads its version names for a checkpoint have one in another's history, or aren't after the current checkpoint (may_move). Neither the voters' rule nor what a node tells clients asked that: votes on such a proposal are taken, no version event on them ever is, so nothing lapses, and every party that voted true stays bound until others' nays end it. A followed key proposing one bound all its followers; with two thirds of the parties so, nothing passed on that version again. may_move's part about the heads is may_name now, which backs_checkpoint asks before a true, and GET /events/counts says as none, so that a party's client backs no such proposal either.
Diffstat (limited to 'src/api/events.rs')
-rw-r--r--src/api/events.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/api/events.rs b/src/api/events.rs
index 5a69769..1d275f9 100644
--- a/src/api/events.rs
+++ b/src/api/events.rs
@@ -199,7 +199,8 @@ async fn heard(state: &AppState) -> std::collections::HashMap<String, u64> {
/// for a checkpoint, those above its heads), the votes on it, the parties
/// voting `true` and `false`, whether it passed and whether it is dead, why a party's
/// client backs it not, where it is no version that can be written on the current one
-/// (`client::backable`), and, for a checkpoint, what its parties signed that moving there
+/// (`client::backable`) or names heads no version may (`State::may_name`), and, for a
+/// checkpoint, what its parties signed that moving there
/// refuses (`beside`, `signed_beside`).
async fn counts(State(state): State<AppState>) -> Response {
let aliases = crate::swarm::members::aliases(&state.doc.read().await.doc);
@@ -256,6 +257,17 @@ async fn counts(State(state): State<AppState>) -> Response {
.proposal(&hash)
.and_then(|proposed| client::backable(current, proposed).err())
.or_else(|| {
+ let heads = read
+ .proposal(&hash)
+ .and_then(|json| crate::federation::version::Version::read(json).ok())
+ .and_then(|version| version.checkpoint)?;
+ let why = read.may_name(&heads).err()?;
+ Some(format!(
+ "no version event may name its heads ({}): it is never written",
+ why.0
+ ))
+ })
+ .or_else(|| {
(proposing.is_empty() && !ballot.proposals.is_empty()).then(|| {
"no event proposing it is above the heads it names: no version \
event is written on a vote on it"