aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-19 16:21:02 +0000
committertv <tv@krebsco.de>2026-11-19 17:36:20 +0100
commit602718835d034ef0a96c8ca29e47f06ce37008dc (patch)
tree99a1ffbf50a4f59b3a5078dafa8c0cb3d192632c
parent9784111bd3b95be5352669b74e174920c101f349 (diff)
events: what moving to a proposed checkpoint refuses, shown
federation.md, and row 68, said a node shows, for a proposed checkpoint, what it holds that its heads lack; no node did. `GET /events/counts` now shows, of each proposal whose version names a checkpoint, the writes, key sets and node lists the node took that moving there refuses (`beside`; null for another version): neither among its heads, in their history, nor above them, as the move has it, which their parties sign again. Proposals and votes lapse with the move, and merge events count for nothing: they are left out. `Store::beside` finds them in one pass, as the move itself does: the two share `Store::above`, which the move computed inline.
-rw-r--r--CHANGELOG.md6
-rw-r--r--docs/federation.md8
-rw-r--r--docs/guides/federation/checkpoints.md5
-rw-r--r--docs/openapi.yaml13
-rw-r--r--src/api/events.rs33
-rw-r--r--src/federation/store/memory.rs54
6 files changed, 95 insertions, 24 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index db5eb3b..cf54938 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,12 @@ it from the release before ([`docs/operations.md`](docs/operations.md),
## Unreleased
+* `GET /events/counts` shows, of a proposed checkpoint, what moving there refuses of what
+ the parties signed (`beside`), as the docs said a node shows
+ ([`docs/guides/federation/checkpoints.md`](docs/guides/federation/checkpoints.md),
+ [Backing one](docs/guides/federation/checkpoints.md#backing-one);
+ [`src/federation/store/memory.rs`](src/federation/store/memory.rs)).
+
* `continuum-party` keeps a directory per federation, `~/.config/continuum/federations/
NAME/`, with its options (`party.toml`), record and key: `--federation` chooses one,
the only one is used unasked, and `init --federation NAME` begins one
diff --git a/docs/federation.md b/docs/federation.md
index e13ff8a..df4501e 100644
--- a/docs/federation.md
+++ b/docs/federation.md
@@ -483,8 +483,10 @@ itself, back a checkpoint only where everything they held for a while before it
proposed is among its heads, in their history, or above them, proposals and votes aside,
which lapse with the move: a move refuses what isn't above its heads, and heads a proposer
made up, built on little, would take back what was written since, a key set dropping a
-stolen key among it. A node shows, for a proposed checkpoint, what it holds that its heads
-lack, as for a fork ([Forks](#forks)). This is the voter's rule, by its own clock: nothing
+stolen key among it. A node shows, for a proposed checkpoint, what its parties signed that
+moving there refuses: writes, key sets and node lists it took that are neither among its
+heads, in their history, nor above them (`beside` in `GET /events/counts`), which their
+parties sign again. This is the voter's rule, by its own clock: nothing
more is judged. It is a version only where its proposal is above those heads, and a
version event writing it is taken only where it is above them too, and so is every vote it
is written on ([`store.md`](store.md), [Events](store.md#events)): so moving to the
@@ -815,7 +817,7 @@ yet*: what would answer it better, which isn't built.
| 65 | After a checkpoint, a party that backed a second proposal once its first was dead, the nays that freed it withheld by those who cast them | Not named: its client keeps those nays with its `true` | unit |
| 66 | Two clients of one party back two proposals at once, or its operator votes by hand beside the node that votes for it | Voting twice: a party votes from one client, the node that votes for it where it has one, through which it votes by hand | — |
| 67 | A party keeps a proposal alive that nobody else backs, or two parties of seven or more, to hold back automatic checkpoints | Holds back none past a while: a node proposes a checkpoint beside a proposal it wouldn't back that fewer than a third of the parties back, or nobody but its proposer; a new one holds back for a while, once a version for its proposer | sim |
-| 68 | A checkpoint proposed at heads that leave out what was written since: a key set dropping a stolen key, say | Not backed: clients and nodes back a checkpoint only where what they held for a while is among its heads, in their history, or above them; a node shows what they lack | unit |
+| 68 | A checkpoint proposed at heads that leave out what was written since: a key set dropping a stolen key, say | Not backed: clients and nodes back a checkpoint only where what they held for a while is among its heads, in their history, or above them; a node shows what moving there refuses | unit |
| 69 | A key a version names, stolen, writes its party's node list at a history from before the version naming the party's keys anew, beside the list the party writes under that version, several, for the lowest ID | The party's counts: of a party's lists, those written under the latest version come first | unit |
| 70 | A checkpoint's version proposed again, by an event beside its heads | Voters back it all the same, as a proposal lapses with the move, and vote on an event proposing it above its heads, as a node shows them; a version event on votes beside them is refused | unit |
| 71 | Merge events under the base revision, signed by a node its party doesn't list, by a party's key, or spelled otherwise | Refused, or none: a merge event is taken only under a revision with merge events, signed by a node its party's node list names, its `merge` `true`; it counts for nothing | unit |
diff --git a/docs/guides/federation/checkpoints.md b/docs/guides/federation/checkpoints.md
index 61800a1..eb9fec2 100644
--- a/docs/guides/federation/checkpoints.md
+++ b/docs/guides/federation/checkpoints.md
@@ -51,7 +51,10 @@ with the move: heads a proposer made up, built on little, would take back what w
written since, a key set dropping a stolen key among it. A node voting by itself backs one
only so, and so does a vote by hand through it (`continuum-party vote … --through`). A
party's client voting on its own (`continuum-party vote`) checks no heads: check them
-yourself, or vote through such a node.
+yourself, or vote through such a node. A node shows what its parties signed that moving
+there refuses, writes, key sets and node lists neither among the heads, in their history,
+nor above them (`beside` of the proposal in `GET /events/counts`): those its parties sign
+again.
* `--store-follow PARTY,…` has a node voting by itself follow those parties' `true`,
by default on versions that only move to a checkpoint, and still by that rule, but not
diff --git a/docs/openapi.yaml b/docs/openapi.yaml
index b5e7b14..a64c739 100644
--- a/docs/openapi.yaml
+++ b/docs/openapi.yaml
@@ -1566,8 +1566,11 @@ paths:
none changing the current one, or one naming the heads of the current one's
checkpoint, as this node reads it, or no event proposing it is above the heads it
names: one that passed all the same is never written,
- or, no version here, this node stops at its version event. A passed proposal is
- written at once, and lapses with the rest.
+ or, no version here, this node stops at its version event; and, of a version
+ naming a checkpoint, the IDs of the writes, key sets and node lists this node took
+ that moving there refuses, as they are neither among its heads, in their
+ history, nor above them, and their parties sign again (`beside`; null for
+ another version). A passed proposal is written at once, and lapses with the rest.
responses:
'200':
description: What counts.
@@ -1611,7 +1614,7 @@ paths:
type: object
additionalProperties:
type: object
- required: [proposals, votes, yes, no, passed, dead, none]
+ required: [proposals, votes, yes, no, passed, dead, none, beside]
properties:
proposals:
type: array
@@ -1635,6 +1638,10 @@ paths:
type: boolean
none:
type: [string, 'null']
+ beside:
+ type: [array, 'null']
+ items:
+ type: string
'404':
$ref: '#/components/responses/Error'
/events/refused:
diff --git a/src/api/events.rs b/src/api/events.rs
index 5182c23..06a6e31 100644
--- a/src/api/events.rs
+++ b/src/api/events.rs
@@ -157,11 +157,12 @@ async fn event(State(state): State<AppState>, Path(id): Path<String>) -> Respons
/// `GET /events/counts`: what counts, as the store reads now: the current version, each
/// party's keys and nodes, what each of those nodes says it speaks and knows (`knows`),
/// the values at places, the members, and the proposals on the
-/// current version, each with the events proposing it a vote may build on (`proposing`:
+/// current version, each with the events proposing it a vote may build on (`proposals`:
/// 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, and why a party's
+/// 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`).
+/// (`client::backable`), and, for a checkpoint, what its parties signed that moving there
+/// refuses (`beside`, `signed_beside`).
async fn counts(State(state): State<AppState>) -> Response {
with_store(&state, |store| {
let read = store.state();
@@ -196,6 +197,11 @@ async fn counts(State(state): State<AppState>) -> Response {
.map(|(hash, ballot)| {
let tally = read.tally(current, &hash);
let proposing = read.proposing(&current.hash, &hash);
+ let beside = read
+ .proposal(&hash)
+ .and_then(|json| crate::federation::version::Version::read(json).ok())
+ .and_then(|version| version.checkpoint)
+ .map(|heads| ids(signed_beside(store, &heads)));
let none = read
.proposal(&hash)
.and_then(|proposed| client::backable(current, proposed).err())
@@ -216,6 +222,7 @@ async fn counts(State(state): State<AppState>) -> Response {
"passed": tally.passed,
"dead": tally.dead,
"none": none,
+ "beside": beside,
}),
)
})
@@ -239,6 +246,26 @@ async fn counts(State(state): State<AppState>) -> Response {
})
}
+/// Of what `store` took, what its parties signed that a move to a checkpoint at `heads`
+/// refuses (`Store::beside`), and they sign again: their writes, key sets and node lists.
+/// Proposals and votes lapse with the move, and merge events count for nothing.
+fn signed_beside(store: &Store<Federation>, heads: &[Id]) -> Vec<Id> {
+ use crate::federation::event::{Does, Event, Signed};
+ store
+ .beside(heads)
+ .into_iter()
+ .filter(|id| {
+ matches!(
+ store.get(id).and_then(Event::read_taken),
+ Some(Event::Signed(Signed {
+ does: Does::Write { .. } | Does::Keys(_) | Does::Nodes(_),
+ ..
+ }))
+ )
+ })
+ .collect()
+}
+
/// What kind of refusal it is, as a client tells them apart, and the event it builds on,
/// for one built on a refused one.
fn kind(refusal: &Refusal) -> (&'static str, Option<&Id>) {
diff --git a/src/federation/store/memory.rs b/src/federation/store/memory.rs
index 05479e3..b4be6f0 100644
--- a/src/federation/store/memory.rs
+++ b/src/federation/store/memory.rs
@@ -359,6 +359,41 @@ impl<F: Fold> Store<F> {
.collect()
}
+ /// Of the events taken after the checkpoint, those a move to a checkpoint at `heads`
+ /// refuses: neither among them, nor in their history, nor above them (`moved`), where
+ /// they are heads a version may name.
+ pub(crate) fn beside(&self, heads: &[Id]) -> Vec<Id> {
+ let set: BTreeSet<Id> = heads.iter().copied().collect();
+ let before = self.history(heads);
+ let above = self.above(&set, &before);
+ self.order
+ .iter()
+ .filter(|id| !before.contains(id) && !above.contains(id))
+ .copied()
+ .collect()
+ }
+
+ /// Of the events taken after the checkpoint, those above `heads`, `before` being their
+ /// history: each building on the heads, or on what is above them, alone, and on all
+ /// the heads or on one above them.
+ fn above(&self, heads: &BTreeSet<Id>, before: &HashSet<Id>) -> HashSet<Id> {
+ let mut above: HashSet<Id> = HashSet::new();
+ for id in self.order.iter().filter(|id| !before.contains(id)) {
+ let dependencies = &self.events[id].dependencies;
+ let on = dependencies
+ .iter()
+ .all(|dependency| heads.contains(dependency) || above.contains(dependency));
+ let holds = dependencies
+ .iter()
+ .any(|dependency| above.contains(dependency))
+ || heads.iter().all(|head| dependencies.contains(head));
+ if on && holds {
+ above.insert(*id);
+ }
+ }
+ above
+ }
+
/// The events taken after the checkpoint among `ids` and all they build on.
fn history(&self, ids: &[Id]) -> HashSet<Id> {
let mut history = HashSet::new();
@@ -422,20 +457,7 @@ impl<F: Fold> Store<F> {
return false;
};
let before = self.history(&ids);
- let mut above: HashSet<Id> = HashSet::new();
- for id in self.order.iter().filter(|id| !before.contains(id)) {
- let dependencies = &self.events[id].dependencies;
- let on = dependencies
- .iter()
- .all(|dependency| heads.contains(dependency) || above.contains(dependency));
- let holds = dependencies
- .iter()
- .any(|dependency| above.contains(dependency))
- || heads.iter().all(|head| dependencies.contains(head));
- if on && holds {
- above.insert(*id);
- }
- }
+ let above = self.above(&heads, &before);
for id in &self.order {
if before.contains(id) {
if !kept.contains_key(id) && !heads.contains(id) {
@@ -1184,6 +1206,10 @@ mod tests {
store.left_out(&[head, beside], &[first, beside, above]),
vec![above]
);
+ // What a move there refuses: what is beside them, and what builds on it too.
+ let both = taken(store.offer(testfold::put(&[above, beside], "d", "1")));
+ assert_eq!(store.beside(&[head]), vec![beside, both]);
+ assert_eq!(store.beside(&[head, beside]), vec![above, both]);
}
/// A store whose root holds puts and a lock, cut at the lock: the cut's ID, the lock's,