diff options
| author | tv <tv@krebsco.de> | 2026-11-18 18:49:50 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-18 20:29:41 +0100 |
| commit | c64fcc05d8c53bee99ab039bd709039afb730cdd (patch) | |
| tree | 45baad78d7b92de42283be2954fc3f9b4dd6129d /src/federation/store/mod.rs | |
| parent | 598366b03679eac9d04f32d9194f3ba4ba9c3da8 (diff) | |
federation: a node stops at a version it doesn't read
A version event writing a proposal passed on the version a node reads, which doesn't
read as a version there (of a later federation, using what a later continuum takes, or
none at all), the node can't judge: `Fold::stops`. The store stops at it: it takes
nothing and refuses nothing from then on, holding back whatever comes, that event first
(`Offered::Stopped`), and keeps none of it across a restart, where it stops there again.
One beside the version the node reads is refused of its own, as any other.
Its operator has it drop that event (`POST /admin/events/drop`), or one it builds on:
it is refused as dropped, or as built on what was, any version event writing that
version with it, kept in the store file; the node judges what it held back and goes on
under the version before. Allowed again, it stops there once more.
The node logs the stop and its end; `GET /events` names the event, why, and how many it
holds back (`stopped`); a put answers `stopped`, written into the document all the same;
a node voting by itself casts nothing while stopped. The test fold's eras tagged `new`
stop a store.
Row 39 is tested (`federation_attack_39`); of rows 9, 10 and 48, a node stops at the
version event.
Diffstat (limited to 'src/federation/store/mod.rs')
| -rw-r--r-- | src/federation/store/mod.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/federation/store/mod.rs b/src/federation/store/mod.rs index 4027fb9..c80f5b8 100644 --- a/src/federation/store/mod.rs +++ b/src/federation/store/mod.rs @@ -82,13 +82,21 @@ pub(crate) trait Fold { /// What the event builds on; `None` where its bytes are none of this fold's events. fn dependencies(event: &[u8]) -> Option<Vec<Id>>; - /// Whether the event is taken where its history reads as `at`. + /// Whether the event is taken where its history reads as `at`, as far as the fold + /// reads it (`stops`). fn judge(at: &Self::State, id: &Id, event: &[u8]) -> Result<(), Refused>; /// Adds the event, whose dependencies are added already. Events neither of which /// builds on the other may come in either order: the state is the same. fn add(state: &mut Self::State, id: &Id, event: &[u8]); + /// Why a node whose store reads as `now` can't judge an event its history, read as + /// `at`, doesn't refuse, where it can't: one only a fold knowing more reads, that the + /// node would take. The store stops at it (`docs/store.md`, A node's own). + fn stops(_at: &Self::State, _now: &Self::State, _id: &Id, _event: &[u8]) -> Option<String> { + None + } + /// Whether a node whose store reads as `now` takes an event its history takes. fn keeps(_now: &Self::State, _id: &Id, _event: &[u8]) -> bool { true |
