From c64fcc05d8c53bee99ab039bd709039afb730cdd Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Nov 2026 18:49:50 +0000 Subject: 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. --- src/federation/store/testfold.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/federation/store/testfold.rs') diff --git a/src/federation/store/testfold.rs b/src/federation/store/testfold.rs index 2478c0a..17e039b 100644 --- a/src/federation/store/testfold.rs +++ b/src/federation/store/testfold.rs @@ -7,7 +7,8 @@ //! * `lock`: a key locked for good. //! * `era`: era `n`, taken only where `n` is one past the era at its history; of two of one //! number, a node keeps the first it takes (as the federation's versions). Eras of one -//! number and tag write the same: a drop of one refuses them all. +//! number and tag write the same: a drop of one refuses them all. One tagged `new` is +//! of a fold knowing more: a node that would take it stops at it. //! * `cut`: cut `n`, naming heads to move the store to, as `era`: above the heads the latest //! cut of its history names, and holding that cut (or after the checkpoint the state //! starts from, where it holds none); none of them in another's history. It must be above @@ -347,6 +348,15 @@ impl Fold for TestFold { } } + fn stops(at: &State, now: &State, _id: &Id, event: &[u8]) -> Option { + match decode(event)? { + (_, Kind::Era { n, tag }) if tag == "new" && now.era == at.era => { + Some(format!("era {n}, tagged new")) + } + _ => None, + } + } + fn keeps(now: &State, _id: &Id, event: &[u8]) -> bool { match decode(event) { Some((_, Kind::Era { n, tag })) => { -- cgit v1.3.1